diff --git "a/_next/static/chunks/b75e687f.1f7b440207b462e5.js" "b/_next/static/chunks/b75e687f.1f7b440207b462e5.js" new file mode 100644--- /dev/null +++ "b/_next/static/chunks/b75e687f.1f7b440207b462e5.js" @@ -0,0 +1,26 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[497],{97797:function(e,t,n){!function(e){"use strict";let t,r,i,o,a;var s=void 0!==n.g?n.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{};function u(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function c(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),n}var d={exports:{}};ec=d.exports,ed="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==l&&l,eh=ef=function(){function e(){this.fetch=!1,this.DOMException=ed.DOMException}return e.prototype=ed,new e}(),function(e){var t=void 0!==eh&&eh||"undefined"!=typeof self&&self||void 0!==t&&t,n="URLSearchParams"in t,r="Symbol"in t&&"iterator"in Symbol,i="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(e){return!1}}(),o="FormData"in t,a="ArrayBuffer"in t;if(a)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],l=ArrayBuffer.isView||function(e){return e&&s.indexOf(Object.prototype.toString.call(e))>-1};function u(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||""===e)throw TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function c(e){return"string"!=typeof e&&(e=String(e)),e}function d(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return r&&(t[Symbol.iterator]=function(){return t}),t}function f(e){this.map={},e instanceof f?e.forEach(function(e,t){this.append(t,e)},this):Array.isArray(e)?e.forEach(function(e){this.append(e[0],e[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}function h(e){if(e.bodyUsed)return Promise.reject(TypeError("Already read"));e.bodyUsed=!0}function p(e){return new Promise(function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}})}function m(e){var t=new FileReader,n=p(t);return t.readAsArrayBuffer(e),n}function g(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function v(){return this.bodyUsed=!1,this._initBody=function(e){var t;this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:i&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:o&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:n&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():a&&i&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=g(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a&&(ArrayBuffer.prototype.isPrototypeOf(e)||l(e))?this._bodyArrayBuffer=g(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var e=h(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?h(this)||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer)):this.blob().then(m)}),this.text=function(){var e,t,n,r=h(this);if(r)return r;if(this._bodyBlob)return e=this._bodyBlob,n=p(t=new FileReader),t.readAsText(e),n;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=Array(t.length),r=0;r-1?r:n),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(i),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==t.cache&&"no-cache"!==t.cache)){var o=/([?&])_=[^&]*/;o.test(this.url)?this.url=this.url.replace(o,"$1_="+(new Date).getTime()):this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}function A(e){var t=new FormData;return e.trim().split("&").forEach(function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(i))}}),t}function w(e,t){if(!(this instanceof w))throw TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText=void 0===t.statusText?"":""+t.statusText,this.headers=new f(t.headers),this.url=t.url||"",this._initBody(e)}y.prototype.clone=function(){return new y(this,{body:this._bodyInit})},v.call(y.prototype),v.call(w.prototype),w.prototype.clone=function(){return new w(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},w.error=function(){var e=new w(null,{status:0,statusText:""});return e.type="error",e};var _=[301,302,303,307,308];w.redirect=function(e,t){if(-1===_.indexOf(t))throw RangeError("Invalid status code");return new w(null,{status:t,headers:{location:e}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function E(n,r){return new Promise(function(o,s){var l=new y(n,r);if(l.signal&&l.signal.aborted)return s(new e.DOMException("Aborted","AbortError"));var u=new XMLHttpRequest;function d(){u.abort()}u.onload=function(){var e,t,n={status:u.status,statusText:u.statusText,headers:(e=u.getAllResponseHeaders()||"",t=new f,e.replace(/\r?\n[\t ]+/g," ").split("\r").map(function(e){return 0===e.indexOf("\n")?e.substr(1,e.length):e}).forEach(function(e){var n=e.split(":"),r=n.shift().trim();if(r){var i=n.join(":").trim();t.append(r,i)}}),t)};n.url="responseURL"in u?u.responseURL:n.headers.get("X-Request-URL");var r="response"in u?u.response:u.responseText;setTimeout(function(){o(new w(r,n))},0)},u.onerror=function(){setTimeout(function(){s(TypeError("Network request failed"))},0)},u.ontimeout=function(){setTimeout(function(){s(TypeError("Network request failed"))},0)},u.onabort=function(){setTimeout(function(){s(new e.DOMException("Aborted","AbortError"))},0)},u.open(l.method,function(e){try{return""===e&&t.location.href?t.location.href:e}catch(t){return e}}(l.url),!0),"include"===l.credentials?u.withCredentials=!0:"omit"===l.credentials&&(u.withCredentials=!1),"responseType"in u&&(i?u.responseType="blob":a&&l.headers.get("Content-Type")&&-1!==l.headers.get("Content-Type").indexOf("application/octet-stream")&&(u.responseType="arraybuffer")),!r||"object"!=typeof r.headers||r.headers instanceof f?l.headers.forEach(function(e,t){u.setRequestHeader(t,e)}):Object.getOwnPropertyNames(r.headers).forEach(function(e){u.setRequestHeader(e,c(r.headers[e]))}),l.signal&&(l.signal.addEventListener("abort",d),u.onreadystatechange=function(){4===u.readyState&&l.signal.removeEventListener("abort",d)}),u.send(void 0===l._bodyInit?null:l._bodyInit)})}E.polyfill=!0,t.fetch||(t.fetch=E,t.Headers=f,t.Request=y,t.Response=w),e.Headers=f,e.Request=y,e.Response=w,e.fetch=E}({}),ef.fetch.ponyfill=!0,delete ef.fetch.polyfill,(ec=(ep=ed.fetch?ed:ef).fetch).default=ep.fetch,ec.fetch=ep.fetch,ec.Headers=ep.Headers,ec.Request=ep.Request,ec.Response=ep.Response,d.exports=ec;var f=u(d.exports),h=[],p=[],m="undefined"!=typeof Uint8Array?Uint8Array:Array,g=!1;function v(){g=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)h[t]=e[t],p[e.charCodeAt(t)]=t;p["-".charCodeAt(0)]=62,p["_".charCodeAt(0)]=63}function b(e){var t;g||v();for(var n=e.length,r=n%3,i="",o=[],a=0,s=n-r;a>18&63]+h[r>>12&63]+h[r>>6&63]+h[63&r]);return i.join("")}(e,a,a+16383>s?s:a+16383));return 1===r?i+=h[(t=e[n-1])>>2]+h[t<<4&63]+"==":2===r&&(i+=h[(t=(e[n-2]<<8)+e[n-1])>>10]+h[t>>4&63]+h[t<<2&63]+"="),o.push(i),o.join("")}function y(e,t,n,r,i){var o,a,s=8*i-r-1,l=(1<>1,c=-7,d=n?i-1:0,f=n?-1:1,h=e[t+d];for(d+=f,o=h&(1<<-c)-1,h>>=-c,c+=s;c>0;o=256*o+e[t+d],d+=f,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=r;c>0;a=256*a+e[t+d],d+=f,c-=8);if(0===o)o=1-u;else{if(o===l)return a?NaN:1/0*(h?-1:1);a+=Math.pow(2,r),o-=u}return(h?-1:1)*a*Math.pow(2,o-r)}function A(e,t,n,r,i,o){var a,s,l,u=8*o-i-1,c=(1<>1,f=23===i?5960464477539062e-23:0,h=r?0:o-1,p=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(isNaN(t=Math.abs(t))||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),(t+=a+d>=1?f/l:f*Math.pow(2,1-d))*l>=2&&(a++,l/=2),a+d>=c?(s=0,a=c):a+d>=1?(s=(t*l-1)*Math.pow(2,i),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),a=0));i>=8;e[n+h]=255&s,h+=p,s/=256,i-=8);for(a=a<0;e[n+h]=255&a,h+=p,a/=256,u-=8);e[n+h-p]|=128*m}var w={}.toString,_=Array.isArray||function(e){return"[object Array]"==w.call(e)};M.TYPED_ARRAY_SUPPORT=void 0===s.TYPED_ARRAY_SUPPORT||s.TYPED_ARRAY_SUPPORT;var E=S();function S(){return M.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function k(e,t){if(S()=S())throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+S().toString(16)+" bytes");return 0|e}function O(e){return!(null==e||!e._isBuffer)}function P(e,t){if(O(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return Y(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return G(e).length;default:if(r)return Y(e).length;t=(""+t).toLowerCase(),r=!0}}function L(e,t,n){var r,i,o=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===n||n>this.length)&&(n=this.length),n<=0)||(n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,n){var r,i=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>i)&&(n=i);for(var o="",a=t;a2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),isNaN(n=+n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return -1;n=e.length-1}else if(n<0){if(!i)return -1;n=0}if("string"==typeof t&&(t=M.from(t,r)),O(t))return 0===t.length?-1:B(e,t,n,r,i);if("number"==typeof t)return t&=255,M.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):B(e,[t],n,r,i);throw TypeError("val must be string, number or Buffer")}function B(e,t,n,r,i){var o,a=1,s=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return -1;a=2,s/=2,l/=2,n/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var c=-1;for(o=n;os&&(n=s-l),o=n;o>=0;o--){for(var d=!0,f=0;f239?4:u>223?3:u>191?2:1;if(i+d<=n)switch(d){case 1:u<128&&(c=u);break;case 2:128==(192&(o=e[i+1]))&&(l=(31&u)<<6|63&o)>127&&(c=l);break;case 3:o=e[i+1],a=e[i+2],128==(192&o)&&128==(192&a)&&(l=(15&u)<<12|(63&o)<<6|63&a)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:o=e[i+1],a=e[i+2],s=e[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(l=(15&u)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&l<1114112&&(c=l)}null===c?(c=65533,d=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),i+=d}return function(e){var t=e.length;if(t<=F)return String.fromCharCode.apply(String,e);for(var n="",r=0;r0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),""},M.prototype.compare=function(e,t,n,r,i){if(!O(e))throw TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return -1;if(t>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0),s=Math.min(o,a),l=this.slice(r,i),u=e.slice(t,n),c=0;cp)&&(n=p),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var m=!1;;)switch(r){case"hex":return function(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=t.length;if(o%2!=0)throw TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a>8,i.push(n%256),i.push(r);return i}(e,this.length-f),this,f,h);default:if(m)throw TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),m=!0}},M.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var F=4096;function z(e,t,n){if(e%1!=0||e<0)throw RangeError("offset is not uint");if(e+t>n)throw RangeError("Trying to access beyond buffer length")}function U(e,t,n,r,i,o){if(!O(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw RangeError("Index out of range")}function q(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function K(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function H(e,t,n,r,i,o){if(n+r>e.length||n<0)throw RangeError("Index out of range")}function V(e,t,n,r,i){return i||H(e,0,n,4),A(e,t,n,r,23,4),n+4}function $(e,t,n,r,i){return i||H(e,0,n,8),A(e,t,n,r,52,8),n+8}M.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(i*=256);)r+=this[e+--t]*i;return r},M.prototype.readUInt8=function(e,t){return t||z(e,1,this.length),this[e]},M.prototype.readUInt16LE=function(e,t){return t||z(e,2,this.length),this[e]|this[e+1]<<8},M.prototype.readUInt16BE=function(e,t){return t||z(e,2,this.length),this[e]<<8|this[e+1]},M.prototype.readUInt32LE=function(e,t){return t||z(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},M.prototype.readUInt32BE=function(e,t){return t||z(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},M.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||z(e,t,this.length);for(var r=this[e],i=1,o=0;++o=(i*=128)&&(r-=Math.pow(2,8*t)),r},M.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||z(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},M.prototype.readInt8=function(e,t){return t||z(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},M.prototype.readInt16LE=function(e,t){t||z(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},M.prototype.readInt16BE=function(e,t){t||z(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},M.prototype.readInt32LE=function(e,t){return t||z(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},M.prototype.readInt32BE=function(e,t){return t||z(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},M.prototype.readFloatLE=function(e,t){return t||z(e,4,this.length),y(this,e,!0,23,4)},M.prototype.readFloatBE=function(e,t){return t||z(e,4,this.length),y(this,e,!1,23,4)},M.prototype.readDoubleLE=function(e,t){return t||z(e,8,this.length),y(this,e,!0,52,8)},M.prototype.readDoubleBE=function(e,t){return t||z(e,8,this.length),y(this,e,!1,52,8)},M.prototype.writeUIntLE=function(e,t,n,r){e=+e,t|=0,n|=0,r||U(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o=0&&(o*=256);)this[t+i]=e/o&255;return t+n},M.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||U(this,e,t,1,255,0),M.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},M.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||U(this,e,t,2,65535,0),M.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):q(this,e,t,!0),t+2},M.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||U(this,e,t,2,65535,0),M.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):q(this,e,t,!1),t+2},M.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||U(this,e,t,4,4294967295,0),M.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):K(this,e,t,!0),t+4},M.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||U(this,e,t,4,4294967295,0),M.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):K(this,e,t,!1),t+4},M.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);U(this,e,t,n,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+n},M.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);U(this,e,t,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},M.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||U(this,e,t,1,127,-128),M.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},M.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||U(this,e,t,2,32767,-32768),M.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):q(this,e,t,!0),t+2},M.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||U(this,e,t,2,32767,-32768),M.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):q(this,e,t,!1),t+2},M.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||U(this,e,t,4,2147483647,-2147483648),M.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):K(this,e,t,!0),t+4},M.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||U(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),M.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):K(this,e,t,!1),t+4},M.prototype.writeFloatLE=function(e,t,n){return V(this,e,t,!0,n)},M.prototype.writeFloatBE=function(e,t,n){return V(this,e,t,!1,n)},M.prototype.writeDoubleLE=function(e,t,n){return $(this,e,t,!0,n)},M.prototype.writeDoubleBE=function(e,t,n){return $(this,e,t,!1,n)},M.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw RangeError("sourceStart out of bounds");if(r<0)throw RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(o<1e3||!M.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i55295&&n<57344){if(!i){if(n>56319||a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function G(e){return function(e){g||v();var t,n,r,i,o,a,s=e.length;if(s%4>0)throw Error("Invalid string. Length must be a multiple of 4");o="="===e[s-2]?2:"="===e[s-1]?1:0,a=new m(3*s/4-o),r=o>0?s-4:s;var l=0;for(t=0,n=0;t>16&255,a[l++]=i>>8&255,a[l++]=255&i;return 2===o?(i=p[e.charCodeAt(t)]<<2|p[e.charCodeAt(t+1)]>>4,a[l++]=255&i):1===o&&(i=p[e.charCodeAt(t)]<<10|p[e.charCodeAt(t+1)]<<4|p[e.charCodeAt(t+2)]>>2,a[l++]=i>>8&255,a[l++]=255&i),a}(function(e){var t;if((e=((t=e).trim?t.trim():t.replace(/^\s+|\s+$/g,"")).replace(W,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Q(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function Z(e){return null!=e&&(!!e._isBuffer||J(e)||"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&J(e.slice(0,0)))}function J(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var X=Object.freeze({__proto__:null,Buffer:M,INSPECT_MAX_BYTES:50,SlowBuffer:function(e){return+e!=e&&(e=0),M.alloc(+e)},isBuffer:Z,kMaxLength:E}),ee={},et={},en={},er=c(X),ei={};function eo(){throw Error("setTimeout has not been defined")}function ea(){throw Error("clearTimeout has not been defined")}var es=eo,el=ea;function eu(e){if(es===setTimeout)return setTimeout(e,0);if((es===eo||!es)&&setTimeout)return es=setTimeout,setTimeout(e,0);try{return es(e,0)}catch(t){try{return es.call(null,e,0)}catch(t){return es.call(this,e,0)}}}"function"==typeof s.setTimeout&&(es=setTimeout),"function"==typeof s.clearTimeout&&(el=clearTimeout);var ec,ed,ef,eh,ep,em,eg=[],ev=!1,eb=-1;function ey(){ev&&em&&(ev=!1,em.length?eg=em.concat(eg):eb=-1,eg.length&&eA())}function eA(){if(!ev){var e=eu(ey);ev=!0;for(var t=eg.length;t;){for(em=eg,eg=[];++eb1)for(var n=1;n4294967295)throw RangeError("requested too many random bytes");var n=eO.allocUnsafe(e);if(e>0){if(e>65536)for(var r=0;r0&&a.length>i){a.warned=!0;var s=Error("Possible EventEmitter memory leak detected. "+a.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");s.name="MaxListenersExceededWarning",s.emitter=e,s.type=t,s.count=a.length,"function"==typeof console.warn?console.warn(s):console.log(s)}}else a=o[t]=n,++e._eventsCount;return e}function eq(e,t,n){var r=!1;function i(){e.removeListener(t,i),r||(r=!0,n.apply(e,arguments))}return i.listener=n,i}function eK(e){var t=this._events;if(t){var n=t[e];if("function"==typeof n)return 1;if(n)return n.length}return 0}function eH(e,t){for(var n=Array(t);t--;)n[t]=e[t];return n}ej.prototype=Object.create(null),eF.EventEmitter=eF,eF.usingDomains=!1,eF.prototype.domain=void 0,eF.prototype._events=void 0,eF.prototype._maxListeners=void 0,eF.defaultMaxListeners=10,eF.init=function(){this.domain=null,eF.usingDomains&&(void 0).active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new ej,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},eF.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},eF.prototype.getMaxListeners=function(){return ez(this)},eF.prototype.emit=function(e){var t,n,r,i,o,a,s,l="error"===e;if(a=this._events)l=l&&null==a.error;else if(!l)return!1;if(s=this.domain,l){if(t=arguments[1],!s){if(t instanceof Error)throw t;var u=Error('Uncaught, unspecified "error" event. ('+t+")");throw u.context=t,u}return t||(t=Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=s,t.domainThrown=!1,s.emit("error",t),!1}if(!(n=a[e]))return!1;var c="function"==typeof n;switch(r=arguments.length){case 1:!function(e,t,n){if(t)e.call(n);else for(var r=e.length,i=eH(e,r),o=0;o0;)if(n[o]===t||n[o].listener&&n[o].listener===t){a=n[o].listener,i=o;break}if(i<0)return this;if(1===n.length){if(n[0]=void 0,0==--this._eventsCount)return this._events=new ej,this;delete r[e]}else!function(e,t){for(var n=t,r=n+1,i=e.length;r0?Reflect.ownKeys(this._events):[]};var eV=c(Object.freeze({__proto__:null,EventEmitter:eF,default:eF})),e$=eV.EventEmitter,eW="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e},eY=/%[sdj%]/g;function eG(e){if(!tt(e)){for(var t=[],n=0;n=i)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}}),a=r[n];n=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),e5(t)?n.showHidden=t:t&&tm(n,t),tr(n.showHidden)&&(n.showHidden=!1),tr(n.depth)&&(n.depth=2),tr(n.colors)&&(n.colors=!1),tr(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=e1),e3(n,e,n.depth)}function e1(e,t){var n=e0.styles[t];return n?"\x1b["+e0.colors[n][0]+"m"+e+"\x1b["+e0.colors[n][1]+"m":e}function e2(e,t){return e}function e3(e,t,n){if(e.customInspect&&t&&tl(t.inspect)&&t.inspect!==e0&&(!t.constructor||t.constructor.prototype!==t)){var r,i,o=t.inspect(n,e);return tt(o)||(o=e3(e,o,n)),o}var a=function(e,t){if(tr(t))return e.stylize("undefined","undefined");if(tt(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return te(t)?e.stylize(""+t,"number"):e5(t)?e.stylize(""+t,"boolean"):e7(t)?e.stylize("null","null"):void 0}(e,t);if(a)return a;var s=Object.keys(t),l=(c={},s.forEach(function(e,t){c[e]=!0}),c);if(e.showHidden&&(s=Object.getOwnPropertyNames(t)),ts(t)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return e6(t);if(0===s.length){if(tl(t)){var u=t.name?": "+t.name:"";return e.stylize("[Function"+u+"]","special")}if(ti(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(ta(t))return e.stylize(Date.prototype.toString.call(t),"date");if(ts(t))return e6(t)}var c,d,f="",h=!1,p=["{","}"];return e8(t)&&(h=!0,p=["[","]"]),tl(t)&&(f=" [Function"+(t.name?": "+t.name:"")+"]"),ti(t)&&(f=" "+RegExp.prototype.toString.call(t)),ta(t)&&(f=" "+Date.prototype.toUTCString.call(t)),ts(t)&&(f=" "+e6(t)),0!==s.length||h&&0!=t.length?n<0?ti(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),d=h?function(e,t,n,r,i){for(var o=[],a=0,s=t.length;a60?i[0]+(""===r?"":r+"\n ")+" "+d.join(",\n ")+" "+i[1]:i[0]+r+" "+d.join(", ")+" "+i[1]):p[0]+f+p[1]}function e6(e){return"["+Error.prototype.toString.call(e)+"]"}function e4(e,t,n,r,i,o){var a,s,l;if((l=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?s=l.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):l.set&&(s=e.stylize("[Setter]","special")),tg(r,i)||(a="["+i+"]"),s||(0>e.seen.indexOf(l.value)?(s=e7(n)?e3(e,l.value,null):e3(e,l.value,n-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+s.split("\n").map(function(e){return" "+e}).join("\n")):s=e.stylize("[Circular]","special")),tr(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function e8(e){return Array.isArray(e)}function e5(e){return"boolean"==typeof e}function e7(e){return null===e}function e9(e){return null==e}function te(e){return"number"==typeof e}function tt(e){return"string"==typeof e}function tn(e){return"symbol"==typeof e}function tr(e){return void 0===e}function ti(e){return to(e)&&"[object RegExp]"===td(e)}function to(e){return"object"==typeof e&&null!==e}function ta(e){return to(e)&&"[object Date]"===td(e)}function ts(e){return to(e)&&("[object Error]"===td(e)||e instanceof Error)}function tl(e){return"function"==typeof e}function tu(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function tc(e){return Z(e)}function td(e){return Object.prototype.toString.call(e)}function tf(e){return e<10?"0"+e.toString(10):e.toString(10)}e0.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},e0.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};var th=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function tp(){var e,t;console.log("%s - %s",(t=[tf((e=new Date).getHours()),tf(e.getMinutes()),tf(e.getSeconds())].join(":"),[e.getDate(),th[e.getMonth()],t].join(" ")),eG.apply(null,arguments))}function tm(e,t){if(!t||!to(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}function tg(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var tv,tb,ty=c(Object.freeze({__proto__:null,_extend:tm,debuglog:eX,default:{inherits:eW,_extend:tm,log:tp,isBuffer:tc,isPrimitive:tu,isFunction:tl,isError:ts,isDate:ta,isObject:to,isRegExp:ti,isUndefined:tr,isSymbol:tn,isString:tt,isNumber:te,isNullOrUndefined:e9,isNull:e7,isBoolean:e5,isArray:e8,inspect:e0,deprecate:eQ,format:eG,debuglog:eX},deprecate:eQ,format:eG,inherits:eW,inspect:e0,isArray:e8,isBoolean:e5,isBuffer:tc,isDate:ta,isError:ts,isFunction:tl,isNull:e7,isNullOrUndefined:e9,isNumber:te,isObject:to,isPrimitive:tu,isRegExp:ti,isString:tt,isSymbol:tn,isUndefined:tr,log:tp}));function tA(e,t){t_(e,t),tw(e)}function tw(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function t_(e,t){e.emit("error",t)}var tE={destroy:function(e,t){var n=this,r=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return r||i?t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,ew(t_,this,e)):ew(t_,this,e)):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?n._writableState?n._writableState.errorEmitted?ew(tw,n):(n._writableState.errorEmitted=!0,ew(tA,n,e)):ew(tA,n,e):t?(ew(tw,n),t(e)):ew(tw,n)})),this},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var n=e._readableState,r=e._writableState;n&&n.autoDestroy||r&&r.autoDestroy?e.destroy(t):e.emit("error",t)}},tS={},tk={};function tM(e,t,n){n||(n=Error);var r=function(e){function n(n,r,i){return e.call(this,"string"==typeof t?t:t(n,r,i))||this}return n.prototype=Object.create(e.prototype),n.prototype.constructor=n,n.__proto__=e,n}(n);r.prototype.name=n.name,r.prototype.code=e,tk[e]=r}function tC(e,t){if(Array.isArray(e)){var n=e.length;return e=e.map(function(e){return String(e)}),n>2?"one of ".concat(t," ").concat(e.slice(0,n-1).join(", "),", or ")+e[n-1]:2===n?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}tM("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError),tM("ERR_INVALID_ARG_TYPE",function(e,t,n){if("string"==typeof t&&(i="not ",t.substr(!o||o<0?0:+o,i.length)===i)?(r="must not be",t=t.replace(/^not /,"")):r="must be",s=" argument",(void 0===l||l>e.length)&&(l=e.length),e.substring(l-s.length,l)===s)a="The ".concat(e," ").concat(r," ").concat(tC(t,"type"));else{var r,i,o,a,s,l,u,c=("number"!=typeof u&&(u=0),u+1>e.length||-1===e.indexOf(".",u))?"argument":"property";a='The "'.concat(e,'" ').concat(c," ").concat(r," ").concat(tC(t,"type"))}return a+". Received type ".concat(typeof n)},TypeError),tM("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),tM("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),tM("ERR_STREAM_PREMATURE_CLOSE","Premature close"),tM("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),tM("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),tM("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),tM("ERR_STREAM_WRITE_AFTER_END","write after end"),tM("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),tM("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),tM("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),tS.codes=tk;var tx,tR,tI,tT,tO=tS.codes.ERR_INVALID_OPT_VALUE,tP={getHighWaterMark:function(e,t,n,r){var i=null!=t.highWaterMark?t.highWaterMark:r?t[n]:null;if(null!=i){if(!isFinite(i)||Math.floor(i)!==i||i<0)throw new tO(r?n:"highWaterMark",i);return Math.floor(i)}return e.objectMode?16:16384}},tL=function(e,t){if(tN("noDeprecation"))return e;var n=!1;return function(){if(!n){if(tN("throwDeprecation"))throw Error(t);tN("traceDeprecation")?console.trace(t):console.warn(t),n=!0}return e.apply(this,arguments)}};function tN(e){try{if(!l.localStorage)return!1}catch(e){return!1}var t=l.localStorage[e];return null!=t&&"true"===String(t).toLowerCase()}function tD(){if(tR)return tx;function e(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,n){var r=e.entry;for(e.entry=null;r;){var i=r.callback;t.pendingcb--,i(void 0),r=r.next}t.corkedRequestsFree.next=e}(t,e)}}tR=1,tx=A,A.WritableState=y;var t,n,r={deprecate:tL},i=er.Buffer,o=(void 0!==l?l:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},a=tP.getHighWaterMark,s=tS.codes,u=s.ERR_INVALID_ARG_TYPE,c=s.ERR_METHOD_NOT_IMPLEMENTED,d=s.ERR_MULTIPLE_CALLBACK,f=s.ERR_STREAM_CANNOT_PIPE,h=s.ERR_STREAM_DESTROYED,p=s.ERR_STREAM_NULL_VALUES,m=s.ERR_STREAM_WRITE_AFTER_END,g=s.ERR_UNKNOWN_ENCODING,v=tE.errorOrDestroy;function b(){}function y(n,r,i){t=t||tB(),n=n||{},"boolean"!=typeof i&&(i=r instanceof t),this.objectMode=!!n.objectMode,i&&(this.objectMode=this.objectMode||!!n.writableObjectMode),this.highWaterMark=a(this,n,"writableHighWaterMark",i),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var o=!1===n.decodeStrings;this.decodeStrings=!o,this.defaultEncoding=n.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,i=n.writecb;if("function"!=typeof i)throw new d;if(n.writing=!1,n.writecb=null,n.length-=n.writelen,n.writelen=0,t)--n.pendingcb,r?(ew(i,t),ew(M,e,n),e._writableState.errorEmitted=!0,v(e,t)):(i(t),e._writableState.errorEmitted=!0,v(e,t),M(e,n));else{var o=S(n)||e.destroyed;o||n.corked||n.bufferProcessing||!n.bufferedRequest||E(e,n),r?ew(_,e,n,o,i):_(e,n,o,i)}}(r,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==n.emitClose,this.autoDestroy=!!n.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}function A(e){var r=this instanceof(t=t||tB());if(!r&&!n.call(A,this))return new A(e);this._writableState=new y(e,this,r),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),e$.call(this)}function w(e,t,n,r,i,o,a){t.writelen=r,t.writecb=a,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new h("write")):n?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function _(e,t,n,r){n||0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain")),t.pendingcb--,r(),M(e,t)}function E(t,n){n.bufferProcessing=!0;var r=n.bufferedRequest;if(t._writev&&r&&r.next){var i=Array(n.bufferedRequestCount),o=n.corkedRequestsFree;o.entry=r;for(var a=0,s=!0;r;)i[a]=r,r.isBuf||(s=!1),r=r.next,a+=1;i.allBuffers=s,w(t,n,!0,n.length,i,"",o.finish),n.pendingcb++,n.lastBufferedRequest=null,o.next?(n.corkedRequestsFree=o.next,o.next=null):n.corkedRequestsFree=new e(n),n.bufferedRequestCount=0}else{for(;r;){var l=r.chunk,u=r.encoding,c=r.callback;if(w(t,n,!1,n.objectMode?1:l.length,l,u,c),r=r.next,n.bufferedRequestCount--,n.writing)break}null===r&&(n.lastBufferedRequest=null)}n.bufferedRequest=r,n.bufferProcessing=!1}function S(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function k(e,t){e._final(function(n){t.pendingcb--,n&&v(e,n),t.prefinished=!0,e.emit("prefinish"),M(e,t)})}function M(e,t){var n=S(t);if(n&&(t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,ew(k,e,t))),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var r=e._readableState;(!r||r.autoDestroy&&r.endEmitted)&&e.destroy()}return n}return eD(A,e$),y.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(y.prototype,"buffer",{get:r.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(n=Function.prototype[Symbol.hasInstance],Object.defineProperty(A,Symbol.hasInstance,{value:function(e){return!!n.call(this,e)||this===A&&e&&e._writableState instanceof y}})):n=function(e){return e instanceof this},A.prototype.pipe=function(){v(this,new f)},A.prototype.write=function(e,t,n){var r,a,s,l,c,d,f,h=this._writableState,g=!1,y=!h.objectMode&&(f=e,i.isBuffer(f)||f instanceof o);return y&&!i.isBuffer(e)&&(r=e,e=i.from(r)),"function"==typeof t&&(n=t,t=null),y?t="buffer":t||(t=h.defaultEncoding),"function"!=typeof n&&(n=b),h.ending?(a=n,v(this,s=new m),ew(a,s)):!y&&(l=e,c=n,null===l?d=new p:"string"==typeof l||h.objectMode||(d=new u("chunk",["string","Buffer"],l)),d&&(v(this,d),ew(c,d),1))||(h.pendingcb++,g=function(e,t,n,r,o,a){if(!n){var s,l,u=(s=r,l=o,t.objectMode||!1===t.decodeStrings||"string"!=typeof s||(s=i.from(s,l)),s);r!==u&&(n=!0,o="buffer",r=u)}var c=t.objectMode?1:r.length;t.length+=c;var d=t.length-1))throw new g(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(A.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(A.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),A.prototype._write=function(e,t,n){n(new c("_write()"))},A.prototype._writev=null,A.prototype.end=function(e,t,n){var r,i=this._writableState;return"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),i.corked&&(i.corked=1,this.uncork()),i.ending||(r=n,i.ending=!0,M(this,i),r&&(i.finished?ew(r):this.once("finish",r)),i.ended=!0,this.writable=!1),this},Object.defineProperty(A.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(A.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),A.prototype.destroy=tE.destroy,A.prototype._undestroy=tE.undestroy,A.prototype._destroy=function(e,t){t(e)},tx}function tB(){if(tT)return tI;tT=1;var e=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};tI=a;var t=tQ(),n=tD();eD(a,t);for(var r=e(n.prototype),i=0;i>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function i(e){var t=this.lastTotal-this.lastNeed,n=function(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function o(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function a(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function s(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function l(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function u(e){return e.toString(this.encoding)}function c(e){return e&&e.length?this.write(e):""}return tF.StringDecoder=n,n.prototype.write=function(e){var t,n;if(0===e.length)return"";if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n=0?(o>0&&(e.lastNeed=o-1),o):--i=0?(o>0&&(e.lastNeed=o-2),o):--i=0?(o>0&&(2===o?o=0:e.lastNeed=o-3),o):0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var i=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,i),e.toString("utf8",t,i)},n.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length},tF}var tU=tS.codes.ERR_STREAM_PREMATURE_CLOSE;function tq(){}var tK,tH,tV,t$,tW,tY,tG=function e(t,n,r){if("function"==typeof n)return e(t,null,n);n||(n={}),i=r||tq,o=!1,r=function(){if(!o){o=!0;for(var e=arguments.length,t=Array(e),n=0;n0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n}},{key:"concat",value:function(e){if(0===this.length)return i.alloc(0);for(var t,n,r=i.allocUnsafe(e>>>0),o=this.head,a=0;o;)t=o.data,n=a,i.prototype.copy.call(t,r,n),a+=o.data.length,o=o.next;return r}},{key:"consume",value:function(e,t){var n;return ei.length?i.length:e;if(o===i.length?r+=i:r+=i.slice(0,e),0==(e-=o)){o===i.length?(++n,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(e){var t=i.allocUnsafe(e),n=this.head,r=1;for(n.data.copy(t),e-=n.data.length;n=n.next;){var o=n.data,a=e>o.length?o.length:e;if(o.copy(t,t.length-e,0,a),0==(e-=a)){a===o.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=o.slice(a));break}++r}return this.length-=r,t}},{key:a,value:function(e,n){return o(this,t(t({},n),{},{depth:0,customInspect:!1}))}}],n(s.prototype,e),r&&n(s,r),Object.defineProperty(s,"prototype",{writable:!1}),s}()}(),c=tP.getHighWaterMark,d=tS.codes,f=d.ERR_INVALID_ARG_TYPE,h=d.ERR_STREAM_PUSH_AFTER_EOF,p=d.ERR_METHOD_NOT_IMPLEMENTED,m=d.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;eD(y,e$);var g=tE.errorOrDestroy,v=["error","close","destroy","pause","resume"];function b(e,t,n){r=r||tB(),e=e||{},"boolean"!=typeof n&&(n=t instanceof r),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=c(this,e,"readableHighWaterMark",n),this.buffer=new u,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(o||(o=tz().StringDecoder),this.decoder=new o(e.encoding),this.encoding=e.encoding)}function y(e){if(r=r||tB(),!(this instanceof y))return new y(e);var t=this instanceof r;this._readableState=new b(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),e$.call(this)}function A(e,r,o,a,s){i("readableAddChunk",r);var l,u,c,d,p=e._readableState;if(null===r)p.reading=!1,function(e,t){if(i("onEofChunk"),!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.sync?E(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,S(e)))}}(e,p);else if(s||(l=r,t.isBuffer(l)||l instanceof n||"string"==typeof l||void 0===l||p.objectMode||(u=new f("chunk",["string","Buffer","Uint8Array"],l)),d=u),d)g(e,d);else if(p.objectMode||r&&r.length>0){if("string"==typeof r||p.objectMode||Object.getPrototypeOf(r)===t.prototype||(c=r,r=t.from(c)),a)p.endEmitted?g(e,new m):w(e,p,r,!0);else if(p.ended)g(e,new h);else{if(p.destroyed)return!1;p.reading=!1,p.decoder&&!o?(r=p.decoder.write(r),p.objectMode||0!==r.length?w(e,p,r,!1):k(e,p)):w(e,p,r,!1)}}else a||(p.reading=!1,k(e,p));return!p.ended&&(p.lengtht.highWaterMark&&(t.highWaterMark=((n=e)>=1073741824?n=1073741824:(n--,n|=n>>>1,n|=n>>>2,n|=n>>>4,n|=n>>>8,n|=n>>>16,n++),n)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function E(e){var t=e._readableState;i("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(i("emitReadable",t.flowing),t.emittedReadable=!0,ew(S,e))}function S(e){var t=e._readableState;i("emitReadable_",t.destroyed,t.length,t.ended),!t.destroyed&&(t.length||t.ended)&&(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,I(e)}function k(e,t){t.readingMore||(t.readingMore=!0,ew(M,e,t))}function M(e,t){for(;!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function x(e){i("readable nexttick read 0"),e.read(0)}function R(e,t){i("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),I(e),t.flowing&&!t.reading&&e.read(0)}function I(e){var t=e._readableState;for(i("flow",t.flowing);t.flowing&&null!==e.read(););}function T(e,t){var n;return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n)}function O(e){var t=e._readableState;i("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,ew(P,t,e))}function P(e,t){if(i("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var n=t._writableState;(!n||n.autoDestroy&&n.finished)&&t.destroy()}}function L(e,t){for(var n=0,r=e.length;n=t.highWaterMark:t.length>0)||t.ended))return i("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?O(this):E(this),null;if(0===(e=_(e,t))&&t.ended)return 0===t.length&&O(this),null;var r,o=t.needReadable;return i("need readable",o),(0===t.length||t.length-e0?T(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&O(this)),null!==r&&this.emit("data",r),r},y.prototype._read=function(e){g(this,new p("_read()"))},y.prototype.pipe=function(t,n){var r=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=t;break;case 1:o.pipes=[o.pipes,t];break;default:o.pipes.push(t)}o.pipesCount+=1,i("pipe count=%d opts=%j",o.pipesCount,n);var a=n&&!1===n.end||t===ex.stdout||t===ex.stderr?p:s;function s(){i("onend"),t.end()}o.endEmitted?ew(a):r.once("end",a),t.on("unpipe",function e(n,a){i("onunpipe"),n===r&&a&&!1===a.hasUnpiped&&(a.hasUnpiped=!0,i("cleanup"),t.removeListener("close",f),t.removeListener("finish",h),t.removeListener("drain",l),t.removeListener("error",d),t.removeListener("unpipe",e),r.removeListener("end",s),r.removeListener("end",p),r.removeListener("data",c),u=!0,o.awaitDrain&&(!t._writableState||t._writableState.needDrain)&&l())});var l=function(){var t=r._readableState;i("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&e(r,"data")&&(t.flowing=!0,I(r))};t.on("drain",l);var u=!1;function c(e){i("ondata");var n=t.write(e);i("dest.write",n),!1===n&&((1===o.pipesCount&&o.pipes===t||o.pipesCount>1&&-1!==L(o.pipes,t))&&!u&&(i("false write response, pause",o.awaitDrain),o.awaitDrain++),r.pause())}function d(n){i("onerror",n),p(),t.removeListener("error",d),0===e(t,"error")&&g(t,n)}function f(){t.removeListener("finish",h),p()}function h(){i("onfinish"),t.removeListener("close",f),p()}function p(){i("unpipe"),r.unpipe(t)}return r.on("data",c),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(t,"error",d),t.once("close",f),t.once("finish",h),t.emit("pipe",r),o.flowing||(i("pipe resume"),r.resume()),t},y.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n)),this;if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o0,!1!==r.flowing&&this.resume()):"readable"===e&&(r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.flowing=!1,r.emittedReadable=!1,i("on readable",r.length,r.reading),r.length?E(this):r.reading||ew(x,this))),n},y.prototype.addListener=y.prototype.on,y.prototype.removeListener=function(e,t){var n=e$.prototype.removeListener.call(this,e,t);return"readable"===e&&ew(C,this),n},y.prototype.removeAllListeners=function(e){var t=e$.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||ew(C,this),t},y.prototype.resume=function(){var e=this._readableState;return e.flowing||(i("resume"),e.flowing=!e.readableListening,e.resumeScheduled||(e.resumeScheduled=!0,ew(R,this,e))),e.paused=!1,this},y.prototype.pause=function(){return i("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(i("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},y.prototype.wrap=function(e){var t=this,n=this._readableState,r=!1;for(var o in e.on("end",function(){if(i("wrapped end"),n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on("data",function(o){i("wrapped data"),n.decoder&&(o=n.decoder.write(o)),n.objectMode&&null==o||(n.objectMode||o&&o.length)&&(t.push(o)||(r=!0,e.pause()))}),e)void 0===this[o]&&"function"==typeof e[o]&&(this[o]=function(t){return function(){return e[t].apply(e,arguments)}}(o));for(var a=0;a0,l=s=function(e){i||(i=e),e&&a.forEach(nn),f||(a.forEach(nn),o(i))},u=!1,s=function(){u||(u=!0,l.apply(void 0,arguments))},c=!1,e.on("close",function(){c=!0}),void 0===rG&&(rG=tG),rG(e,{readable:f,writable:r},function(e){if(e)return s(e);c=!0,s()}),d=!1,function(t){if(!c&&!d)return d=!0,e.setHeader&&"function"==typeof e.abort?e.abort():"function"==typeof e.destroy?e.destroy():void s(t||new ne("pipe"))}});return t.reduce(nr)};var ni=eB.exports,no=eT().Buffer,na=ni.Transform;function ns(e){na.call(this),this._block=no.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}eD(ns,na),ns.prototype._transform=function(e,t,n){var r=null;try{this.update(e,t)}catch(e){r=e}n(r)},ns.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)},ns.prototype.update=function(e,t){if(function(e,t){if(!no.isBuffer(e)&&"string"!=typeof e)throw TypeError(t+" must be a string or a buffer")}(e,"Data"),this._finalized)throw Error("Digest already called");no.isBuffer(e)||(e=no.from(e,t));for(var n=this._block,r=0;this._blockOffset+e.length-r>=this._blockSize;){for(var i=this._blockOffset;i0;++o)this._length[o]+=a,(a=this._length[o]/4294967296|0)>0&&(this._length[o]-=4294967296*a);return this},ns.prototype._update=function(){throw Error("_update is not implemented")},ns.prototype.digest=function(e){if(this._finalized)throw Error("Digest already called");this._finalized=!0;var t=this._digest();void 0!==e&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var n=0;n<4;++n)this._length[n]=0;return t},ns.prototype._digest=function(){throw Error("_digest is not implemented")};var nl=eT().Buffer,nu=Array(16);function nc(){ns.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function nd(e,t){return e<>>32-t}function nf(e,t,n,r,i,o,a){return nd(e+(t&n|~t&r)+i+o|0,a)+t|0}function nh(e,t,n,r,i,o,a){return nd(e+(t&r|n&~r)+i+o|0,a)+t|0}function np(e,t,n,r,i,o,a){return nd(e+(t^n^r)+i+o|0,a)+t|0}function nm(e,t,n,r,i,o,a){return nd(e+(n^(t|~r))+i+o|0,a)+t|0}eD(nc,ns),nc.prototype._update=function(){for(var e=0;e<16;++e)nu[e]=this._block.readInt32LE(4*e);var t=this._a,n=this._b,r=this._c,i=this._d;t=nf(t,n,r,i,nu[0],3614090360,7),i=nf(i,t,n,r,nu[1],3905402710,12),r=nf(r,i,t,n,nu[2],606105819,17),n=nf(n,r,i,t,nu[3],3250441966,22),t=nf(t,n,r,i,nu[4],4118548399,7),i=nf(i,t,n,r,nu[5],1200080426,12),r=nf(r,i,t,n,nu[6],2821735955,17),n=nf(n,r,i,t,nu[7],4249261313,22),t=nf(t,n,r,i,nu[8],1770035416,7),i=nf(i,t,n,r,nu[9],2336552879,12),r=nf(r,i,t,n,nu[10],4294925233,17),n=nf(n,r,i,t,nu[11],2304563134,22),t=nf(t,n,r,i,nu[12],1804603682,7),i=nf(i,t,n,r,nu[13],4254626195,12),r=nf(r,i,t,n,nu[14],2792965006,17),t=nh(t,n=nf(n,r,i,t,nu[15],1236535329,22),r,i,nu[1],4129170786,5),i=nh(i,t,n,r,nu[6],3225465664,9),r=nh(r,i,t,n,nu[11],643717713,14),n=nh(n,r,i,t,nu[0],3921069994,20),t=nh(t,n,r,i,nu[5],3593408605,5),i=nh(i,t,n,r,nu[10],38016083,9),r=nh(r,i,t,n,nu[15],3634488961,14),n=nh(n,r,i,t,nu[4],3889429448,20),t=nh(t,n,r,i,nu[9],568446438,5),i=nh(i,t,n,r,nu[14],3275163606,9),r=nh(r,i,t,n,nu[3],4107603335,14),n=nh(n,r,i,t,nu[8],1163531501,20),t=nh(t,n,r,i,nu[13],2850285829,5),i=nh(i,t,n,r,nu[2],4243563512,9),r=nh(r,i,t,n,nu[7],1735328473,14),t=np(t,n=nh(n,r,i,t,nu[12],2368359562,20),r,i,nu[5],4294588738,4),i=np(i,t,n,r,nu[8],2272392833,11),r=np(r,i,t,n,nu[11],1839030562,16),n=np(n,r,i,t,nu[14],4259657740,23),t=np(t,n,r,i,nu[1],2763975236,4),i=np(i,t,n,r,nu[4],1272893353,11),r=np(r,i,t,n,nu[7],4139469664,16),n=np(n,r,i,t,nu[10],3200236656,23),t=np(t,n,r,i,nu[13],681279174,4),i=np(i,t,n,r,nu[0],3936430074,11),r=np(r,i,t,n,nu[3],3572445317,16),n=np(n,r,i,t,nu[6],76029189,23),t=np(t,n,r,i,nu[9],3654602809,4),i=np(i,t,n,r,nu[12],3873151461,11),r=np(r,i,t,n,nu[15],530742520,16),t=nm(t,n=np(n,r,i,t,nu[2],3299628645,23),r,i,nu[0],4096336452,6),i=nm(i,t,n,r,nu[7],1126891415,10),r=nm(r,i,t,n,nu[14],2878612391,15),n=nm(n,r,i,t,nu[5],4237533241,21),t=nm(t,n,r,i,nu[12],1700485571,6),i=nm(i,t,n,r,nu[3],2399980690,10),r=nm(r,i,t,n,nu[10],4293915773,15),n=nm(n,r,i,t,nu[1],2240044497,21),t=nm(t,n,r,i,nu[8],1873313359,6),i=nm(i,t,n,r,nu[15],4264355552,10),r=nm(r,i,t,n,nu[6],2734768916,15),n=nm(n,r,i,t,nu[13],1309151649,21),t=nm(t,n,r,i,nu[4],4149444226,6),i=nm(i,t,n,r,nu[11],3174756917,10),r=nm(r,i,t,n,nu[2],718787259,15),n=nm(n,r,i,t,nu[9],3951481745,21),this._a=this._a+t|0,this._b=this._b+n|0,this._c=this._c+r|0,this._d=this._d+i|0},nc.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=nl.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e};var ng=er.Buffer,nv=Array(16),nb=[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],ny=[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],nA=[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],nw=[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];function n_(){ns.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function nE(e,t){return e<>>32-t}eD(n_,ns),n_.prototype._update=function(){for(var e,t,n,r,i,o,a,s,l,u,c,d,f,h,p,m,g,v,b,y,A,w,_,E,S,k,M,C,x,R,I,T,O,P,L,N,D,B,j,F,z,U,q,K,H,V,$,W,Y,G,Q,Z,J=0;J<16;++J)nv[J]=this._block.readInt32LE(4*J);for(var X=0|this._a,ee=0|this._b,et=0|this._c,en=0|this._d,er=0|this._e,ei=0|this._a,eo=0|this._b,ea=0|this._c,es=0|this._d,el=0|this._e,eu=0;eu<80;eu+=1)eu<16?(e=X,t=ee,n=et,r=en,i=er,Q=nE(e+(t^n^r)+nv[nb[eu]]+0|0,nA[eu])+i|0,o=ei,a=eo,s=ea,l=es,u=el,Z=nE(o+(a^(s|~l))+nv[ny[eu]]+1352829926|0,nw[eu])+u|0):eu<32?(c=X,d=ee,f=et,h=en,p=er,Q=nE(c+(d&f|~d&h)+nv[nb[eu]]+1518500249|0,nA[eu])+p|0,m=ei,g=eo,v=ea,b=es,y=el,Z=nE(m+(g&b|v&~b)+nv[ny[eu]]+1548603684|0,nw[eu])+y|0):eu<48?(A=X,w=ee,_=et,E=en,S=er,Q=nE(A+((w|~_)^E)+nv[nb[eu]]+1859775393|0,nA[eu])+S|0,k=ei,M=eo,C=ea,x=es,R=el,Z=nE(k+((M|~C)^x)+nv[ny[eu]]+1836072691|0,nw[eu])+R|0):eu<64?(I=X,T=ee,O=et,P=en,L=er,Q=nE(I+(T&P|O&~P)+nv[nb[eu]]+2400959708|0,nA[eu])+L|0,N=ei,D=eo,B=ea,j=es,F=el,Z=nE(N+(D&B|~D&j)+nv[ny[eu]]+2053994217|0,nw[eu])+F|0):(z=X,U=ee,q=et,K=en,H=er,Q=nE(z+(U^(q|~K))+nv[nb[eu]]+2840853838|0,nA[eu])+H|0,V=ei,$=eo,W=ea,Y=es,G=el,Z=nE(V+($^W^Y)+nv[ny[eu]]+0|0,nw[eu])+G|0),X=er,er=en,en=nE(et,10),et=ee,ee=Q,ei=el,el=es,es=nE(ea,10),ea=eo,eo=Z;var ec=this._b+et+es|0;this._b=this._c+en+el|0,this._c=this._d+er+ei|0,this._d=this._e+X+eo|0,this._e=this._a+ee+ea|0,this._a=ec},n_.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=ng.alloc?ng.alloc(20):new ng(20);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e.writeInt32LE(this._e,16),e};var nS={exports:{}},nk=eT().Buffer;function nM(e,t){this._block=nk.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}nM.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=nk.from(e,t));for(var n=this._block,r=this._blockSize,i=e.length,o=this._len,a=0;a=this._finalSize&&(this._update(this._block),this._block.fill(0));var n=8*this._len;if(n<=4294967295)this._block.writeUInt32BE(n,this._blockSize-4);else{var r=(4294967295&n)>>>0;this._block.writeUInt32BE((n-r)/4294967296,this._blockSize-8),this._block.writeUInt32BE(r,this._blockSize-4)}this._update(this._block);var i=this._hash();return e?i.toString(e):i},nM.prototype._update=function(){throw Error("_update must be implemented by subclass")};var nC=eT().Buffer,nx=[1518500249,1859775393,-1894007588,-899497514],nR=Array(80);function nI(){this.init(),this._w=nR,nM.call(this,64,56)}eD(nI,nM),nI.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},nI.prototype._update=function(e){for(var t,n=this._w,r=0|this._a,i=0|this._b,o=0|this._c,a=0|this._d,s=0|this._e,l=0;l<16;++l)n[l]=e.readInt32BE(4*l);for(;l<80;++l)n[l]=n[l-3]^n[l-8]^n[l-14]^n[l-16];for(var u=0;u<80;++u){var c,d,f,h,p=~~(u/20),m=0|((t=r)<<5|t>>>27)+(c=i,d=o,f=a,0===p?c&d|~c&f:2===p?c&d|c&f|d&f:c^d^f)+s+n[u]+nx[p];s=a,a=o,o=(h=i)<<30|h>>>2,i=r,r=m}this._a=r+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0},nI.prototype._hash=function(){var e=nC.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e};var nT=eT().Buffer,nO=[1518500249,1859775393,-1894007588,-899497514],nP=Array(80);function nL(){this.init(),this._w=nP,nM.call(this,64,56)}eD(nL,nM),nL.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},nL.prototype._update=function(e){for(var t,n=this._w,r=0|this._a,i=0|this._b,o=0|this._c,a=0|this._d,s=0|this._e,l=0;l<16;++l)n[l]=e.readInt32BE(4*l);for(;l<80;++l)n[l]=(t=n[l-3]^n[l-8]^n[l-14]^n[l-16])<<1|t>>>31;for(var u=0;u<80;++u){var c,d,f,h,p,m=~~(u/20),g=((c=r)<<5|c>>>27)+(d=i,f=o,h=a,0===m?d&f|~d&h:2===m?d&f|d&h|f&h:d^f^h)+s+n[u]+nO[m]|0;s=a,a=o,o=(p=i)<<30|p>>>2,i=r,r=g}this._a=r+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0},nL.prototype._hash=function(){var e=nT.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e};var nN=eT().Buffer,nD=[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],nB=Array(64);function nj(){this.init(),this._w=nB,nM.call(this,64,56)}eD(nj,nM),nj.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},nj.prototype._update=function(e){for(var t=this._w,n=0|this._a,r=0|this._b,i=0|this._c,o=0|this._d,a=0|this._e,s=0|this._f,l=0|this._g,u=0|this._h,c=0;c<16;++c)t[c]=e.readInt32BE(4*c);for(;c<64;++c)t[c]=(((f=t[c-2])>>>17|f<<15)^(f>>>19|f<<13)^f>>>10)+t[c-7]+(((h=t[c-15])>>>7|h<<25)^(h>>>18|h<<14)^h>>>3)+t[c-16]|0;for(var d=0;d<64;++d){var f,h,p,m,g,v,b,y,A,w=u+(((p=a)>>>6|p<<26)^(p>>>11|p<<21)^(p>>>25|p<<7))+(m=a,g=s,(v=l)^m&(g^v))+nD[d]+t[d]|0,_=(((b=n)>>>2|b<<30)^(b>>>13|b<<19)^(b>>>22|b<<10))+((y=n)&(A=r)|i&(y|A))|0;u=l,l=s,s=a,a=o+w|0,o=i,i=r,r=n,n=w+_|0}this._a=n+this._a|0,this._b=r+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=a+this._e|0,this._f=s+this._f|0,this._g=l+this._g|0,this._h=u+this._h|0},nj.prototype._hash=function(){var e=nN.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e};var nF=eT().Buffer,nz=Array(64);function nU(){this.init(),this._w=nz,nM.call(this,64,56)}eD(nU,nj),nU.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},nU.prototype._hash=function(){var e=nF.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e};var nq=eT().Buffer,nK=[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],nH=Array(160);function nV(){this.init(),this._w=nH,nM.call(this,128,112)}function n$(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function nW(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function nY(e,t){return e>>>0>>0?1:0}eD(nV,nM),nV.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},nV.prototype._update=function(e){for(var t=this._w,n=0|this._ah,r=0|this._bh,i=0|this._ch,o=0|this._dh,a=0|this._eh,s=0|this._fh,l=0|this._gh,u=0|this._hh,c=0|this._al,d=0|this._bl,f=0|this._cl,h=0|this._dl,p=0|this._el,m=0|this._fl,g=0|this._gl,v=0|this._hl,b=0;b<32;b+=2)t[b]=e.readInt32BE(4*b),t[b+1]=e.readInt32BE(4*b+4);for(;b<160;b+=2){var y,A,w,_,E,S,k,M,C=t[b-30],x=t[b-30+1],R=((y=C)>>>1|(A=x)<<31)^(y>>>8|A<<24)^y>>>7,I=((w=x)>>>1|(_=C)<<31)^(w>>>8|_<<24)^(w>>>7|_<<25),T=((E=C=t[b-4])>>>19|(S=x=t[b-4+1])<<13)^(S>>>29|E<<3)^E>>>6,O=((k=x)>>>19|(M=C)<<13)^(M>>>29|k<<3)^(k>>>6|M<<26),P=t[b-14],L=t[b-14+1],N=t[b-32],D=t[b-32+1],B=I+L|0,j=R+P+nY(B,I)|0;j=(j=j+T+nY(B=B+O|0,O)|0)+N+nY(B=B+D|0,D)|0,t[b]=j,t[b+1]=B}for(var F=0;F<160;F+=2){j=t[F],B=t[F+1];var z,U,q,K,H,V,$,W,Y,G,Q=(z=n)&(U=r)|i&(z|U),Z=(q=c)&(K=d)|f&(q|K),J=n$(n,c),X=n$(c,n),ee=nW(a,p),et=nW(p,a),en=nK[F],er=nK[F+1],ei=(H=a,V=s,($=l)^H&(V^$)),eo=(W=p,Y=m,(G=g)^W&(Y^G)),ea=v+et|0,es=u+ee+nY(ea,v)|0;es=(es=(es=es+ei+nY(ea=ea+eo|0,eo)|0)+en+nY(ea=ea+er|0,er)|0)+j+nY(ea=ea+B|0,B)|0;var el=X+Z|0,eu=J+Q+nY(el,X)|0;u=l,v=g,l=s,g=m,s=a,m=p,a=o+es+nY(p=h+ea|0,h)|0,o=i,h=f,i=r,f=d,r=n,d=c,n=es+eu+nY(c=ea+el|0,ea)|0}this._al=this._al+c|0,this._bl=this._bl+d|0,this._cl=this._cl+f|0,this._dl=this._dl+h|0,this._el=this._el+p|0,this._fl=this._fl+m|0,this._gl=this._gl+g|0,this._hl=this._hl+v|0,this._ah=this._ah+n+nY(this._al,c)|0,this._bh=this._bh+r+nY(this._bl,d)|0,this._ch=this._ch+i+nY(this._cl,f)|0,this._dh=this._dh+o+nY(this._dl,h)|0,this._eh=this._eh+a+nY(this._el,p)|0,this._fh=this._fh+s+nY(this._fl,m)|0,this._gh=this._gh+l+nY(this._gl,g)|0,this._hh=this._hh+u+nY(this._hl,v)|0},nV.prototype._hash=function(){var e=nq.allocUnsafe(64);function t(t,n,r){e.writeInt32BE(t,r),e.writeInt32BE(n,r+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e};var nG=eT().Buffer,nQ=Array(160);function nZ(){this.init(),this._w=nQ,nM.call(this,128,112)}eD(nZ,nV),nZ.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},nZ.prototype._hash=function(){var e=nG.allocUnsafe(48);function t(t,n,r){e.writeInt32BE(t,r),e.writeInt32BE(n,r+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e};var nJ=nS.exports=function(e){var t=nJ[e=e.toLowerCase()];if(!t)throw Error(e+" is not supported (we accept pull requests)");return new t};nJ.sha=nI,nJ.sha1=nL,nJ.sha224=nU,nJ.sha256=nj,nJ.sha384=nZ,nJ.sha512=nV;var nX=nS.exports;function n0(){this.head=null,this.tail=null,this.length=0}n0.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},n0.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},n0.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},n0.prototype.clear=function(){this.head=this.tail=null,this.length=0},n0.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},n0.prototype.concat=function(e){if(0===this.length)return M.alloc(0);if(1===this.length)return this.head.data;for(var t=M.allocUnsafe(e>>>0),n=this.head,r=0;n;)n.data.copy(t,r),r+=n.data.length,n=n.next;return t};var n1=M.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function n2(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),function(e){if(e&&!n1(e))throw Error("Unknown encoding: "+e)}(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=n6;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=n4;break;default:return void(this.write=n3)}this.charBuffer=new M(6),this.charReceived=0,this.charLength=0}function n3(e){return e.toString(this.encoding)}function n6(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function n4(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}n2.prototype.write=function(e){for(var t,n="";this.charLength;){var r=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,r),this.charReceived+=r,this.charReceived=55296&&t<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return n;break}this.charLength+=this.surrogateSize,n=""}this.detectIncompleteChar(e);var i=e.length;if(this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,i),i-=this.charReceived),i=(n+=e.toString(this.encoding,0,i)).length-1,(t=n.charCodeAt(i))>=55296&&t<=56319){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),e.copy(this.charBuffer,0,0,o),n.substring(0,i)}return n},n2.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var n=e[e.length-t];if(1==t&&n>>5==6){this.charLength=2;break}if(t<=2&&n>>4==14){this.charLength=3;break}if(t<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=t},n2.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;t+=r.slice(0,n).toString(i)}return t};var n8=Object.freeze({__proto__:null,StringDecoder:n2});n9.ReadableState=n7;var n5=eX("stream");function n7(e,t){e=e||{},this.objectMode=!!e.objectMode,t instanceof rM&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var n=e.highWaterMark,r=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:r,this.highWaterMark=~~this.highWaterMark,this.buffer=new n0,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(this.decoder=new n2(e.encoding),this.encoding=e.encoding)}function n9(e){if(!(this instanceof n9))return new n9(e);this._readableState=new n7(e,this),this.readable=!0,e&&"function"==typeof e.read&&(this._read=e.read),eF.call(this)}function re(e,t,n,r,i){var o,a,s,l=(a=null,Z(o=n)||"string"==typeof o||null==o||t.objectMode||(a=TypeError("Invalid non-string/buffer chunk")),a);if(l)e.emit("error",l);else if(null===n)t.reading=!1,function(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,rn(e)}}(e,t);else if(t.objectMode||n&&n.length>0){if(t.ended&&!i){var u=Error("stream.push() after EOF");e.emit("error",u)}else if(t.endEmitted&&i){var c=Error("stream.unshift() after end event");e.emit("error",c)}else!t.decoder||i||r||(n=t.decoder.write(n),s=!t.objectMode&&0===n.length),i||(t.reading=!1),s||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&rn(e))),t.readingMore||(t.readingMore=!0,ew(ri,e,t))}else i||(t.reading=!1);return!t.ended&&(t.needReadable||t.lengtht.highWaterMark&&(t.highWaterMark=((n=e)>=8388608?n=8388608:(n--,n|=n>>>1,n|=n>>>2,n|=n>>>4,n|=n>>>8,n|=n>>>16,n++),n)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function rn(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(n5("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?ew(rr,e):rr(e))}function rr(e){n5("emit readable"),e.emit("readable"),rs(e)}function ri(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):(r=t.buffer,i=t.decoder,eo.length?o.length:e;if(a===o.length?i+=o:i+=o.slice(0,e),0==(e-=a)){a===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(a));break}++r}return t.length-=r,i}(e,r):function(e,t){var n=M.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,a=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,a),0==(e-=a)){a===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(a));break}++i}return t.length-=i,n}(e,r),n=o),n)}function ru(e){var t=e._readableState;if(t.length>0)throw Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,ew(rc,t,e))}function rc(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function rd(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return n5("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?ru(this):rn(this),null;if(0===(e=rt(e,t))&&t.ended)return 0===t.length&&ru(this),null;var r,i=t.needReadable;return n5("need readable",i),(0===t.length||t.length-e0?rl(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&ru(this)),null!==r&&this.emit("data",r),r},n9.prototype._read=function(e){this.emit("error",Error("not implemented"))},n9.prototype.pipe=function(e,t){var n=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=e;break;case 1:r.pipes=[r.pipes,e];break;default:r.pipes.push(e)}r.pipesCount+=1,n5("pipe count=%d opts=%j",r.pipesCount,t);var i=t&&!1===t.end?u:a;function o(e){n5("onunpipe"),e===n&&u()}function a(){n5("onend"),e.end()}r.endEmitted?ew(i):n.once("end",i),e.on("unpipe",o);var s=function(){var e=n._readableState;n5("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&n.listeners("data").length&&(e.flowing=!0,rs(n))};e.on("drain",s);var l=!1;function u(){n5("cleanup"),e.removeListener("close",h),e.removeListener("finish",p),e.removeListener("drain",s),e.removeListener("error",f),e.removeListener("unpipe",o),n.removeListener("end",a),n.removeListener("end",u),n.removeListener("data",d),l=!0,r.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&s()}var c=!1;function d(t){n5("ondata"),c=!1,!1!==e.write(t)||c||((1===r.pipesCount&&r.pipes===e||r.pipesCount>1&&-1!==rd(r.pipes,e))&&!l&&(n5("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,c=!0),n.pause())}function f(t){var n;n5("onerror",t),m(),e.removeListener("error",f),0===(n="error",e.listeners(n).length)&&e.emit("error",t)}function h(){e.removeListener("finish",p),m()}function p(){n5("onfinish"),e.removeListener("close",h),m()}function m(){n5("unpipe"),n.unpipe(e)}return n.on("data",d),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",f),e.once("close",h),e.once("finish",p),e.emit("pipe",n),r.flowing||(n5("pipe resume"),n.resume()),e},n9.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this)),this;if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i-1))throw TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},rm.prototype._write=function(e,t,n){n(Error("not implemented"))},rm.prototype._writev=null,rm.prototype.end=function(e,t,n){var r,i=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),i.corked&&(i.corked=1,this.uncork()),i.ending||i.finished||(r=n,i.ending=!0,rw(this,i),r&&(i.finished?ew(r):this.once("finish",r)),i.ended=!0,this.writable=!1)},eW(rM,n9);for(var rE=Object.keys(rm.prototype),rS=0;rS64?t=e(t):t.length<64&&(t=rq.concat([t,rK],64));for(var n=this._ipad=rq.allocUnsafe(64),r=this._opad=rq.allocUnsafe(64),i=0;i<64;i++)n[i]=54^t[i],r[i]=92^t[i];this._hash=[n]}eD(rH,rF),rH.prototype._update=function(e){this._hash.push(e)},rH.prototype._final=function(){var e=this._alg(rq.concat(this._hash));return this._alg(rq.concat([this._opad,e]))};var rV=function(e){return(new nc).update(e).digest()},r$=eT().Buffer,rW=r$.alloc(128);function rY(e,t){rF.call(this,"digest"),"string"==typeof t&&(t=r$.from(t));var n="sha512"===e||"sha384"===e?128:64;(this._alg=e,this._key=t,t.length>n)?t=("rmd160"===e?new n_:nX(e)).update(t).digest():t.length1073741823||t!=t)throw TypeError("Bad key length")},r1=l.process&&l.process.browser?"utf-8":l.process&&l.process.version?parseInt(ex.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary":"utf-8",r2=eT().Buffer,r3=function(e,t,n){if(r2.isBuffer(e))return e;if("string"==typeof e)return r2.from(e,t);if(ArrayBuffer.isView(e))return r2.from(e.buffer);throw TypeError(n+" must be a string, a Buffer, a typed array or a DataView")},r6=eT().Buffer,r4=r6.alloc(128),r8={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function r5(e,t,n){var r="rmd160"===e||"ripemd160"===e?function(e){return(new n_).update(e).digest()}:"md5"===e?rV:function(t){return nX(e).update(t).digest()},i="sha512"===e||"sha384"===e?128:64;t.length>i?t=r(t):t.length>>0},writeUInt32BE:function(e,t,n){e[0+n]=t>>>24,e[1+n]=t>>>16&255,e[2+n]=t>>>8&255,e[3+n]=255&t},ip:function(e,t,n,r){for(var i=0,o=0,a=6;a>=0;a-=2){for(var s=0;s<=24;s+=8)i<<=1,i|=t>>>s+a&1;for(s=0;s<=24;s+=8)i<<=1,i|=e>>>s+a&1}for(a=6;a>=0;a-=2){for(s=1;s<=25;s+=8)o<<=1,o|=t>>>s+a&1;for(s=1;s<=25;s+=8)o<<=1,o|=e>>>s+a&1}n[r+0]=i>>>0,n[r+1]=o>>>0},rip:function(e,t,n,r){for(var i=0,o=0,a=0;a<4;a++)for(var s=24;s>=0;s-=8)i<<=1,i|=t>>>s+a&1,i<<=1,i|=e>>>s+a&1;for(a=4;a<8;a++)for(s=24;s>=0;s-=8)o<<=1,o|=t>>>s+a&1,o<<=1,o|=e>>>s+a&1;n[r+0]=i>>>0,n[r+1]=o>>>0},pc1:function(e,t,n,r){for(var i=0,o=0,a=7;a>=5;a--){for(var s=0;s<=24;s+=8)i<<=1,i|=t>>s+a&1;for(s=0;s<=24;s+=8)i<<=1,i|=e>>s+a&1}for(s=0;s<=24;s+=8)i<<=1,i|=t>>s+a&1;for(a=1;a<=3;a++){for(s=0;s<=24;s+=8)o<<=1,o|=t>>s+a&1;for(s=0;s<=24;s+=8)o<<=1,o|=e>>s+a&1}for(s=0;s<=24;s+=8)o<<=1,o|=e>>s+a&1;n[r+0]=i>>>0,n[r+1]=o>>>0},r28shl:function(e,t){return e<>>28-t}},id=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];ic.pc2=function(e,t,n,r){for(var i=0,o=0,a=id.length>>>1,s=0;s>>id[s]&1;for(s=a;s>>id[s]&1;n[r+0]=i>>>0,n[r+1]=o>>>0},ic.expand=function(e,t,n){var r=0,i=0;r=(1&e)<<5|e>>>27;for(var o=23;o>=15;o-=4)r<<=6,r|=e>>>o&63;for(o=11;o>=3;o-=4)i|=e>>>o&63,i<<=6;i|=(31&e)<<1|e>>>31,t[n+0]=r>>>0,t[n+1]=i>>>0};var ih=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];ic.substitute=function(e,t){for(var n=0,r=0;r<4;r++)n<<=4,n|=ih[64*r+(e>>>18-6*r&63)];for(r=0;r<4;r++)n<<=4,n|=ih[256+64*r+(t>>>18-6*r&63)];return n>>>0};var ip=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];function im(e,t){if(!e)throw Error(t||"Assertion failed")}function ig(e){this.options=e,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=Array(this.blockSize),this.bufferOff=0,this.padding=!1!==e.padding}function iv(){this.tmp=[,,],this.keys=null}function ib(e){ig.call(this,e);var t=new iv;this._desState=t,this.deriveKeys(t,e.key)}ic.permute=function(e){for(var t=0,n=0;n>>ip[n]&1;return t>>>0},ic.padSplit=function(e,t,n){for(var r=e.toString(2);r.length0;r--)t+=this._buffer(e,t),n+=this._flushBuffer(i,n);return t+=this._buffer(e,t),i},ig.prototype.final=function(e){var t,n;return e&&(t=this.update(e)),n="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),t?t.concat(n):n},ig.prototype._pad=function(e,t){if(0===t)return!1;for(;t>>1];n=ic.r28shl(n,o),r=ic.r28shl(r,o),ic.pc2(n,r,e.keys,i)}},ib.prototype._update=function(e,t,n,r){var i=this._desState,o=ic.readUInt32BE(e,t),a=ic.readUInt32BE(e,t+4);ic.ip(o,a,i.tmp,0),o=i.tmp[0],a=i.tmp[1],"encrypt"===this.type?this._encrypt(i,o,a,i.tmp,0):this._decrypt(i,o,a,i.tmp,0),o=i.tmp[0],a=i.tmp[1],ic.writeUInt32BE(n,o,r),ic.writeUInt32BE(n,a,r+4)},ib.prototype._pad=function(e,t){if(!1===this.padding)return!1;for(var n=e.length-t,r=t;r>>0,o=d}ic.rip(a,o,r,i)},ib.prototype._decrypt=function(e,t,n,r,i){for(var o=n,a=t,s=e.keys.length-2;s>=0;s-=2){var l=e.keys[s],u=e.keys[s+1];ic.expand(o,e.tmp,0),l^=e.tmp[0],u^=e.tmp[1];var c=ic.substitute(l,u),d=o;o=(a^ic.permute(c))>>>0,a=d}ic.rip(o,a,r,i)};var iA={},iw={};function i_(e){im.equal(e.length,8,"Invalid IV length"),this.iv=Array(8);for(var t=0;t>o%8,e._prev=function(e,t){var n=e.length,r=-1,i=ij.allocUnsafe(e.length);for(e=ij.concat([e,ij.from([t])]);++r>7;return i}(e._prev,n?r:i);return a}(e,t[o],n);return i};var iF={};iF.encrypt=function(e,t){for(;e._cache.length>>24]^c[p>>>16&255]^d[m>>>8&255]^f[255&g]^t[v++],a=u[p>>>24]^c[m>>>16&255]^d[g>>>8&255]^f[255&h]^t[v++],s=u[m>>>24]^c[g>>>16&255]^d[h>>>8&255]^f[255&p]^t[v++],l=u[g>>>24]^c[h>>>16&255]^d[p>>>8&255]^f[255&m]^t[v++],h=o,p=a,m=s,g=l;return o=(r[h>>>24]<<24|r[p>>>16&255]<<16|r[m>>>8&255]<<8|r[255&g])^t[v++],[o>>>=0,a=((r[p>>>24]<<24|r[m>>>16&255]<<16|r[g>>>8&255]<<8|r[255&h])^t[v++])>>>0,s=((r[m>>>24]<<24|r[g>>>16&255]<<16|r[h>>>8&255]<<8|r[255&p])^t[v++])>>>0,l=((r[g>>>24]<<24|r[h>>>16&255]<<16|r[p>>>8&255]<<8|r[255&m])^t[v++])>>>0]}var iZ=[0,1,2,4,8,16,32,64,128,27,54],iJ=function(){for(var e=Array(256),t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;for(var n=[],r=[],i=[[],[],[],[]],o=[[],[],[],[]],a=0,s=0,l=0;l<256;++l){var u=s^s<<1^s<<2^s<<3^s<<4;u=u>>>8^255&u^99,n[a]=u,r[u]=a;var c=e[a],d=e[c],f=e[d],h=257*e[u]^16843008*u;i[0][a]=h<<24|h>>>8,i[1][a]=h<<16|h>>>16,i[2][a]=h<<8|h>>>24,i[3][a]=h,h=16843009*f^65537*d^257*c^16843008*a,o[0][u]=h<<24|h>>>8,o[1][u]=h<<16|h>>>16,o[2][u]=h<<8|h>>>24,o[3][u]=h,0===a?a=s=1:(a=c^e[e[e[f^c]]],s^=e[e[s]])}return{SBOX:n,INV_SBOX:r,SUB_MIX:i,INV_SUB_MIX:o}}();function iX(e){this._key=iY(e),this._reset()}iX.blockSize=16,iX.keySize=32,iX.prototype.blockSize=iX.blockSize,iX.prototype.keySize=iX.keySize,iX.prototype._reset=function(){for(var e=this._key,t=e.length,n=t+6,r=4*(n+1),i=[],o=0;o>>24,a=(iJ.SBOX[a>>>24]<<24|iJ.SBOX[a>>>16&255]<<16|iJ.SBOX[a>>>8&255]<<8|iJ.SBOX[255&a])^iZ[o/t|0]<<24):t>6&&o%t==4&&(a=iJ.SBOX[a>>>24]<<24|iJ.SBOX[a>>>16&255]<<16|iJ.SBOX[a>>>8&255]<<8|iJ.SBOX[255&a]),i[o]=i[o-t]^a}for(var s=[],l=0;l>>24]]^iJ.INV_SUB_MIX[1][iJ.SBOX[c>>>16&255]]^iJ.INV_SUB_MIX[2][iJ.SBOX[c>>>8&255]]^iJ.INV_SUB_MIX[3][iJ.SBOX[255&c]]}this._nRounds=n,this._keySchedule=i,this._invKeySchedule=s},iX.prototype.encryptBlockRaw=function(e){return iQ(e=iY(e),this._keySchedule,iJ.SUB_MIX,iJ.SBOX,this._nRounds)},iX.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),n=iW.allocUnsafe(16);return n.writeUInt32BE(t[0],0),n.writeUInt32BE(t[1],4),n.writeUInt32BE(t[2],8),n.writeUInt32BE(t[3],12),n},iX.prototype.decryptBlock=function(e){var t=(e=iY(e))[1];e[1]=e[3],e[3]=t;var n=iQ(e,this._invKeySchedule,iJ.INV_SUB_MIX,iJ.INV_SBOX,this._nRounds),r=iW.allocUnsafe(16);return r.writeUInt32BE(n[0],0),r.writeUInt32BE(n[3],4),r.writeUInt32BE(n[2],8),r.writeUInt32BE(n[1],12),r},iX.prototype.scrub=function(){iG(this._keySchedule),iG(this._invKeySchedule),iG(this._key)},i$.AES=iX;var i0=eT().Buffer,i1=i0.alloc(16,0);function i2(e){var t=i0.allocUnsafe(16);return t.writeUInt32BE(e[0]>>>0,0),t.writeUInt32BE(e[1]>>>0,4),t.writeUInt32BE(e[2]>>>0,8),t.writeUInt32BE(e[3]>>>0,12),t}function i3(e){this.h=e,this.state=i0.alloc(16,0),this.cache=i0.allocUnsafe(0)}i3.prototype.ghash=function(e){for(var t=-1;++t0;t--)r[t]=r[t]>>>1|(1&r[t-1])<<31;r[0]=r[0]>>>1,n&&(r[0]=-520093696^r[0])}this.state=i2(i)},i3.prototype.update=function(e){var t;for(this.cache=i0.concat([this.cache,e]);this.cache.length>=16;)t=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(t)},i3.prototype.final=function(e,t){return this.cache.length&&this.ghash(i0.concat([this.cache,i1],16)),this.ghash(i2([0,e,0,t])),this.state};var i6=eT().Buffer;function i4(e,t,n,r){rF.call(this);var i=i6.alloc(4,0);this._cipher=new i$.AES(t);var o=this._cipher.encryptBlock(i);this._ghash=new i3(o),n=function(e,t,n){if(12===t.length)return e._finID=i6.concat([t,i6.from([0,0,0,1])]),i6.concat([t,i6.from([0,0,0,2])]);var r=new i3(n),i=t.length,o=i%16;r.update(t),o&&(o=16-o,r.update(i6.alloc(o,0))),r.update(i6.alloc(8,0));var a=i6.alloc(8);a.writeUIntBE(8*i,0,8),r.update(a),e._finID=r.state;var s=i6.from(e._finID);return iU(s),s}(this,n,o),this._prev=i6.from(n),this._cache=i6.allocUnsafe(0),this._secCache=i6.allocUnsafe(0),this._decrypt=r,this._alen=0,this._len=0,this._mode=e,this._authTag=null,this._called=!1}eD(i4,rF),i4.prototype._update=function(e){if(!this._called&&this._alen){var t=16-this._alen%16;t<16&&(t=i6.alloc(t,0),this._ghash.update(t))}this._called=!0;var n=this._mode.encrypt(this,e);return this._decrypt?this._ghash.update(e):this._ghash.update(n),this._len+=e.length,n},i4.prototype._final=function(){if(this._decrypt&&!this._authTag)throw Error("Unsupported state or unable to authenticate data");var e=iT(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(e,t){var n=0;e.length!==t.length&&n++;for(var r=Math.min(e.length,t.length),i=0;i0||r>0;){var l=new nc;l.update(s),l.update(e),t&&l.update(t),s=l.digest();var u=0;if(i>0){var c=o.length-i;u=Math.min(i,s.length),s.copy(o,c,0,u),i-=u}if(u0){var d=a.length-r,f=Math.min(r,s.length-u);s.copy(a,d,u,u+f),r-=f}}return s.fill(0),{key:o,iv:a}},oe=eT().Buffer;function ot(e,t,n){rF.call(this),this._cache=new or,this._cipher=new i$.AES(t),this._prev=oe.from(n),this._mode=e,this._autopadding=!0}eD(ot,rF),ot.prototype._update=function(e){var t,n;this._cache.add(e);for(var r=[];t=this._cache.get();)n=this._mode.encrypt(this,t),r.push(n);return oe.concat(r)};var on=oe.alloc(16,16);function or(){this.cache=oe.allocUnsafe(0)}function oi(e,t,n){var r=iK[e.toLowerCase()];if(!r)throw TypeError("invalid suite type");if("string"==typeof t&&(t=oe.from(t)),t.length!==r.key/8)throw TypeError("invalid key length "+t.length);if("string"==typeof n&&(n=oe.from(n)),"GCM"!==r.mode&&n.length!==r.iv)throw TypeError("invalid iv length "+n.length);return"stream"===r.type?new i5(r.module,t,n):"auth"===r.type?new i4(r.module,t,n):new ot(r.module,t,n)}ot.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return e=this._mode.encrypt(this,e),this._cipher.scrub(),e;if(!e.equals(on))throw this._cipher.scrub(),Error("data not multiple of block length")},ot.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},or.prototype.add=function(e){this.cache=oe.concat([this.cache,e])},or.prototype.get=function(){if(this.cache.length>15){var e=this.cache.slice(0,16);return this.cache=this.cache.slice(16),e}return null},or.prototype.flush=function(){for(var e=16-this.cache.length,t=oe.allocUnsafe(e),n=-1;++n16)throw Error("unable to decrypt data");for(var n=-1;++n16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t}else if(this.cache.length>=16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t;return null},ol.prototype.flush=function(){if(this.cache.length)return this.cache},oo.createDecipher=function(e,t){var n=iK[e.toLowerCase()];if(!n)throw TypeError("invalid suite type");var r=i9(t,!1,n.key,n.iv);return ou(e,r.key,r.iv)},oo.createDecipheriv=ou,ix.createCipher=ix.Cipher=iR.createCipher,ix.createCipheriv=ix.Cipheriv=iR.createCipheriv,ix.createDecipher=ix.Decipher=oo.createDecipher,ix.createDecipheriv=ix.Decipheriv=oo.createDecipheriv,ix.listCiphers=ix.getCiphers=function(){return Object.keys(iK)};var oc={};function od(e,t,n){if(iK[e=e.toLowerCase()])return ix.createCipheriv(e,t,n);if(oc[e])return new iC({key:t,iv:n,mode:e});throw TypeError("invalid suite type")}function of(e,t,n){if(iK[e=e.toLowerCase()])return ix.createDecipheriv(e,t,n);if(oc[e])return new iC({key:t,iv:n,mode:e,decrypt:!0});throw TypeError("invalid suite type")}oc["des-ecb"]={key:8,iv:0},oc["des-cbc"]=oc.des={key:8,iv:8},oc["des-ede3-cbc"]=oc.des3={key:24,iv:8},oc["des-ede3"]={key:24,iv:0},oc["des-ede-cbc"]={key:16,iv:8},oc["des-ede"]={key:16,iv:0},il.createCipher=il.Cipher=function(e,t){if(iK[e=e.toLowerCase()])n=iK[e].key,r=iK[e].iv;else{if(!oc[e])throw TypeError("invalid suite type");n=8*oc[e].key,r=oc[e].iv}var n,r,i=i9(t,!1,n,r);return od(e,i.key,i.iv)},il.createCipheriv=il.Cipheriv=od,il.createDecipher=il.Decipher=function(e,t){if(iK[e=e.toLowerCase()])n=iK[e].key,r=iK[e].iv;else{if(!oc[e])throw TypeError("invalid suite type");n=8*oc[e].key,r=oc[e].iv}var n,r,i=i9(t,!1,n,r);return of(e,i.key,i.iv)},il.createDecipheriv=il.Decipheriv=of,il.listCiphers=il.getCiphers=function(){return Object.keys(oc).concat(ix.getCiphers())};var oh={},op={exports:{}};!function(e,t){function n(e,t){if(!e)throw Error(t||"Assertion failed")}function r(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function i(e,t,n){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}"object"==typeof e?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;try{l="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:er.Buffer}catch(e){}function o(e,t){var n=e.charCodeAt(t);return n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:n-48&15}function a(e,t,n){var r=o(e,n);return n-1>=t&&(r|=o(e,n-1)<<4),r}function s(e,t,n,r){for(var i=0,o=Math.min(e.length,n),a=t;a=49?s-49+10:s>=17?s-17+10:s}return i}i.isBN=function(e){return e instanceof i||null!==e&&"object"==typeof e&&e.constructor.wordSize===i.wordSize&&Array.isArray(e.words)},i.max=function(e,t){return e.cmp(t)>0?e:t},i.min=function(e,t){return 0>e.cmp(t)?e:t},i.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)a=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},i.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=Array(this.length);for(var r=0;r=t;r-=2)i=a(e,t,r)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(r=(e.length-t)%2==0?t+1:t;r=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this.strip()},i.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,a=o%r,l=Math.min(o,o-a)+n,u=0,c=n;c1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?""};var l,u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function f(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],a=i*o,s=67108863&a,l=a/67108864|0;n.words[0]=s;for(var u=1;u>>26,d=67108863&l,f=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=f;h++){var p=u-h|0;c+=(a=(i=0|e.words[p])*(o=0|t.words[h])+d)/67108864|0,d=67108863&a}n.words[u]=0|d,l=0|c}return 0!==l?n.words[u]=0|l:n.length--,n.strip()}i.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var i=0,o=0,a=0;a>>24-i&16777215)||a!==this.length-1?u[6-l.length]+l+r:l+r,(i+=2)>=26&&(i-=26,a--)}for(0!==o&&(r=o.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var f=c[e],h=d[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(h).toString(e);r=(p=p.idivn(h)).isZero()?m+r:u[f-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(e,t){return n(void 0!==l),this.toArrayLike(l,e,t)},i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},i.prototype.toArrayLike=function(e,t,r){var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0"),this.strip();var a,s,l=new e(o),u=this.clone();if("le"===t){for(s=0;!u.isZero();s++)a=u.andln(255),u.iushrn(8),l[s]=a;for(;s=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;ne.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;re.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,a=0;a>26,this.words[a]=67108863&t;for(;0!==o&&a>26,this.words[a]=67108863&t;if(0===o&&a>>13,h=0|a[1],p=8191&h,m=h>>>13,g=0|a[2],v=8191&g,b=g>>>13,y=0|a[3],A=8191&y,w=y>>>13,_=0|a[4],E=8191&_,S=_>>>13,k=0|a[5],M=8191&k,C=k>>>13,x=0|a[6],R=8191&x,I=x>>>13,T=0|a[7],O=8191&T,P=T>>>13,L=0|a[8],N=8191&L,D=L>>>13,B=0|a[9],j=8191&B,F=B>>>13,z=0|s[0],U=8191&z,q=z>>>13,K=0|s[1],H=8191&K,V=K>>>13,$=0|s[2],W=8191&$,Y=$>>>13,G=0|s[3],Q=8191&G,Z=G>>>13,J=0|s[4],X=8191&J,ee=J>>>13,et=0|s[5],en=8191&et,er=et>>>13,ei=0|s[6],eo=8191&ei,ea=ei>>>13,es=0|s[7],el=8191&es,eu=es>>>13,ec=0|s[8],ed=8191&ec,ef=ec>>>13,eh=0|s[9],ep=8191&eh,em=eh>>>13;n.negative=e.negative^t.negative,n.length=19;var eg=(u+(r=Math.imul(d,U))|0)+((8191&(i=(i=Math.imul(d,q))+Math.imul(f,U)|0))<<13)|0;u=((o=Math.imul(f,q))+(i>>>13)|0)+(eg>>>26)|0,eg&=67108863,r=Math.imul(p,U),i=(i=Math.imul(p,q))+Math.imul(m,U)|0,o=Math.imul(m,q);var ev=(u+(r=r+Math.imul(d,H)|0)|0)+((8191&(i=(i=i+Math.imul(d,V)|0)+Math.imul(f,H)|0))<<13)|0;u=((o=o+Math.imul(f,V)|0)+(i>>>13)|0)+(ev>>>26)|0,ev&=67108863,r=Math.imul(v,U),i=(i=Math.imul(v,q))+Math.imul(b,U)|0,o=Math.imul(b,q),r=r+Math.imul(p,H)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,H)|0,o=o+Math.imul(m,V)|0;var eb=(u+(r=r+Math.imul(d,W)|0)|0)+((8191&(i=(i=i+Math.imul(d,Y)|0)+Math.imul(f,W)|0))<<13)|0;u=((o=o+Math.imul(f,Y)|0)+(i>>>13)|0)+(eb>>>26)|0,eb&=67108863,r=Math.imul(A,U),i=(i=Math.imul(A,q))+Math.imul(w,U)|0,o=Math.imul(w,q),r=r+Math.imul(v,H)|0,i=(i=i+Math.imul(v,V)|0)+Math.imul(b,H)|0,o=o+Math.imul(b,V)|0,r=r+Math.imul(p,W)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,Y)|0;var ey=(u+(r=r+Math.imul(d,Q)|0)|0)+((8191&(i=(i=i+Math.imul(d,Z)|0)+Math.imul(f,Q)|0))<<13)|0;u=((o=o+Math.imul(f,Z)|0)+(i>>>13)|0)+(ey>>>26)|0,ey&=67108863,r=Math.imul(E,U),i=(i=Math.imul(E,q))+Math.imul(S,U)|0,o=Math.imul(S,q),r=r+Math.imul(A,H)|0,i=(i=i+Math.imul(A,V)|0)+Math.imul(w,H)|0,o=o+Math.imul(w,V)|0,r=r+Math.imul(v,W)|0,i=(i=i+Math.imul(v,Y)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,Y)|0,r=r+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,Z)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,Z)|0;var eA=(u+(r=r+Math.imul(d,X)|0)|0)+((8191&(i=(i=i+Math.imul(d,ee)|0)+Math.imul(f,X)|0))<<13)|0;u=((o=o+Math.imul(f,ee)|0)+(i>>>13)|0)+(eA>>>26)|0,eA&=67108863,r=Math.imul(M,U),i=(i=Math.imul(M,q))+Math.imul(C,U)|0,o=Math.imul(C,q),r=r+Math.imul(E,H)|0,i=(i=i+Math.imul(E,V)|0)+Math.imul(S,H)|0,o=o+Math.imul(S,V)|0,r=r+Math.imul(A,W)|0,i=(i=i+Math.imul(A,Y)|0)+Math.imul(w,W)|0,o=o+Math.imul(w,Y)|0,r=r+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,Z)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,Z)|0,r=r+Math.imul(p,X)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,ee)|0;var ew=(u+(r=r+Math.imul(d,en)|0)|0)+((8191&(i=(i=i+Math.imul(d,er)|0)+Math.imul(f,en)|0))<<13)|0;u=((o=o+Math.imul(f,er)|0)+(i>>>13)|0)+(ew>>>26)|0,ew&=67108863,r=Math.imul(R,U),i=(i=Math.imul(R,q))+Math.imul(I,U)|0,o=Math.imul(I,q),r=r+Math.imul(M,H)|0,i=(i=i+Math.imul(M,V)|0)+Math.imul(C,H)|0,o=o+Math.imul(C,V)|0,r=r+Math.imul(E,W)|0,i=(i=i+Math.imul(E,Y)|0)+Math.imul(S,W)|0,o=o+Math.imul(S,Y)|0,r=r+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,Z)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,Z)|0,r=r+Math.imul(v,X)|0,i=(i=i+Math.imul(v,ee)|0)+Math.imul(b,X)|0,o=o+Math.imul(b,ee)|0,r=r+Math.imul(p,en)|0,i=(i=i+Math.imul(p,er)|0)+Math.imul(m,en)|0,o=o+Math.imul(m,er)|0;var e_=(u+(r=r+Math.imul(d,eo)|0)|0)+((8191&(i=(i=i+Math.imul(d,ea)|0)+Math.imul(f,eo)|0))<<13)|0;u=((o=o+Math.imul(f,ea)|0)+(i>>>13)|0)+(e_>>>26)|0,e_&=67108863,r=Math.imul(O,U),i=(i=Math.imul(O,q))+Math.imul(P,U)|0,o=Math.imul(P,q),r=r+Math.imul(R,H)|0,i=(i=i+Math.imul(R,V)|0)+Math.imul(I,H)|0,o=o+Math.imul(I,V)|0,r=r+Math.imul(M,W)|0,i=(i=i+Math.imul(M,Y)|0)+Math.imul(C,W)|0,o=o+Math.imul(C,Y)|0,r=r+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,Z)|0)+Math.imul(S,Q)|0,o=o+Math.imul(S,Z)|0,r=r+Math.imul(A,X)|0,i=(i=i+Math.imul(A,ee)|0)+Math.imul(w,X)|0,o=o+Math.imul(w,ee)|0,r=r+Math.imul(v,en)|0,i=(i=i+Math.imul(v,er)|0)+Math.imul(b,en)|0,o=o+Math.imul(b,er)|0,r=r+Math.imul(p,eo)|0,i=(i=i+Math.imul(p,ea)|0)+Math.imul(m,eo)|0,o=o+Math.imul(m,ea)|0;var eE=(u+(r=r+Math.imul(d,el)|0)|0)+((8191&(i=(i=i+Math.imul(d,eu)|0)+Math.imul(f,el)|0))<<13)|0;u=((o=o+Math.imul(f,eu)|0)+(i>>>13)|0)+(eE>>>26)|0,eE&=67108863,r=Math.imul(N,U),i=(i=Math.imul(N,q))+Math.imul(D,U)|0,o=Math.imul(D,q),r=r+Math.imul(O,H)|0,i=(i=i+Math.imul(O,V)|0)+Math.imul(P,H)|0,o=o+Math.imul(P,V)|0,r=r+Math.imul(R,W)|0,i=(i=i+Math.imul(R,Y)|0)+Math.imul(I,W)|0,o=o+Math.imul(I,Y)|0,r=r+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,Z)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,Z)|0,r=r+Math.imul(E,X)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(S,X)|0,o=o+Math.imul(S,ee)|0,r=r+Math.imul(A,en)|0,i=(i=i+Math.imul(A,er)|0)+Math.imul(w,en)|0,o=o+Math.imul(w,er)|0,r=r+Math.imul(v,eo)|0,i=(i=i+Math.imul(v,ea)|0)+Math.imul(b,eo)|0,o=o+Math.imul(b,ea)|0,r=r+Math.imul(p,el)|0,i=(i=i+Math.imul(p,eu)|0)+Math.imul(m,el)|0,o=o+Math.imul(m,eu)|0;var eS=(u+(r=r+Math.imul(d,ed)|0)|0)+((8191&(i=(i=i+Math.imul(d,ef)|0)+Math.imul(f,ed)|0))<<13)|0;u=((o=o+Math.imul(f,ef)|0)+(i>>>13)|0)+(eS>>>26)|0,eS&=67108863,r=Math.imul(j,U),i=(i=Math.imul(j,q))+Math.imul(F,U)|0,o=Math.imul(F,q),r=r+Math.imul(N,H)|0,i=(i=i+Math.imul(N,V)|0)+Math.imul(D,H)|0,o=o+Math.imul(D,V)|0,r=r+Math.imul(O,W)|0,i=(i=i+Math.imul(O,Y)|0)+Math.imul(P,W)|0,o=o+Math.imul(P,Y)|0,r=r+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,Z)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,Z)|0,r=r+Math.imul(M,X)|0,i=(i=i+Math.imul(M,ee)|0)+Math.imul(C,X)|0,o=o+Math.imul(C,ee)|0,r=r+Math.imul(E,en)|0,i=(i=i+Math.imul(E,er)|0)+Math.imul(S,en)|0,o=o+Math.imul(S,er)|0,r=r+Math.imul(A,eo)|0,i=(i=i+Math.imul(A,ea)|0)+Math.imul(w,eo)|0,o=o+Math.imul(w,ea)|0,r=r+Math.imul(v,el)|0,i=(i=i+Math.imul(v,eu)|0)+Math.imul(b,el)|0,o=o+Math.imul(b,eu)|0,r=r+Math.imul(p,ed)|0,i=(i=i+Math.imul(p,ef)|0)+Math.imul(m,ed)|0,o=o+Math.imul(m,ef)|0;var ek=(u+(r=r+Math.imul(d,ep)|0)|0)+((8191&(i=(i=i+Math.imul(d,em)|0)+Math.imul(f,ep)|0))<<13)|0;u=((o=o+Math.imul(f,em)|0)+(i>>>13)|0)+(ek>>>26)|0,ek&=67108863,r=Math.imul(j,H),i=(i=Math.imul(j,V))+Math.imul(F,H)|0,o=Math.imul(F,V),r=r+Math.imul(N,W)|0,i=(i=i+Math.imul(N,Y)|0)+Math.imul(D,W)|0,o=o+Math.imul(D,Y)|0,r=r+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,Z)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,Z)|0,r=r+Math.imul(R,X)|0,i=(i=i+Math.imul(R,ee)|0)+Math.imul(I,X)|0,o=o+Math.imul(I,ee)|0,r=r+Math.imul(M,en)|0,i=(i=i+Math.imul(M,er)|0)+Math.imul(C,en)|0,o=o+Math.imul(C,er)|0,r=r+Math.imul(E,eo)|0,i=(i=i+Math.imul(E,ea)|0)+Math.imul(S,eo)|0,o=o+Math.imul(S,ea)|0,r=r+Math.imul(A,el)|0,i=(i=i+Math.imul(A,eu)|0)+Math.imul(w,el)|0,o=o+Math.imul(w,eu)|0,r=r+Math.imul(v,ed)|0,i=(i=i+Math.imul(v,ef)|0)+Math.imul(b,ed)|0,o=o+Math.imul(b,ef)|0;var eM=(u+(r=r+Math.imul(p,ep)|0)|0)+((8191&(i=(i=i+Math.imul(p,em)|0)+Math.imul(m,ep)|0))<<13)|0;u=((o=o+Math.imul(m,em)|0)+(i>>>13)|0)+(eM>>>26)|0,eM&=67108863,r=Math.imul(j,W),i=(i=Math.imul(j,Y))+Math.imul(F,W)|0,o=Math.imul(F,Y),r=r+Math.imul(N,Q)|0,i=(i=i+Math.imul(N,Z)|0)+Math.imul(D,Q)|0,o=o+Math.imul(D,Z)|0,r=r+Math.imul(O,X)|0,i=(i=i+Math.imul(O,ee)|0)+Math.imul(P,X)|0,o=o+Math.imul(P,ee)|0,r=r+Math.imul(R,en)|0,i=(i=i+Math.imul(R,er)|0)+Math.imul(I,en)|0,o=o+Math.imul(I,er)|0,r=r+Math.imul(M,eo)|0,i=(i=i+Math.imul(M,ea)|0)+Math.imul(C,eo)|0,o=o+Math.imul(C,ea)|0,r=r+Math.imul(E,el)|0,i=(i=i+Math.imul(E,eu)|0)+Math.imul(S,el)|0,o=o+Math.imul(S,eu)|0,r=r+Math.imul(A,ed)|0,i=(i=i+Math.imul(A,ef)|0)+Math.imul(w,ed)|0,o=o+Math.imul(w,ef)|0;var eC=(u+(r=r+Math.imul(v,ep)|0)|0)+((8191&(i=(i=i+Math.imul(v,em)|0)+Math.imul(b,ep)|0))<<13)|0;u=((o=o+Math.imul(b,em)|0)+(i>>>13)|0)+(eC>>>26)|0,eC&=67108863,r=Math.imul(j,Q),i=(i=Math.imul(j,Z))+Math.imul(F,Q)|0,o=Math.imul(F,Z),r=r+Math.imul(N,X)|0,i=(i=i+Math.imul(N,ee)|0)+Math.imul(D,X)|0,o=o+Math.imul(D,ee)|0,r=r+Math.imul(O,en)|0,i=(i=i+Math.imul(O,er)|0)+Math.imul(P,en)|0,o=o+Math.imul(P,er)|0,r=r+Math.imul(R,eo)|0,i=(i=i+Math.imul(R,ea)|0)+Math.imul(I,eo)|0,o=o+Math.imul(I,ea)|0,r=r+Math.imul(M,el)|0,i=(i=i+Math.imul(M,eu)|0)+Math.imul(C,el)|0,o=o+Math.imul(C,eu)|0,r=r+Math.imul(E,ed)|0,i=(i=i+Math.imul(E,ef)|0)+Math.imul(S,ed)|0,o=o+Math.imul(S,ef)|0;var ex=(u+(r=r+Math.imul(A,ep)|0)|0)+((8191&(i=(i=i+Math.imul(A,em)|0)+Math.imul(w,ep)|0))<<13)|0;u=((o=o+Math.imul(w,em)|0)+(i>>>13)|0)+(ex>>>26)|0,ex&=67108863,r=Math.imul(j,X),i=(i=Math.imul(j,ee))+Math.imul(F,X)|0,o=Math.imul(F,ee),r=r+Math.imul(N,en)|0,i=(i=i+Math.imul(N,er)|0)+Math.imul(D,en)|0,o=o+Math.imul(D,er)|0,r=r+Math.imul(O,eo)|0,i=(i=i+Math.imul(O,ea)|0)+Math.imul(P,eo)|0,o=o+Math.imul(P,ea)|0,r=r+Math.imul(R,el)|0,i=(i=i+Math.imul(R,eu)|0)+Math.imul(I,el)|0,o=o+Math.imul(I,eu)|0,r=r+Math.imul(M,ed)|0,i=(i=i+Math.imul(M,ef)|0)+Math.imul(C,ed)|0,o=o+Math.imul(C,ef)|0;var eR=(u+(r=r+Math.imul(E,ep)|0)|0)+((8191&(i=(i=i+Math.imul(E,em)|0)+Math.imul(S,ep)|0))<<13)|0;u=((o=o+Math.imul(S,em)|0)+(i>>>13)|0)+(eR>>>26)|0,eR&=67108863,r=Math.imul(j,en),i=(i=Math.imul(j,er))+Math.imul(F,en)|0,o=Math.imul(F,er),r=r+Math.imul(N,eo)|0,i=(i=i+Math.imul(N,ea)|0)+Math.imul(D,eo)|0,o=o+Math.imul(D,ea)|0,r=r+Math.imul(O,el)|0,i=(i=i+Math.imul(O,eu)|0)+Math.imul(P,el)|0,o=o+Math.imul(P,eu)|0,r=r+Math.imul(R,ed)|0,i=(i=i+Math.imul(R,ef)|0)+Math.imul(I,ed)|0,o=o+Math.imul(I,ef)|0;var eI=(u+(r=r+Math.imul(M,ep)|0)|0)+((8191&(i=(i=i+Math.imul(M,em)|0)+Math.imul(C,ep)|0))<<13)|0;u=((o=o+Math.imul(C,em)|0)+(i>>>13)|0)+(eI>>>26)|0,eI&=67108863,r=Math.imul(j,eo),i=(i=Math.imul(j,ea))+Math.imul(F,eo)|0,o=Math.imul(F,ea),r=r+Math.imul(N,el)|0,i=(i=i+Math.imul(N,eu)|0)+Math.imul(D,el)|0,o=o+Math.imul(D,eu)|0,r=r+Math.imul(O,ed)|0,i=(i=i+Math.imul(O,ef)|0)+Math.imul(P,ed)|0,o=o+Math.imul(P,ef)|0;var eT=(u+(r=r+Math.imul(R,ep)|0)|0)+((8191&(i=(i=i+Math.imul(R,em)|0)+Math.imul(I,ep)|0))<<13)|0;u=((o=o+Math.imul(I,em)|0)+(i>>>13)|0)+(eT>>>26)|0,eT&=67108863,r=Math.imul(j,el),i=(i=Math.imul(j,eu))+Math.imul(F,el)|0,o=Math.imul(F,eu),r=r+Math.imul(N,ed)|0,i=(i=i+Math.imul(N,ef)|0)+Math.imul(D,ed)|0,o=o+Math.imul(D,ef)|0;var eO=(u+(r=r+Math.imul(O,ep)|0)|0)+((8191&(i=(i=i+Math.imul(O,em)|0)+Math.imul(P,ep)|0))<<13)|0;u=((o=o+Math.imul(P,em)|0)+(i>>>13)|0)+(eO>>>26)|0,eO&=67108863,r=Math.imul(j,ed),i=(i=Math.imul(j,ef))+Math.imul(F,ed)|0,o=Math.imul(F,ef);var eP=(u+(r=r+Math.imul(N,ep)|0)|0)+((8191&(i=(i=i+Math.imul(N,em)|0)+Math.imul(D,ep)|0))<<13)|0;u=((o=o+Math.imul(D,em)|0)+(i>>>13)|0)+(eP>>>26)|0,eP&=67108863;var eL=(u+(r=Math.imul(j,ep))|0)+((8191&(i=(i=Math.imul(j,em))+Math.imul(F,ep)|0))<<13)|0;return u=((o=Math.imul(F,em))+(i>>>13)|0)+(eL>>>26)|0,eL&=67108863,l[0]=eg,l[1]=ev,l[2]=eb,l[3]=ey,l[4]=eA,l[5]=ew,l[6]=e_,l[7]=eE,l[8]=eS,l[9]=ek,l[10]=eM,l[11]=eC,l[12]=ex,l[13]=eR,l[14]=eI,l[15]=eT,l[16]=eO,l[17]=eP,l[18]=eL,0!==u&&(l[19]=u,n.length++),n};function p(e,t,n){return(new m).mulp(e,t,n)}function m(e,t){this.x=e,this.y=t}Math.imul||(h=f),i.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?h(this,e,t):n<63?f(this,e,t):n<1024?function(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,e,t):p(this,e,t)},m.prototype.makeRBT=function(e){for(var t=Array(e),n=i.prototype._countBits(e)-1,r=0;r>=1;return r},m.prototype.permute=function(e,t,n,r,i,o){for(var a=0;a>>=1)i++;return 1<>>=13,r[2*a+1]=8191&o,o>>>=13;for(a=2*t;a>=26,t+=(i/67108864|0)+(o>>>26),this.words[r]=67108863&o}return 0!==t&&(this.words[r]=t,this.length++),this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=function(e){for(var t=Array(e.bitLength()),n=0;n>>i}return t}(e);if(0===t.length)return new i(1);for(var n=this,r=0;r=0);var t,r=e%26,i=(e-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(t=0;t>>26-r}a&&(this.words[t]=a,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var i,o=e%26,a=Math.min((e-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,l=0;l=0&&(0!==u||l>=i);l--){var c=0|this.words[l];this.words[l]=u<<26-o|c>>>o,u=c&s}return r&&0!==u&&(r.words[r.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;return!(this.length<=r)&&!!(this.words[r]&1<=0);var t=e%26,r=(e-t)/26;return(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)?this:(0!==t&&r++,this.length=Math.min(r,this.length),0!==t&&(this.words[this.length-1]&=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(l/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===s)return this.strip();for(n(-1===s),s=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},i.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),o=e,a=0|o.words[o.length-1];0!=(n=26-this._countBits(a))&&(o=o.ushln(n),r.iushln(n),a=0|o.words[o.length-1]);var s,l=r.length-o.length;if("mod"!==t){(s=new i(null)).length=l+1,s.words=Array(s.length);for(var u=0;u=0;d--){var f=67108864*(0|r.words[o.length+d])+(0|r.words[o.length+d-1]);for(f=Math.min(f/a|0,67108863),r._ishlnsubmul(o,f,d);0!==r.negative;)f--,r.negative=0,r._ishlnsubmul(o,1,d),r.isZero()||(r.negative^=1);s&&(s.words[d]=f)}return s&&s.strip(),r.strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(e,t,r){var o,a,s;return n(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(o=s.div.neg()),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(e)),{div:o,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||0>this.cmp(e)?{div:new i(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new i(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modn(e.words[0]))}:this._wordDiv(e,t)},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modn=function(e){n(e<=67108863);for(var t=67108864%e,r=0,i=this.length-1;i>=0;i--)r=(t*r+(0|this.words[i]))%e;return r},i.prototype.idivn=function(e){n(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*t;this.words[r]=i/e|0,t=i%e}return this.strip()},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o=new i(1),a=new i(0),s=new i(0),l=new i(1),u=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++u;for(var c=r.clone(),d=t.clone();!t.isZero();){for(var f=0,h=1;0==(t.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(t.iushrn(f);f-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(c),a.isub(d)),o.iushrn(1),a.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||l.isOdd())&&(s.iadd(c),l.isub(d)),s.iushrn(1),l.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(s),a.isub(l)):(r.isub(t),s.isub(o),l.isub(a))}return{a:s,b:l,gcd:r.iushln(u)}},i.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o,a=new i(1),s=new i(0),l=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,c=1;0==(t.words[0]&c)&&u<26;++u,c<<=1);if(u>0)for(t.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(l),a.iushrn(1);for(var d=0,f=1;0==(r.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(r.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(l),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(s)):(r.isub(t),s.isub(a))}return 0>(o=0===t.cmpn(1)?a:s).cmpn(0)&&o.iadd(e),o},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return -1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){ri&&(t=1);break}}return t},i.prototype.gtn=function(e){return 1===this.cmpn(e)},i.prototype.gt=function(e){return 1===this.cmp(e)},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return -1===this.cmpn(e)},i.prototype.lt=function(e){return -1===this.cmp(e)},i.prototype.lten=function(e){return 0>=this.cmpn(e)},i.prototype.lte=function(e){return 0>=this.cmp(e)},i.prototype.eqn=function(e){return 0===this.cmpn(e)},i.prototype.eq=function(e){return 0===this.cmp(e)},i.red=function(e){return new _(e)},i.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var g={k256:null,p224:null,p192:null,p25519:null};function v(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function y(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function A(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function w(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function _(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function E(e){_.call(this,e),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)}v.prototype._tmp=function(){var e=new i(null);return e.words=Array(Math.ceil(this.n/13)),e},v.prototype.ireduce=function(e){var t,n=e;do this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength();while(t>this.n);var r=t0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},v.prototype.split=function(e,t){e.iushrn(this.n,0,t)},v.prototype.imulK=function(e){return e.imul(this.k)},r(b,v),b.prototype.split=function(e,t){for(var n=Math.min(e.length,9),r=0;r>>22,i=o}i>>>=22,e.words[r-10]=i,0===i&&e.length>10?e.length-=10:e.length-=9},b.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){var t;if(g[e])return g[e];if("k256"===e)t=new b;else if("p224"===e)t=new y;else if("p192"===e)t=new A;else{if("p25519"!==e)throw Error("Unknown prime "+e);t=new w}return g[e]=t,t},_.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},_.prototype._verify2=function(e,t){n(0==(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},_.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},_.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},_.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},_.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},_.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return 0>n.cmpn(0)&&n.iadd(this.m),n._forceRed(this)},_.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return 0>n.cmpn(0)&&n.iadd(this.m),n},_.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},_.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},_.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},_.prototype.isqr=function(e){return this.imul(e,e.clone())},_.prototype.sqr=function(e){return this.mul(e,e)},_.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new i(1)).iushrn(2);return this.pow(e,r)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);n(!o.isZero());var s=new i(1).toRed(this),l=s.redNeg(),u=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new i(2*c*c).toRed(this);0!==this.pow(c,u).cmp(l);)c.redIAdd(l);for(var d=this.pow(c,o),f=this.pow(e,o.addn(1).iushrn(1)),h=this.pow(e,o),p=a;0!==h.cmp(s);){for(var m=h,g=0;0!==m.cmp(s);g++)m=m.redSqr();n(g=0;r--){for(var u=t.words[r],c=l-1;c>=0;c--){var d=u>>c&1;o!==n[0]&&(o=this.sqr(o)),0!==d||0!==a?(a<<=1,a|=d,(4==++s||0===r&&0===c)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}l=26}return o},_.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},_.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new E(e)},r(E,_),E.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},E.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},E.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):0>i.cmpn(0)&&(o=i.iadd(this.m)),o._forceRed(this)},E.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(r).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):0>o.cmpn(0)&&(a=o.iadd(this.m)),a._forceRed(this)},E.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(op,l);var om,og,ov,ob,oy,oA=op.exports,ow={exports:{}};function o_(){if(om)return ow.exports;function e(e){this.rand=e}if(om=1,ow.exports=function(n){return t||(t=new e(null)),t.generate(n)},ow.exports.Rand=e,e.prototype.generate=function(e){return this._rand(e)},e.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),n=0;n=0);return n},t.prototype._randrange=function(e,t){var n=t.sub(e);return e.add(this._randbelow(n))},t.prototype.test=function(e,t,n){var r=e.bitLength(),i=oA.mont(e),o=new oA(1).toRed(i);t||(t=Math.max(1,r/48|0));for(var a=e.subn(1),s=0;!a.testn(s);s++);for(var l=e.shrn(s),u=a.toRed(i);t>0;t--){var c=this._randrange(new oA(2),a);n&&n(c);var d=c.toRed(i).redPow(l);if(0!==d.cmp(o)&&0!==d.cmp(u)){for(var f=1;f0;t--){var u=this._randrange(new oA(2),o),c=e.gcd(u);if(0!==c.cmpn(1))return c;var d=u.toRed(r).redPow(s);if(0!==d.cmp(i)&&0!==d.cmp(l)){for(var f=1;fu;)h.ishrn(1);if(h.isEven()&&h.iadd(n),h.testn(1)||h.iadd(r),f.cmp(r)){if(!f.cmp(i))for(;h.mod(o).cmp(a);)h.iadd(l)}else for(;h.mod(e).cmp(s);)h.iadd(l);if(c(p=h.shrn(1))&&c(h)&&d(p)&&d(h)&&t.test(p)&&t.test(h))return h}}return ob}var ok,oM,oC,ox={modp1:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}},oR={exports:{}},oI={exports:{}};!function(e,t){function n(e,t){if(!e)throw Error(t||"Assertion failed")}function r(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function i(e,t,n){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}"object"==typeof e?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;try{c="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:er.Buffer}catch(e){}function o(e,t){var r=e.charCodeAt(t);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+e)}function a(e,t,n){var r=o(e,n);return n-1>=t&&(r|=o(e,n-1)<<4),r}function s(e,t,r,i){for(var o=0,a=0,s=Math.min(e.length,r),l=t;l=49?u-49+10:u>=17?u-17+10:u,n(u>=0&&a0?e:t},i.min=function(e,t){return 0>e.cmp(t)?e:t},i.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)a=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},i.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=Array(this.length);for(var r=0;r=t;r-=2)i=a(e,t,r)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(r=(e.length-t)%2==0?t+1:t;r=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,a=o%r,l=Math.min(o,o-a)+n,u=0,c=n;c1&&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")]=u}catch(e){i.prototype.inspect=u}else i.prototype.inspect=u;function u(){return(this.red?""}var c,d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function p(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],a=i*o,s=67108863&a,l=a/67108864|0;n.words[0]=s;for(var u=1;u>>26,d=67108863&l,f=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=f;h++){var p=u-h|0;c+=(a=(i=0|e.words[p])*(o=0|t.words[h])+d)/67108864|0,d=67108863&a}n.words[u]=0|d,l=0|c}return 0!==l?n.words[u]=0|l:n.length--,n._strip()}i.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var i=0,o=0,a=0;a>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),r=0!==o||a!==this.length-1?d[6-l.length]+l+r:l+r}for(0!==o&&(r=o.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var u=f[e],c=h[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modrn(c).toString(e);r=(p=p.idivn(c)).isZero()?m+r:d[u-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16,2)},c&&(i.prototype.toBuffer=function(e,t){return this.toArrayLike(c,e,t)}),i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},i.prototype.toArrayLike=function(e,t,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var a=e.allocUnsafe?e.allocUnsafe(o):new e(o);return this["_toArrayLike"+("le"===t?"LE":"BE")](a,i),a},i.prototype._toArrayLikeLE=function(e,t){for(var n=0,r=0,i=0,o=0;i>8&255),n>16&255),6===o?(n>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n=0&&(e[n--]=a>>8&255),n>=0&&(e[n--]=a>>16&255),6===o?(n>=0&&(e[n--]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n>=0)for(e[n--]=r;n>=0;)e[n--]=0},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;ne.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;re.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,a=0;a>26,this.words[a]=67108863&t;for(;0!==o&&a>26,this.words[a]=67108863&t;if(0===o&&a>>13,h=0|a[1],p=8191&h,m=h>>>13,g=0|a[2],v=8191&g,b=g>>>13,y=0|a[3],A=8191&y,w=y>>>13,_=0|a[4],E=8191&_,S=_>>>13,k=0|a[5],M=8191&k,C=k>>>13,x=0|a[6],R=8191&x,I=x>>>13,T=0|a[7],O=8191&T,P=T>>>13,L=0|a[8],N=8191&L,D=L>>>13,B=0|a[9],j=8191&B,F=B>>>13,z=0|s[0],U=8191&z,q=z>>>13,K=0|s[1],H=8191&K,V=K>>>13,$=0|s[2],W=8191&$,Y=$>>>13,G=0|s[3],Q=8191&G,Z=G>>>13,J=0|s[4],X=8191&J,ee=J>>>13,et=0|s[5],en=8191&et,er=et>>>13,ei=0|s[6],eo=8191&ei,ea=ei>>>13,es=0|s[7],el=8191&es,eu=es>>>13,ec=0|s[8],ed=8191&ec,ef=ec>>>13,eh=0|s[9],ep=8191&eh,em=eh>>>13;n.negative=e.negative^t.negative,n.length=19;var eg=(u+(r=Math.imul(d,U))|0)+((8191&(i=(i=Math.imul(d,q))+Math.imul(f,U)|0))<<13)|0;u=((o=Math.imul(f,q))+(i>>>13)|0)+(eg>>>26)|0,eg&=67108863,r=Math.imul(p,U),i=(i=Math.imul(p,q))+Math.imul(m,U)|0,o=Math.imul(m,q);var ev=(u+(r=r+Math.imul(d,H)|0)|0)+((8191&(i=(i=i+Math.imul(d,V)|0)+Math.imul(f,H)|0))<<13)|0;u=((o=o+Math.imul(f,V)|0)+(i>>>13)|0)+(ev>>>26)|0,ev&=67108863,r=Math.imul(v,U),i=(i=Math.imul(v,q))+Math.imul(b,U)|0,o=Math.imul(b,q),r=r+Math.imul(p,H)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,H)|0,o=o+Math.imul(m,V)|0;var eb=(u+(r=r+Math.imul(d,W)|0)|0)+((8191&(i=(i=i+Math.imul(d,Y)|0)+Math.imul(f,W)|0))<<13)|0;u=((o=o+Math.imul(f,Y)|0)+(i>>>13)|0)+(eb>>>26)|0,eb&=67108863,r=Math.imul(A,U),i=(i=Math.imul(A,q))+Math.imul(w,U)|0,o=Math.imul(w,q),r=r+Math.imul(v,H)|0,i=(i=i+Math.imul(v,V)|0)+Math.imul(b,H)|0,o=o+Math.imul(b,V)|0,r=r+Math.imul(p,W)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,Y)|0;var ey=(u+(r=r+Math.imul(d,Q)|0)|0)+((8191&(i=(i=i+Math.imul(d,Z)|0)+Math.imul(f,Q)|0))<<13)|0;u=((o=o+Math.imul(f,Z)|0)+(i>>>13)|0)+(ey>>>26)|0,ey&=67108863,r=Math.imul(E,U),i=(i=Math.imul(E,q))+Math.imul(S,U)|0,o=Math.imul(S,q),r=r+Math.imul(A,H)|0,i=(i=i+Math.imul(A,V)|0)+Math.imul(w,H)|0,o=o+Math.imul(w,V)|0,r=r+Math.imul(v,W)|0,i=(i=i+Math.imul(v,Y)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,Y)|0,r=r+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,Z)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,Z)|0;var eA=(u+(r=r+Math.imul(d,X)|0)|0)+((8191&(i=(i=i+Math.imul(d,ee)|0)+Math.imul(f,X)|0))<<13)|0;u=((o=o+Math.imul(f,ee)|0)+(i>>>13)|0)+(eA>>>26)|0,eA&=67108863,r=Math.imul(M,U),i=(i=Math.imul(M,q))+Math.imul(C,U)|0,o=Math.imul(C,q),r=r+Math.imul(E,H)|0,i=(i=i+Math.imul(E,V)|0)+Math.imul(S,H)|0,o=o+Math.imul(S,V)|0,r=r+Math.imul(A,W)|0,i=(i=i+Math.imul(A,Y)|0)+Math.imul(w,W)|0,o=o+Math.imul(w,Y)|0,r=r+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,Z)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,Z)|0,r=r+Math.imul(p,X)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,ee)|0;var ew=(u+(r=r+Math.imul(d,en)|0)|0)+((8191&(i=(i=i+Math.imul(d,er)|0)+Math.imul(f,en)|0))<<13)|0;u=((o=o+Math.imul(f,er)|0)+(i>>>13)|0)+(ew>>>26)|0,ew&=67108863,r=Math.imul(R,U),i=(i=Math.imul(R,q))+Math.imul(I,U)|0,o=Math.imul(I,q),r=r+Math.imul(M,H)|0,i=(i=i+Math.imul(M,V)|0)+Math.imul(C,H)|0,o=o+Math.imul(C,V)|0,r=r+Math.imul(E,W)|0,i=(i=i+Math.imul(E,Y)|0)+Math.imul(S,W)|0,o=o+Math.imul(S,Y)|0,r=r+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,Z)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,Z)|0,r=r+Math.imul(v,X)|0,i=(i=i+Math.imul(v,ee)|0)+Math.imul(b,X)|0,o=o+Math.imul(b,ee)|0,r=r+Math.imul(p,en)|0,i=(i=i+Math.imul(p,er)|0)+Math.imul(m,en)|0,o=o+Math.imul(m,er)|0;var e_=(u+(r=r+Math.imul(d,eo)|0)|0)+((8191&(i=(i=i+Math.imul(d,ea)|0)+Math.imul(f,eo)|0))<<13)|0;u=((o=o+Math.imul(f,ea)|0)+(i>>>13)|0)+(e_>>>26)|0,e_&=67108863,r=Math.imul(O,U),i=(i=Math.imul(O,q))+Math.imul(P,U)|0,o=Math.imul(P,q),r=r+Math.imul(R,H)|0,i=(i=i+Math.imul(R,V)|0)+Math.imul(I,H)|0,o=o+Math.imul(I,V)|0,r=r+Math.imul(M,W)|0,i=(i=i+Math.imul(M,Y)|0)+Math.imul(C,W)|0,o=o+Math.imul(C,Y)|0,r=r+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,Z)|0)+Math.imul(S,Q)|0,o=o+Math.imul(S,Z)|0,r=r+Math.imul(A,X)|0,i=(i=i+Math.imul(A,ee)|0)+Math.imul(w,X)|0,o=o+Math.imul(w,ee)|0,r=r+Math.imul(v,en)|0,i=(i=i+Math.imul(v,er)|0)+Math.imul(b,en)|0,o=o+Math.imul(b,er)|0,r=r+Math.imul(p,eo)|0,i=(i=i+Math.imul(p,ea)|0)+Math.imul(m,eo)|0,o=o+Math.imul(m,ea)|0;var eE=(u+(r=r+Math.imul(d,el)|0)|0)+((8191&(i=(i=i+Math.imul(d,eu)|0)+Math.imul(f,el)|0))<<13)|0;u=((o=o+Math.imul(f,eu)|0)+(i>>>13)|0)+(eE>>>26)|0,eE&=67108863,r=Math.imul(N,U),i=(i=Math.imul(N,q))+Math.imul(D,U)|0,o=Math.imul(D,q),r=r+Math.imul(O,H)|0,i=(i=i+Math.imul(O,V)|0)+Math.imul(P,H)|0,o=o+Math.imul(P,V)|0,r=r+Math.imul(R,W)|0,i=(i=i+Math.imul(R,Y)|0)+Math.imul(I,W)|0,o=o+Math.imul(I,Y)|0,r=r+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,Z)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,Z)|0,r=r+Math.imul(E,X)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(S,X)|0,o=o+Math.imul(S,ee)|0,r=r+Math.imul(A,en)|0,i=(i=i+Math.imul(A,er)|0)+Math.imul(w,en)|0,o=o+Math.imul(w,er)|0,r=r+Math.imul(v,eo)|0,i=(i=i+Math.imul(v,ea)|0)+Math.imul(b,eo)|0,o=o+Math.imul(b,ea)|0,r=r+Math.imul(p,el)|0,i=(i=i+Math.imul(p,eu)|0)+Math.imul(m,el)|0,o=o+Math.imul(m,eu)|0;var eS=(u+(r=r+Math.imul(d,ed)|0)|0)+((8191&(i=(i=i+Math.imul(d,ef)|0)+Math.imul(f,ed)|0))<<13)|0;u=((o=o+Math.imul(f,ef)|0)+(i>>>13)|0)+(eS>>>26)|0,eS&=67108863,r=Math.imul(j,U),i=(i=Math.imul(j,q))+Math.imul(F,U)|0,o=Math.imul(F,q),r=r+Math.imul(N,H)|0,i=(i=i+Math.imul(N,V)|0)+Math.imul(D,H)|0,o=o+Math.imul(D,V)|0,r=r+Math.imul(O,W)|0,i=(i=i+Math.imul(O,Y)|0)+Math.imul(P,W)|0,o=o+Math.imul(P,Y)|0,r=r+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,Z)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,Z)|0,r=r+Math.imul(M,X)|0,i=(i=i+Math.imul(M,ee)|0)+Math.imul(C,X)|0,o=o+Math.imul(C,ee)|0,r=r+Math.imul(E,en)|0,i=(i=i+Math.imul(E,er)|0)+Math.imul(S,en)|0,o=o+Math.imul(S,er)|0,r=r+Math.imul(A,eo)|0,i=(i=i+Math.imul(A,ea)|0)+Math.imul(w,eo)|0,o=o+Math.imul(w,ea)|0,r=r+Math.imul(v,el)|0,i=(i=i+Math.imul(v,eu)|0)+Math.imul(b,el)|0,o=o+Math.imul(b,eu)|0,r=r+Math.imul(p,ed)|0,i=(i=i+Math.imul(p,ef)|0)+Math.imul(m,ed)|0,o=o+Math.imul(m,ef)|0;var ek=(u+(r=r+Math.imul(d,ep)|0)|0)+((8191&(i=(i=i+Math.imul(d,em)|0)+Math.imul(f,ep)|0))<<13)|0;u=((o=o+Math.imul(f,em)|0)+(i>>>13)|0)+(ek>>>26)|0,ek&=67108863,r=Math.imul(j,H),i=(i=Math.imul(j,V))+Math.imul(F,H)|0,o=Math.imul(F,V),r=r+Math.imul(N,W)|0,i=(i=i+Math.imul(N,Y)|0)+Math.imul(D,W)|0,o=o+Math.imul(D,Y)|0,r=r+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,Z)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,Z)|0,r=r+Math.imul(R,X)|0,i=(i=i+Math.imul(R,ee)|0)+Math.imul(I,X)|0,o=o+Math.imul(I,ee)|0,r=r+Math.imul(M,en)|0,i=(i=i+Math.imul(M,er)|0)+Math.imul(C,en)|0,o=o+Math.imul(C,er)|0,r=r+Math.imul(E,eo)|0,i=(i=i+Math.imul(E,ea)|0)+Math.imul(S,eo)|0,o=o+Math.imul(S,ea)|0,r=r+Math.imul(A,el)|0,i=(i=i+Math.imul(A,eu)|0)+Math.imul(w,el)|0,o=o+Math.imul(w,eu)|0,r=r+Math.imul(v,ed)|0,i=(i=i+Math.imul(v,ef)|0)+Math.imul(b,ed)|0,o=o+Math.imul(b,ef)|0;var eM=(u+(r=r+Math.imul(p,ep)|0)|0)+((8191&(i=(i=i+Math.imul(p,em)|0)+Math.imul(m,ep)|0))<<13)|0;u=((o=o+Math.imul(m,em)|0)+(i>>>13)|0)+(eM>>>26)|0,eM&=67108863,r=Math.imul(j,W),i=(i=Math.imul(j,Y))+Math.imul(F,W)|0,o=Math.imul(F,Y),r=r+Math.imul(N,Q)|0,i=(i=i+Math.imul(N,Z)|0)+Math.imul(D,Q)|0,o=o+Math.imul(D,Z)|0,r=r+Math.imul(O,X)|0,i=(i=i+Math.imul(O,ee)|0)+Math.imul(P,X)|0,o=o+Math.imul(P,ee)|0,r=r+Math.imul(R,en)|0,i=(i=i+Math.imul(R,er)|0)+Math.imul(I,en)|0,o=o+Math.imul(I,er)|0,r=r+Math.imul(M,eo)|0,i=(i=i+Math.imul(M,ea)|0)+Math.imul(C,eo)|0,o=o+Math.imul(C,ea)|0,r=r+Math.imul(E,el)|0,i=(i=i+Math.imul(E,eu)|0)+Math.imul(S,el)|0,o=o+Math.imul(S,eu)|0,r=r+Math.imul(A,ed)|0,i=(i=i+Math.imul(A,ef)|0)+Math.imul(w,ed)|0,o=o+Math.imul(w,ef)|0;var eC=(u+(r=r+Math.imul(v,ep)|0)|0)+((8191&(i=(i=i+Math.imul(v,em)|0)+Math.imul(b,ep)|0))<<13)|0;u=((o=o+Math.imul(b,em)|0)+(i>>>13)|0)+(eC>>>26)|0,eC&=67108863,r=Math.imul(j,Q),i=(i=Math.imul(j,Z))+Math.imul(F,Q)|0,o=Math.imul(F,Z),r=r+Math.imul(N,X)|0,i=(i=i+Math.imul(N,ee)|0)+Math.imul(D,X)|0,o=o+Math.imul(D,ee)|0,r=r+Math.imul(O,en)|0,i=(i=i+Math.imul(O,er)|0)+Math.imul(P,en)|0,o=o+Math.imul(P,er)|0,r=r+Math.imul(R,eo)|0,i=(i=i+Math.imul(R,ea)|0)+Math.imul(I,eo)|0,o=o+Math.imul(I,ea)|0,r=r+Math.imul(M,el)|0,i=(i=i+Math.imul(M,eu)|0)+Math.imul(C,el)|0,o=o+Math.imul(C,eu)|0,r=r+Math.imul(E,ed)|0,i=(i=i+Math.imul(E,ef)|0)+Math.imul(S,ed)|0,o=o+Math.imul(S,ef)|0;var ex=(u+(r=r+Math.imul(A,ep)|0)|0)+((8191&(i=(i=i+Math.imul(A,em)|0)+Math.imul(w,ep)|0))<<13)|0;u=((o=o+Math.imul(w,em)|0)+(i>>>13)|0)+(ex>>>26)|0,ex&=67108863,r=Math.imul(j,X),i=(i=Math.imul(j,ee))+Math.imul(F,X)|0,o=Math.imul(F,ee),r=r+Math.imul(N,en)|0,i=(i=i+Math.imul(N,er)|0)+Math.imul(D,en)|0,o=o+Math.imul(D,er)|0,r=r+Math.imul(O,eo)|0,i=(i=i+Math.imul(O,ea)|0)+Math.imul(P,eo)|0,o=o+Math.imul(P,ea)|0,r=r+Math.imul(R,el)|0,i=(i=i+Math.imul(R,eu)|0)+Math.imul(I,el)|0,o=o+Math.imul(I,eu)|0,r=r+Math.imul(M,ed)|0,i=(i=i+Math.imul(M,ef)|0)+Math.imul(C,ed)|0,o=o+Math.imul(C,ef)|0;var eR=(u+(r=r+Math.imul(E,ep)|0)|0)+((8191&(i=(i=i+Math.imul(E,em)|0)+Math.imul(S,ep)|0))<<13)|0;u=((o=o+Math.imul(S,em)|0)+(i>>>13)|0)+(eR>>>26)|0,eR&=67108863,r=Math.imul(j,en),i=(i=Math.imul(j,er))+Math.imul(F,en)|0,o=Math.imul(F,er),r=r+Math.imul(N,eo)|0,i=(i=i+Math.imul(N,ea)|0)+Math.imul(D,eo)|0,o=o+Math.imul(D,ea)|0,r=r+Math.imul(O,el)|0,i=(i=i+Math.imul(O,eu)|0)+Math.imul(P,el)|0,o=o+Math.imul(P,eu)|0,r=r+Math.imul(R,ed)|0,i=(i=i+Math.imul(R,ef)|0)+Math.imul(I,ed)|0,o=o+Math.imul(I,ef)|0;var eI=(u+(r=r+Math.imul(M,ep)|0)|0)+((8191&(i=(i=i+Math.imul(M,em)|0)+Math.imul(C,ep)|0))<<13)|0;u=((o=o+Math.imul(C,em)|0)+(i>>>13)|0)+(eI>>>26)|0,eI&=67108863,r=Math.imul(j,eo),i=(i=Math.imul(j,ea))+Math.imul(F,eo)|0,o=Math.imul(F,ea),r=r+Math.imul(N,el)|0,i=(i=i+Math.imul(N,eu)|0)+Math.imul(D,el)|0,o=o+Math.imul(D,eu)|0,r=r+Math.imul(O,ed)|0,i=(i=i+Math.imul(O,ef)|0)+Math.imul(P,ed)|0,o=o+Math.imul(P,ef)|0;var eT=(u+(r=r+Math.imul(R,ep)|0)|0)+((8191&(i=(i=i+Math.imul(R,em)|0)+Math.imul(I,ep)|0))<<13)|0;u=((o=o+Math.imul(I,em)|0)+(i>>>13)|0)+(eT>>>26)|0,eT&=67108863,r=Math.imul(j,el),i=(i=Math.imul(j,eu))+Math.imul(F,el)|0,o=Math.imul(F,eu),r=r+Math.imul(N,ed)|0,i=(i=i+Math.imul(N,ef)|0)+Math.imul(D,ed)|0,o=o+Math.imul(D,ef)|0;var eO=(u+(r=r+Math.imul(O,ep)|0)|0)+((8191&(i=(i=i+Math.imul(O,em)|0)+Math.imul(P,ep)|0))<<13)|0;u=((o=o+Math.imul(P,em)|0)+(i>>>13)|0)+(eO>>>26)|0,eO&=67108863,r=Math.imul(j,ed),i=(i=Math.imul(j,ef))+Math.imul(F,ed)|0,o=Math.imul(F,ef);var eP=(u+(r=r+Math.imul(N,ep)|0)|0)+((8191&(i=(i=i+Math.imul(N,em)|0)+Math.imul(D,ep)|0))<<13)|0;u=((o=o+Math.imul(D,em)|0)+(i>>>13)|0)+(eP>>>26)|0,eP&=67108863;var eL=(u+(r=Math.imul(j,ep))|0)+((8191&(i=(i=Math.imul(j,em))+Math.imul(F,ep)|0))<<13)|0;return u=((o=Math.imul(F,em))+(i>>>13)|0)+(eL>>>26)|0,eL&=67108863,l[0]=eg,l[1]=ev,l[2]=eb,l[3]=ey,l[4]=eA,l[5]=ew,l[6]=e_,l[7]=eE,l[8]=eS,l[9]=ek,l[10]=eM,l[11]=eC,l[12]=ex,l[13]=eR,l[14]=eI,l[15]=eT,l[16]=eO,l[17]=eP,l[18]=eL,0!==u&&(l[19]=u,n.length++),n};function g(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}Math.imul||(m=p),i.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?m(this,e,t):n<63?p(this,e,t):g(this,e,t)},i.prototype.mul=function(e){var t=new i(null);return t.words=Array(this.length+e.length),this.mulTo(e,t)},i.prototype.mulf=function(e){var t=new i(null);return t.words=Array(this.length+e.length),g(this,e,t)},i.prototype.imul=function(e){return this.clone().mulTo(e,this)},i.prototype.imuln=function(e){var t=e<0;t&&(e=-e),n("number"==typeof e),n(e<67108864);for(var r=0,i=0;i>=26,r+=(o/67108864|0)+(a>>>26),this.words[i]=67108863&a}return 0!==r&&(this.words[i]=r,this.length++),t?this.ineg():this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=function(e){for(var t=Array(e.bitLength()),n=0;n>>i&1}return t}(e);if(0===t.length)return new i(1);for(var n=this,r=0;r=0);var t,r=e%26,i=(e-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(t=0;t>>26-r}a&&(this.words[t]=a,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var i,o=e%26,a=Math.min((e-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,l=0;l=0&&(0!==u||l>=i);l--){var c=0|this.words[l];this.words[l]=u<<26-o|c>>>o,u=c&s}return r&&0!==u&&(r.words[r.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;return!(this.length<=r)&&!!(this.words[r]&1<=0);var t=e%26,r=(e-t)/26;return(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)?this:(0!==t&&r++,this.length=Math.min(r,this.length),0!==t&&(this.words[this.length-1]&=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(l/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),o=e,a=0|o.words[o.length-1];0!=(n=26-this._countBits(a))&&(o=o.ushln(n),r.iushln(n),a=0|o.words[o.length-1]);var s,l=r.length-o.length;if("mod"!==t){(s=new i(null)).length=l+1,s.words=Array(s.length);for(var u=0;u=0;d--){var f=67108864*(0|r.words[o.length+d])+(0|r.words[o.length+d-1]);for(f=Math.min(f/a|0,67108863),r._ishlnsubmul(o,f,d);0!==r.negative;)f--,r.negative=0,r._ishlnsubmul(o,1,d),r.isZero()||(r.negative^=1);s&&(s.words[d]=f)}return s&&s._strip(),r._strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(e,t,r){var o,a,s;return n(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(o=s.div.neg()),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(e)),{div:o,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||0>this.cmp(e)?{div:new i(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new i(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modrn(e.words[0]))}:this._wordDiv(e,t)},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modrn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=67108864%e,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%e;return t?-i:i},i.prototype.modn=function(e){return this.modrn(e)},i.prototype.idivn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/e|0,r=o%e}return this._strip(),t?this.ineg():this},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o=new i(1),a=new i(0),s=new i(0),l=new i(1),u=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++u;for(var c=r.clone(),d=t.clone();!t.isZero();){for(var f=0,h=1;0==(t.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(t.iushrn(f);f-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(c),a.isub(d)),o.iushrn(1),a.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||l.isOdd())&&(s.iadd(c),l.isub(d)),s.iushrn(1),l.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(s),a.isub(l)):(r.isub(t),s.isub(o),l.isub(a))}return{a:s,b:l,gcd:r.iushln(u)}},i.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o,a=new i(1),s=new i(0),l=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,c=1;0==(t.words[0]&c)&&u<26;++u,c<<=1);if(u>0)for(t.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(l),a.iushrn(1);for(var d=0,f=1;0==(r.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(r.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(l),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(s)):(r.isub(t),s.isub(a))}return 0>(o=0===t.cmpn(1)?a:s).cmpn(0)&&o.iadd(e),o},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return -1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){ri&&(t=1);break}}return t},i.prototype.gtn=function(e){return 1===this.cmpn(e)},i.prototype.gt=function(e){return 1===this.cmp(e)},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return -1===this.cmpn(e)},i.prototype.lt=function(e){return -1===this.cmp(e)},i.prototype.lten=function(e){return 0>=this.cmpn(e)},i.prototype.lte=function(e){return 0>=this.cmp(e)},i.prototype.eqn=function(e){return 0===this.cmpn(e)},i.prototype.eq=function(e){return 0===this.cmp(e)},i.red=function(e){return new E(e)},i.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var v={k256:null,p224:null,p192:null,p25519:null};function b(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function A(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function S(e){E.call(this,e),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)}b.prototype._tmp=function(){var e=new i(null);return e.words=Array(Math.ceil(this.n/13)),e},b.prototype.ireduce=function(e){var t,n=e;do this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength();while(t>this.n);var r=t0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},b.prototype.split=function(e,t){e.iushrn(this.n,0,t)},b.prototype.imulK=function(e){return e.imul(this.k)},r(y,b),y.prototype.split=function(e,t){for(var n=Math.min(e.length,9),r=0;r>>22,i=o}i>>>=22,e.words[r-10]=i,0===i&&e.length>10?e.length-=10:e.length-=9},y.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){var t;if(v[e])return v[e];if("k256"===e)t=new y;else if("p224"===e)t=new A;else if("p192"===e)t=new w;else{if("p25519"!==e)throw Error("Unknown prime "+e);t=new _}return v[e]=t,t},E.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},E.prototype._verify2=function(e,t){n(0==(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},E.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(l(e,e.umod(this.m)._forceRed(this)),e)},E.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},E.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},E.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},E.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return 0>n.cmpn(0)&&n.iadd(this.m),n._forceRed(this)},E.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return 0>n.cmpn(0)&&n.iadd(this.m),n},E.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},E.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},E.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},E.prototype.isqr=function(e){return this.imul(e,e.clone())},E.prototype.sqr=function(e){return this.mul(e,e)},E.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new i(1)).iushrn(2);return this.pow(e,r)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);n(!o.isZero());var s=new i(1).toRed(this),l=s.redNeg(),u=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new i(2*c*c).toRed(this);0!==this.pow(c,u).cmp(l);)c.redIAdd(l);for(var d=this.pow(c,o),f=this.pow(e,o.addn(1).iushrn(1)),h=this.pow(e,o),p=a;0!==h.cmp(s);){for(var m=h,g=0;0!==m.cmp(s);g++)m=m.redSqr();n(g=0;r--){for(var u=t.words[r],c=l-1;c>=0;c--){var d=u>>c&1;o!==n[0]&&(o=this.sqr(o)),0!==d||0!==a?(a<<=1,a|=d,(4==++s||0===r&&0===c)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}l=26}return o},E.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},E.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new S(e)},r(S,E),S.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},S.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},S.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):0>i.cmpn(0)&&(o=i.iadd(this.m)),o._forceRed(this)},S.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(r).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):0>o.cmpn(0)&&(a=o.iadd(this.m)),a._forceRed(this)},S.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(oI,l);var oT=oI.exports;function oO(e){var t,n=e.modulus.byteLength();do t=new oT(eL(n));while(t.cmp(e.modulus)>=0||!t.umod(e.prime1)||!t.umod(e.prime2));return t}function oP(e,t){var n,r={blinder:(n=oO(t)).toRed(oT.mont(t.modulus)).redPow(new oT(t.publicExponent)).fromRed(),unblinder:n.invm(t.modulus)},i=t.modulus.byteLength(),o=new oT(e).mul(r.blinder).umod(t.modulus),a=o.toRed(oT.mont(t.prime1)),s=o.toRed(oT.mont(t.prime2)),l=t.coefficient,u=t.prime1,c=t.prime2,d=a.redPow(t.exponent1).fromRed(),f=s.redPow(t.exponent2).fromRed(),h=d.isub(f).imul(l).umod(u).imul(c);return f.iadd(h).imul(r.unblinder).umod(t.modulus).toArrayLike(M,"be",i)}oP.getr=oO;var oL={},oN={version:"6.5.4"},oD={},oB={};(function(e){function t(e){return 1===e.length?"0"+e:e}function n(e){for(var n="",r=0;r>8,a=255&i;o?n.push(o,a):n.push(a)}return n},e.zero2=t,e.toHex=n,e.encode=function(e,t){return"hex"===t?n(e):e}})(oB),oD.assert=im,oD.toArray=oB.toArray,oD.zero2=oB.zero2,oD.toHex=oB.toHex,oD.encode=oB.encode,oD.getNAF=function(e,t,n){var r=Array(Math.max(e.bitLength(),n)+1);r.fill(0);for(var i=1<(i>>1)-1?(i>>1)-l:l,o.isubn(s)):s=0,r[a]=s,o.iushrn(1)}return r},oD.getJSF=function(e,t){var n=[[],[]];e=e.clone(),t=t.clone();for(var r,i=0,o=0;e.cmpn(-i)>0||t.cmpn(-o)>0;){var a,s,l=e.andln(3)+i&3,u=t.andln(3)+o&3;3===l&&(l=-1),3===u&&(u=-1),a=0==(1&l)?0:3!=(r=e.andln(7)+i&7)&&5!==r||2!==u?l:-l,n[0].push(a),s=0==(1&u)?0:3!=(r=t.andln(7)+o&7)&&5!==r||2!==l?u:-u,n[1].push(s),2*i===a+1&&(i=1-i),2*o===s+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return n},oD.cachedProperty=function(e,t,n){var r="_"+t;e.prototype[t]=function(){return void 0!==this[r]?this[r]:this[r]=n.call(this)}},oD.parseBytes=function(e){return"string"==typeof e?oD.toArray(e,"hex"):e},oD.intFromLE=function(e){return new oA(e,"hex","le")};var oj={},oF=oD.getNAF,oz=oD.getJSF,oU=oD.assert;function oq(e,t){this.type=e,this.p=new oA(t.p,16),this.red=t.prime?oA.red(t.prime):oA.mont(this.p),this.zero=new oA(0).toRed(this.red),this.one=new oA(1).toRed(this.red),this.two=new oA(2).toRed(this.red),this.n=t.n&&new oA(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=[,,,,],this._wnafT2=[,,,,],this._wnafT3=[,,,,],this._wnafT4=[,,,,],this._bitLength=this.n?this.n.bitLength():0;var n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function oK(e,t){this.curve=e,this.type=t,this.precomputed=null}oq.prototype.point=function(){throw Error("Not implemented")},oq.prototype.validate=function(){throw Error("Not implemented")},oq.prototype._fixedNafMul=function(e,t){oU(e.precomputed);var n=e._getDoubles(),r=oF(t,1,this._bitLength),i=(1<=o;l--)a=(a<<1)+r[l];s.push(a)}for(var u=this.jpoint(null,null,null),c=this.jpoint(null,null,null),d=i;d>0;d--){for(o=0;o=0;s--){for(var l=0;s>=0&&0===o[s];s--)l++;if(s>=0&&l++,a=a.dblp(l),s<0)break;var u=o[s];oU(0!==u),a="affine"===e.type?u>0?a.mixedAdd(i[u-1>>1]):a.mixedAdd(i[-u-1>>1].neg()):u>0?a.add(i[u-1>>1]):a.add(i[-u-1>>1].neg())}return"affine"===e.type?a.toP():a},oq.prototype._wnafMulAdd=function(e,t,n,r,i){var o,a,s,l=this._wnafT1,u=this._wnafT2,c=this._wnafT3,d=0;for(o=0;o=1;o-=2){var h=o-1,p=o;if(1===l[h]&&1===l[p]){var m=[t[h],null,null,t[p]];0===t[h].y.cmp(t[p].y)?(m[1]=t[h].add(t[p]),m[2]=t[h].toJ().mixedAdd(t[p].neg())):0===t[h].y.cmp(t[p].y.redNeg())?(m[1]=t[h].toJ().mixedAdd(t[p]),m[2]=t[h].add(t[p].neg())):(m[1]=t[h].toJ().mixedAdd(t[p]),m[2]=t[h].toJ().mixedAdd(t[p].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],v=oz(n[h],n[p]);for(d=Math.max(v[0].length,d),c[h]=Array(d),c[p]=Array(d),a=0;a=0;o--){for(var _=0;o>=0;){var E=!0;for(a=0;a=0&&_++,A=A.dblp(_),o<0)break;for(a=0;a0?s=u[a][S-1>>1]:S<0&&(s=u[a][-S-1>>1].neg()),A="affine"===s.type?A.mixedAdd(s):A.add(s))}}for(o=0;o=Math.ceil((e.bitLength()+1)/t.step)},oK.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;ir[0].cmp(r[1])?r[0]:r[1]).toRed(this.red)}if(e.lambda)n=new oA(e.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(t))?n=i[0]:(n=i[1],oH(0===this.g.mul(n).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:n,basis:e.basis?e.basis.map(function(e){return{a:new oA(e.a,16),b:new oA(e.b,16)}}):this._getEndoBasis(n)}}},oV.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:oA.mont(e),n=new oA(2).toRed(t).redInvm(),r=n.redNeg(),i=new oA(3).toRed(t).redNeg().redSqrt().redMul(n);return[r.redAdd(i).fromRed(),r.redSub(i).fromRed()]},oV.prototype._getEndoBasis=function(e){for(var t,n,r,i,o,a,s,l,u,c=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=e,f=this.n.clone(),h=new oA(1),p=new oA(0),m=new oA(0),g=new oA(1),v=0;0!==d.cmpn(0);){var b=f.div(d);l=f.sub(b.mul(d)),u=m.sub(b.mul(h));var y=g.sub(b.mul(p));if(!r&&0>l.cmp(c))t=s.neg(),n=h,r=l.neg(),i=u;else if(r&&2==++v)break;s=l,f=d,d=l,m=h,h=u,g=p,p=y}o=l.neg(),a=u;var A=r.sqr().add(i.sqr());return o.sqr().add(a.sqr()).cmp(A)>=0&&(o=t,a=n),r.negative&&(r=r.neg(),i=i.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:r,b:i},{a:o,b:a}]},oV.prototype._endoSplit=function(e){var t=this.endo.basis,n=t[0],r=t[1],i=r.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=i.mul(n.a),s=o.mul(r.a),l=i.mul(n.b),u=o.mul(r.b);return{k1:e.sub(a).sub(s),k2:l.add(u).neg()}},oV.prototype.pointFromX=function(e,t){(e=new oA(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),r=n.redSqrt();if(0!==r.redSqr().redSub(n).cmp(this.zero))throw Error("invalid point");var i=r.fromRed().isOdd();return(t&&!i||!t&&i)&&(r=r.redNeg()),this.point(e,r)},oV.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,n=e.y,r=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(r).redIAdd(this.b);return 0===n.redSqr().redISub(i).cmpn(0)},oV.prototype._endoWnafMulAdd=function(e,t,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},o$.prototype.isInfinity=function(){return this.inf},o$.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e)||0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var n=t.redSqr().redISub(this.x).redISub(e.x),r=t.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},o$.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,n=this.x.redSqr(),r=e.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(t).redMul(r),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},o$.prototype.getX=function(){return this.x.fromRed()},o$.prototype.getY=function(){return this.y.fromRed()},o$.prototype.mul=function(e){return e=new oA(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},o$.prototype.mulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},o$.prototype.jmulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},o$.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},o$.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,r=function(e){return e.neg()};t.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return t},o$.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},eD(oW,oq.BasePoint),oV.prototype.jpoint=function(e,t,n){return new oW(this,e,t,n)},oW.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),n=this.x.redMul(t),r=this.y.redMul(t).redMul(e);return this.curve.point(n,r)},oW.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},oW.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(t),i=e.x.redMul(n),o=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),s=r.redSub(i),l=o.redSub(a);if(0===s.cmpn(0))return 0!==l.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),c=u.redMul(s),d=r.redMul(u),f=l.redSqr().redIAdd(c).redISub(d).redISub(d),h=l.redMul(d.redISub(f)).redISub(o.redMul(c)),p=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(f,h,p)},oW.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),n=this.x,r=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z),a=n.redSub(r),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),u=l.redMul(a),c=n.redMul(l),d=s.redSqr().redIAdd(u).redISub(c).redISub(c),f=s.redMul(c.redISub(d)).redISub(i.redMul(u)),h=this.z.redMul(a);return this.curve.jpoint(d,f,h)},oW.prototype.dblp=function(e){if(0===e||this.isInfinity())return this;if(!e)return this.dbl();if(this.curve.zeroA||this.curve.threeA){var t,n=this;for(t=0;t=0)return!1;if(n.redIAdd(i),0===this.x.cmp(n))return!0}},oW.prototype.inspect=function(){return this.isInfinity()?"":""},oW.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},eD(oY,oq),oY.prototype.validate=function(e){var t=e.normalize().x,n=t.redSqr(),r=n.redMul(t).redAdd(n.redMul(this.a)).redAdd(t);return 0===r.redSqrt().redSqr().cmp(r)},eD(oG,oq.BasePoint),oY.prototype.decodePoint=function(e,t){return this.point(oD.toArray(e,t),1)},oY.prototype.point=function(e,t){return new oG(this,e,t)},oY.prototype.pointFromJSON=function(e){return oG.fromJSON(this,e)},oG.prototype.precompute=function(){},oG.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},oG.fromJSON=function(e,t){return new oG(e,t[0],t[1]||e.one)},oG.prototype.inspect=function(){return this.isInfinity()?"":""},oG.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},oG.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),n=e.redSub(t),r=e.redMul(t),i=n.redMul(t.redAdd(this.curve.a24.redMul(n)));return this.curve.point(r,i)},oG.prototype.add=function(){throw Error("Not supported on Montgomery curve")},oG.prototype.diffAdd=function(e,t){var n=this.x.redAdd(this.z),r=this.x.redSub(this.z),i=e.x.redAdd(e.z),o=e.x.redSub(e.z).redMul(n),a=i.redMul(r),s=t.z.redMul(o.redAdd(a).redSqr()),l=t.x.redMul(o.redISub(a).redSqr());return this.curve.point(s,l)},oG.prototype.mul=function(e){for(var t=e.clone(),n=this,r=this.curve.point(null,null),i=[];0!==t.cmpn(0);t.iushrn(1))i.push(t.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(n=n.diffAdd(r,this),r=r.dbl()):(r=n.diffAdd(r,this),n=n.dbl());return r},oG.prototype.mulAdd=function(){throw Error("Not supported on Montgomery curve")},oG.prototype.jumlAdd=function(){throw Error("Not supported on Montgomery curve")},oG.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},oG.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},oG.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var oQ=oD.assert;function oZ(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,oq.call(this,"edwards",e),this.a=new oA(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new oA(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new oA(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),oQ(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}function oJ(e,t,n,r,i){oq.BasePoint.call(this,e,"projective"),null===t&&null===n&&null===r?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new oA(t,16),this.y=new oA(n,16),this.z=r?new oA(r,16):this.curve.one,this.t=i&&new oA(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}eD(oZ,oq),oZ.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},oZ.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},oZ.prototype.jpoint=function(e,t,n,r){return this.point(e,t,n,r)},oZ.prototype.pointFromX=function(e,t){(e=new oA(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr(),r=this.c2.redSub(this.a.redMul(n)),i=this.one.redSub(this.c2.redMul(this.d).redMul(n)),o=r.redMul(i.redInvm()),a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw Error("invalid point");var s=a.fromRed().isOdd();return(t&&!s||!t&&s)&&(a=a.redNeg()),this.point(e,a)},oZ.prototype.pointFromY=function(e,t){(e=new oA(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr(),r=n.redSub(this.c2),i=n.redMul(this.d).redMul(this.c2).redSub(this.a),o=r.redMul(i.redInvm());if(0===o.cmp(this.zero)){if(t)throw Error("invalid point");return this.point(this.zero,e)}var a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw Error("invalid point");return a.fromRed().isOdd()!==t&&(a=a.redNeg()),this.point(a,e)},oZ.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),n=e.y.redSqr(),r=t.redMul(this.a).redAdd(n),i=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(n)));return 0===r.cmp(i)},eD(oJ,oq.BasePoint),oZ.prototype.pointFromJSON=function(e){return oJ.fromJSON(this,e)},oZ.prototype.point=function(e,t,n,r){return new oJ(this,e,t,n,r)},oJ.fromJSON=function(e,t){return new oJ(e,t[0],t[1],t[2])},oJ.prototype.inspect=function(){return this.isInfinity()?"":""},oJ.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},oJ.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var r=this.curve._mulA(e),i=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),o=r.redAdd(t),a=o.redSub(n),s=r.redSub(t),l=i.redMul(a),u=o.redMul(s),c=i.redMul(s),d=a.redMul(o);return this.curve.point(l,u,d,c)},oJ.prototype._projDbl=function(){var e,t,n,r,i,o,a=this.x.redAdd(this.y).redSqr(),s=this.x.redSqr(),l=this.y.redSqr();if(this.curve.twisted){var u=(r=this.curve._mulA(s)).redAdd(l);this.zOne?(e=a.redSub(s).redSub(l).redMul(u.redSub(this.curve.two)),t=u.redMul(r.redSub(l)),n=u.redSqr().redSub(u).redSub(u)):(i=this.z.redSqr(),o=u.redSub(i).redISub(i),e=a.redSub(s).redISub(l).redMul(o),t=u.redMul(r.redSub(l)),n=u.redMul(o))}else r=s.redAdd(l),i=this.curve._mulC(this.z).redSqr(),o=r.redSub(i).redSub(i),e=this.curve._mulC(a.redISub(r)).redMul(o),t=this.curve._mulC(r).redMul(s.redISub(l)),n=r.redMul(o);return this.curve.point(e,t,n)},oJ.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},oJ.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),r=this.t.redMul(this.curve.dd).redMul(e.t),i=this.z.redMul(e.z.redAdd(e.z)),o=n.redSub(t),a=i.redSub(r),s=i.redAdd(r),l=n.redAdd(t),u=o.redMul(a),c=s.redMul(l),d=o.redMul(l),f=a.redMul(s);return this.curve.point(u,c,f,d)},oJ.prototype._projAdd=function(e){var t,n,r=this.z.redMul(e.z),i=r.redSqr(),o=this.x.redMul(e.x),a=this.y.redMul(e.y),s=this.curve.d.redMul(o).redMul(a),l=i.redSub(s),u=i.redAdd(s),c=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(o).redISub(a),d=r.redMul(l).redMul(c);return this.curve.twisted?(t=r.redMul(u).redMul(a.redSub(this.curve._mulA(o))),n=l.redMul(u)):(t=r.redMul(u).redMul(a.redSub(o)),n=this.curve._mulC(l).redMul(u)),this.curve.point(d,t,n)},oJ.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},oJ.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},oJ.prototype.mulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!1)},oJ.prototype.jmulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!0)},oJ.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},oJ.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},oJ.prototype.getX=function(){return this.normalize(),this.x.fromRed()},oJ.prototype.getY=function(){return this.normalize(),this.y.fromRed()},oJ.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},oJ.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var n=e.clone(),r=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(r),0===this.x.cmp(t))return!0}},oJ.prototype.toP=oJ.prototype.normalize,oJ.prototype.mixedAdd=oJ.prototype.add,oj.base=oq,oj.short=oV,oj.mont=oY,oj.edwards=oZ;var oX={},o0={},o1={};function o2(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function o3(e){return 1===e.length?"0"+e:e}function o6(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}o1.inherits=eD,o1.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if("string"==typeof e){if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),i=0;i>6|192:((o=e,a=i,55296!=(64512&o.charCodeAt(a))||a<0||a+1>=o.length||56320!=(64512&o.charCodeAt(a+1)))?n[r++]=s>>12|224:(s=65536+((1023&s)<<10)+(1023&e.charCodeAt(++i)),n[r++]=s>>18|240,n[r++]=s>>12&63|128),n[r++]=s>>6&63|128),n[r++]=63&s|128)}}else for(i=0;i>>0;return a},o1.split32=function(e,t){for(var n=Array(4*e.length),r=0,i=0;r>>24,n[i+1]=o>>>16&255,n[i+2]=o>>>8&255,n[i+3]=255&o):(n[i+3]=o>>>24,n[i+2]=o>>>16&255,n[i+1]=o>>>8&255,n[i]=255&o)}return n},o1.rotr32=function(e,t){return e>>>t|e<<32-t},o1.rotl32=function(e,t){return e<>>32-t},o1.sum32=function(e,t){return e+t>>>0},o1.sum32_3=function(e,t,n){return e+t+n>>>0},o1.sum32_4=function(e,t,n,r){return e+t+n+r>>>0},o1.sum32_5=function(e,t,n,r,i){return e+t+n+r+i>>>0},o1.sum64=function(e,t,n,r){var i=e[t],o=r+e[t+1]>>>0;e[t]=(o>>0,e[t+1]=o},o1.sum64_hi=function(e,t,n,r){return(t+r>>>0>>0},o1.sum64_lo=function(e,t,n,r){return t+r>>>0},o1.sum64_4_hi=function(e,t,n,r,i,o,a,s){var l=t;return e+n+i+a+(0+(((l=l+r>>>0)>>0)>>0)>>0},o1.sum64_4_lo=function(e,t,n,r,i,o,a,s){return t+r+o+s>>>0},o1.sum64_5_hi=function(e,t,n,r,i,o,a,s,l,u){var c=t;return e+n+i+a+l+(0+(((c=c+r>>>0)>>0)>>0)>>0)>>0},o1.sum64_5_lo=function(e,t,n,r,i,o,a,s,l,u){return t+r+o+s+u>>>0},o1.rotr64_hi=function(e,t,n){return(t<<32-n|e>>>n)>>>0},o1.rotr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0},o1.shr64_hi=function(e,t,n){return e>>>n},o1.shr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0};var o4={};function o8(){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}o4.BlockHash=o8,o8.prototype.update=function(e,t){if(e=o1.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var n=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-n,e.length),0===this.pending.length&&(this.pending=null),e=o1.join32(e,0,e.length-n,this.endian);for(var r=0;r>>24&255,r[i++]=e>>>16&255,r[i++]=e>>>8&255,r[i++]=255&e}else for(r[i++]=255&e,r[i++]=e>>>8&255,r[i++]=e>>>16&255,r[i++]=e>>>24&255,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,o=8;o>>3},o7.g1_256=function(e){return o9(e,17)^o9(e,19)^e>>>10};var at=o1.rotl32,an=o1.sum32,ar=o1.sum32_5,ai=o7.ft_1,ao=o4.BlockHash,aa=[1518500249,1859775393,2400959708,3395469782];function as(){if(!(this instanceof as))return new as;ao.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=Array(80)}o1.inherits(as,ao),as.blockSize=512,as.outSize=160,as.hmacStrength=80,as.padLength=64,as.prototype._update=function(e,t){for(var n=this.W,r=0;r<16;r++)n[r]=e[t+r];for(;r=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,n,r)}aY.prototype._init=function(e){e.length>this.blockSize&&(e=(new this.Hash).update(e).digest()),im(e.length<=this.blockSize);for(var t=e.length;t=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},aG.prototype.generate=function(e,t,n,r){if(this._reseed>this.reseedInterval)throw Error("Reseed is required");"string"!=typeof t&&(r=n,n=t,t=null),n&&(n=oB.toArray(n,r||"hex"),this._update(n));for(var i=[];i.length"};var aJ=oD.assert;function aX(e,t){if(e instanceof aX)return e;this._importDER(e,t)||(aJ(e.r&&e.s,"Signature without r or s"),this.r=new oA(e.r,16),this.s=new oA(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function a0(){this.place=0}function a1(e,t){var n=e[t.place++];if(!(128&n))return n;var r=15&n;if(0===r||r>4)return!1;for(var i=0,o=0,a=t.place;o>>=0;return!(i<=127)&&(t.place=a,i)}function a2(e){for(var t=0,n=e.length-1;!e[t]&&!(128&e[t+1])&&t>>3);for(e.push(128|n);--n;)e.push(t>>>(n<<3)&255);e.push(t)}}aX.prototype._importDER=function(e,t){e=oD.toArray(e,t);var n=new a0;if(48!==e[n.place++])return!1;var r=a1(e,n);if(!1===r||r+n.place!==e.length||2!==e[n.place++])return!1;var i=a1(e,n);if(!1===i)return!1;var o=e.slice(n.place,i+n.place);if(n.place+=i,2!==e[n.place++])return!1;var a=a1(e,n);if(!1===a||e.length!==a+n.place)return!1;var s=e.slice(n.place,a+n.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}return this.r=new oA(o),this.s=new oA(s),this.recoveryParam=null,!0},aX.prototype.toDER=function(e){var t=this.r.toArray(),n=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&n[0]&&(n=[0].concat(n)),t=a2(t),n=a2(n);!(n[0]||128&n[1]);)n=n.slice(1);var r=[2];a3(r,t.length),(r=r.concat(t)).push(2),a3(r,n.length);var i=r.concat(n),o=[48];return a3(o,i.length),o=o.concat(i),oD.encode(o,e)};var a6=oD.assert,a4=oD.parseBytes,a8=oD.cachedProperty;function a5(e,t){this.eddsa=e,this._secret=a4(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=a4(t.pub)}a5.fromPublic=function(e,t){return t instanceof a5?t:new a5(e,{pub:t})},a5.fromSecret=function(e,t){return t instanceof a5?t:new a5(e,{secret:t})},a5.prototype.secret=function(){return this._secret},a8(a5,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),a8(a5,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),a8(a5,"privBytes",function(){var e=this.eddsa,t=this.hash(),n=e.encodingLength-1,r=t.slice(0,e.encodingLength);return r[0]&=248,r[n]&=127,r[n]|=64,r}),a8(a5,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),a8(a5,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),a8(a5,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),a5.prototype.sign=function(e){return a6(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},a5.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},a5.prototype.getSecret=function(e){return a6(this._secret,"KeyPair is public only"),oD.encode(this.secret(),e)},a5.prototype.getPublic=function(e){return oD.encode(this.pubBytes(),e)};var a7=oD.assert,a9=oD.cachedProperty,se=oD.parseBytes;function st(e,t){this.eddsa=e,"object"!=typeof t&&(t=se(t)),Array.isArray(t)&&(t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),a7(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof oA&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}a9(st,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),a9(st,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),a9(st,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),a9(st,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),st.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},st.prototype.toHex=function(){return oD.encode(this.toBytes(),"hex").toUpperCase()};var sn=oD.assert,sr=oD.parseBytes;function si(e){if(sn("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof si))return new si(e);e=oX[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=o0.sha512}function so(){return sd||(sd=1,oL.version=oN.version,oL.utils=oD,oL.rand=o_(),oL.curve=oj,oL.curves=oX,oL.ec=function(){if(sc)return su;sc=1;var e=o_(),t=oD.assert;function n(e){if(!(this instanceof n))return new n(e);"string"==typeof e&&(t(Object.prototype.hasOwnProperty.call(oX,e),"Unknown curve "+e),e=oX[e]),e instanceof oX.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}return su=n,n.prototype.keyPair=function(e){return new aZ(this,e)},n.prototype.keyFromPrivate=function(e,t){return aZ.fromPrivate(this,e,t)},n.prototype.keyFromPublic=function(e,t){return aZ.fromPublic(this,e,t)},n.prototype.genKeyPair=function(t){t||(t={});for(var n=new aG({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||e(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),i=this.n.sub(new oA(2));;){var o=new oA(n.generate(r));if(!(o.cmp(i)>0))return o.iaddn(1),this.keyFromPrivate(o)}},n.prototype._truncateToN=function(e,t){var n=8*e.byteLength()-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},n.prototype.sign=function(e,t,n,r){"object"==typeof n&&(r=n,n=null),r||(r={}),t=this.keyFromPrivate(t,n),e=this._truncateToN(new oA(e,16));for(var i=this.n.byteLength(),o=t.getPrivate().toArray("be",i),a=e.toArray("be",i),s=new aG({hash:this.hash,entropy:o,nonce:a,pers:r.pers,persEnc:r.persEnc||"utf8"}),l=this.n.sub(new oA(1)),u=0;;u++){var c=r.k?r.k(u):new oA(s.generate(this.n.byteLength()));if(!(0>=(c=this._truncateToN(c,!0)).cmpn(1)||c.cmp(l)>=0)){var d=this.g.mul(c);if(!d.isInfinity()){var f=d.getX(),h=f.umod(this.n);if(0!==h.cmpn(0)){var p=c.invm(this.n).mul(h.mul(t.getPrivate()).iadd(e));if(0!==(p=p.umod(this.n)).cmpn(0)){var m=(d.getY().isOdd()?1:0)|(0!==f.cmp(h)?2:0);return r.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),m^=1),new aX({r:h,s:p,recoveryParam:m})}}}}}},n.prototype.verify=function(e,t,n,r){e=this._truncateToN(new oA(e,16)),n=this.keyFromPublic(n,r);var i=(t=new aX(t,"hex")).r,o=t.s;if(0>i.cmpn(1)||i.cmp(this.n)>=0||0>o.cmpn(1)||o.cmp(this.n)>=0)return!1;var a,s=o.invm(this.n),l=s.mul(e).umod(this.n),u=s.mul(i).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(l,n.getPublic(),u)).isInfinity()&&a.eqXToP(i):!(a=this.g.mulAdd(l,n.getPublic(),u)).isInfinity()&&0===a.getX().umod(this.n).cmp(i)},n.prototype.recoverPubKey=function(e,n,r,i){t((3&r)===r,"The recovery param is more than two bits"),n=new aX(n,i);var o=this.n,a=new oA(e),s=n.r,l=n.s,u=1&r,c=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&c)throw Error("Unable to find sencond key candinate");s=c?this.curve.pointFromX(s.add(this.curve.n),u):this.curve.pointFromX(s,u);var d=n.r.invm(o),f=o.sub(a).mul(d).umod(o),h=l.mul(d).umod(o);return this.g.mulAdd(f,s,h)},n.prototype.getKeyRecoveryParam=function(e,t,n,r){if(null!==(t=new aX(t,r)).recoveryParam)return t.recoveryParam;for(var i,o=0;o<4;o++){try{i=this.recoverPubKey(e,t,o)}catch(e){continue}if(i.eq(n))return o}throw Error("Unable to find valid recovery factor")},su}(),oL.eddsa=si),oL}si.prototype.sign=function(e,t){e=sr(e);var n=this.keyFromSecret(t),r=this.hashInt(n.messagePrefix(),e),i=this.g.mul(r),o=this.encodePoint(i),a=this.hashInt(o,n.pubBytes(),e).mul(n.priv()),s=r.add(a).umod(this.curve.n);return this.makeSignature({R:i,S:s,Rencoded:o})},si.prototype.verify=function(e,t,n){e=sr(e),t=this.makeSignature(t);var r=this.keyFromPublic(n),i=this.hashInt(t.Rencoded(),r.pubBytes(),e),o=this.g.mul(t.S());return t.R().add(r.pub().mul(i)).eq(o)},si.prototype.hashInt=function(){for(var e=this.hash(),t=0;t=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+e)}function a(e,t,n){var r=o(e,n);return n-1>=t&&(r|=o(e,n-1)<<4),r}function s(e,t,r,i){for(var o=0,a=0,s=Math.min(e.length,r),l=t;l=49?u-49+10:u>=17?u-17+10:u,n(u>=0&&a0?e:t},i.min=function(e,t){return 0>e.cmp(t)?e:t},i.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)a=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},i.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=Array(this.length);for(var r=0;r=t;r-=2)i=a(e,t,r)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(r=(e.length-t)%2==0?t+1:t;r=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,a=o%r,l=Math.min(o,o-a)+n,u=0,c=n;c1&&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")]=u}catch(e){i.prototype.inspect=u}else i.prototype.inspect=u;function u(){return(this.red?""}var c,d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function p(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],a=i*o,s=67108863&a,l=a/67108864|0;n.words[0]=s;for(var u=1;u>>26,d=67108863&l,f=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=f;h++){var p=u-h|0;c+=(a=(i=0|e.words[p])*(o=0|t.words[h])+d)/67108864|0,d=67108863&a}n.words[u]=0|d,l=0|c}return 0!==l?n.words[u]=0|l:n.length--,n._strip()}i.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var i=0,o=0,a=0;a>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),r=0!==o||a!==this.length-1?d[6-l.length]+l+r:l+r}for(0!==o&&(r=o.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var u=f[e],c=h[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modrn(c).toString(e);r=(p=p.idivn(c)).isZero()?m+r:d[u-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16,2)},c&&(i.prototype.toBuffer=function(e,t){return this.toArrayLike(c,e,t)}),i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},i.prototype.toArrayLike=function(e,t,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var a=e.allocUnsafe?e.allocUnsafe(o):new e(o);return this["_toArrayLike"+("le"===t?"LE":"BE")](a,i),a},i.prototype._toArrayLikeLE=function(e,t){for(var n=0,r=0,i=0,o=0;i>8&255),n>16&255),6===o?(n>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n=0&&(e[n--]=a>>8&255),n>=0&&(e[n--]=a>>16&255),6===o?(n>=0&&(e[n--]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n>=0)for(e[n--]=r;n>=0;)e[n--]=0},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;ne.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;re.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,a=0;a>26,this.words[a]=67108863&t;for(;0!==o&&a>26,this.words[a]=67108863&t;if(0===o&&a>>13,h=0|a[1],p=8191&h,m=h>>>13,g=0|a[2],v=8191&g,b=g>>>13,y=0|a[3],A=8191&y,w=y>>>13,_=0|a[4],E=8191&_,S=_>>>13,k=0|a[5],M=8191&k,C=k>>>13,x=0|a[6],R=8191&x,I=x>>>13,T=0|a[7],O=8191&T,P=T>>>13,L=0|a[8],N=8191&L,D=L>>>13,B=0|a[9],j=8191&B,F=B>>>13,z=0|s[0],U=8191&z,q=z>>>13,K=0|s[1],H=8191&K,V=K>>>13,$=0|s[2],W=8191&$,Y=$>>>13,G=0|s[3],Q=8191&G,Z=G>>>13,J=0|s[4],X=8191&J,ee=J>>>13,et=0|s[5],en=8191&et,er=et>>>13,ei=0|s[6],eo=8191&ei,ea=ei>>>13,es=0|s[7],el=8191&es,eu=es>>>13,ec=0|s[8],ed=8191&ec,ef=ec>>>13,eh=0|s[9],ep=8191&eh,em=eh>>>13;n.negative=e.negative^t.negative,n.length=19;var eg=(u+(r=Math.imul(d,U))|0)+((8191&(i=(i=Math.imul(d,q))+Math.imul(f,U)|0))<<13)|0;u=((o=Math.imul(f,q))+(i>>>13)|0)+(eg>>>26)|0,eg&=67108863,r=Math.imul(p,U),i=(i=Math.imul(p,q))+Math.imul(m,U)|0,o=Math.imul(m,q);var ev=(u+(r=r+Math.imul(d,H)|0)|0)+((8191&(i=(i=i+Math.imul(d,V)|0)+Math.imul(f,H)|0))<<13)|0;u=((o=o+Math.imul(f,V)|0)+(i>>>13)|0)+(ev>>>26)|0,ev&=67108863,r=Math.imul(v,U),i=(i=Math.imul(v,q))+Math.imul(b,U)|0,o=Math.imul(b,q),r=r+Math.imul(p,H)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,H)|0,o=o+Math.imul(m,V)|0;var eb=(u+(r=r+Math.imul(d,W)|0)|0)+((8191&(i=(i=i+Math.imul(d,Y)|0)+Math.imul(f,W)|0))<<13)|0;u=((o=o+Math.imul(f,Y)|0)+(i>>>13)|0)+(eb>>>26)|0,eb&=67108863,r=Math.imul(A,U),i=(i=Math.imul(A,q))+Math.imul(w,U)|0,o=Math.imul(w,q),r=r+Math.imul(v,H)|0,i=(i=i+Math.imul(v,V)|0)+Math.imul(b,H)|0,o=o+Math.imul(b,V)|0,r=r+Math.imul(p,W)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,Y)|0;var ey=(u+(r=r+Math.imul(d,Q)|0)|0)+((8191&(i=(i=i+Math.imul(d,Z)|0)+Math.imul(f,Q)|0))<<13)|0;u=((o=o+Math.imul(f,Z)|0)+(i>>>13)|0)+(ey>>>26)|0,ey&=67108863,r=Math.imul(E,U),i=(i=Math.imul(E,q))+Math.imul(S,U)|0,o=Math.imul(S,q),r=r+Math.imul(A,H)|0,i=(i=i+Math.imul(A,V)|0)+Math.imul(w,H)|0,o=o+Math.imul(w,V)|0,r=r+Math.imul(v,W)|0,i=(i=i+Math.imul(v,Y)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,Y)|0,r=r+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,Z)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,Z)|0;var eA=(u+(r=r+Math.imul(d,X)|0)|0)+((8191&(i=(i=i+Math.imul(d,ee)|0)+Math.imul(f,X)|0))<<13)|0;u=((o=o+Math.imul(f,ee)|0)+(i>>>13)|0)+(eA>>>26)|0,eA&=67108863,r=Math.imul(M,U),i=(i=Math.imul(M,q))+Math.imul(C,U)|0,o=Math.imul(C,q),r=r+Math.imul(E,H)|0,i=(i=i+Math.imul(E,V)|0)+Math.imul(S,H)|0,o=o+Math.imul(S,V)|0,r=r+Math.imul(A,W)|0,i=(i=i+Math.imul(A,Y)|0)+Math.imul(w,W)|0,o=o+Math.imul(w,Y)|0,r=r+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,Z)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,Z)|0,r=r+Math.imul(p,X)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,ee)|0;var ew=(u+(r=r+Math.imul(d,en)|0)|0)+((8191&(i=(i=i+Math.imul(d,er)|0)+Math.imul(f,en)|0))<<13)|0;u=((o=o+Math.imul(f,er)|0)+(i>>>13)|0)+(ew>>>26)|0,ew&=67108863,r=Math.imul(R,U),i=(i=Math.imul(R,q))+Math.imul(I,U)|0,o=Math.imul(I,q),r=r+Math.imul(M,H)|0,i=(i=i+Math.imul(M,V)|0)+Math.imul(C,H)|0,o=o+Math.imul(C,V)|0,r=r+Math.imul(E,W)|0,i=(i=i+Math.imul(E,Y)|0)+Math.imul(S,W)|0,o=o+Math.imul(S,Y)|0,r=r+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,Z)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,Z)|0,r=r+Math.imul(v,X)|0,i=(i=i+Math.imul(v,ee)|0)+Math.imul(b,X)|0,o=o+Math.imul(b,ee)|0,r=r+Math.imul(p,en)|0,i=(i=i+Math.imul(p,er)|0)+Math.imul(m,en)|0,o=o+Math.imul(m,er)|0;var e_=(u+(r=r+Math.imul(d,eo)|0)|0)+((8191&(i=(i=i+Math.imul(d,ea)|0)+Math.imul(f,eo)|0))<<13)|0;u=((o=o+Math.imul(f,ea)|0)+(i>>>13)|0)+(e_>>>26)|0,e_&=67108863,r=Math.imul(O,U),i=(i=Math.imul(O,q))+Math.imul(P,U)|0,o=Math.imul(P,q),r=r+Math.imul(R,H)|0,i=(i=i+Math.imul(R,V)|0)+Math.imul(I,H)|0,o=o+Math.imul(I,V)|0,r=r+Math.imul(M,W)|0,i=(i=i+Math.imul(M,Y)|0)+Math.imul(C,W)|0,o=o+Math.imul(C,Y)|0,r=r+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,Z)|0)+Math.imul(S,Q)|0,o=o+Math.imul(S,Z)|0,r=r+Math.imul(A,X)|0,i=(i=i+Math.imul(A,ee)|0)+Math.imul(w,X)|0,o=o+Math.imul(w,ee)|0,r=r+Math.imul(v,en)|0,i=(i=i+Math.imul(v,er)|0)+Math.imul(b,en)|0,o=o+Math.imul(b,er)|0,r=r+Math.imul(p,eo)|0,i=(i=i+Math.imul(p,ea)|0)+Math.imul(m,eo)|0,o=o+Math.imul(m,ea)|0;var eE=(u+(r=r+Math.imul(d,el)|0)|0)+((8191&(i=(i=i+Math.imul(d,eu)|0)+Math.imul(f,el)|0))<<13)|0;u=((o=o+Math.imul(f,eu)|0)+(i>>>13)|0)+(eE>>>26)|0,eE&=67108863,r=Math.imul(N,U),i=(i=Math.imul(N,q))+Math.imul(D,U)|0,o=Math.imul(D,q),r=r+Math.imul(O,H)|0,i=(i=i+Math.imul(O,V)|0)+Math.imul(P,H)|0,o=o+Math.imul(P,V)|0,r=r+Math.imul(R,W)|0,i=(i=i+Math.imul(R,Y)|0)+Math.imul(I,W)|0,o=o+Math.imul(I,Y)|0,r=r+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,Z)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,Z)|0,r=r+Math.imul(E,X)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(S,X)|0,o=o+Math.imul(S,ee)|0,r=r+Math.imul(A,en)|0,i=(i=i+Math.imul(A,er)|0)+Math.imul(w,en)|0,o=o+Math.imul(w,er)|0,r=r+Math.imul(v,eo)|0,i=(i=i+Math.imul(v,ea)|0)+Math.imul(b,eo)|0,o=o+Math.imul(b,ea)|0,r=r+Math.imul(p,el)|0,i=(i=i+Math.imul(p,eu)|0)+Math.imul(m,el)|0,o=o+Math.imul(m,eu)|0;var eS=(u+(r=r+Math.imul(d,ed)|0)|0)+((8191&(i=(i=i+Math.imul(d,ef)|0)+Math.imul(f,ed)|0))<<13)|0;u=((o=o+Math.imul(f,ef)|0)+(i>>>13)|0)+(eS>>>26)|0,eS&=67108863,r=Math.imul(j,U),i=(i=Math.imul(j,q))+Math.imul(F,U)|0,o=Math.imul(F,q),r=r+Math.imul(N,H)|0,i=(i=i+Math.imul(N,V)|0)+Math.imul(D,H)|0,o=o+Math.imul(D,V)|0,r=r+Math.imul(O,W)|0,i=(i=i+Math.imul(O,Y)|0)+Math.imul(P,W)|0,o=o+Math.imul(P,Y)|0,r=r+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,Z)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,Z)|0,r=r+Math.imul(M,X)|0,i=(i=i+Math.imul(M,ee)|0)+Math.imul(C,X)|0,o=o+Math.imul(C,ee)|0,r=r+Math.imul(E,en)|0,i=(i=i+Math.imul(E,er)|0)+Math.imul(S,en)|0,o=o+Math.imul(S,er)|0,r=r+Math.imul(A,eo)|0,i=(i=i+Math.imul(A,ea)|0)+Math.imul(w,eo)|0,o=o+Math.imul(w,ea)|0,r=r+Math.imul(v,el)|0,i=(i=i+Math.imul(v,eu)|0)+Math.imul(b,el)|0,o=o+Math.imul(b,eu)|0,r=r+Math.imul(p,ed)|0,i=(i=i+Math.imul(p,ef)|0)+Math.imul(m,ed)|0,o=o+Math.imul(m,ef)|0;var ek=(u+(r=r+Math.imul(d,ep)|0)|0)+((8191&(i=(i=i+Math.imul(d,em)|0)+Math.imul(f,ep)|0))<<13)|0;u=((o=o+Math.imul(f,em)|0)+(i>>>13)|0)+(ek>>>26)|0,ek&=67108863,r=Math.imul(j,H),i=(i=Math.imul(j,V))+Math.imul(F,H)|0,o=Math.imul(F,V),r=r+Math.imul(N,W)|0,i=(i=i+Math.imul(N,Y)|0)+Math.imul(D,W)|0,o=o+Math.imul(D,Y)|0,r=r+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,Z)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,Z)|0,r=r+Math.imul(R,X)|0,i=(i=i+Math.imul(R,ee)|0)+Math.imul(I,X)|0,o=o+Math.imul(I,ee)|0,r=r+Math.imul(M,en)|0,i=(i=i+Math.imul(M,er)|0)+Math.imul(C,en)|0,o=o+Math.imul(C,er)|0,r=r+Math.imul(E,eo)|0,i=(i=i+Math.imul(E,ea)|0)+Math.imul(S,eo)|0,o=o+Math.imul(S,ea)|0,r=r+Math.imul(A,el)|0,i=(i=i+Math.imul(A,eu)|0)+Math.imul(w,el)|0,o=o+Math.imul(w,eu)|0,r=r+Math.imul(v,ed)|0,i=(i=i+Math.imul(v,ef)|0)+Math.imul(b,ed)|0,o=o+Math.imul(b,ef)|0;var eM=(u+(r=r+Math.imul(p,ep)|0)|0)+((8191&(i=(i=i+Math.imul(p,em)|0)+Math.imul(m,ep)|0))<<13)|0;u=((o=o+Math.imul(m,em)|0)+(i>>>13)|0)+(eM>>>26)|0,eM&=67108863,r=Math.imul(j,W),i=(i=Math.imul(j,Y))+Math.imul(F,W)|0,o=Math.imul(F,Y),r=r+Math.imul(N,Q)|0,i=(i=i+Math.imul(N,Z)|0)+Math.imul(D,Q)|0,o=o+Math.imul(D,Z)|0,r=r+Math.imul(O,X)|0,i=(i=i+Math.imul(O,ee)|0)+Math.imul(P,X)|0,o=o+Math.imul(P,ee)|0,r=r+Math.imul(R,en)|0,i=(i=i+Math.imul(R,er)|0)+Math.imul(I,en)|0,o=o+Math.imul(I,er)|0,r=r+Math.imul(M,eo)|0,i=(i=i+Math.imul(M,ea)|0)+Math.imul(C,eo)|0,o=o+Math.imul(C,ea)|0,r=r+Math.imul(E,el)|0,i=(i=i+Math.imul(E,eu)|0)+Math.imul(S,el)|0,o=o+Math.imul(S,eu)|0,r=r+Math.imul(A,ed)|0,i=(i=i+Math.imul(A,ef)|0)+Math.imul(w,ed)|0,o=o+Math.imul(w,ef)|0;var eC=(u+(r=r+Math.imul(v,ep)|0)|0)+((8191&(i=(i=i+Math.imul(v,em)|0)+Math.imul(b,ep)|0))<<13)|0;u=((o=o+Math.imul(b,em)|0)+(i>>>13)|0)+(eC>>>26)|0,eC&=67108863,r=Math.imul(j,Q),i=(i=Math.imul(j,Z))+Math.imul(F,Q)|0,o=Math.imul(F,Z),r=r+Math.imul(N,X)|0,i=(i=i+Math.imul(N,ee)|0)+Math.imul(D,X)|0,o=o+Math.imul(D,ee)|0,r=r+Math.imul(O,en)|0,i=(i=i+Math.imul(O,er)|0)+Math.imul(P,en)|0,o=o+Math.imul(P,er)|0,r=r+Math.imul(R,eo)|0,i=(i=i+Math.imul(R,ea)|0)+Math.imul(I,eo)|0,o=o+Math.imul(I,ea)|0,r=r+Math.imul(M,el)|0,i=(i=i+Math.imul(M,eu)|0)+Math.imul(C,el)|0,o=o+Math.imul(C,eu)|0,r=r+Math.imul(E,ed)|0,i=(i=i+Math.imul(E,ef)|0)+Math.imul(S,ed)|0,o=o+Math.imul(S,ef)|0;var ex=(u+(r=r+Math.imul(A,ep)|0)|0)+((8191&(i=(i=i+Math.imul(A,em)|0)+Math.imul(w,ep)|0))<<13)|0;u=((o=o+Math.imul(w,em)|0)+(i>>>13)|0)+(ex>>>26)|0,ex&=67108863,r=Math.imul(j,X),i=(i=Math.imul(j,ee))+Math.imul(F,X)|0,o=Math.imul(F,ee),r=r+Math.imul(N,en)|0,i=(i=i+Math.imul(N,er)|0)+Math.imul(D,en)|0,o=o+Math.imul(D,er)|0,r=r+Math.imul(O,eo)|0,i=(i=i+Math.imul(O,ea)|0)+Math.imul(P,eo)|0,o=o+Math.imul(P,ea)|0,r=r+Math.imul(R,el)|0,i=(i=i+Math.imul(R,eu)|0)+Math.imul(I,el)|0,o=o+Math.imul(I,eu)|0,r=r+Math.imul(M,ed)|0,i=(i=i+Math.imul(M,ef)|0)+Math.imul(C,ed)|0,o=o+Math.imul(C,ef)|0;var eR=(u+(r=r+Math.imul(E,ep)|0)|0)+((8191&(i=(i=i+Math.imul(E,em)|0)+Math.imul(S,ep)|0))<<13)|0;u=((o=o+Math.imul(S,em)|0)+(i>>>13)|0)+(eR>>>26)|0,eR&=67108863,r=Math.imul(j,en),i=(i=Math.imul(j,er))+Math.imul(F,en)|0,o=Math.imul(F,er),r=r+Math.imul(N,eo)|0,i=(i=i+Math.imul(N,ea)|0)+Math.imul(D,eo)|0,o=o+Math.imul(D,ea)|0,r=r+Math.imul(O,el)|0,i=(i=i+Math.imul(O,eu)|0)+Math.imul(P,el)|0,o=o+Math.imul(P,eu)|0,r=r+Math.imul(R,ed)|0,i=(i=i+Math.imul(R,ef)|0)+Math.imul(I,ed)|0,o=o+Math.imul(I,ef)|0;var eI=(u+(r=r+Math.imul(M,ep)|0)|0)+((8191&(i=(i=i+Math.imul(M,em)|0)+Math.imul(C,ep)|0))<<13)|0;u=((o=o+Math.imul(C,em)|0)+(i>>>13)|0)+(eI>>>26)|0,eI&=67108863,r=Math.imul(j,eo),i=(i=Math.imul(j,ea))+Math.imul(F,eo)|0,o=Math.imul(F,ea),r=r+Math.imul(N,el)|0,i=(i=i+Math.imul(N,eu)|0)+Math.imul(D,el)|0,o=o+Math.imul(D,eu)|0,r=r+Math.imul(O,ed)|0,i=(i=i+Math.imul(O,ef)|0)+Math.imul(P,ed)|0,o=o+Math.imul(P,ef)|0;var eT=(u+(r=r+Math.imul(R,ep)|0)|0)+((8191&(i=(i=i+Math.imul(R,em)|0)+Math.imul(I,ep)|0))<<13)|0;u=((o=o+Math.imul(I,em)|0)+(i>>>13)|0)+(eT>>>26)|0,eT&=67108863,r=Math.imul(j,el),i=(i=Math.imul(j,eu))+Math.imul(F,el)|0,o=Math.imul(F,eu),r=r+Math.imul(N,ed)|0,i=(i=i+Math.imul(N,ef)|0)+Math.imul(D,ed)|0,o=o+Math.imul(D,ef)|0;var eO=(u+(r=r+Math.imul(O,ep)|0)|0)+((8191&(i=(i=i+Math.imul(O,em)|0)+Math.imul(P,ep)|0))<<13)|0;u=((o=o+Math.imul(P,em)|0)+(i>>>13)|0)+(eO>>>26)|0,eO&=67108863,r=Math.imul(j,ed),i=(i=Math.imul(j,ef))+Math.imul(F,ed)|0,o=Math.imul(F,ef);var eP=(u+(r=r+Math.imul(N,ep)|0)|0)+((8191&(i=(i=i+Math.imul(N,em)|0)+Math.imul(D,ep)|0))<<13)|0;u=((o=o+Math.imul(D,em)|0)+(i>>>13)|0)+(eP>>>26)|0,eP&=67108863;var eL=(u+(r=Math.imul(j,ep))|0)+((8191&(i=(i=Math.imul(j,em))+Math.imul(F,ep)|0))<<13)|0;return u=((o=Math.imul(F,em))+(i>>>13)|0)+(eL>>>26)|0,eL&=67108863,l[0]=eg,l[1]=ev,l[2]=eb,l[3]=ey,l[4]=eA,l[5]=ew,l[6]=e_,l[7]=eE,l[8]=eS,l[9]=ek,l[10]=eM,l[11]=eC,l[12]=ex,l[13]=eR,l[14]=eI,l[15]=eT,l[16]=eO,l[17]=eP,l[18]=eL,0!==u&&(l[19]=u,n.length++),n};function g(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}Math.imul||(m=p),i.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?m(this,e,t):n<63?p(this,e,t):g(this,e,t)},i.prototype.mul=function(e){var t=new i(null);return t.words=Array(this.length+e.length),this.mulTo(e,t)},i.prototype.mulf=function(e){var t=new i(null);return t.words=Array(this.length+e.length),g(this,e,t)},i.prototype.imul=function(e){return this.clone().mulTo(e,this)},i.prototype.imuln=function(e){var t=e<0;t&&(e=-e),n("number"==typeof e),n(e<67108864);for(var r=0,i=0;i>=26,r+=(o/67108864|0)+(a>>>26),this.words[i]=67108863&a}return 0!==r&&(this.words[i]=r,this.length++),t?this.ineg():this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=function(e){for(var t=Array(e.bitLength()),n=0;n>>i&1}return t}(e);if(0===t.length)return new i(1);for(var n=this,r=0;r=0);var t,r=e%26,i=(e-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(t=0;t>>26-r}a&&(this.words[t]=a,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var i,o=e%26,a=Math.min((e-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,l=0;l=0&&(0!==u||l>=i);l--){var c=0|this.words[l];this.words[l]=u<<26-o|c>>>o,u=c&s}return r&&0!==u&&(r.words[r.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;return!(this.length<=r)&&!!(this.words[r]&1<=0);var t=e%26,r=(e-t)/26;return(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)?this:(0!==t&&r++,this.length=Math.min(r,this.length),0!==t&&(this.words[this.length-1]&=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(l/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),o=e,a=0|o.words[o.length-1];0!=(n=26-this._countBits(a))&&(o=o.ushln(n),r.iushln(n),a=0|o.words[o.length-1]);var s,l=r.length-o.length;if("mod"!==t){(s=new i(null)).length=l+1,s.words=Array(s.length);for(var u=0;u=0;d--){var f=67108864*(0|r.words[o.length+d])+(0|r.words[o.length+d-1]);for(f=Math.min(f/a|0,67108863),r._ishlnsubmul(o,f,d);0!==r.negative;)f--,r.negative=0,r._ishlnsubmul(o,1,d),r.isZero()||(r.negative^=1);s&&(s.words[d]=f)}return s&&s._strip(),r._strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(e,t,r){var o,a,s;return n(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(o=s.div.neg()),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(e)),{div:o,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||0>this.cmp(e)?{div:new i(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new i(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modrn(e.words[0]))}:this._wordDiv(e,t)},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modrn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=67108864%e,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%e;return t?-i:i},i.prototype.modn=function(e){return this.modrn(e)},i.prototype.idivn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/e|0,r=o%e}return this._strip(),t?this.ineg():this},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o=new i(1),a=new i(0),s=new i(0),l=new i(1),u=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++u;for(var c=r.clone(),d=t.clone();!t.isZero();){for(var f=0,h=1;0==(t.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(t.iushrn(f);f-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(c),a.isub(d)),o.iushrn(1),a.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||l.isOdd())&&(s.iadd(c),l.isub(d)),s.iushrn(1),l.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(s),a.isub(l)):(r.isub(t),s.isub(o),l.isub(a))}return{a:s,b:l,gcd:r.iushln(u)}},i.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o,a=new i(1),s=new i(0),l=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,c=1;0==(t.words[0]&c)&&u<26;++u,c<<=1);if(u>0)for(t.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(l),a.iushrn(1);for(var d=0,f=1;0==(r.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(r.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(l),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(s)):(r.isub(t),s.isub(a))}return 0>(o=0===t.cmpn(1)?a:s).cmpn(0)&&o.iadd(e),o},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return -1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){ri&&(t=1);break}}return t},i.prototype.gtn=function(e){return 1===this.cmpn(e)},i.prototype.gt=function(e){return 1===this.cmp(e)},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return -1===this.cmpn(e)},i.prototype.lt=function(e){return -1===this.cmp(e)},i.prototype.lten=function(e){return 0>=this.cmpn(e)},i.prototype.lte=function(e){return 0>=this.cmp(e)},i.prototype.eqn=function(e){return 0===this.cmpn(e)},i.prototype.eq=function(e){return 0===this.cmp(e)},i.red=function(e){return new E(e)},i.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var v={k256:null,p224:null,p192:null,p25519:null};function b(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function A(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function S(e){E.call(this,e),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)}b.prototype._tmp=function(){var e=new i(null);return e.words=Array(Math.ceil(this.n/13)),e},b.prototype.ireduce=function(e){var t,n=e;do this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength();while(t>this.n);var r=t0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},b.prototype.split=function(e,t){e.iushrn(this.n,0,t)},b.prototype.imulK=function(e){return e.imul(this.k)},r(y,b),y.prototype.split=function(e,t){for(var n=Math.min(e.length,9),r=0;r>>22,i=o}i>>>=22,e.words[r-10]=i,0===i&&e.length>10?e.length-=10:e.length-=9},y.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){var t;if(v[e])return v[e];if("k256"===e)t=new y;else if("p224"===e)t=new A;else if("p192"===e)t=new w;else{if("p25519"!==e)throw Error("Unknown prime "+e);t=new _}return v[e]=t,t},E.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},E.prototype._verify2=function(e,t){n(0==(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},E.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(l(e,e.umod(this.m)._forceRed(this)),e)},E.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},E.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},E.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},E.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return 0>n.cmpn(0)&&n.iadd(this.m),n._forceRed(this)},E.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return 0>n.cmpn(0)&&n.iadd(this.m),n},E.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},E.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},E.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},E.prototype.isqr=function(e){return this.imul(e,e.clone())},E.prototype.sqr=function(e){return this.mul(e,e)},E.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new i(1)).iushrn(2);return this.pow(e,r)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);n(!o.isZero());var s=new i(1).toRed(this),l=s.redNeg(),u=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new i(2*c*c).toRed(this);0!==this.pow(c,u).cmp(l);)c.redIAdd(l);for(var d=this.pow(c,o),f=this.pow(e,o.addn(1).iushrn(1)),h=this.pow(e,o),p=a;0!==h.cmp(s);){for(var m=h,g=0;0!==m.cmp(s);g++)m=m.redSqr();n(g=0;r--){for(var u=t.words[r],c=l-1;c>=0;c--){var d=u>>c&1;o!==n[0]&&(o=this.sqr(o)),0!==d||0!==a?(a<<=1,a|=d,(4==++s||0===r&&0===c)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}l=26}return o},E.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},E.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new S(e)},r(S,E),S.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},S.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},S.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):0>i.cmpn(0)&&(o=i.iadd(this.m)),o._forceRed(this)},S.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(r).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):0>o.cmpn(0)&&(a=o.iadd(this.m)),a._forceRed(this)},S.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(sa,l);var ss,sl,su,sc,sd,sf,sh=sa.exports,sp={},sm={},sg={},sv={},sb=er.Buffer,sy={};for(sf in er)er.hasOwnProperty(sf)&&"SlowBuffer"!==sf&&"Buffer"!==sf&&(sy[sf]=er[sf]);var sA=sy.Buffer={};for(sf in sb)sb.hasOwnProperty(sf)&&"allocUnsafe"!==sf&&"allocUnsafeSlow"!==sf&&(sA[sf]=sb[sf]);if(sy.Buffer.prototype=sb.prototype,sA.from&&sA.from!==Uint8Array.from||(sA.from=function(e,t,n){if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type '+typeof e);if(e&&void 0===e.length)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);return sb(e,t,n)}),sA.alloc||(sA.alloc=function(e,t,n){if("number"!=typeof e)throw TypeError('The "size" argument must be of type number. Received type '+typeof e);if(e<0||e>=2*1073741824)throw RangeError('The value "'+e+'" is invalid for option "size"');var r=sb(e);return t&&0!==t.length?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r}),!sy.kStringMaxLength)try{sy.kStringMaxLength=ex.binding("buffer").kStringMaxLength}catch(e){}sy.constants||(sy.constants={MAX_LENGTH:sy.kMaxLength},sy.kStringMaxLength&&(sy.constants.MAX_STRING_LENGTH=sy.kStringMaxLength));var sw={};function s_(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}function sE(e,t){this.path=e,this.rethrow(t)}sw.Reporter=s_,s_.prototype.isError=function(e){return e instanceof sE},s_.prototype.save=function(){let e=this._reporterState;return{obj:e.obj,pathLen:e.path.length}},s_.prototype.restore=function(e){let t=this._reporterState;t.obj=e.obj,t.path=t.path.slice(0,e.pathLen)},s_.prototype.enterKey=function(e){return this._reporterState.path.push(e)},s_.prototype.exitKey=function(e){let t=this._reporterState;t.path=t.path.slice(0,e-1)},s_.prototype.leaveKey=function(e,t,n){let r=this._reporterState;this.exitKey(e),null!==r.obj&&(r.obj[t]=n)},s_.prototype.path=function(){return this._reporterState.path.join("/")},s_.prototype.enterObject=function(){let e=this._reporterState,t=e.obj;return e.obj={},t},s_.prototype.leaveObject=function(e){let t=this._reporterState,n=t.obj;return t.obj=e,n},s_.prototype.error=function(e){let t;let n=this._reporterState,r=e instanceof sE;if(t=r?e:new sE(n.path.map(function(e){return"["+JSON.stringify(e)+"]"}).join(""),e.message||e,e.stack),!n.options.partial)throw t;return r||n.errors.push(t),t},s_.prototype.wrapResult=function(e){let t=this._reporterState;return t.options.partial?{result:this.isError(e)?null:e,errors:t.errors}:e},eD(sE,Error),sE.prototype.rethrow=function(e){if(this.message=e+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,sE),!this.stack)try{throw Error(this.message)}catch(e){this.stack=e.stack}return this};var sS={};let sk=sw.Reporter,sM=sy.Buffer;function sC(e,t){sk.call(this,t),sM.isBuffer(e)?(this.base=e,this.offset=0,this.length=e.length):this.error("Input not Buffer")}function sx(e,t){if(Array.isArray(e))this.length=0,this.value=e.map(function(e){return sx.isEncoderBuffer(e)||(e=new sx(e,t)),this.length+=e.length,e},this);else if("number"==typeof e){if(!(0<=e&&e<=255))return t.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if("string"==typeof e)this.value=e,this.length=sM.byteLength(e);else{if(!sM.isBuffer(e))return t.error("Unsupported type: "+typeof e);this.value=e,this.length=e.length}}eD(sC,sk),sS.DecoderBuffer=sC,sC.isDecoderBuffer=function(e){return e instanceof sC||"object"==typeof e&&sM.isBuffer(e.base)&&"DecoderBuffer"===e.constructor.name&&"number"==typeof e.offset&&"number"==typeof e.length&&"function"==typeof e.save&&"function"==typeof e.restore&&"function"==typeof e.isEmpty&&"function"==typeof e.readUInt8&&"function"==typeof e.skip&&"function"==typeof e.raw},sC.prototype.save=function(){return{offset:this.offset,reporter:sk.prototype.save.call(this)}},sC.prototype.restore=function(e){let t=new sC(this.base);return t.offset=e.offset,t.length=this.offset,this.offset=e.offset,sk.prototype.restore.call(this,e.reporter),t},sC.prototype.isEmpty=function(){return this.offset===this.length},sC.prototype.readUInt8=function(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||"DecoderBuffer overrun")},sC.prototype.skip=function(e,t){if(!(this.offset+e<=this.length))return this.error(t||"DecoderBuffer overrun");let n=new sC(this.base);return n._reporterState=this._reporterState,n.offset=this.offset,n.length=this.offset+e,this.offset+=e,n},sC.prototype.raw=function(e){return this.base.slice(e?e.offset:this.offset,this.length)},sS.EncoderBuffer=sx,sx.isEncoderBuffer=function(e){return e instanceof sx||"object"==typeof e&&"EncoderBuffer"===e.constructor.name&&"number"==typeof e.length&&"function"==typeof e.join},sx.prototype.join=function(e,t){return e||(e=sM.alloc(this.length)),t||(t=0),0===this.length||(Array.isArray(this.value)?this.value.forEach(function(n){n.join(e,t),t+=n.length}):("number"==typeof this.value?e[t]=this.value:"string"==typeof this.value?e.write(this.value,t):sM.isBuffer(this.value)&&this.value.copy(e,t),t+=this.length)),e};let sR=sw.Reporter,sI=sS.EncoderBuffer,sT=sS.DecoderBuffer,sO=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],sP=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(sO);function sL(e,t,n){let r={};this._baseState=r,r.name=n,r.enc=e,r.parent=t||null,r.children=null,r.tag=null,r.args=null,r.reverseArgs=null,r.choice=null,r.optional=!1,r.any=!1,r.obj=!1,r.use=null,r.useDecoder=null,r.key=null,r.default=null,r.explicit=null,r.implicit=null,r.contains=null,r.parent||(r.children=[],this._wrap())}let sN=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];sL.prototype.clone=function(){let e=this._baseState,t={};sN.forEach(function(n){t[n]=e[n]});let n=new this.constructor(t.parent);return n._baseState=t,n},sL.prototype._wrap=function(){let e=this._baseState;sP.forEach(function(t){this[t]=function(){let n=new this.constructor(this);return e.children.push(n),n[t].apply(n,arguments)}},this)},sL.prototype._init=function(e){let t=this._baseState;im(null===t.parent),e.call(this),t.children=t.children.filter(function(e){return e._baseState.parent===this},this),im.equal(t.children.length,1,"Root node can have only one child")},sL.prototype._useArgs=function(e){let t=this._baseState,n=e.filter(function(e){return e instanceof this.constructor},this);e=e.filter(function(e){return!(e instanceof this.constructor)},this),0!==n.length&&(im(null===t.children),t.children=n,n.forEach(function(e){e._baseState.parent=this},this)),0!==e.length&&(im(null===t.args),t.args=e,t.reverseArgs=e.map(function(e){if("object"!=typeof e||e.constructor!==Object)return e;let t={};return Object.keys(e).forEach(function(n){n==(0|n)&&(n|=0),t[e[n]]=n}),t}))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach(function(e){sL.prototype[e]=function(){throw Error(e+" not implemented for encoding: "+this._baseState.enc)}}),sO.forEach(function(e){sL.prototype[e]=function(){let t=this._baseState,n=Array.prototype.slice.call(arguments);return im(null===t.tag),t.tag=e,this._useArgs(n),this}}),sL.prototype.use=function(e){im(e);let t=this._baseState;return im(null===t.use),t.use=e,this},sL.prototype.optional=function(){return this._baseState.optional=!0,this},sL.prototype.def=function(e){let t=this._baseState;return im(null===t.default),t.default=e,t.optional=!0,this},sL.prototype.explicit=function(e){let t=this._baseState;return im(null===t.explicit&&null===t.implicit),t.explicit=e,this},sL.prototype.implicit=function(e){let t=this._baseState;return im(null===t.explicit&&null===t.implicit),t.implicit=e,this},sL.prototype.obj=function(){let e=this._baseState,t=Array.prototype.slice.call(arguments);return e.obj=!0,0!==t.length&&this._useArgs(t),this},sL.prototype.key=function(e){let t=this._baseState;return im(null===t.key),t.key=e,this},sL.prototype.any=function(){return this._baseState.any=!0,this},sL.prototype.choice=function(e){let t=this._baseState;return im(null===t.choice),t.choice=e,this._useArgs(Object.keys(e).map(function(t){return e[t]})),this},sL.prototype.contains=function(e){let t=this._baseState;return im(null===t.use),t.contains=e,this},sL.prototype._decode=function(e,t){let n=this._baseState;if(null===n.parent)return e.wrapResult(n.children[0]._decode(e,t));let r,i=n.default,o=!0,a=null;if(null!==n.key&&(a=e.enterKey(n.key)),n.optional){let r=null;if(null!==n.explicit?r=n.explicit:null!==n.implicit?r=n.implicit:null!==n.tag&&(r=n.tag),null!==r||n.any){if(o=this._peekTag(e,r,n.any),e.isError(o))return o}else{let r=e.save();try{null===n.choice?this._decodeGeneric(n.tag,e,t):this._decodeChoice(e,t),o=!0}catch(e){o=!1}e.restore(r)}}if(n.obj&&o&&(r=e.enterObject()),o){if(null!==n.explicit){let t=this._decodeTag(e,n.explicit);if(e.isError(t))return t;e=t}let r=e.offset;if(null===n.use&&null===n.choice){let t;n.any&&(t=e.save());let r=this._decodeTag(e,null!==n.implicit?n.implicit:n.tag,n.any);if(e.isError(r))return r;n.any?i=e.raw(t):e=r}if(t&&t.track&&null!==n.tag&&t.track(e.path(),r,e.length,"tagged"),t&&t.track&&null!==n.tag&&t.track(e.path(),e.offset,e.length,"content"),n.any||(i=null===n.choice?this._decodeGeneric(n.tag,e,t):this._decodeChoice(e,t)),e.isError(i))return i;if(n.any||null!==n.choice||null===n.children||n.children.forEach(function(n){n._decode(e,t)}),n.contains&&("octstr"===n.tag||"bitstr"===n.tag)){let r=new sT(i);i=this._getUse(n.contains,e._reporterState.obj)._decode(r,t)}}return n.obj&&o&&(i=e.leaveObject(r)),null===n.key||null===i&&!0!==o?null!==a&&e.exitKey(a):e.leaveKey(a,n.key,i),i},sL.prototype._decodeGeneric=function(e,t,n){let r=this._baseState;return"seq"===e||"set"===e?null:"seqof"===e||"setof"===e?this._decodeList(t,e,r.args[0],n):/str$/.test(e)?this._decodeStr(t,e,n):"objid"===e&&r.args?this._decodeObjid(t,r.args[0],r.args[1],n):"objid"===e?this._decodeObjid(t,null,null,n):"gentime"===e||"utctime"===e?this._decodeTime(t,e,n):"null_"===e?this._decodeNull(t,n):"bool"===e?this._decodeBool(t,n):"objDesc"===e?this._decodeStr(t,e,n):"int"===e||"enum"===e?this._decodeInt(t,r.args&&r.args[0],n):null!==r.use?this._getUse(r.use,t._reporterState.obj)._decode(t,n):t.error("unknown tag: "+e)},sL.prototype._getUse=function(e,t){let n=this._baseState;return n.useDecoder=this._use(e,t),im(null===n.useDecoder._baseState.parent),n.useDecoder=n.useDecoder._baseState.children[0],n.implicit!==n.useDecoder._baseState.implicit&&(n.useDecoder=n.useDecoder.clone(),n.useDecoder._baseState.implicit=n.implicit),n.useDecoder},sL.prototype._decodeChoice=function(e,t){let n=this._baseState,r=null,i=!1;return Object.keys(n.choice).some(function(o){let a=e.save(),s=n.choice[o];try{let n=s._decode(e,t);if(e.isError(n))return!1;r={type:o,value:n},i=!0}catch(t){return e.restore(a),!1}return!0},this),i?r:e.error("Choice not matched")},sL.prototype._createEncoderBuffer=function(e){return new sI(e,this.reporter)},sL.prototype._encode=function(e,t,n){let r=this._baseState;if(null!==r.default&&r.default===e)return;let i=this._encodeValue(e,t,n);return void 0===i||this._skipDefault(i,t,n)?void 0:i},sL.prototype._encodeValue=function(e,t,n){let r=this._baseState;if(null===r.parent)return r.children[0]._encode(e,t||new sR);let i=null;if(this.reporter=t,r.optional&&void 0===e){if(null===r.default)return;e=r.default}let o=null,a=!1;if(r.any)i=this._createEncoderBuffer(e);else if(r.choice)i=this._encodeChoice(e,t);else if(r.contains)o=this._getUse(r.contains,n)._encode(e,t),a=!0;else if(r.children)o=r.children.map(function(n){if("null_"===n._baseState.tag)return n._encode(null,t,e);if(null===n._baseState.key)return t.error("Child should have a key");let r=t.enterKey(n._baseState.key);if("object"!=typeof e)return t.error("Child expected, but input is not object");let i=n._encode(e[n._baseState.key],t,e);return t.leaveKey(r),i},this).filter(function(e){return e}),o=this._createEncoderBuffer(o);else if("seqof"===r.tag||"setof"===r.tag){if(!r.args||1!==r.args.length)return t.error("Too many args for : "+r.tag);if(!Array.isArray(e))return t.error("seqof/setof, but data is not Array");let n=this.clone();n._baseState.implicit=null,o=this._createEncoderBuffer(e.map(function(n){let r=this._baseState;return this._getUse(r.args[0],e)._encode(n,t)},n))}else null!==r.use?i=this._getUse(r.use,n)._encode(e,t):(o=this._encodePrimitive(r.tag,e),a=!0);if(!r.any&&null===r.choice){let e=null!==r.implicit?r.implicit:r.tag,n=null===r.implicit?"universal":"context";null===e?null===r.use&&t.error("Tag could be omitted only for .use()"):null===r.use&&(i=this._encodeComposite(e,a,n,o))}return null!==r.explicit&&(i=this._encodeComposite(r.explicit,!1,"context",i)),i},sL.prototype._encodeChoice=function(e,t){let n=this._baseState,r=n.choice[e.type];return r||im(!1,e.type+" not found in "+JSON.stringify(Object.keys(n.choice))),r._encode(e.value,t)},sL.prototype._encodePrimitive=function(e,t){let n=this._baseState;if(/str$/.test(e))return this._encodeStr(t,e);if("objid"===e&&n.args)return this._encodeObjid(t,n.reverseArgs[0],n.args[1]);if("objid"===e)return this._encodeObjid(t,null,null);if("gentime"===e||"utctime"===e)return this._encodeTime(t,e);if("null_"===e)return this._encodeNull();if("int"===e||"enum"===e)return this._encodeInt(t,n.args&&n.reverseArgs[0]);if("bool"===e)return this._encodeBool(t);if("objDesc"===e)return this._encodeStr(t,e);throw Error("Unsupported tag: "+e)},sL.prototype._isNumstr=function(e){return/^[0-9 ]*$/.test(e)},sL.prototype._isPrintstr=function(e){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(e)};var sD={};!function(e){function t(e){let t={};return Object.keys(e).forEach(function(n){(0|n)==n&&(n|=0),t[e[n]]=n}),t}e.tagClass={0:"universal",1:"application",2:"context",3:"private"},e.tagClassByName=t(e.tagClass),e.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},e.tagByName=t(e.tag)}(sD);let sB=sy.Buffer;function sj(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new sF,this.tree._init(e.body)}function sF(e){sL.call(this,"der",e)}function sz(e){return e<10?"0"+e:e}function sU(e){sj.call(this,e),this.enc="pem"}sj.prototype.encode=function(e,t){return this.tree._encode(e,t).join()},eD(sF,sL),sF.prototype._encodeComposite=function(e,t,n,r){let i=function(e,t,n,r){let i;if("seqof"===e?e="seq":"setof"===e&&(e="set"),sD.tagByName.hasOwnProperty(e))i=sD.tagByName[e];else{if("number"!=typeof e||(0|e)!==e)return r.error("Unknown tag: "+e);i=e}return i>=31?r.error("Multi-octet tag encoding unsupported"):(t||(i|=32),i|sD.tagClassByName[n||"universal"]<<6)}(e,t,n,this.reporter);if(r.length<128){let e=sB.alloc(2);return e[0]=i,e[1]=r.length,this._createEncoderBuffer([e,r])}let o=1;for(let e=r.length;e>=256;e>>=8)o++;let a=sB.alloc(2+o);a[0]=i,a[1]=128|o;for(let e=1+o,t=r.length;t>0;e--,t>>=8)a[e]=255&t;return this._createEncoderBuffer([a,r])},sF.prototype._encodeStr=function(e,t){if("bitstr"===t)return this._createEncoderBuffer([0|e.unused,e.data]);if("bmpstr"===t){let t=sB.alloc(2*e.length);for(let n=0;n=40)return this.reporter.error("Second objid identifier OOB");e.splice(0,2,40*e[0]+e[1])}let r=0;for(let t=0;t=128;n>>=7)r++}let i=sB.alloc(r),o=i.length-1;for(let t=e.length-1;t>=0;t--){let n=e[t];for(i[o--]=127&n;(n>>=7)>0;)i[o--]=128|127&n}return this._createEncoderBuffer(i)},sF.prototype._encodeTime=function(e,t){let n;let r=new Date(e);return"gentime"===t?n=[sz(r.getUTCFullYear()),sz(r.getUTCMonth()+1),sz(r.getUTCDate()),sz(r.getUTCHours()),sz(r.getUTCMinutes()),sz(r.getUTCSeconds()),"Z"].join(""):"utctime"===t?n=[sz(r.getUTCFullYear()%100),sz(r.getUTCMonth()+1),sz(r.getUTCDate()),sz(r.getUTCHours()),sz(r.getUTCMinutes()),sz(r.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+t+" time is not supported yet"),this._encodeStr(n,"octstr")},sF.prototype._encodeNull=function(){return this._createEncoderBuffer("")},sF.prototype._encodeInt=function(e,t){if("string"==typeof e){if(!t)return this.reporter.error("String int or enum given, but no values map");if(!t.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=t[e]}if("number"!=typeof e&&!sB.isBuffer(e)){let t=e.toArray();!e.sign&&128&t[0]&&t.unshift(0),e=sB.from(t)}if(sB.isBuffer(e)){let t=e.length;0===e.length&&t++;let n=sB.alloc(t);return e.copy(n),0===e.length&&(n[0]=0),this._createEncoderBuffer(n)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);let n=1;for(let t=e;t>=256;t>>=8)n++;let r=Array(n);for(let t=r.length-1;t>=0;t--)r[t]=255&e,e>>=8;return 128&r[0]&&r.unshift(0),this._createEncoderBuffer(sB.from(r))},sF.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},sF.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getEncoder("der").tree},sF.prototype._skipDefault=function(e,t,n){let r;let i=this._baseState;if(null===i.default)return!1;let o=e.join();if(void 0===i.defaultBuffer&&(i.defaultBuffer=this._encodeValue(i.default,t,n).join()),o.length!==i.defaultBuffer.length)return!1;for(r=0;r>6],i=0==(32&n);if(31==(31&n)){let r=n;for(n=0;128==(128&r);){if(r=e.readUInt8(t),e.isError(r))return r;n<<=7,n|=127&r}}else n&=31;return{cls:r,primitive:i,tag:n,tagStr:sD.tag[n]}}function sW(e,t,n){let r=e.readUInt8(n);if(e.isError(r))return r;if(!t&&128===r)return null;if(0==(128&r))return r;let i=127&r;if(i>4)return e.error("length octect is too long");r=0;for(let t=0;tn-a-2)throw Error("message too long");var s=lI.alloc(n-r-a-2),l=n-o-1,u=eL(o),c=lC(lI.concat([i,s,lI.alloc(1,1),t],l),lM(u,l)),d=lC(u,lM(c,o));return new oA(lI.concat([lI.alloc(1),d,c],n))}(o,t);else if(1===r)i=function(e,t,n){var r,i=t.length,o=e.modulus.byteLength();if(i>o-11)throw Error("message too long");return r=n?lI.alloc(o-i-3,255):function(e){for(var t,n=lI.allocUnsafe(e),r=0,i=eL(2*e),o=0;r=0)throw Error("data too long for modulus")}return n?oP(i,o):lR(i,o)},lS.privateDecrypt=function(e,t,n){r=e.padding?e.padding:n?1:4;var r,i,o=lm(e),a=o.modulus.byteLength();if(t.length>a||new oA(t).cmp(o.modulus)>=0)throw Error("decryption error");i=n?lR(new oA(t),o):oP(t,o);var s=lT.alloc(a-i.length);if(i=lT.concat([s,i],a),4===r)return function(e,t){var n=e.modulus.byteLength(),r=rU("sha1").update(lT.alloc(0)).digest(),i=r.length;if(0!==t[0])throw Error("decryption error");var o=t.slice(1,i+1),a=t.slice(i+1),s=lC(o,lM(a,i)),l=lC(a,lM(s,n-i-1));if(function(e,t){e=lT.from(e),t=lT.from(t);var n=0,r=e.length;e.length!==t.length&&(n++,r=Math.min(e.length,t.length));for(var i=-1;++i=t.length){o++;break}var a=t.slice(2,i-1);if(("0002"!==r.toString("hex")&&!n||"0001"!==r.toString("hex")&&n)&&o++,a.length<8&&o++,o)throw Error("decryption error");return t.slice(i)}(0,i,n);if(3===r)return i;throw Error("unknown padding")},lS.privateEncrypt=function(e,t){return lS.publicEncrypt(e,t,!0)},lS.publicDecrypt=function(e,t){return lS.privateDecrypt(e,t,!0)};var lO={};function lP(){throw Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}var lL,lN=eT(),lD=lN.Buffer,lB=lN.kMaxLength,lj=l.crypto||l.msCrypto;function lF(e,t){if("number"!=typeof e||e!=e)throw TypeError("offset must be a number");if(e>4294967295||e<0)throw TypeError("offset must be a uint32");if(e>lB||e>t)throw RangeError("offset out of range")}function lz(e,t,n){if("number"!=typeof e||e!=e)throw TypeError("size must be a number");if(e>4294967295||e<0)throw TypeError("size must be a uint32");if(e+t>n||e>lB)throw RangeError("buffer too small")}function lU(e,t,n,r){var i=new Uint8Array(e.buffer,t,n);return lj.getRandomValues(i),r?void ew(function(){r(null,e)}):e}function lq(){if(lL)return ei;lL=1,ei.randomBytes=ei.rng=ei.pseudoRandomBytes=ei.prng=eL,ei.createHash=ei.Hash=rU,ei.createHmac=ei.Hmac=rZ;var e=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(Object.keys(rJ));ei.getHashes=function(){return e},ei.pbkdf2=rX.pbkdf2,ei.pbkdf2Sync=rX.pbkdf2Sync,ei.Cipher=il.Cipher,ei.createCipher=il.createCipher,ei.Cipheriv=il.Cipheriv,ei.createCipheriv=il.createCipheriv,ei.Decipher=il.Decipher,ei.createDecipher=il.createDecipher,ei.Decipheriv=il.Decipheriv,ei.createDecipheriv=il.createDecipheriv,ei.getCiphers=il.getCiphers,ei.listCiphers=il.listCiphers;var t=function(){if(oC)return oh;oC=1;var e=oS(),t=function(){if(oM)return ok;oM=1;var e=new(oE()),t=new oA(24),n=new oA(11),r=new oA(10),i=new oA(3),o=new oA(7),a=oS();function s(e,t){return t=t||"utf8",Z(e)||(e=new M(e,t)),this._pub=new oA(e),this}function l(e,t){return t=t||"utf8",Z(e)||(e=new M(e,t)),this._priv=new oA(e),this}ok=c;var u={};function c(e,t,n){this.setGenerator(t),this.__prime=new oA(e),this._prime=oA.mont(this.__prime),this._primeLen=e.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,n?(this.setPublicKey=s,this.setPrivateKey=l):this._primeCode=8}function d(e,t){var n=new M(e.toArray());return t?n.toString(t):n}return Object.defineProperty(c.prototype,"verifyError",{enumerable:!0,get:function(){return"number"!=typeof this._primeCode&&(this._primeCode=function(s,l){var c=l.toString("hex"),d=[c,s.toString(16)].join("_");if(d in u)return u[d];var f,h=0;if(s.isEven()||!a.simpleSieve||!a.fermatTest(s)||!e.test(s))return h+=1+("02"===c||"05"===c?8:4),u[d]=h,h;switch(e.test(s.shrn(1))||(h+=2),c){case"02":s.mod(t).cmp(n)&&(h+=8);break;case"05":(f=s.mod(r)).cmp(i)&&f.cmp(o)&&(h+=8);break;default:h+=4}return u[d]=h,h}(this.__prime,this.__gen)),this._primeCode}}),c.prototype.generateKeys=function(){return this._priv||(this._priv=new oA(eL(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},c.prototype.computeSecret=function(e){var t=new M((e=(e=new oA(e)).toRed(this._prime)).redPow(this._priv).fromRed().toArray()),n=this.getPrime();if(t.length0&&n.ishrn(r),n}function i(t,n,i){var o,a;do{for(o=e.alloc(0);8*o.length=e.cmpn(0)||e.cmp(t)>=t)throw Error("invalid sig")}return lv=function(r,i,o,a,s){var l,u,c,d,f,h,p,m,g,v,b,y=lm(o);if("ec"===y.type){if("ecdsa"!==a&&"ecdsa/rsa"!==a)throw Error("wrong public key type");return function(e,n,r){var i=lE[r.data.algorithm.curve.join(".")];if(!i)throw Error("unknown curve "+r.data.algorithm.curve.join("."));var o=new t(i),a=r.data.subjectPrivateKey.data;return o.verify(n,e,a)}(r,i,y)}if("dsa"===y.type){if("dsa"!==a)throw Error("wrong public key type");return l=r,u=i,c=y.data.p,d=y.data.q,f=y.data.g,h=y.data.pub_key,m=(p=lm.signature.decode(l,"der")).s,g=p.r,n(m,d),n(g,d),v=sh.mont(c),b=m.invm(d),0===f.toRed(v).redPow(new sh(u).mul(b).mod(d)).fromRed().mul(h.toRed(v).redPow(g.mul(b).mod(d)).fromRed()).mod(c).mod(d).cmp(g)}if("rsa"!==a&&"ecdsa/rsa"!==a)throw Error("wrong public key type");i=e.concat([s,i]);for(var A=y.modulus.byteLength(),w=[1],_=0;i.length+w.length+2{switch(e){case"sha256":case"sha3-256":case"blake2s256":return 32;case"sha512":case"sha3-512":case"blake2b512":return 64;case"sha224":case"sha3-224":return 28;case"sha384":case"sha3-384":return 48;case"sha1":return 20;case"md5":return 16;default:{let t=l$[e];return void 0===t&&(t=lH(e).digest().length,l$[e]=t),t}}},lY=(e,t,n,r)=>{let i=lK.isBuffer(n)?n:lK.from(n);return lV(e,r&&r.length?lK.from(r):lK.alloc(t,0)).update(i).digest()},lG=(e,t,n,r,i)=>{let o=lK.isBuffer(i)?i:lK.from(i||""),a=o.length,s=Math.ceil(r/t);if(s>255)throw Error(`OKM length ${r} is too long for ${e} hash`);let l=lK.alloc(t*s+a+1);for(let r=1,i=0,u=0;r<=s;++r)o.copy(l,u),l[u+a]=r,lV(e,n).update(l.slice(i,u+a+1)).digest().copy(l,u),i=u,u+=t;return l.slice(0,r)};function lQ(e,t,{salt:n="",info:r="",hash:i="SHA-256"}={}){let o=lW(i=i.toLowerCase().replace("-","")),a=lY(i,o,e,n);return lG(i,o,a,t,r)}Object.defineProperties(lQ,{hash_length:{configurable:!1,enumerable:!1,writable:!1,value:lW},extract:{configurable:!1,enumerable:!1,writable:!1,value:lY},expand:{configurable:!1,enumerable:!1,writable:!1,value:lG}});let lZ="Impossible case. Please create issue.",lJ="The tweak was out of range or the resulted private key is invalid",lX="The tweak was out of range or equal to zero",l0="Public Key could not be parsed",l1="Public Key serialization error",l2="Signature could not be parsed";function l3(e,t){if(!e)throw Error(t)}function l6(e,t,n){if(l3(t instanceof Uint8Array,`Expected ${e} to be an Uint8Array`),void 0!==n){if(Array.isArray(n)){let r=`Expected ${e} to be an Uint8Array with length [${n.join(", ")}]`;l3(n.includes(t.length),r)}else{let r=`Expected ${e} to be an Uint8Array with length ${n}`;l3(t.length===n,r)}}}function l4(e){l3("Boolean"===l5(e),"Expected compressed to be a Boolean")}function l8(e=e=>new Uint8Array(e),t){return"function"==typeof e&&(e=e(t)),l6("output",e,t),e}function l5(e){return Object.prototype.toString.call(e).slice(8,-1)}var l7={},l9={},ue={exports:{}};!function(e,t){function n(e,t){if(!e)throw Error(t||"Assertion failed")}function r(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function i(e,t,n){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}"object"==typeof e?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;try{l="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:er.Buffer}catch(e){}function o(e,t){var n=e.charCodeAt(t);return n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:n-48&15}function a(e,t,n){var r=o(e,n);return n-1>=t&&(r|=o(e,n-1)<<4),r}function s(e,t,n,r){for(var i=0,o=Math.min(e.length,n),a=t;a=49?s-49+10:s>=17?s-17+10:s}return i}i.isBN=function(e){return e instanceof i||null!==e&&"object"==typeof e&&e.constructor.wordSize===i.wordSize&&Array.isArray(e.words)},i.max=function(e,t){return e.cmp(t)>0?e:t},i.min=function(e,t){return 0>e.cmp(t)?e:t},i.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)a=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},i.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=Array(this.length);for(var r=0;r=t;r-=2)i=a(e,t,r)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(r=(e.length-t)%2==0?t+1:t;r=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this.strip()},i.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,a=o%r,l=Math.min(o,o-a)+n,u=0,c=n;c1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?""};var l,u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function f(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],a=i*o,s=67108863&a,l=a/67108864|0;n.words[0]=s;for(var u=1;u>>26,d=67108863&l,f=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=f;h++){var p=u-h|0;c+=(a=(i=0|e.words[p])*(o=0|t.words[h])+d)/67108864|0,d=67108863&a}n.words[u]=0|d,l=0|c}return 0!==l?n.words[u]=0|l:n.length--,n.strip()}i.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var i=0,o=0,a=0;a>>24-i&16777215)||a!==this.length-1?u[6-l.length]+l+r:l+r,(i+=2)>=26&&(i-=26,a--)}for(0!==o&&(r=o.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var f=c[e],h=d[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(h).toString(e);r=(p=p.idivn(h)).isZero()?m+r:u[f-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(e,t){return n(void 0!==l),this.toArrayLike(l,e,t)},i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},i.prototype.toArrayLike=function(e,t,r){var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0"),this.strip();var a,s,l=new e(o),u=this.clone();if("le"===t){for(s=0;!u.isZero();s++)a=u.andln(255),u.iushrn(8),l[s]=a;for(;s=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;ne.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;re.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,a=0;a>26,this.words[a]=67108863&t;for(;0!==o&&a>26,this.words[a]=67108863&t;if(0===o&&a>>13,h=0|a[1],p=8191&h,m=h>>>13,g=0|a[2],v=8191&g,b=g>>>13,y=0|a[3],A=8191&y,w=y>>>13,_=0|a[4],E=8191&_,S=_>>>13,k=0|a[5],M=8191&k,C=k>>>13,x=0|a[6],R=8191&x,I=x>>>13,T=0|a[7],O=8191&T,P=T>>>13,L=0|a[8],N=8191&L,D=L>>>13,B=0|a[9],j=8191&B,F=B>>>13,z=0|s[0],U=8191&z,q=z>>>13,K=0|s[1],H=8191&K,V=K>>>13,$=0|s[2],W=8191&$,Y=$>>>13,G=0|s[3],Q=8191&G,Z=G>>>13,J=0|s[4],X=8191&J,ee=J>>>13,et=0|s[5],en=8191&et,er=et>>>13,ei=0|s[6],eo=8191&ei,ea=ei>>>13,es=0|s[7],el=8191&es,eu=es>>>13,ec=0|s[8],ed=8191&ec,ef=ec>>>13,eh=0|s[9],ep=8191&eh,em=eh>>>13;n.negative=e.negative^t.negative,n.length=19;var eg=(u+(r=Math.imul(d,U))|0)+((8191&(i=(i=Math.imul(d,q))+Math.imul(f,U)|0))<<13)|0;u=((o=Math.imul(f,q))+(i>>>13)|0)+(eg>>>26)|0,eg&=67108863,r=Math.imul(p,U),i=(i=Math.imul(p,q))+Math.imul(m,U)|0,o=Math.imul(m,q);var ev=(u+(r=r+Math.imul(d,H)|0)|0)+((8191&(i=(i=i+Math.imul(d,V)|0)+Math.imul(f,H)|0))<<13)|0;u=((o=o+Math.imul(f,V)|0)+(i>>>13)|0)+(ev>>>26)|0,ev&=67108863,r=Math.imul(v,U),i=(i=Math.imul(v,q))+Math.imul(b,U)|0,o=Math.imul(b,q),r=r+Math.imul(p,H)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(m,H)|0,o=o+Math.imul(m,V)|0;var eb=(u+(r=r+Math.imul(d,W)|0)|0)+((8191&(i=(i=i+Math.imul(d,Y)|0)+Math.imul(f,W)|0))<<13)|0;u=((o=o+Math.imul(f,Y)|0)+(i>>>13)|0)+(eb>>>26)|0,eb&=67108863,r=Math.imul(A,U),i=(i=Math.imul(A,q))+Math.imul(w,U)|0,o=Math.imul(w,q),r=r+Math.imul(v,H)|0,i=(i=i+Math.imul(v,V)|0)+Math.imul(b,H)|0,o=o+Math.imul(b,V)|0,r=r+Math.imul(p,W)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,Y)|0;var ey=(u+(r=r+Math.imul(d,Q)|0)|0)+((8191&(i=(i=i+Math.imul(d,Z)|0)+Math.imul(f,Q)|0))<<13)|0;u=((o=o+Math.imul(f,Z)|0)+(i>>>13)|0)+(ey>>>26)|0,ey&=67108863,r=Math.imul(E,U),i=(i=Math.imul(E,q))+Math.imul(S,U)|0,o=Math.imul(S,q),r=r+Math.imul(A,H)|0,i=(i=i+Math.imul(A,V)|0)+Math.imul(w,H)|0,o=o+Math.imul(w,V)|0,r=r+Math.imul(v,W)|0,i=(i=i+Math.imul(v,Y)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,Y)|0,r=r+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,Z)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,Z)|0;var eA=(u+(r=r+Math.imul(d,X)|0)|0)+((8191&(i=(i=i+Math.imul(d,ee)|0)+Math.imul(f,X)|0))<<13)|0;u=((o=o+Math.imul(f,ee)|0)+(i>>>13)|0)+(eA>>>26)|0,eA&=67108863,r=Math.imul(M,U),i=(i=Math.imul(M,q))+Math.imul(C,U)|0,o=Math.imul(C,q),r=r+Math.imul(E,H)|0,i=(i=i+Math.imul(E,V)|0)+Math.imul(S,H)|0,o=o+Math.imul(S,V)|0,r=r+Math.imul(A,W)|0,i=(i=i+Math.imul(A,Y)|0)+Math.imul(w,W)|0,o=o+Math.imul(w,Y)|0,r=r+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,Z)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,Z)|0,r=r+Math.imul(p,X)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,ee)|0;var ew=(u+(r=r+Math.imul(d,en)|0)|0)+((8191&(i=(i=i+Math.imul(d,er)|0)+Math.imul(f,en)|0))<<13)|0;u=((o=o+Math.imul(f,er)|0)+(i>>>13)|0)+(ew>>>26)|0,ew&=67108863,r=Math.imul(R,U),i=(i=Math.imul(R,q))+Math.imul(I,U)|0,o=Math.imul(I,q),r=r+Math.imul(M,H)|0,i=(i=i+Math.imul(M,V)|0)+Math.imul(C,H)|0,o=o+Math.imul(C,V)|0,r=r+Math.imul(E,W)|0,i=(i=i+Math.imul(E,Y)|0)+Math.imul(S,W)|0,o=o+Math.imul(S,Y)|0,r=r+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,Z)|0)+Math.imul(w,Q)|0,o=o+Math.imul(w,Z)|0,r=r+Math.imul(v,X)|0,i=(i=i+Math.imul(v,ee)|0)+Math.imul(b,X)|0,o=o+Math.imul(b,ee)|0,r=r+Math.imul(p,en)|0,i=(i=i+Math.imul(p,er)|0)+Math.imul(m,en)|0,o=o+Math.imul(m,er)|0;var e_=(u+(r=r+Math.imul(d,eo)|0)|0)+((8191&(i=(i=i+Math.imul(d,ea)|0)+Math.imul(f,eo)|0))<<13)|0;u=((o=o+Math.imul(f,ea)|0)+(i>>>13)|0)+(e_>>>26)|0,e_&=67108863,r=Math.imul(O,U),i=(i=Math.imul(O,q))+Math.imul(P,U)|0,o=Math.imul(P,q),r=r+Math.imul(R,H)|0,i=(i=i+Math.imul(R,V)|0)+Math.imul(I,H)|0,o=o+Math.imul(I,V)|0,r=r+Math.imul(M,W)|0,i=(i=i+Math.imul(M,Y)|0)+Math.imul(C,W)|0,o=o+Math.imul(C,Y)|0,r=r+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,Z)|0)+Math.imul(S,Q)|0,o=o+Math.imul(S,Z)|0,r=r+Math.imul(A,X)|0,i=(i=i+Math.imul(A,ee)|0)+Math.imul(w,X)|0,o=o+Math.imul(w,ee)|0,r=r+Math.imul(v,en)|0,i=(i=i+Math.imul(v,er)|0)+Math.imul(b,en)|0,o=o+Math.imul(b,er)|0,r=r+Math.imul(p,eo)|0,i=(i=i+Math.imul(p,ea)|0)+Math.imul(m,eo)|0,o=o+Math.imul(m,ea)|0;var eE=(u+(r=r+Math.imul(d,el)|0)|0)+((8191&(i=(i=i+Math.imul(d,eu)|0)+Math.imul(f,el)|0))<<13)|0;u=((o=o+Math.imul(f,eu)|0)+(i>>>13)|0)+(eE>>>26)|0,eE&=67108863,r=Math.imul(N,U),i=(i=Math.imul(N,q))+Math.imul(D,U)|0,o=Math.imul(D,q),r=r+Math.imul(O,H)|0,i=(i=i+Math.imul(O,V)|0)+Math.imul(P,H)|0,o=o+Math.imul(P,V)|0,r=r+Math.imul(R,W)|0,i=(i=i+Math.imul(R,Y)|0)+Math.imul(I,W)|0,o=o+Math.imul(I,Y)|0,r=r+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,Z)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,Z)|0,r=r+Math.imul(E,X)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(S,X)|0,o=o+Math.imul(S,ee)|0,r=r+Math.imul(A,en)|0,i=(i=i+Math.imul(A,er)|0)+Math.imul(w,en)|0,o=o+Math.imul(w,er)|0,r=r+Math.imul(v,eo)|0,i=(i=i+Math.imul(v,ea)|0)+Math.imul(b,eo)|0,o=o+Math.imul(b,ea)|0,r=r+Math.imul(p,el)|0,i=(i=i+Math.imul(p,eu)|0)+Math.imul(m,el)|0,o=o+Math.imul(m,eu)|0;var eS=(u+(r=r+Math.imul(d,ed)|0)|0)+((8191&(i=(i=i+Math.imul(d,ef)|0)+Math.imul(f,ed)|0))<<13)|0;u=((o=o+Math.imul(f,ef)|0)+(i>>>13)|0)+(eS>>>26)|0,eS&=67108863,r=Math.imul(j,U),i=(i=Math.imul(j,q))+Math.imul(F,U)|0,o=Math.imul(F,q),r=r+Math.imul(N,H)|0,i=(i=i+Math.imul(N,V)|0)+Math.imul(D,H)|0,o=o+Math.imul(D,V)|0,r=r+Math.imul(O,W)|0,i=(i=i+Math.imul(O,Y)|0)+Math.imul(P,W)|0,o=o+Math.imul(P,Y)|0,r=r+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,Z)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,Z)|0,r=r+Math.imul(M,X)|0,i=(i=i+Math.imul(M,ee)|0)+Math.imul(C,X)|0,o=o+Math.imul(C,ee)|0,r=r+Math.imul(E,en)|0,i=(i=i+Math.imul(E,er)|0)+Math.imul(S,en)|0,o=o+Math.imul(S,er)|0,r=r+Math.imul(A,eo)|0,i=(i=i+Math.imul(A,ea)|0)+Math.imul(w,eo)|0,o=o+Math.imul(w,ea)|0,r=r+Math.imul(v,el)|0,i=(i=i+Math.imul(v,eu)|0)+Math.imul(b,el)|0,o=o+Math.imul(b,eu)|0,r=r+Math.imul(p,ed)|0,i=(i=i+Math.imul(p,ef)|0)+Math.imul(m,ed)|0,o=o+Math.imul(m,ef)|0;var ek=(u+(r=r+Math.imul(d,ep)|0)|0)+((8191&(i=(i=i+Math.imul(d,em)|0)+Math.imul(f,ep)|0))<<13)|0;u=((o=o+Math.imul(f,em)|0)+(i>>>13)|0)+(ek>>>26)|0,ek&=67108863,r=Math.imul(j,H),i=(i=Math.imul(j,V))+Math.imul(F,H)|0,o=Math.imul(F,V),r=r+Math.imul(N,W)|0,i=(i=i+Math.imul(N,Y)|0)+Math.imul(D,W)|0,o=o+Math.imul(D,Y)|0,r=r+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,Z)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,Z)|0,r=r+Math.imul(R,X)|0,i=(i=i+Math.imul(R,ee)|0)+Math.imul(I,X)|0,o=o+Math.imul(I,ee)|0,r=r+Math.imul(M,en)|0,i=(i=i+Math.imul(M,er)|0)+Math.imul(C,en)|0,o=o+Math.imul(C,er)|0,r=r+Math.imul(E,eo)|0,i=(i=i+Math.imul(E,ea)|0)+Math.imul(S,eo)|0,o=o+Math.imul(S,ea)|0,r=r+Math.imul(A,el)|0,i=(i=i+Math.imul(A,eu)|0)+Math.imul(w,el)|0,o=o+Math.imul(w,eu)|0,r=r+Math.imul(v,ed)|0,i=(i=i+Math.imul(v,ef)|0)+Math.imul(b,ed)|0,o=o+Math.imul(b,ef)|0;var eM=(u+(r=r+Math.imul(p,ep)|0)|0)+((8191&(i=(i=i+Math.imul(p,em)|0)+Math.imul(m,ep)|0))<<13)|0;u=((o=o+Math.imul(m,em)|0)+(i>>>13)|0)+(eM>>>26)|0,eM&=67108863,r=Math.imul(j,W),i=(i=Math.imul(j,Y))+Math.imul(F,W)|0,o=Math.imul(F,Y),r=r+Math.imul(N,Q)|0,i=(i=i+Math.imul(N,Z)|0)+Math.imul(D,Q)|0,o=o+Math.imul(D,Z)|0,r=r+Math.imul(O,X)|0,i=(i=i+Math.imul(O,ee)|0)+Math.imul(P,X)|0,o=o+Math.imul(P,ee)|0,r=r+Math.imul(R,en)|0,i=(i=i+Math.imul(R,er)|0)+Math.imul(I,en)|0,o=o+Math.imul(I,er)|0,r=r+Math.imul(M,eo)|0,i=(i=i+Math.imul(M,ea)|0)+Math.imul(C,eo)|0,o=o+Math.imul(C,ea)|0,r=r+Math.imul(E,el)|0,i=(i=i+Math.imul(E,eu)|0)+Math.imul(S,el)|0,o=o+Math.imul(S,eu)|0,r=r+Math.imul(A,ed)|0,i=(i=i+Math.imul(A,ef)|0)+Math.imul(w,ed)|0,o=o+Math.imul(w,ef)|0;var eC=(u+(r=r+Math.imul(v,ep)|0)|0)+((8191&(i=(i=i+Math.imul(v,em)|0)+Math.imul(b,ep)|0))<<13)|0;u=((o=o+Math.imul(b,em)|0)+(i>>>13)|0)+(eC>>>26)|0,eC&=67108863,r=Math.imul(j,Q),i=(i=Math.imul(j,Z))+Math.imul(F,Q)|0,o=Math.imul(F,Z),r=r+Math.imul(N,X)|0,i=(i=i+Math.imul(N,ee)|0)+Math.imul(D,X)|0,o=o+Math.imul(D,ee)|0,r=r+Math.imul(O,en)|0,i=(i=i+Math.imul(O,er)|0)+Math.imul(P,en)|0,o=o+Math.imul(P,er)|0,r=r+Math.imul(R,eo)|0,i=(i=i+Math.imul(R,ea)|0)+Math.imul(I,eo)|0,o=o+Math.imul(I,ea)|0,r=r+Math.imul(M,el)|0,i=(i=i+Math.imul(M,eu)|0)+Math.imul(C,el)|0,o=o+Math.imul(C,eu)|0,r=r+Math.imul(E,ed)|0,i=(i=i+Math.imul(E,ef)|0)+Math.imul(S,ed)|0,o=o+Math.imul(S,ef)|0;var ex=(u+(r=r+Math.imul(A,ep)|0)|0)+((8191&(i=(i=i+Math.imul(A,em)|0)+Math.imul(w,ep)|0))<<13)|0;u=((o=o+Math.imul(w,em)|0)+(i>>>13)|0)+(ex>>>26)|0,ex&=67108863,r=Math.imul(j,X),i=(i=Math.imul(j,ee))+Math.imul(F,X)|0,o=Math.imul(F,ee),r=r+Math.imul(N,en)|0,i=(i=i+Math.imul(N,er)|0)+Math.imul(D,en)|0,o=o+Math.imul(D,er)|0,r=r+Math.imul(O,eo)|0,i=(i=i+Math.imul(O,ea)|0)+Math.imul(P,eo)|0,o=o+Math.imul(P,ea)|0,r=r+Math.imul(R,el)|0,i=(i=i+Math.imul(R,eu)|0)+Math.imul(I,el)|0,o=o+Math.imul(I,eu)|0,r=r+Math.imul(M,ed)|0,i=(i=i+Math.imul(M,ef)|0)+Math.imul(C,ed)|0,o=o+Math.imul(C,ef)|0;var eR=(u+(r=r+Math.imul(E,ep)|0)|0)+((8191&(i=(i=i+Math.imul(E,em)|0)+Math.imul(S,ep)|0))<<13)|0;u=((o=o+Math.imul(S,em)|0)+(i>>>13)|0)+(eR>>>26)|0,eR&=67108863,r=Math.imul(j,en),i=(i=Math.imul(j,er))+Math.imul(F,en)|0,o=Math.imul(F,er),r=r+Math.imul(N,eo)|0,i=(i=i+Math.imul(N,ea)|0)+Math.imul(D,eo)|0,o=o+Math.imul(D,ea)|0,r=r+Math.imul(O,el)|0,i=(i=i+Math.imul(O,eu)|0)+Math.imul(P,el)|0,o=o+Math.imul(P,eu)|0,r=r+Math.imul(R,ed)|0,i=(i=i+Math.imul(R,ef)|0)+Math.imul(I,ed)|0,o=o+Math.imul(I,ef)|0;var eI=(u+(r=r+Math.imul(M,ep)|0)|0)+((8191&(i=(i=i+Math.imul(M,em)|0)+Math.imul(C,ep)|0))<<13)|0;u=((o=o+Math.imul(C,em)|0)+(i>>>13)|0)+(eI>>>26)|0,eI&=67108863,r=Math.imul(j,eo),i=(i=Math.imul(j,ea))+Math.imul(F,eo)|0,o=Math.imul(F,ea),r=r+Math.imul(N,el)|0,i=(i=i+Math.imul(N,eu)|0)+Math.imul(D,el)|0,o=o+Math.imul(D,eu)|0,r=r+Math.imul(O,ed)|0,i=(i=i+Math.imul(O,ef)|0)+Math.imul(P,ed)|0,o=o+Math.imul(P,ef)|0;var eT=(u+(r=r+Math.imul(R,ep)|0)|0)+((8191&(i=(i=i+Math.imul(R,em)|0)+Math.imul(I,ep)|0))<<13)|0;u=((o=o+Math.imul(I,em)|0)+(i>>>13)|0)+(eT>>>26)|0,eT&=67108863,r=Math.imul(j,el),i=(i=Math.imul(j,eu))+Math.imul(F,el)|0,o=Math.imul(F,eu),r=r+Math.imul(N,ed)|0,i=(i=i+Math.imul(N,ef)|0)+Math.imul(D,ed)|0,o=o+Math.imul(D,ef)|0;var eO=(u+(r=r+Math.imul(O,ep)|0)|0)+((8191&(i=(i=i+Math.imul(O,em)|0)+Math.imul(P,ep)|0))<<13)|0;u=((o=o+Math.imul(P,em)|0)+(i>>>13)|0)+(eO>>>26)|0,eO&=67108863,r=Math.imul(j,ed),i=(i=Math.imul(j,ef))+Math.imul(F,ed)|0,o=Math.imul(F,ef);var eP=(u+(r=r+Math.imul(N,ep)|0)|0)+((8191&(i=(i=i+Math.imul(N,em)|0)+Math.imul(D,ep)|0))<<13)|0;u=((o=o+Math.imul(D,em)|0)+(i>>>13)|0)+(eP>>>26)|0,eP&=67108863;var eL=(u+(r=Math.imul(j,ep))|0)+((8191&(i=(i=Math.imul(j,em))+Math.imul(F,ep)|0))<<13)|0;return u=((o=Math.imul(F,em))+(i>>>13)|0)+(eL>>>26)|0,eL&=67108863,l[0]=eg,l[1]=ev,l[2]=eb,l[3]=ey,l[4]=eA,l[5]=ew,l[6]=e_,l[7]=eE,l[8]=eS,l[9]=ek,l[10]=eM,l[11]=eC,l[12]=ex,l[13]=eR,l[14]=eI,l[15]=eT,l[16]=eO,l[17]=eP,l[18]=eL,0!==u&&(l[19]=u,n.length++),n};function p(e,t,n){return(new m).mulp(e,t,n)}function m(e,t){this.x=e,this.y=t}Math.imul||(h=f),i.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?h(this,e,t):n<63?f(this,e,t):n<1024?function(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,e,t):p(this,e,t)},m.prototype.makeRBT=function(e){for(var t=Array(e),n=i.prototype._countBits(e)-1,r=0;r>=1;return r},m.prototype.permute=function(e,t,n,r,i,o){for(var a=0;a>>=1)i++;return 1<>>=13,r[2*a+1]=8191&o,o>>>=13;for(a=2*t;a>=26,t+=(i/67108864|0)+(o>>>26),this.words[r]=67108863&o}return 0!==t&&(this.words[r]=t,this.length++),this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=function(e){for(var t=Array(e.bitLength()),n=0;n>>i}return t}(e);if(0===t.length)return new i(1);for(var n=this,r=0;r=0);var t,r=e%26,i=(e-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(t=0;t>>26-r}a&&(this.words[t]=a,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var i,o=e%26,a=Math.min((e-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,l=0;l=0&&(0!==u||l>=i);l--){var c=0|this.words[l];this.words[l]=u<<26-o|c>>>o,u=c&s}return r&&0!==u&&(r.words[r.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;return!(this.length<=r)&&!!(this.words[r]&1<=0);var t=e%26,r=(e-t)/26;return(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)?this:(0!==t&&r++,this.length=Math.min(r,this.length),0!==t&&(this.words[this.length-1]&=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(l/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===s)return this.strip();for(n(-1===s),s=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},i.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),o=e,a=0|o.words[o.length-1];0!=(n=26-this._countBits(a))&&(o=o.ushln(n),r.iushln(n),a=0|o.words[o.length-1]);var s,l=r.length-o.length;if("mod"!==t){(s=new i(null)).length=l+1,s.words=Array(s.length);for(var u=0;u=0;d--){var f=67108864*(0|r.words[o.length+d])+(0|r.words[o.length+d-1]);for(f=Math.min(f/a|0,67108863),r._ishlnsubmul(o,f,d);0!==r.negative;)f--,r.negative=0,r._ishlnsubmul(o,1,d),r.isZero()||(r.negative^=1);s&&(s.words[d]=f)}return s&&s.strip(),r.strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(e,t,r){var o,a,s;return n(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(o=s.div.neg()),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(e)),{div:o,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||0>this.cmp(e)?{div:new i(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new i(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modn(e.words[0]))}:this._wordDiv(e,t)},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modn=function(e){n(e<=67108863);for(var t=67108864%e,r=0,i=this.length-1;i>=0;i--)r=(t*r+(0|this.words[i]))%e;return r},i.prototype.idivn=function(e){n(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*t;this.words[r]=i/e|0,t=i%e}return this.strip()},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o=new i(1),a=new i(0),s=new i(0),l=new i(1),u=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++u;for(var c=r.clone(),d=t.clone();!t.isZero();){for(var f=0,h=1;0==(t.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(t.iushrn(f);f-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(c),a.isub(d)),o.iushrn(1),a.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||l.isOdd())&&(s.iadd(c),l.isub(d)),s.iushrn(1),l.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(s),a.isub(l)):(r.isub(t),s.isub(o),l.isub(a))}return{a:s,b:l,gcd:r.iushln(u)}},i.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o,a=new i(1),s=new i(0),l=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,c=1;0==(t.words[0]&c)&&u<26;++u,c<<=1);if(u>0)for(t.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(l),a.iushrn(1);for(var d=0,f=1;0==(r.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(r.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(l),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(s)):(r.isub(t),s.isub(a))}return 0>(o=0===t.cmpn(1)?a:s).cmpn(0)&&o.iadd(e),o},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return -1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){ri&&(t=1);break}}return t},i.prototype.gtn=function(e){return 1===this.cmpn(e)},i.prototype.gt=function(e){return 1===this.cmp(e)},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return -1===this.cmpn(e)},i.prototype.lt=function(e){return -1===this.cmp(e)},i.prototype.lten=function(e){return 0>=this.cmpn(e)},i.prototype.lte=function(e){return 0>=this.cmp(e)},i.prototype.eqn=function(e){return 0===this.cmpn(e)},i.prototype.eq=function(e){return 0===this.cmp(e)},i.red=function(e){return new _(e)},i.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var g={k256:null,p224:null,p192:null,p25519:null};function v(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function y(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function A(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function w(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function _(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function E(e){_.call(this,e),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)}v.prototype._tmp=function(){var e=new i(null);return e.words=Array(Math.ceil(this.n/13)),e},v.prototype.ireduce=function(e){var t,n=e;do this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength();while(t>this.n);var r=t0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},v.prototype.split=function(e,t){e.iushrn(this.n,0,t)},v.prototype.imulK=function(e){return e.imul(this.k)},r(b,v),b.prototype.split=function(e,t){for(var n=Math.min(e.length,9),r=0;r>>22,i=o}i>>>=22,e.words[r-10]=i,0===i&&e.length>10?e.length-=10:e.length-=9},b.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){var t;if(g[e])return g[e];if("k256"===e)t=new b;else if("p224"===e)t=new y;else if("p192"===e)t=new A;else{if("p25519"!==e)throw Error("Unknown prime "+e);t=new w}return g[e]=t,t},_.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},_.prototype._verify2=function(e,t){n(0==(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},_.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},_.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},_.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},_.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},_.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return 0>n.cmpn(0)&&n.iadd(this.m),n._forceRed(this)},_.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return 0>n.cmpn(0)&&n.iadd(this.m),n},_.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},_.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},_.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},_.prototype.isqr=function(e){return this.imul(e,e.clone())},_.prototype.sqr=function(e){return this.mul(e,e)},_.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new i(1)).iushrn(2);return this.pow(e,r)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);n(!o.isZero());var s=new i(1).toRed(this),l=s.redNeg(),u=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new i(2*c*c).toRed(this);0!==this.pow(c,u).cmp(l);)c.redIAdd(l);for(var d=this.pow(c,o),f=this.pow(e,o.addn(1).iushrn(1)),h=this.pow(e,o),p=a;0!==h.cmp(s);){for(var m=h,g=0;0!==m.cmp(s);g++)m=m.redSqr();n(g=0;r--){for(var u=t.words[r],c=l-1;c>=0;c--){var d=u>>c&1;o!==n[0]&&(o=this.sqr(o)),0!==d||0!==a?(a<<=1,a|=d,(4==++s||0===r&&0===c)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}l=26}return o},_.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},_.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new E(e)},r(E,_),E.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},E.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},E.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):0>i.cmpn(0)&&(o=i.iadd(this.m)),o._forceRed(this)},E.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(r).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):0>o.cmpn(0)&&(a=o.iadd(this.m)),a._forceRed(this)},E.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(ue,l);var ut=ue.exports;function un(e,t){if(!e)throw Error(t||"Assertion failed")}un.equal=function(e,t,n){if(e!=t)throw Error(n||"Assertion failed: "+e+" != "+t)};var ur={};(function(e){function t(e){return 1===e.length?"0"+e:e}function n(e){for(var n="",r=0;r>8,a=255&i;o?n.push(o,a):n.push(a)}return n},e.zero2=t,e.toHex=n,e.encode=function(e,t){return"hex"===t?n(e):e}})(ur),l9.assert=un,l9.toArray=ur.toArray,l9.zero2=ur.zero2,l9.toHex=ur.toHex,l9.encode=ur.encode,l9.getNAF=function(e,t,n){var r=Array(Math.max(e.bitLength(),n)+1);r.fill(0);for(var i=1<(i>>1)-1?(i>>1)-l:l,o.isubn(s)):s=0,r[a]=s,o.iushrn(1)}return r},l9.getJSF=function(e,t){var n=[[],[]];e=e.clone(),t=t.clone();for(var r,i=0,o=0;e.cmpn(-i)>0||t.cmpn(-o)>0;){var a,s,l=e.andln(3)+i&3,u=t.andln(3)+o&3;3===l&&(l=-1),3===u&&(u=-1),a=0==(1&l)?0:3!=(r=e.andln(7)+i&7)&&5!==r||2!==u?l:-l,n[0].push(a),s=0==(1&u)?0:3!=(r=t.andln(7)+o&7)&&5!==r||2!==l?u:-u,n[1].push(s),2*i===a+1&&(i=1-i),2*o===s+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return n},l9.cachedProperty=function(e,t,n){var r="_"+t;e.prototype[t]=function(){return void 0!==this[r]?this[r]:this[r]=n.call(this)}},l9.parseBytes=function(e){return"string"==typeof e?l9.toArray(e,"hex"):e},l9.intFromLE=function(e){return new ut(e,"hex","le")};var ui,uo={exports:{}};function ua(e){this.rand=e}if(uo.exports=function(e){return ui||(ui=new ua(null)),ui.generate(e)},uo.exports.Rand=ua,ua.prototype.generate=function(e){return this._rand(e)},ua.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),n=0;n0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function up(e,t){this.curve=e,this.type=t,this.precomputed=null}uh.prototype.point=function(){throw Error("Not implemented")},uh.prototype.validate=function(){throw Error("Not implemented")},uh.prototype._fixedNafMul=function(e,t){uf(e.precomputed);var n=e._getDoubles(),r=uc(t,1,this._bitLength),i=(1<=o;l--)a=(a<<1)+r[l];s.push(a)}for(var u=this.jpoint(null,null,null),c=this.jpoint(null,null,null),d=i;d>0;d--){for(o=0;o=0;s--){for(var l=0;s>=0&&0===o[s];s--)l++;if(s>=0&&l++,a=a.dblp(l),s<0)break;var u=o[s];uf(0!==u),a="affine"===e.type?u>0?a.mixedAdd(i[u-1>>1]):a.mixedAdd(i[-u-1>>1].neg()):u>0?a.add(i[u-1>>1]):a.add(i[-u-1>>1].neg())}return"affine"===e.type?a.toP():a},uh.prototype._wnafMulAdd=function(e,t,n,r,i){var o,a,s,l=this._wnafT1,u=this._wnafT2,c=this._wnafT3,d=0;for(o=0;o=1;o-=2){var h=o-1,p=o;if(1===l[h]&&1===l[p]){var m=[t[h],null,null,t[p]];0===t[h].y.cmp(t[p].y)?(m[1]=t[h].add(t[p]),m[2]=t[h].toJ().mixedAdd(t[p].neg())):0===t[h].y.cmp(t[p].y.redNeg())?(m[1]=t[h].toJ().mixedAdd(t[p]),m[2]=t[h].add(t[p].neg())):(m[1]=t[h].toJ().mixedAdd(t[p]),m[2]=t[h].toJ().mixedAdd(t[p].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],v=ud(n[h],n[p]);for(d=Math.max(v[0].length,d),c[h]=Array(d),c[p]=Array(d),a=0;a=0;o--){for(var _=0;o>=0;){var E=!0;for(a=0;a=0&&_++,A=A.dblp(_),o<0)break;for(a=0;a0?s=u[a][S-1>>1]:S<0&&(s=u[a][-S-1>>1].neg()),A="affine"===s.type?A.mixedAdd(s):A.add(s))}}for(o=0;o=Math.ceil((e.bitLength()+1)/t.step)},up.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;ir[0].cmp(r[1])?r[0]:r[1]).toRed(this.red)}if(e.lambda)n=new ut(e.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(t))?n=i[0]:(n=i[1],uv(0===this.g.mul(n).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:n,basis:e.basis?e.basis.map(function(e){return{a:new ut(e.a,16),b:new ut(e.b,16)}}):this._getEndoBasis(n)}}},ub.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:ut.mont(e),n=new ut(2).toRed(t).redInvm(),r=n.redNeg(),i=new ut(3).toRed(t).redNeg().redSqrt().redMul(n);return[r.redAdd(i).fromRed(),r.redSub(i).fromRed()]},ub.prototype._getEndoBasis=function(e){for(var t,n,r,i,o,a,s,l,u,c=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=e,f=this.n.clone(),h=new ut(1),p=new ut(0),m=new ut(0),g=new ut(1),v=0;0!==d.cmpn(0);){var b=f.div(d);l=f.sub(b.mul(d)),u=m.sub(b.mul(h));var y=g.sub(b.mul(p));if(!r&&0>l.cmp(c))t=s.neg(),n=h,r=l.neg(),i=u;else if(r&&2==++v)break;s=l,f=d,d=l,m=h,h=u,g=p,p=y}o=l.neg(),a=u;var A=r.sqr().add(i.sqr());return o.sqr().add(a.sqr()).cmp(A)>=0&&(o=t,a=n),r.negative&&(r=r.neg(),i=i.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:r,b:i},{a:o,b:a}]},ub.prototype._endoSplit=function(e){var t=this.endo.basis,n=t[0],r=t[1],i=r.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=i.mul(n.a),s=o.mul(r.a),l=i.mul(n.b),u=o.mul(r.b);return{k1:e.sub(a).sub(s),k2:l.add(u).neg()}},ub.prototype.pointFromX=function(e,t){(e=new ut(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),r=n.redSqrt();if(0!==r.redSqr().redSub(n).cmp(this.zero))throw Error("invalid point");var i=r.fromRed().isOdd();return(t&&!i||!t&&i)&&(r=r.redNeg()),this.point(e,r)},ub.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,n=e.y,r=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(r).redIAdd(this.b);return 0===n.redSqr().redISub(i).cmpn(0)},ub.prototype._endoWnafMulAdd=function(e,t,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},uy.prototype.isInfinity=function(){return this.inf},uy.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e)||0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var n=t.redSqr().redISub(this.x).redISub(e.x),r=t.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},uy.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,n=this.x.redSqr(),r=e.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(t).redMul(r),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},uy.prototype.getX=function(){return this.x.fromRed()},uy.prototype.getY=function(){return this.y.fromRed()},uy.prototype.mul=function(e){return e=new ut(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},uy.prototype.mulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},uy.prototype.jmulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},uy.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},uy.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,r=function(e){return e.neg()};t.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return t},uy.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},ug(uA,uh.BasePoint),ub.prototype.jpoint=function(e,t,n){return new uA(this,e,t,n)},uA.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),n=this.x.redMul(t),r=this.y.redMul(t).redMul(e);return this.curve.point(n,r)},uA.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},uA.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(t),i=e.x.redMul(n),o=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),s=r.redSub(i),l=o.redSub(a);if(0===s.cmpn(0))return 0!==l.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),c=u.redMul(s),d=r.redMul(u),f=l.redSqr().redIAdd(c).redISub(d).redISub(d),h=l.redMul(d.redISub(f)).redISub(o.redMul(c)),p=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(f,h,p)},uA.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),n=this.x,r=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z),a=n.redSub(r),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),u=l.redMul(a),c=n.redMul(l),d=s.redSqr().redIAdd(u).redISub(c).redISub(c),f=s.redMul(c.redISub(d)).redISub(i.redMul(u)),h=this.z.redMul(a);return this.curve.jpoint(d,f,h)},uA.prototype.dblp=function(e){if(0===e||this.isInfinity())return this;if(!e)return this.dbl();if(this.curve.zeroA||this.curve.threeA){var t,n=this;for(t=0;t=0)return!1;if(n.redIAdd(i),0===this.x.cmp(n))return!0}},uA.prototype.inspect=function(){return this.isInfinity()?"":""},uA.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},ug(uw,uh),uw.prototype.validate=function(e){var t=e.normalize().x,n=t.redSqr(),r=n.redMul(t).redAdd(n.redMul(this.a)).redAdd(t);return 0===r.redSqrt().redSqr().cmp(r)},ug(u_,uh.BasePoint),uw.prototype.decodePoint=function(e,t){return this.point(l9.toArray(e,t),1)},uw.prototype.point=function(e,t){return new u_(this,e,t)},uw.prototype.pointFromJSON=function(e){return u_.fromJSON(this,e)},u_.prototype.precompute=function(){},u_.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},u_.fromJSON=function(e,t){return new u_(e,t[0],t[1]||e.one)},u_.prototype.inspect=function(){return this.isInfinity()?"":""},u_.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},u_.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),n=e.redSub(t),r=e.redMul(t),i=n.redMul(t.redAdd(this.curve.a24.redMul(n)));return this.curve.point(r,i)},u_.prototype.add=function(){throw Error("Not supported on Montgomery curve")},u_.prototype.diffAdd=function(e,t){var n=this.x.redAdd(this.z),r=this.x.redSub(this.z),i=e.x.redAdd(e.z),o=e.x.redSub(e.z).redMul(n),a=i.redMul(r),s=t.z.redMul(o.redAdd(a).redSqr()),l=t.x.redMul(o.redISub(a).redSqr());return this.curve.point(s,l)},u_.prototype.mul=function(e){for(var t=e.clone(),n=this,r=this.curve.point(null,null),i=[];0!==t.cmpn(0);t.iushrn(1))i.push(t.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(n=n.diffAdd(r,this),r=r.dbl()):(r=n.diffAdd(r,this),n=n.dbl());return r},u_.prototype.mulAdd=function(){throw Error("Not supported on Montgomery curve")},u_.prototype.jumlAdd=function(){throw Error("Not supported on Montgomery curve")},u_.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},u_.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},u_.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var uE=l9.assert;function uS(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,uh.call(this,"edwards",e),this.a=new ut(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new ut(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new ut(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),uE(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}function uk(e,t,n,r,i){uh.BasePoint.call(this,e,"projective"),null===t&&null===n&&null===r?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new ut(t,16),this.y=new ut(n,16),this.z=r?new ut(r,16):this.curve.one,this.t=i&&new ut(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}ug(uS,uh),uS.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},uS.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},uS.prototype.jpoint=function(e,t,n,r){return this.point(e,t,n,r)},uS.prototype.pointFromX=function(e,t){(e=new ut(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr(),r=this.c2.redSub(this.a.redMul(n)),i=this.one.redSub(this.c2.redMul(this.d).redMul(n)),o=r.redMul(i.redInvm()),a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw Error("invalid point");var s=a.fromRed().isOdd();return(t&&!s||!t&&s)&&(a=a.redNeg()),this.point(e,a)},uS.prototype.pointFromY=function(e,t){(e=new ut(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr(),r=n.redSub(this.c2),i=n.redMul(this.d).redMul(this.c2).redSub(this.a),o=r.redMul(i.redInvm());if(0===o.cmp(this.zero)){if(t)throw Error("invalid point");return this.point(this.zero,e)}var a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw Error("invalid point");return a.fromRed().isOdd()!==t&&(a=a.redNeg()),this.point(a,e)},uS.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),n=e.y.redSqr(),r=t.redMul(this.a).redAdd(n),i=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(n)));return 0===r.cmp(i)},ug(uk,uh.BasePoint),uS.prototype.pointFromJSON=function(e){return uk.fromJSON(this,e)},uS.prototype.point=function(e,t,n,r){return new uk(this,e,t,n,r)},uk.fromJSON=function(e,t){return new uk(e,t[0],t[1],t[2])},uk.prototype.inspect=function(){return this.isInfinity()?"":""},uk.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},uk.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var r=this.curve._mulA(e),i=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),o=r.redAdd(t),a=o.redSub(n),s=r.redSub(t),l=i.redMul(a),u=o.redMul(s),c=i.redMul(s),d=a.redMul(o);return this.curve.point(l,u,d,c)},uk.prototype._projDbl=function(){var e,t,n,r,i,o,a=this.x.redAdd(this.y).redSqr(),s=this.x.redSqr(),l=this.y.redSqr();if(this.curve.twisted){var u=(r=this.curve._mulA(s)).redAdd(l);this.zOne?(e=a.redSub(s).redSub(l).redMul(u.redSub(this.curve.two)),t=u.redMul(r.redSub(l)),n=u.redSqr().redSub(u).redSub(u)):(i=this.z.redSqr(),o=u.redSub(i).redISub(i),e=a.redSub(s).redISub(l).redMul(o),t=u.redMul(r.redSub(l)),n=u.redMul(o))}else r=s.redAdd(l),i=this.curve._mulC(this.z).redSqr(),o=r.redSub(i).redSub(i),e=this.curve._mulC(a.redISub(r)).redMul(o),t=this.curve._mulC(r).redMul(s.redISub(l)),n=r.redMul(o);return this.curve.point(e,t,n)},uk.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},uk.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),r=this.t.redMul(this.curve.dd).redMul(e.t),i=this.z.redMul(e.z.redAdd(e.z)),o=n.redSub(t),a=i.redSub(r),s=i.redAdd(r),l=n.redAdd(t),u=o.redMul(a),c=s.redMul(l),d=o.redMul(l),f=a.redMul(s);return this.curve.point(u,c,f,d)},uk.prototype._projAdd=function(e){var t,n,r=this.z.redMul(e.z),i=r.redSqr(),o=this.x.redMul(e.x),a=this.y.redMul(e.y),s=this.curve.d.redMul(o).redMul(a),l=i.redSub(s),u=i.redAdd(s),c=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(o).redISub(a),d=r.redMul(l).redMul(c);return this.curve.twisted?(t=r.redMul(u).redMul(a.redSub(this.curve._mulA(o))),n=l.redMul(u)):(t=r.redMul(u).redMul(a.redSub(o)),n=this.curve._mulC(l).redMul(u)),this.curve.point(d,t,n)},uk.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},uk.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},uk.prototype.mulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!1)},uk.prototype.jmulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!0)},uk.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},uk.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},uk.prototype.getX=function(){return this.normalize(),this.x.fromRed()},uk.prototype.getY=function(){return this.normalize(),this.y.fromRed()},uk.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},uk.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var n=e.clone(),r=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(r),0===this.x.cmp(t))return!0}},uk.prototype.toP=uk.prototype.normalize,uk.prototype.mixedAdd=uk.prototype.add,uu.base=uh,uu.short=ub,uu.mont=uw,uu.edwards=uS;var uM={},uC={},ux={};function uR(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function uI(e){return 1===e.length?"0"+e:e}function uT(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}ux.inherits=ug,ux.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if("string"==typeof e){if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),i=0;i>6|192:((o=e,a=i,55296!=(64512&o.charCodeAt(a))||a<0||a+1>=o.length||56320!=(64512&o.charCodeAt(a+1)))?n[r++]=s>>12|224:(s=65536+((1023&s)<<10)+(1023&e.charCodeAt(++i)),n[r++]=s>>18|240,n[r++]=s>>12&63|128),n[r++]=s>>6&63|128),n[r++]=63&s|128)}}else for(i=0;i>>0;return a},ux.split32=function(e,t){for(var n=Array(4*e.length),r=0,i=0;r>>24,n[i+1]=o>>>16&255,n[i+2]=o>>>8&255,n[i+3]=255&o):(n[i+3]=o>>>24,n[i+2]=o>>>16&255,n[i+1]=o>>>8&255,n[i]=255&o)}return n},ux.rotr32=function(e,t){return e>>>t|e<<32-t},ux.rotl32=function(e,t){return e<>>32-t},ux.sum32=function(e,t){return e+t>>>0},ux.sum32_3=function(e,t,n){return e+t+n>>>0},ux.sum32_4=function(e,t,n,r){return e+t+n+r>>>0},ux.sum32_5=function(e,t,n,r,i){return e+t+n+r+i>>>0},ux.sum64=function(e,t,n,r){var i=e[t],o=r+e[t+1]>>>0;e[t]=(o>>0,e[t+1]=o},ux.sum64_hi=function(e,t,n,r){return(t+r>>>0>>0},ux.sum64_lo=function(e,t,n,r){return t+r>>>0},ux.sum64_4_hi=function(e,t,n,r,i,o,a,s){var l=t;return e+n+i+a+(0+(((l=l+r>>>0)>>0)>>0)>>0},ux.sum64_4_lo=function(e,t,n,r,i,o,a,s){return t+r+o+s>>>0},ux.sum64_5_hi=function(e,t,n,r,i,o,a,s,l,u){var c=t;return e+n+i+a+l+(0+(((c=c+r>>>0)>>0)>>0)>>0)>>0},ux.sum64_5_lo=function(e,t,n,r,i,o,a,s,l,u){return t+r+o+s+u>>>0},ux.rotr64_hi=function(e,t,n){return(t<<32-n|e>>>n)>>>0},ux.rotr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0},ux.shr64_hi=function(e,t,n){return e>>>n},ux.shr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0};var uO={};function uP(){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}uO.BlockHash=uP,uP.prototype.update=function(e,t){if(e=ux.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var n=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-n,e.length),0===this.pending.length&&(this.pending=null),e=ux.join32(e,0,e.length-n,this.endian);for(var r=0;r>>24&255,r[i++]=e>>>16&255,r[i++]=e>>>8&255,r[i++]=255&e}else for(r[i++]=255&e,r[i++]=e>>>8&255,r[i++]=e>>>16&255,r[i++]=e>>>24&255,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,o=8;o>>3},uN.g1_256=function(e){return uD(e,17)^uD(e,19)^e>>>10};var uj=ux.rotl32,uF=ux.sum32,uz=ux.sum32_5,uU=uN.ft_1,uq=uO.BlockHash,uK=[1518500249,1859775393,2400959708,3395469782];function uH(){if(!(this instanceof uH))return new uH;uq.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=Array(80)}ux.inherits(uH,uq),uH.blockSize=512,uH.outSize=160,uH.hmacStrength=80,uH.padLength=64,uH.prototype._update=function(e,t){for(var n=this.W,r=0;r<16;r++)n[r]=e[t+r];for(;r=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,n,r)}cw.prototype._init=function(e){e.length>this.blockSize&&(e=(new this.Hash).update(e).digest()),un(e.length<=this.blockSize);for(var t=e.length;t=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},c_.prototype.generate=function(e,t,n,r){if(this._reseed>this.reseedInterval)throw Error("Reseed is required");"string"!=typeof t&&(r=n,n=t,t=null),n&&(n=ur.toArray(n,r||"hex"),this._update(n));for(var i=[];i.length"};var ck=l9.assert;function cM(e,t){if(e instanceof cM)return e;this._importDER(e,t)||(ck(e.r&&e.s,"Signature without r or s"),this.r=new ut(e.r,16),this.s=new ut(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function cC(){this.place=0}function cx(e,t){var n=e[t.place++];if(!(128&n))return n;var r=15&n;if(0===r||r>4)return!1;for(var i=0,o=0,a=t.place;o>>=0;return!(i<=127)&&(t.place=a,i)}function cR(e){for(var t=0,n=e.length-1;!e[t]&&!(128&e[t+1])&&t>>3);for(e.push(128|n);--n;)e.push(t>>>(n<<3)&255);e.push(t)}}cM.prototype._importDER=function(e,t){e=l9.toArray(e,t);var n=new cC;if(48!==e[n.place++])return!1;var r=cx(e,n);if(!1===r||r+n.place!==e.length||2!==e[n.place++])return!1;var i=cx(e,n);if(!1===i)return!1;var o=e.slice(n.place,i+n.place);if(n.place+=i,2!==e[n.place++])return!1;var a=cx(e,n);if(!1===a||e.length!==a+n.place)return!1;var s=e.slice(n.place,a+n.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}return this.r=new ut(o),this.s=new ut(s),this.recoveryParam=null,!0},cM.prototype.toDER=function(e){var t=this.r.toArray(),n=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&n[0]&&(n=[0].concat(n)),t=cR(t),n=cR(n);!(n[0]||128&n[1]);)n=n.slice(1);var r=[2];cI(r,t.length),(r=r.concat(t)).push(2),cI(r,n.length);var i=r.concat(n),o=[48];return cI(o,i.length),o=o.concat(i),l9.encode(o,e)};var cT=l9.assert;function cO(e){if(!(this instanceof cO))return new cO(e);"string"==typeof e&&(cT(Object.prototype.hasOwnProperty.call(uM,e),"Unknown curve "+e),e=uM[e]),e instanceof uM.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}cO.prototype.keyPair=function(e){return new cS(this,e)},cO.prototype.keyFromPrivate=function(e,t){return cS.fromPrivate(this,e,t)},cO.prototype.keyFromPublic=function(e,t){return cS.fromPublic(this,e,t)},cO.prototype.genKeyPair=function(e){e||(e={});for(var t=new c_({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||ul(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),r=this.n.sub(new ut(2));;){var i=new ut(t.generate(n));if(!(i.cmp(r)>0))return i.iaddn(1),this.keyFromPrivate(i)}},cO.prototype._truncateToN=function(e,t){var n=8*e.byteLength()-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},cO.prototype.sign=function(e,t,n,r){"object"==typeof n&&(r=n,n=null),r||(r={}),t=this.keyFromPrivate(t,n),e=this._truncateToN(new ut(e,16));for(var i=this.n.byteLength(),o=t.getPrivate().toArray("be",i),a=e.toArray("be",i),s=new c_({hash:this.hash,entropy:o,nonce:a,pers:r.pers,persEnc:r.persEnc||"utf8"}),l=this.n.sub(new ut(1)),u=0;;u++){var c=r.k?r.k(u):new ut(s.generate(this.n.byteLength()));if(!(0>=(c=this._truncateToN(c,!0)).cmpn(1)||c.cmp(l)>=0)){var d=this.g.mul(c);if(!d.isInfinity()){var f=d.getX(),h=f.umod(this.n);if(0!==h.cmpn(0)){var p=c.invm(this.n).mul(h.mul(t.getPrivate()).iadd(e));if(0!==(p=p.umod(this.n)).cmpn(0)){var m=(d.getY().isOdd()?1:0)|(0!==f.cmp(h)?2:0);return r.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),m^=1),new cM({r:h,s:p,recoveryParam:m})}}}}}},cO.prototype.verify=function(e,t,n,r){e=this._truncateToN(new ut(e,16)),n=this.keyFromPublic(n,r);var i=(t=new cM(t,"hex")).r,o=t.s;if(0>i.cmpn(1)||i.cmp(this.n)>=0||0>o.cmpn(1)||o.cmp(this.n)>=0)return!1;var a,s=o.invm(this.n),l=s.mul(e).umod(this.n),u=s.mul(i).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(l,n.getPublic(),u)).isInfinity()&&a.eqXToP(i):!(a=this.g.mulAdd(l,n.getPublic(),u)).isInfinity()&&0===a.getX().umod(this.n).cmp(i)},cO.prototype.recoverPubKey=function(e,t,n,r){cT((3&n)===n,"The recovery param is more than two bits"),t=new cM(t,r);var i=this.n,o=new ut(e),a=t.r,s=t.s,l=1&n,u=n>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw Error("Unable to find sencond key candinate");a=u?this.curve.pointFromX(a.add(this.curve.n),l):this.curve.pointFromX(a,l);var c=t.r.invm(i),d=i.sub(o).mul(c).umod(i),f=s.mul(c).umod(i);return this.g.mulAdd(d,a,f)},cO.prototype.getKeyRecoveryParam=function(e,t,n,r){if(null!==(t=new cM(t,r)).recoveryParam)return t.recoveryParam;for(var i,o=0;o<4;o++){try{i=this.recoverPubKey(e,t,o)}catch(e){continue}if(i.eq(n))return o}throw Error("Unable to find valid recovery factor")};var cP=l9.assert,cL=l9.parseBytes,cN=l9.cachedProperty;function cD(e,t){this.eddsa=e,this._secret=cL(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=cL(t.pub)}cD.fromPublic=function(e,t){return t instanceof cD?t:new cD(e,{pub:t})},cD.fromSecret=function(e,t){return t instanceof cD?t:new cD(e,{secret:t})},cD.prototype.secret=function(){return this._secret},cN(cD,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),cN(cD,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),cN(cD,"privBytes",function(){var e=this.eddsa,t=this.hash(),n=e.encodingLength-1,r=t.slice(0,e.encodingLength);return r[0]&=248,r[n]&=127,r[n]|=64,r}),cN(cD,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),cN(cD,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),cN(cD,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),cD.prototype.sign=function(e){return cP(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},cD.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},cD.prototype.getSecret=function(e){return cP(this._secret,"KeyPair is public only"),l9.encode(this.secret(),e)},cD.prototype.getPublic=function(e){return l9.encode(this.pubBytes(),e)};var cB=l9.assert,cj=l9.cachedProperty,cF=l9.parseBytes;function cz(e,t){this.eddsa=e,"object"!=typeof t&&(t=cF(t)),Array.isArray(t)&&(t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),cB(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof ut&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}cj(cz,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),cj(cz,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),cj(cz,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),cj(cz,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),cz.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},cz.prototype.toHex=function(){return l9.encode(this.toBytes(),"hex").toUpperCase()};var cU=l9.assert,cq=l9.parseBytes;function cK(e){if(cU("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof cK))return new cK(e);e=uM[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=uC.sha512}cK.prototype.sign=function(e,t){e=cq(e);var n=this.keyFromSecret(t),r=this.hashInt(n.messagePrefix(),e),i=this.g.mul(r),o=this.encodePoint(i),a=this.hashInt(o,n.pubBytes(),e).mul(n.priv()),s=r.add(a).umod(this.curve.n);return this.makeSignature({R:i,S:s,Rencoded:o})},cK.prototype.verify=function(e,t,n){e=cq(e),t=this.makeSignature(t);var r=this.keyFromPublic(n),i=this.hashInt(t.Rencoded(),r.pubBytes(),e),o=this.g.mul(t.S());return t.R().add(r.pub().mul(i)).eq(o)},cK.prototype.hashInt=function(){for(var e=this.hash(),t=0;t=0)return null;let r=(n=n.toRed(cV.red)).redSqr().redIMul(n).redIAdd(cV.b).redSqrt();return 3===e!==r.isOdd()&&(r=r.redNeg()),cH.keyPair({pub:{x:n,y:r}})}(t,e.subarray(1,33));case 4:case 6:case 7:return 65!==e.length?null:function(e,t,n){let r=new c$(t),i=new c$(n);if(r.cmp(cV.p)>=0||i.cmp(cV.p)>=0||(r=r.toRed(cV.red),i=i.toRed(cV.red),(6===e||7===e)&&i.isOdd()!==(7===e)))return null;let o=r.redSqr().redIMul(r);return i.redSqr().redISub(o.redIAdd(cV.b)).isZero()?cH.keyPair({pub:{x:r,y:i}}):null}(t,e.subarray(1,33),e.subarray(33,65));default:return null}}function cY(e,t){let n=t.encode(null,33===e.length);for(let t=0;t0,privateKeyVerify(e){let t=new c$(e);return 0>t.cmp(cV.n)&&!t.isZero()?0:1},privateKeyNegate(e){let t=new c$(e),n=cV.n.sub(t).umod(cV.n).toArrayLike(Uint8Array,"be",32);return e.set(n),0},privateKeyTweakAdd(e,t){let n=new c$(t);if(n.cmp(cV.n)>=0||(n.iadd(new c$(e)),n.cmp(cV.n)>=0&&n.isub(cV.n),n.isZero()))return 1;let r=n.toArrayLike(Uint8Array,"be",32);return e.set(r),0},privateKeyTweakMul(e,t){let n=new c$(t);if(n.cmp(cV.n)>=0||n.isZero())return 1;n.imul(new c$(e)),n.cmp(cV.n)>=0&&(n=n.umod(cV.n));let r=n.toArrayLike(Uint8Array,"be",32);return e.set(r),0},publicKeyVerify:e=>null===cW(e)?1:0,publicKeyCreate(e,t){let n=new c$(t);return n.cmp(cV.n)>=0||n.isZero()?1:(cY(e,cH.keyFromPrivate(t).getPublic()),0)},publicKeyConvert(e,t){let n=cW(t);return null===n?1:(cY(e,n.getPublic()),0)},publicKeyNegate(e,t){let n=cW(t);if(null===n)return 1;let r=n.getPublic();return r.y=r.y.redNeg(),cY(e,r),0},publicKeyCombine(e,t){let n=Array(t.length);for(let e=0;e=0)return 2;let i=r.getPublic().add(cV.g.mul(n));return i.isInfinity()?2:(cY(e,i),0)},publicKeyTweakMul(e,t,n){let r=cW(t);return null===r?1:(n=new c$(n)).cmp(cV.n)>=0||n.isZero()?2:(cY(e,r.getPublic().mul(n)),0)},signatureNormalize(e){let t=new c$(e.subarray(0,32)),n=new c$(e.subarray(32,64));return t.cmp(cV.n)>=0||n.cmp(cV.n)>=0?1:(1===n.cmp(cH.nh)&&e.set(cV.n.sub(n).toArrayLike(Uint8Array,"be",32),32),0)},signatureExport(e,t){let n=t.subarray(0,32),r=t.subarray(32,64);if(new c$(n).cmp(cV.n)>=0||new c$(r).cmp(cV.n)>=0)return 1;let{output:i}=e,o=i.subarray(4,37);o[0]=0,o.set(n,1);let a=33,s=0;for(;a>1&&0===o[s]&&!(128&o[s+1]);--a,++s);if(128&(o=o.subarray(s))[0]||a>1&&0===o[0]&&!(128&o[1]))return 1;let l=i.subarray(39,72);l[0]=0,l.set(r,1);let u=33,c=0;for(;u>1&&0===l[c]&&!(128&l[c+1]);--u,++c);return 128&(l=l.subarray(c))[0]||u>1&&0===l[0]&&!(128&l[1])?1:(e.outputlen=6+a+u,i[0]=48,i[1]=e.outputlen-2,i[2]=2,i[3]=o.length,i.set(o,4),i[4+a]=2,i[5+a]=l.length,i.set(l,6+a),0)},signatureImport(e,t){if(t.length<8||t.length>72||48!==t[0]||t[1]!==t.length-2||2!==t[2])return 1;let n=t[3];if(0===n||5+n>=t.length||2!==t[4+n])return 1;let r=t[5+n];if(0===r||6+n+r!==t.length||128&t[4]||n>1&&0===t[4]&&!(128&t[5])||128&t[n+6]||r>1&&0===t[n+6]&&!(128&t[n+7]))return 1;let i=t.subarray(4,4+n);if(33===i.length&&0===i[0]&&(i=i.subarray(1)),i.length>32)return 1;let o=t.subarray(6+n);if(33===o.length&&0===o[0]&&(o=o.slice(1)),o.length>32)throw Error("S length is too long");let a=new c$(i);a.cmp(cV.n)>=0&&(a=new c$(0));let s=new c$(t.subarray(6+n));return s.cmp(cV.n)>=0&&(s=new c$(0)),e.set(a.toArrayLike(Uint8Array,"be",32),0),e.set(s.toArrayLike(Uint8Array,"be",32),32),0},ecdsaSign(e,t,n,r,i){let o;if(i){let e=i;i=i=>{let o=e(t,n,null,r,i);if(!(o instanceof Uint8Array&&32===o.length))throw Error("This is the way");return new c$(o)}}let a=new c$(n);if(a.cmp(cV.n)>=0||a.isZero())return 1;try{o=cH.sign(t,n,{canonical:!0,k:i,pers:r})}catch(e){return 1}return e.signature.set(o.r.toArrayLike(Uint8Array,"be",32),0),e.signature.set(o.s.toArrayLike(Uint8Array,"be",32),32),e.recid=o.recoveryParam,0},ecdsaVerify(e,t,n){let r={r:e.subarray(0,32),s:e.subarray(32,64)},i=new c$(r.r),o=new c$(r.s);if(i.cmp(cV.n)>=0||o.cmp(cV.n)>=0)return 1;if(1===o.cmp(cH.nh)||i.isZero()||o.isZero())return 3;let a=cW(n);if(null===a)return 2;let s=a.getPublic();return cH.verify(t,r,s)?0:3},ecdsaRecover(e,t,n,r){let i;let o={r:t.slice(0,32),s:t.slice(32,64)},a=new c$(o.r),s=new c$(o.s);if(a.cmp(cV.n)>=0||s.cmp(cV.n)>=0)return 1;if(a.isZero()||s.isZero())return 2;try{i=cH.recoverPubKey(r,o,n)}catch(e){return 2}return cY(e,i),0},ecdh(e,t,n,r,i,o,a){let s=cW(t);if(null===s)return 1;let l=new c$(n);if(l.cmp(cV.n)>=0||l.isZero())return 2;let u=s.getPublic().mul(l);if(void 0===i){let t=u.encode(null,!0),n=cH.hash().update(t).digest();for(let t=0;t<32;++t)e[t]=n[t]}else{o||(o=new Uint8Array(32));let t=u.getX().toArray("be",32);for(let e=0;e<32;++e)o[e]=t[e];a||(a=new Uint8Array(32));let n=u.getY().toArray("be",32);for(let e=0;e<32;++e)a[e]=n[e];let s=i(o,a,r);if(!(s instanceof Uint8Array&&s.length===e.length))return 2;e.set(s)}return 0}},{contextRandomize(e){if(l3(null===e||e instanceof Uint8Array,"Expected seed to be an Uint8Array or null"),null!==e&&l6("seed",e,32),1===i.contextRandomize(e))throw Error("Unknow error on context randomization")},privateKeyVerify:e=>(l6("private key",e,32),0===i.privateKeyVerify(e)),privateKeyNegate(e){switch(l6("private key",e,32),i.privateKeyNegate(e)){case 0:return e;case 1:throw Error(lZ)}},privateKeyTweakAdd(e,t){switch(l6("private key",e,32),l6("tweak",t,32),i.privateKeyTweakAdd(e,t)){case 0:return e;case 1:throw Error(lJ)}},privateKeyTweakMul(e,t){switch(l6("private key",e,32),l6("tweak",t,32),i.privateKeyTweakMul(e,t)){case 0:return e;case 1:throw Error(lX)}},publicKeyVerify:e=>(l6("public key",e,[33,65]),0===i.publicKeyVerify(e)),publicKeyCreate(e,t=!0,n){switch(l6("private key",e,32),l4(t),n=l8(n,t?33:65),i.publicKeyCreate(n,e)){case 0:return n;case 1:throw Error("Private Key is invalid");case 2:throw Error(l1)}},publicKeyConvert(e,t=!0,n){switch(l6("public key",e,[33,65]),l4(t),n=l8(n,t?33:65),i.publicKeyConvert(n,e)){case 0:return n;case 1:throw Error(l0);case 2:throw Error(l1)}},publicKeyNegate(e,t=!0,n){switch(l6("public key",e,[33,65]),l4(t),n=l8(n,t?33:65),i.publicKeyNegate(n,e)){case 0:return n;case 1:throw Error(l0);case 2:throw Error(lZ);case 3:throw Error(l1)}},publicKeyCombine(e,t=!0,n){for(let t of(l3(Array.isArray(e),"Expected public keys to be an Array"),l3(e.length>0,"Expected public keys array will have more than zero items"),e))l6("public key",t,[33,65]);switch(l4(t),n=l8(n,t?33:65),i.publicKeyCombine(n,e)){case 0:return n;case 1:throw Error(l0);case 2:throw Error("The sum of the public keys is not valid");case 3:throw Error(l1)}},publicKeyTweakAdd(e,t,n=!0,r){switch(l6("public key",e,[33,65]),l6("tweak",t,32),l4(n),r=l8(r,n?33:65),i.publicKeyTweakAdd(r,e,t)){case 0:return r;case 1:throw Error(l0);case 2:throw Error(lJ)}},publicKeyTweakMul(e,t,n=!0,r){switch(l6("public key",e,[33,65]),l6("tweak",t,32),l4(n),r=l8(r,n?33:65),i.publicKeyTweakMul(r,e,t)){case 0:return r;case 1:throw Error(l0);case 2:throw Error(lX)}},signatureNormalize(e){switch(l6("signature",e,64),i.signatureNormalize(e)){case 0:return e;case 1:throw Error(l2)}},signatureExport(e,t){l6("signature",e,64);let n={output:t=l8(t,72),outputlen:72};switch(i.signatureExport(n,e)){case 0:return t.slice(0,n.outputlen);case 1:throw Error(l2);case 2:throw Error(lZ)}},signatureImport(e,t){switch(l6("signature",e),t=l8(t,64),i.signatureImport(t,e)){case 0:return t;case 1:throw Error(l2);case 2:throw Error(lZ)}},ecdsaSign(e,t,n={},r){l6("message",e,32),l6("private key",t,32),l3("Object"===l5(n),"Expected options to be an Object"),void 0!==n.data&&l6("options.data",n.data),void 0!==n.noncefn&&l3("Function"===l5(n.noncefn),"Expected options.noncefn to be a Function");let o={signature:r=l8(r,64),recid:null};switch(i.ecdsaSign(o,e,t,n.data,n.noncefn)){case 0:return o;case 1:throw Error("The nonce generation function failed, or the private key was invalid");case 2:throw Error(lZ)}},ecdsaVerify(e,t,n){switch(l6("signature",e,64),l6("message",t,32),l6("public key",n,[33,65]),i.ecdsaVerify(e,t,n)){case 0:return!0;case 3:return!1;case 1:throw Error(l2);case 2:throw Error(l0)}},ecdsaRecover(e,t,n,r=!0,o){switch(l6("signature",e,64),l3("Number"===l5(t)&&t>=0&&t<=3,"Expected recovery id to be a Number within interval [0, 3]"),l6("message",n,32),l4(r),o=l8(o,r?33:65),i.ecdsaRecover(o,e,t,n)){case 0:return o;case 1:throw Error(l2);case 2:throw Error("Public key could not be recover");case 3:throw Error(lZ)}},ecdh(e,t,n={},r){switch(l6("public key",e,[33,65]),l6("private key",t,32),l3("Object"===l5(n),"Expected options to be an Object"),void 0!==n.data&&l6("options.data",n.data),void 0!==n.hashfn?(l3("Function"===l5(n.hashfn),"Expected options.hashfn to be a Function"),void 0!==n.xbuf&&l6("options.xbuf",n.xbuf,32),void 0!==n.ybuf&&l6("options.ybuf",n.ybuf,32),l6("output",r)):r=l8(r,32),i.ecdh(r,e,t,n.data,n.hashfn,n.xbuf,n.ybuf)){case 0:return r;case 1:throw Error(l0);case 2:throw Error("Scalar was invalid (zero or overflow)")}}}),cQ={},cZ={};Object.defineProperty(cZ,"__esModule",{value:!0}),cZ.SECRET_KEY_LENGTH=cZ.AES_IV_PLUS_TAG_LENGTH=cZ.AES_TAG_LENGTH=cZ.AES_IV_LENGTH=cZ.UNCOMPRESSED_PUBLIC_KEY_SIZE=void 0,cZ.UNCOMPRESSED_PUBLIC_KEY_SIZE=65,cZ.AES_IV_LENGTH=16,cZ.AES_TAG_LENGTH=16,cZ.AES_IV_PLUS_TAG_LENGTH=cZ.AES_IV_LENGTH+cZ.AES_TAG_LENGTH,cZ.SECRET_KEY_LENGTH=32;var cJ=l&&l.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(cQ,"__esModule",{value:!0}),cQ.aesDecrypt=cQ.aesEncrypt=cQ.getValidSecret=cQ.decodeHex=cQ.remove0x=void 0;var cX=lq(),c0=cJ(cG);function c1(e){return e.startsWith("0x")||e.startsWith("0X")?e.slice(2):e}cQ.remove0x=c1,cQ.decodeHex=function(e){return M.from(c1(e),"hex")},cQ.getValidSecret=function(){var e;do e=(0,cX.randomBytes)(cZ.SECRET_KEY_LENGTH);while(!c0.default.privateKeyVerify(e));return e},cQ.aesEncrypt=function(e,t){var n=(0,cX.randomBytes)(cZ.AES_IV_LENGTH),r=(0,cX.createCipheriv)("aes-256-gcm",e,n),i=M.concat([r.update(t),r.final()]),o=r.getAuthTag();return M.concat([n,o,i])},cQ.aesDecrypt=function(e,t){var n=t.slice(0,cZ.AES_IV_LENGTH),r=t.slice(cZ.AES_IV_LENGTH,cZ.AES_IV_PLUS_TAG_LENGTH),i=t.slice(cZ.AES_IV_PLUS_TAG_LENGTH),o=(0,cX.createDecipheriv)("aes-256-gcm",e,n);return o.setAuthTag(r),M.concat([o.update(i),o.final()])};var c2={},c3=l&&l.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(c2,"__esModule",{value:!0});var c6=c3(lQ),c4=c3(cG),c8=function(){function e(e){this.uncompressed=M.from(c4.default.publicKeyConvert(e,!1)),this.compressed=M.from(c4.default.publicKeyConvert(e,!0))}return e.fromHex=function(t){var n=(0,cQ.decodeHex)(t);if(n.length===cZ.UNCOMPRESSED_PUBLIC_KEY_SIZE-1){var r=M.from([4]);return new e(M.concat([r,n]))}return new e(n)},e.prototype.toHex=function(e){return void 0===e&&(e=!0),e?this.compressed.toString("hex"):this.uncompressed.toString("hex")},e.prototype.decapsulate=function(e){var t=M.concat([this.uncompressed,e.multiply(this)]);return(0,c6.default)(t,32,{hash:"SHA-256"})},e.prototype.equals=function(e){return this.uncompressed.equals(e.uncompressed)},e}();c2.default=c8;var c5=l&&l.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(en,"__esModule",{value:!0});var c7=c5(lQ),c9=c5(cG),de=c5(c2),dt=function(){function e(e){if(this.secret=e||(0,cQ.getValidSecret)(),!c9.default.privateKeyVerify(this.secret))throw Error("Invalid private key");this.publicKey=new de.default(M.from(c9.default.publicKeyCreate(this.secret)))}return e.fromHex=function(t){return new e((0,cQ.decodeHex)(t))},e.prototype.toHex=function(){return"0x".concat(this.secret.toString("hex"))},e.prototype.encapsulate=function(e){var t=M.concat([this.publicKey.uncompressed,this.multiply(e)]);return(0,c7.default)(t,32,{hash:"SHA-256"})},e.prototype.multiply=function(e){return M.from(c9.default.publicKeyTweakMul(e.compressed,this.secret,!1))},e.prototype.equals=function(e){return this.secret.equals(e.secret)},e}();en.default=dt,da=l&&l.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},Object.defineProperty(et,"__esModule",{value:!0}),et.PublicKey=et.PrivateKey=void 0,Object.defineProperty(et,"PrivateKey",{enumerable:!0,get:function(){return da(en).default}}),Object.defineProperty(et,"PublicKey",{enumerable:!0,get:function(){return da(c2).default}}),Object.defineProperty(ee,"__esModule",{value:!0}),ee.utils=ee.PublicKey=ee.PrivateKey=ee.decrypt=ee.encrypt=void 0,ee.encrypt=function(e,t){var n=new et.PrivateKey,r=e instanceof M?new et.PublicKey(e):et.PublicKey.fromHex(e),i=n.encapsulate(r),o=(0,cQ.aesEncrypt)(i,t);return M.concat([n.publicKey.uncompressed,o])},ee.decrypt=function(e,t){var n=e instanceof M?new et.PrivateKey(e):et.PrivateKey.fromHex(e),r=new et.PublicKey(t.slice(0,cZ.UNCOMPRESSED_PUBLIC_KEY_SIZE)),i=t.slice(cZ.UNCOMPRESSED_PUBLIC_KEY_SIZE),o=r.decapsulate(n);return(0,cQ.aesDecrypt)(o,i)},Object.defineProperty(ee,"PrivateKey",{enumerable:!0,get:function(){return et.PrivateKey}}),Object.defineProperty(ee,"PublicKey",{enumerable:!0,get:function(){return et.PublicKey}}),ee.utils={aesDecrypt:cQ.aesDecrypt,aesEncrypt:cQ.aesEncrypt,decodeHex:cQ.decodeHex,getValidSecret:cQ.getValidSecret,remove0x:cQ.remove0x};var dn={exports:{}};!function(e){var t=Object.hasOwnProperty,n=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},r="object"==typeof ex,i="function"==typeof Symbol,o="object"==typeof Reflect,a="function"==typeof setImmediate?setImmediate:setTimeout,s=i?o&&"function"==typeof Reflect.ownKeys?Reflect.ownKeys:function(e){var t=Object.getOwnPropertyNames(e);return t.push.apply(t,Object.getOwnPropertySymbols(e)),t}:Object.keys;function l(){this._events={},this._conf&&u.call(this,this._conf)}function u(t){t&&(this._conf=t,t.delimiter&&(this.delimiter=t.delimiter),t.maxListeners!==e&&(this._maxListeners=t.maxListeners),t.wildcard&&(this.wildcard=t.wildcard),t.newListener&&(this._newListener=t.newListener),t.removeListener&&(this._removeListener=t.removeListener),t.verboseMemoryLeak&&(this.verboseMemoryLeak=t.verboseMemoryLeak),t.ignoreErrors&&(this.ignoreErrors=t.ignoreErrors),this.wildcard&&(this.listenerTree={}))}function c(e,t){var n="(node) warning: possible EventEmitter memory leak detected. "+e+" listeners added. Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak&&(n+=" Event name: "+t+"."),void 0!==ex&&ex.emitWarning){var r=Error(n);r.name="MaxListenersExceededWarning",r.emitter=this,r.count=e,ex.emitWarning(r)}else console.error(n),console.trace&&console.trace()}var d=function(e,t,n){var r=arguments.length;switch(r){case 0:return[];case 1:return[e];case 2:return[e,t];case 3:return[e,t,n];default:for(var i=Array(r);r--;)i[r]=arguments[r];return i}};function f(t,n){for(var r={},i=t.length,o=n?n.length:0,a=0;a0;)if(o===e[a])return r;i(t)}}Object.assign(h.prototype,{subscribe:function(e,t,n){var r=this,i=this._target,o=this._emitter,a=this._listeners,s=function(){var r=d.apply(null,arguments),a={data:r,name:t,original:e};n?!1!==n.call(i,a)&&o.emit.apply(o,[a.name].concat(r)):o.emit.apply(o,[t].concat(r))};if(a[e])throw Error("Event '"+e+"' is already listening");this._listenersCount++,o._newListener&&o._removeListener&&!r._onNewListener?(this._onNewListener=function(n){n===t&&null===a[e]&&(a[e]=s,r._on.call(i,e,s))},o.on("newListener",this._onNewListener),this._onRemoveListener=function(n){n===t&&!o.hasListeners(n)&&a[e]&&(a[e]=null,r._off.call(i,e,s))},a[e]=null,o.on("removeListener",this._onRemoveListener)):(a[e]=s,r._on.call(i,e,s))},unsubscribe:function(e){var t,n,r,i=this,o=this._listeners,a=this._emitter,l=this._off,u=this._target;if(e&&"string"!=typeof e)throw TypeError("event must be a string");function c(){i._onNewListener&&(a.off("newListener",i._onNewListener),a.off("removeListener",i._onRemoveListener),i._onNewListener=null,i._onRemoveListener=null);var e=A.call(a,i);a._observers.splice(e,1)}if(e){if(!(t=o[e]))return;l.call(u,e,t),delete o[e],--this._listenersCount||c()}else{for(r=(n=s(o)).length;r-- >0;)e=n[r],l.call(u,e,o[e]);this._listeners={},this._listenersCount=0,c()}}});var v=g(["function"]),b=g(["object","function"]);function y(e,t,n){var r,i,o,a=0,s=new e(function(l,u,c){function d(){i&&(i=null),a&&(clearTimeout(a),a=0)}r=!(n=p(n,{timeout:0,overload:!1},{timeout:function(e,t){return("number"!=typeof(e*=1)||e<0||!Number.isFinite(e))&&t("timeout must be a positive number"),e}})).overload&&"function"==typeof e.prototype.cancel&&"function"==typeof c;var f=function(e){d(),l(e)},h=function(e){d(),u(e)};r?t(f,h,c):(i=[function(e){h(e||Error("canceled"))}],t(f,h,function(e){if(o)throw Error("Unable to subscribe on cancel event asynchronously");if("function"!=typeof e)throw TypeError("onCancel callback must be a function");i.push(e)}),o=!0),n.timeout>0&&(a=setTimeout(function(){var e=Error("timeout");e.code="ETIMEDOUT",a=0,s.cancel(e),u(e)},n.timeout))});return r||(s.cancel=function(e){if(i){for(var t=i.length,n=1;n0;)"_listeners"!==(h=b[l])&&(y=w(e,t,n[h],r+1,i))&&(A?A.push.apply(A,y):A=y);return A}if("**"===_){for((v=r+1===i||r+2===i&&"*"===E)&&n._listeners&&(A=w(e,t,n,i,i)),l=(b=s(n)).length;l-- >0;)"_listeners"!==(h=b[l])&&("*"===h||"**"===h?(n[h]._listeners&&!v&&(y=w(e,t,n[h],i,i))&&(A?A.push.apply(A,y):A=y),y=w(e,t,n[h],r,i)):y=w(e,t,n[h],h===E?r+2:r,i),y&&(A?A.push.apply(A,y):A=y));return A}n[_]&&(A=w(e,t,n[_],r+1,i))}if((p=n["*"])&&w(e,t,p,r+1,i),m=n["**"]){if(r0;)"_listeners"!==(h=b[l])&&(h===E?w(e,t,m[h],r+2,i):h===_?w(e,t,m[h],r+1,i):((g={})[h]=m[h],w(e,t,{"**":g},r+1,i)));else m._listeners?w(e,t,m,i,i):m["*"]&&m["*"]._listeners&&w(e,t,m["*"],i,i)}return A}function _(e,t,n){var r,i,o=0,a=0,s=this.delimiter,l=s.length;if("string"==typeof e){if(-1!==(r=e.indexOf(s))){i=[,,,,,];do i[o++]=e.slice(a,r),a=r+l;while(-1!==(r=e.indexOf(s,a)));i[o++]=e.slice(a)}else i=[e],o=1}else i=e,o=e.length;if(o>1){for(r=0;r+10&&d._listeners.length>this._maxListeners&&(d._listeners.warned=!0,c.call(this,d._listeners.length,u))):d._listeners=t,!0;return!0}function E(e,t,n,r){for(var i,o,a,l,u=s(e),c=u.length,d=e._listeners;c-- >0;)i=e[o=u[c]],a="_listeners"===o?n:n?n.concat(o):[o],l=r||"symbol"==typeof o,d&&t.push(l?a:a.join(this.delimiter)),"object"==typeof i&&E.call(this,i,t,a,l);return t}function S(e){for(var t,n,r,i=s(e),o=i.length;o-- >0;)(t=e[n=i[o]])&&(r=!0,"_listeners"===n||S(t)||delete e[n]);return r}function k(e,t,n){this.emitter=e,this.event=t,this.listener=n}function M(t,n,i){if(!0===i)s=!0;else if(!1===i)o=!0;else{if(!i||"object"!=typeof i)throw TypeError("options should be an object or true");var o=i.async,s=i.promisify,l=i.nextTick,u=i.objectify}if(o||l||s){var c=n,d=n._origin||n;if(l&&!r)throw Error("process.nextTick is not supported");s===e&&(s="AsyncFunction"===n.constructor.name),(n=function(){var e=arguments,t=this,n=this.event;return s?l?Promise.resolve():new Promise(function(e){a(e)}).then(function(){return t.event=n,c.apply(t,e)}):(l?ew:a)(function(){t.event=n,c.apply(t,e)})})._async=!0,n._origin=d}return[n,u?new k(this,t,n):this]}function C(e){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,u.call(this,e)}k.prototype.off=function(){return this.emitter.off(this.event,this.listener),this},C.EventEmitter2=C,C.prototype.listenTo=function(t,r,i){if("object"!=typeof t)throw TypeError("target musts be an object");var o=this;return i=p(i,{on:e,off:e,reducers:e},{on:v,off:v,reducers:b}),function(e){if("object"!=typeof e)throw TypeError("events must be an object");var n,r=i.reducers,a=A.call(o,t);n=-1===a?new h(o,t,i):o._observers[a];for(var l,u=s(e),c=u.length,d="function"==typeof r,f=0;f0;)r=n[i],e&&r._target!==e||(r.unsubscribe(t),o=!0);return o},C.prototype.delimiter=".",C.prototype.setMaxListeners=function(t){t!==e&&(this._maxListeners=t,this._conf||(this._conf={}),this._conf.maxListeners=t)},C.prototype.getMaxListeners=function(){return this._maxListeners},C.prototype.event="",C.prototype.once=function(e,t,n){return this._once(e,t,!1,n)},C.prototype.prependOnceListener=function(e,t,n){return this._once(e,t,!0,n)},C.prototype._once=function(e,t,n,r){return this._many(e,1,t,n,r)},C.prototype.many=function(e,t,n,r){return this._many(e,t,n,!1,r)},C.prototype.prependMany=function(e,t,n,r){return this._many(e,t,n,!0,r)},C.prototype._many=function(e,t,n,r,i){var o=this;if("function"!=typeof n)throw Error("many only accepts instances of Function");function a(){return 0==--t&&o.off(e,a),n.apply(this,arguments)}return a._origin=n,this._on(e,a,r,i)},C.prototype.emit=function(){if(!this._events&&!this._all)return!1;this._events||l.call(this);var e,t,n,r,o,a,s=arguments[0],u=this.wildcard;if("newListener"===s&&!this._newListener&&!this._events.newListener)return!1;if(u&&(e=s,"newListener"!==s&&"removeListener"!==s&&"object"==typeof s)){if(n=s.length,i){for(r=0;r3)for(t=Array(d-1),o=1;o3)for(n=Array(f-1),a=1;a0&&this._events[t].length>this._maxListeners&&(this._events[t].warned=!0,c.call(this,this._events[t].length,t))):this._events[t]=n,a},C.prototype.off=function(e,t){if("function"!=typeof t)throw Error("removeListener only takes instances of Function");var r,i=[];if(this.wildcard){var o="string"==typeof e?e.split(this.delimiter):e.slice();if(!(i=w.call(this,null,o,this.listenerTree,0)))return this}else{if(!this._events[e])return this;r=this._events[e],i.push({_listeners:r})}for(var a=0;a0){for(n=0,r=(t=this._all).length;n0;)"function"==typeof(r=l[n[o]])?i.push(r):i.push.apply(i,r);return i}if(this.wildcard){if(!(a=this.listenerTree))return[];var u=[],c="string"==typeof t?t.split(this.delimiter):t.slice();return w.call(this,u,c,a,0),u}return l&&(r=l[t])?"function"==typeof r?[r]:r:[]},C.prototype.eventNames=function(e){var t=this._events;return this.wildcard?E.call(this,this.listenerTree,[],null,e):t?s(t):[]},C.prototype.listenerCount=function(e){return this.listeners(e).length},C.prototype.hasListeners=function(t){if(this.wildcard){var n=[],r="string"==typeof t?t.split(this.delimiter):t.slice();return w.call(this,n,r,this.listenerTree,0),n.length>0}var i=this._events,o=this._all;return!!(o&&o.length||i&&(t===e?s(i).length:i[t]))},C.prototype.listenersAny=function(){return this._all?this._all:[]},C.prototype.waitFor=function(t,n){var r=this,i=typeof n;return"number"===i?n={timeout:n}:"function"===i&&(n={filter:n}),y((n=p(n,{timeout:0,filter:e,handleError:!1,Promise:Promise,overload:!1},{filter:v,Promise:m})).Promise,function(e,i,o){function a(){var o=n.filter;if(!o||o.apply(r,arguments)){if(r.off(t,a),n.handleError){var s=arguments[0];s?i(s):e(d.apply(null,arguments).slice(1))}else e(d.apply(null,arguments))}}o(function(){r.off(t,a)}),r._on(t,a,!1)},{timeout:n.timeout,overload:n.overload})};var x=C.prototype;Object.defineProperties(C,{defaultMaxListeners:{get:function(){return x._maxListeners},set:function(e){if("number"!=typeof e||e<0||Number.isNaN(e))throw TypeError("n must be a non-negative number");x._maxListeners=e},enumerable:!0},once:{value:function(e,t,n){return y((n=p(n,{Promise:Promise,timeout:0,overload:!1},{Promise:m})).Promise,function(n,r,i){if("function"==typeof e.addEventListener)return o=function(){n(d.apply(null,arguments))},i(function(){e.removeEventListener(t,o)}),void e.addEventListener(t,o,{once:!0});var o,a,s=function(){a&&e.removeListener("error",a),n(d.apply(null,arguments))};"error"!==t&&(a=function(n){e.removeListener(t,s),r(n)},e.once("error",a)),i(function(){a&&e.removeListener("error",a),e.removeListener(t,s)}),e.once(t,s)},{timeout:n.timeout,overload:n.overload})},writable:!0,configurable:!0}}),Object.defineProperties(x,{_maxListeners:{value:10,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),"function"==typeof e&&e.amd?e(function(){return C}):dn.exports=C}();var dr,di,da,ds,dl=dn.exports,du=new Uint8Array(16),dc=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function dd(e){return"string"==typeof e&&dc.test(e)}for(var df=[],dh=0;dh<256;++dh)df.push((dh+256).toString(16).substr(1));function dp(e,t,n){var r=(e=e||{}).random||(e.rng||function(){if(!ds&&!(ds="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ds(du)})();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(var i=0;i<16;++i)t[n+i]=r[i];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(df[e[t+0]]+df[e[t+1]]+df[e[t+2]]+df[e[t+3]]+"-"+df[e[t+4]]+df[e[t+5]]+"-"+df[e[t+6]]+df[e[t+7]]+"-"+df[e[t+8]]+df[e[t+9]]+"-"+df[e[t+10]]+df[e[t+11]]+df[e[t+12]]+df[e[t+13]]+df[e[t+14]]+df[e[t+15]]).toLowerCase();if(!dd(n))throw TypeError("Stringified UUID is invalid");return n}(r)}let dm=Object.create(null);dm.open="0",dm.close="1",dm.ping="2",dm.pong="3",dm.message="4",dm.upgrade="5",dm.noop="6";let dg=Object.create(null);Object.keys(dm).forEach(e=>{dg[dm[e]]=e});let dv={type:"error",data:"parser error"},db="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),dy="function"==typeof ArrayBuffer,dA=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,dw=({type:e,data:t},n,r)=>db&&t instanceof Blob?n?r(t):d_(t,r):dy&&(t instanceof ArrayBuffer||dA(t))?n?r(t):d_(new Blob([t]),r):r(dm[e]+(t||"")),d_=(e,t)=>{let n=new FileReader;return n.onload=function(){t("b"+(n.result.split(",")[1]||""))},n.readAsDataURL(e)};function dE(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let dS="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e<64;e++)dS["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(e)]=e;let dk="function"==typeof ArrayBuffer,dM=(e,t)=>{if("string"!=typeof e)return{type:"message",data:dx(e,t)};let n=e.charAt(0);return"b"===n?{type:"message",data:dC(e.substring(1),t)}:dg[n]?e.length>1?{type:dg[n],data:e.substring(1)}:{type:dg[n]}:dv},dC=(e,t)=>dk?dx((e=>{let t,n,r,i,o,a=.75*e.length,s=e.length,l=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);let u=new ArrayBuffer(a),c=new Uint8Array(u);for(t=0;t>4,c[l++]=(15&r)<<4|i>>2,c[l++]=(3&i)<<6|63&o;return u})(e),t):{base64:!0,data:e},dx=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer;function dR(e){if(e)return function(e){for(var t in dR.prototype)e[t]=dR.prototype[t];return e}(e)}dR.prototype.on=dR.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},dR.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},dR.prototype.off=dR.prototype.removeListener=dR.prototype.removeAllListeners=dR.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var i=0;i(e.hasOwnProperty(n)&&(t[n]=e[n]),t),{})}let dO=dI.setTimeout,dP=dI.clearTimeout;function dL(e,t){t.useNativeTimers?(e.setTimeoutFn=dO.bind(dI),e.clearTimeoutFn=dP.bind(dI)):(e.setTimeoutFn=dI.setTimeout.bind(dI),e.clearTimeoutFn=dI.clearTimeout.bind(dI))}class dN extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type="TransportError"}}class dD extends dR{constructor(e){super(),this.writable=!1,dL(this,e),this.opts=e,this.query=e.query,this.socket=e.socket}onError(e,t,n){return super.emitReserved("error",new dN(e,t,n)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(e){"open"===this.readyState&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){let t=dM(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){let e=this.opts.hostname;return -1===e.indexOf(":")?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(443!==this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(e){let t=function(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}(e);return t.length?"?"+t:""}}let dB="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),dj={},dF,dz=0,dU=0;function dq(e){let t="";do t=dB[e%64]+t,e=Math.floor(e/64);while(e>0);return t}function dK(){let e=dq(+new Date);return e!==dF?(dz=0,dF=e):e+"."+dq(dz++)}for(;dU<64;dU++)dj[dB[dU]]=dU;let dH=!1;try{dH="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(e){}let dV=dH;function d$(e){let t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||dV))return new XMLHttpRequest}catch(e){}if(!t)try{return new dI[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch(e){}}function dW(){}let dY=null!=new d$({xdomain:!1}).responseType;class dG extends dR{constructor(e,t){super(),dL(this,t),this.opts=t,this.method=t.method||"GET",this.uri=e,this.data=void 0!==t.data?t.data:null,this.create()}create(){var e;let t=dT(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this.opts.xd;let n=this.xhr=new d$(t);try{n.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders)for(let e in n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0),this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(e)&&n.setRequestHeader(e,this.opts.extraHeaders[e])}catch(e){}if("POST"===this.method)try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{n.setRequestHeader("Accept","*/*")}catch(e){}null===(e=this.opts.cookieJar)||void 0===e||e.addCookies(n),"withCredentials"in n&&(n.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(n.timeout=this.opts.requestTimeout),n.onreadystatechange=()=>{var e;3===n.readyState&&(null===(e=this.opts.cookieJar)||void 0===e||e.parseCookies(n)),4===n.readyState&&(200===n.status||1223===n.status?this.onLoad():this.setTimeoutFn(()=>{this.onError("number"==typeof n.status?n.status:0)},0))},n.send(this.data)}catch(e){return void this.setTimeoutFn(()=>{this.onError(e)},0)}"undefined"!=typeof document&&(this.index=dG.requestsCount++,dG.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(e){if(void 0!==this.xhr&&null!==this.xhr){if(this.xhr.onreadystatechange=dW,e)try{this.xhr.abort()}catch(e){}"undefined"!=typeof document&&delete dG.requests[this.index],this.xhr=null}}onLoad(){let e=this.xhr.responseText;null!==e&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}function dQ(){for(let e in dG.requests)dG.requests.hasOwnProperty(e)&&dG.requests[e].abort()}dG.requestsCount=0,dG.requests={},"undefined"!=typeof document&&("function"==typeof attachEvent?attachEvent("onunload",dQ):"function"==typeof addEventListener&&addEventListener("onpagehide"in dI?"pagehide":"unload",dQ,!1));let dZ="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),dJ=dI.WebSocket||dI.MozWebSocket,dX="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase(),d0={websocket:class extends dD{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;let e=this.uri(),t=this.opts.protocols,n=dX?{}:dT(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=dX?new dJ(e,t,n):t?new dJ(e,t):new dJ(e)}catch(e){return this.emitReserved("error",e)}this.ws.binaryType=this.socket.binaryType||"arraybuffer",this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t{try{this.ws.send(e)}catch(e){}r&&dZ(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){void 0!==this.ws&&(this.ws.close(),this.ws=null)}uri(){let e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=dK()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}check(){return!!dJ}},webtransport:class extends dD{get name(){return"webtransport"}doOpen(){"function"==typeof WebTransport&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(e=>{let t;let n=e.readable.getReader();this.writer=e.writable.getWriter();let i=()=>{n.read().then(({done:e,value:n})=>{var o,a;e||(t||1!==n.byteLength||54!==n[0]?(this.onPacket((o=t,a="arraybuffer",r||(r=new TextDecoder),dM(o||n[0]<48||n[0]>54?n:r.decode(n),a))),t=!1):t=!0,i())}).catch(e=>{})};i();let o=this.query.sid?`0{"sid":"${this.query.sid}"}`:"0";this.writer.write((new TextEncoder).encode(o)).then(()=>this.onOpen())})}))}write(e){this.writable=!1;for(let n=0;n{t||(t=new TextEncoder),n(t.encode(e))})}(r,e=>{"message"===r.type&&"string"!=typeof r.data&&e[0]>=48&&e[0]<=54&&this.writer.write(Uint8Array.of(54)),this.writer.write(e).then(()=>{i&&dZ(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})})}}doClose(){var e;null===(e=this.transport)||void 0===e||e.close()}},polling:class extends dD{constructor(e){if(super(e),this.polling=!1,"undefined"!=typeof location){let t="https:"===location.protocol,n=location.port;n||(n=t?"443":"80"),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||n!==e.port}let t=e&&e.forceBase64;this.supportsBinary=dY&&!t,this.opts.withCredentials&&(this.cookieJar=void 0)}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";let t=()=>{this.readyState="paused",e()};if(this.polling||!this.writable){let e=0;this.polling&&(e++,this.once("pollComplete",function(){--e||t()})),this.writable||(e++,this.once("drain",function(){--e||t()}))}else t()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){((e,t)=>{let n=e.split("\x1e"),r=[];for(let e=0;e{if("opening"===this.readyState&&"open"===e.type&&this.onOpen(),"close"===e.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(e)}),"closed"!==this.readyState&&(this.polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this.poll())}doClose(){let e=()=>{this.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}write(e){this.writable=!1,((e,t)=>{let n=e.length,r=Array(n),i=0;e.forEach((e,o)=>{dw(e,!1,e=>{r[o]=e,++i===n&&t(r.join("\x1e"))})})})(e,e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let e=this.opts.secure?"https":"http",t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=dK()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}request(e={}){return Object.assign(e,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new dG(this.uri(),e)}doWrite(e,t){let n=this.request({method:"POST",data:e});n.on("success",t),n.on("error",(e,t)=>{this.onError("xhr post error",e,t)})}doPoll(){let e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(e,t)=>{this.onError("xhr poll error",e,t)}),this.pollXhr=e}}},d1=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,d2=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function d3(e){let t=e,n=e.indexOf("["),r=e.indexOf("]");-1!=n&&-1!=r&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let i=d1.exec(e||""),o={},a=14;for(;a--;)o[d2[a]]=i[a]||"";return -1!=n&&-1!=r&&(o.source=t,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=function(e,t){let n=t.replace(/\/{2,9}/g,"/").split("/");return"/"!=t.slice(0,1)&&0!==t.length||n.splice(0,1),"/"==t.slice(-1)&&n.splice(n.length-1,1),n}(0,o.path),o.queryKey=function(e,t){let n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,t,r){t&&(n[t]=r)}),n}(0,o.query),o}let d6=class e extends dR{constructor(e,t={}){super(),this.writeBuffer=[],e&&"object"==typeof e&&(t=e,e=null),e?(e=d3(e),t.hostname=e.host,t.secure="https"===e.protocol||"wss"===e.protocol,t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=d3(t.host).host),dL(this,t),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=t.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(e){let t={},n=e.split("&");for(let e=0,r=n.length;e{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){let t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);let n=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new d0[e](n)}open(){let t;if(this.opts.rememberUpgrade&&e.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))t="websocket";else{if(0===this.transports.length)return void this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);t=this.transports[0]}this.readyState="opening";try{t=this.createTransport(t)}catch(e){return this.transports.shift(),void this.open()}t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",e=>this.onClose("transport close",e))}probe(t){let n=this.createTransport(t),r=!1;e.priorWebsocketSuccess=!1;let i=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",t=>{if(!r){if("pong"===t.type&&"probe"===t.data)this.upgrading=!0,this.emitReserved("upgrading",n),n&&(e.priorWebsocketSuccess="websocket"===n.name,this.transport.pause(()=>{r||"closed"!==this.readyState&&(c(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())}));else{let e=Error("probe error");e.transport=n.name,this.emitReserved("upgradeError",e)}}}))};function o(){r||(r=!0,c(),n.close(),n=null)}let a=e=>{let t=Error("probe error: "+e);t.transport=n.name,o(),this.emitReserved("upgradeError",t)};function s(){a("transport closed")}function l(){a("socket closed")}function u(e){n&&e.name!==n.name&&o()}let c=()=>{n.removeListener("open",i),n.removeListener("error",a),n.removeListener("close",s),this.off("close",l),this.off("upgrading",u)};n.once("open",i),n.once("error",a),n.once("close",s),this.once("close",l),this.once("upgrading",u),-1!==this.upgrades.indexOf("webtransport")&&"webtransport"!==t?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onOpen(){if(this.readyState="open",e.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush(),"open"===this.readyState&&this.opts.upgrade){let e=0,t=this.upgrades.length;for(;e{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let e=this.getWritablePackets();this.transport.send(e),this.prevBufferLen=e.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let t=0;t=57344?n+=3:(r++,n+=4);return n}(n):Math.ceil(1.33*(n.byteLength||n.size))),t>0&&e>this.maxPayload)return this.writeBuffer.slice(0,t);e+=2}return this.writeBuffer}write(e,t,n){return this.sendPacket("message",e,t,n),this}send(e,t,n){return this.sendPacket("message",e,t,n),this}sendPacket(e,t,n,r){if("function"==typeof t&&(r=t,t=void 0),"function"==typeof n&&(r=n,n=null),"closing"===this.readyState||"closed"===this.readyState)return;(n=n||{}).compress=!1!==n.compress;let i={type:e,data:t,options:n};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),r&&this.once("flush",r),this.flush()}close(){let e=()=>{this.onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},n=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?n():e()}):this.upgrading?n():e()),this}onError(t){e.priorWebsocketSuccess=!1,this.emitReserved("error",t),this.onClose("transport error",t)}onClose(e,t){"opening"!==this.readyState&&"open"!==this.readyState&&"closing"!==this.readyState||(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),"function"==typeof removeEventListener&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){let t=[],n=0,r=e.length;for(;n"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,d5=Object.prototype.toString,d7="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===d5.call(Blob),d9="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===d5.call(File);function fe(e){return d4&&(e instanceof ArrayBuffer||d8(e))||d7&&e instanceof Blob||d9&&e instanceof File}let ft=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];function fn(e){return"[object Object]"===Object.prototype.toString.call(e)}(fy=fA||(fA={}))[fy.CONNECT=0]="CONNECT",fy[fy.DISCONNECT=1]="DISCONNECT",fy[fy.EVENT=2]="EVENT",fy[fy.ACK=3]="ACK",fy[fy.CONNECT_ERROR=4]="CONNECT_ERROR",fy[fy.BINARY_EVENT=5]="BINARY_EVENT",fy[fy.BINARY_ACK=6]="BINARY_ACK";class fr extends dR{constructor(e){super(),this.reviver=e}add(e){let t;if("string"==typeof e){if(this.reconstructor)throw Error("got plaintext data when reconstructing a packet");let n=(t=this.decodeString(e)).type===fA.BINARY_EVENT;n||t.type===fA.BINARY_ACK?(t.type=n?fA.EVENT:fA.ACK,this.reconstructor=new fi(t),0===t.attachments&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else{if(!fe(e)&&!e.base64)throw Error("Unknown type: "+e);if(!this.reconstructor)throw Error("got binary data when not reconstructing a packet");(t=this.reconstructor.takeBinaryData(e))&&(this.reconstructor=null,super.emitReserved("decoded",t))}}decodeString(e){let t=0,n={type:Number(e.charAt(0))};if(void 0===fA[n.type])throw Error("unknown packet type "+n.type);if(n.type===fA.BINARY_EVENT||n.type===fA.BINARY_ACK){let r=t+1;for(;"-"!==e.charAt(++t)&&t!=e.length;);let i=e.substring(r,t);if(i!=Number(i)||"-"!==e.charAt(t))throw Error("Illegal attachments");n.attachments=Number(i)}if("/"===e.charAt(t+1)){let r=t+1;for(;++t&&","!==e.charAt(t)&&t!==e.length;);n.nsp=e.substring(r,t)}else n.nsp="/";let r=e.charAt(t+1);if(""!==r&&Number(r)==r){let r=t+1;for(;++t;){let n=e.charAt(t);if(null==n||Number(n)!=n){--t;break}if(t===e.length)break}n.id=Number(e.substring(r,t+1))}if(e.charAt(++t)){let r=this.tryParse(e.substr(t));if(!fr.isPayloadValid(n.type,r))throw Error("invalid payload");n.data=r}return n}tryParse(e){try{return JSON.parse(e,this.reviver)}catch(e){return!1}}static isPayloadValid(e,t){switch(e){case fA.CONNECT:return fn(t);case fA.DISCONNECT:return void 0===t;case fA.CONNECT_ERROR:return"string"==typeof t||fn(t);case fA.EVENT:case fA.BINARY_EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===ft.indexOf(t[0]));case fA.ACK:case fA.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class fi{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){var t,n;let e=(t=this.reconPack,n=this.buffers,t.data=function e(t,n){if(!t)return t;if(t&&!0===t._placeholder){if("number"==typeof t.num&&t.num>=0&&t.num{delete this.acks[e];for(let t=0;t{this.io.clearTimeoutFn(i),t.apply(this,[null,...e])}}emitWithAck(e,...t){let n=void 0!==this.flags.timeout||void 0!==this._opts.ackTimeout;return new Promise((r,i)=>{t.push((e,t)=>n?e?i(e):r(t):r(e)),this.emit(e,...t)})}_addToQueue(e){let t;"function"==typeof e[e.length-1]&&(t=e.pop());let n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((e,...r)=>{if(n===this._queue[0])return null!==e?n.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)):(this._queue.shift(),t&&t(null,...r)),n.pending=!1,this._drainQueue()}),this._queue.push(n),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||0===this._queue.length)return;let t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){"function"==typeof this.auth?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:fA.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t)}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case fA.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case fA.EVENT:case fA.BINARY_EVENT:this.onevent(e);break;case fA.ACK:case fA.BINARY_ACK:this.onack(e);break;case fA.DISCONNECT:this.ondisconnect();break;case fA.CONNECT_ERROR:this.destroy();let t=Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t)}}onevent(e){let t=e.data||[];null!=e.id&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length)for(let t of this._anyListeners.slice())t.apply(this,e);super.emit.apply(this,e),this._pid&&e.length&&"string"==typeof e[e.length-1]&&(this._lastOffset=e[e.length-1])}ack(e){let t=this,n=!1;return function(...r){n||(n=!0,t.packet({type:fA.ACK,id:e,data:r}))}}onack(e){let t=this.acks[e.id];"function"==typeof t&&(t.apply(this,e.data),delete this.acks[e.id])}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:fA.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){let t=this._anyListeners;for(let n=0;n0&&e.jitter<=1?e.jitter:0,this.attempts=0}fu.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=0==(1&Math.floor(10*t))?e-n:e+n}return 0|Math.min(e,this.max)},fu.prototype.reset=function(){this.attempts=0},fu.prototype.setMin=function(e){this.ms=e},fu.prototype.setMax=function(e){this.max=e},fu.prototype.setJitter=function(e){this.jitter=e};class fc extends dR{constructor(e,t){var n;super(),this.nsps={},this.subs=[],e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.opts=t,dL(this,t),this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(n=t.randomizationFactor)&&void 0!==n?n:.5),this.backoff=new fu({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this._readyState="closed",this.uri=e;let r=t.parser||fo;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=!1!==t.autoConnect,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return void 0===e?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return void 0===e?this._reconnectionDelay:(this._reconnectionDelay=e,null===(t=this.backoff)||void 0===t||t.setMin(e),this)}randomizationFactor(e){var t;return void 0===e?this._randomizationFactor:(this._randomizationFactor=e,null===(t=this.backoff)||void 0===t||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return void 0===e?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,null===(t=this.backoff)||void 0===t||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new d6(this.uri,this.opts);let t=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;let r=fa(t,"open",function(){n.onopen(),e&&e()}),i=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},o=fa(t,"error",i);if(!1!==this._timeout){let e=this._timeout,n=this.setTimeoutFn(()=>{r(),i(Error("timeout")),t.close()},e);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}return this.subs.push(r),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");let e=this.engine;this.subs.push(fa(e,"ping",this.onping.bind(this)),fa(e,"data",this.ondata.bind(this)),fa(e,"error",this.onerror.bind(this)),fa(e,"close",this.onclose.bind(this)),fa(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(e){this.onclose("parse error",e)}}ondecoded(e){dZ(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new fl(this,e,t),this.nsps[e]=n),n}_destroy(e){for(let e of Object.keys(this.nsps))if(this.nsps[e].active)return;this._close()}_packet(e){let t=this.encoder.encode(e);for(let n=0;ne()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e,t){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let t=this.backoff.duration();this._reconnecting=!0;let n=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open(t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",t)):e.onreconnect()}))},t);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}}onreconnect(){let e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}let fd={};function ff(e,t){let n;"object"==typeof e&&(t=e,e=void 0);let r=function(e,t="",n){let r=e;n=n||"undefined"!=typeof location&&location,null==e&&(e=n.protocol+"//"+n.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?n.protocol+e:n.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==n?n.protocol+"//"+e:"https://"+e),r=d3(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";let i=-1!==r.host.indexOf(":")?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+i+":"+r.port+t,r.href=r.protocol+"://"+i+(n&&n.port===r.port?"":":"+r.port),r}(e,(t=t||{}).path||"/socket.io"),i=r.source,o=r.id,a=r.path,s=fd[o]&&a in fd[o].nsps;return t.forceNew||t["force new connection"]||!1===t.multiplex||s?n=new fc(i,t):(fd[o]||(fd[o]=new fc(i,t)),n=fd[o]),r.query&&!t.query&&(t.query=r.queryKey),n.socket(r.path,t)}function fh(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(a,s)}l((r=r.apply(e,t||[])).next())})}Object.assign(ff,{Manager:fc,Socket:fl,io:ff,connect:ff}),"function"==typeof SuppressedError&&SuppressedError;var fp=void 0!==s?s:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function fm(){throw Error("setTimeout has not been defined")}function fg(){throw Error("clearTimeout has not been defined")}var fv=fm,fb=fg;"function"==typeof fp.setTimeout&&(fv=setTimeout),"function"==typeof fp.clearTimeout&&(fb=clearTimeout);var fy,fA,fw,f_=[],fE=!1,fS=-1;function fk(){fE&&fw&&(fE=!1,fw.length?f_=fw.concat(f_):fS=-1,f_.length&&function(){if(!fE){var e=function(e){if(fv===setTimeout)return setTimeout(e,0);if((fv===fm||!fv)&&setTimeout)return fv=setTimeout,setTimeout(e,0);try{return fv(e,0)}catch(t){try{return fv.call(null,e,0)}catch(t){return fv.call(this,e,0)}}}(fk);fE=!0;for(var t=f_.length;t;){for(fw=f_,f_=[];++fS{if("%%"===n)return"%";o++;let i=t.formatters[r];if("function"==typeof i){let t=e[o];n=i.call(s,t),e.splice(o,1),o--}return n}),t.formatArgs.call(s,e),(s.log||t.log).apply(s,e)}return s.namespace=e,s.useColors=t.useColors(),s.color=t.selectColor(e),s.extend=n,s.destroy=t.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==a?a:(i!==t.namespaces&&(i=t.namespaces,o=t.enabled(e)),o),set:e=>{a=e}}),"function"==typeof t.init&&t.init(s),s}function n(e,n){let r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function r(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){let e=[...t.names.map(r),...t.skips.map(r).map(e=>"-"+e)].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.namespaces=e,t.names=[],t.skips=[];let r=("string"==typeof e?e:"").split(/[\s,]+/),i=r.length;for(n=0;n=1.5*n?"s":"")}return fC=1,fM=function(t,n){n=n||{};var r,i,o=typeof t;if("string"===o&&t.length>0)return function(e){if(!((e=String(e)).length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*n;case"weeks":case"week":case"w":return 6048e5*n;case"days":case"day":case"d":return 864e5*n;case"hours":case"hour":case"hrs":case"hr":case"h":return 36e5*n;case"minutes":case"minute":case"mins":case"min":case"m":return 6e4*n;case"seconds":case"second":case"secs":case"sec":case"s":return 1e3*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}(t);if("number"===o&&isFinite(t))return n.long?(r=Math.abs(t))>=864e5?e(t,r,864e5,"day"):r>=36e5?e(t,r,36e5,"hour"):r>=6e4?e(t,r,6e4,"minute"):r>=1e3?e(t,r,1e3,"second"):t+" ms":(i=Math.abs(t))>=864e5?Math.round(t/864e5)+"d":i>=36e5?Math.round(t/36e5)+"h":i>=6e4?Math.round(t/6e4)+"m":i>=1e3?Math.round(t/1e3)+"s":t+"ms";throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}}(),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach(n=>{t[n]=e[n]}),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t{"%%"!==e&&(r++,"%c"===e&&(i=r))}),t.splice(i,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&void 0!==fR&&"env"in fR&&(e=fR.env.DEBUG),e},t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(n=!1,()=>{n||(n=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=fT(t);let{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(fI,fI.exports);var fO=(vt=fI.exports)&&vt.__esModule&&Object.prototype.hasOwnProperty.call(vt,"default")?vt.default:vt;let fP=fO("KeyExchange:Layer"),fL=fO("SocketService:Layer"),fN=fO("Ecies:Layer"),fD=fO("RemoteCommunication:Layer");fP.color="##95c44e",fL.color="#f638d7",fN.color="#465b9c",fD.color="#47a2be";let fB={KeyExchange:fP,SocketService:fL,Ecies:fN,RemoteCommunication:fD},fj,fF=[],fz=[],fU=(e,t)=>fh(void 0,void 0,void 0,function*(){fj=t,fz.push(e),(function(e){return fh(this,void 0,void 0,function*(){if(!fj||!e)return;!function(){let e=fz;fz=fF,fF=e}();let t=fj.endsWith("/")?`${fj}debug`:`${fj}/debug`,n=Object.assign({},e);if(delete n.params,e.params)for(let[t,r]of Object.entries(e.params))n[t]=r;let r=JSON.stringify(n);fB.RemoteCommunication(`[sendBufferedEvents] Sending ${fF.length} analytics events to ${t}`);try{let e=yield f(t,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:r}),n=yield e.text();fB.RemoteCommunication(`[sendBufferedEvents] Response: ${n}`),fF.length=0}catch(e){console.warn("Error sending analytics",e)}})})(e).catch(()=>{})});var fq=[],fK=[],fH="undefined"!=typeof Uint8Array?Uint8Array:Array,fV=!1;function f$(){fV=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)fq[t]=e[t],fK[e.charCodeAt(t)]=t;fK["-".charCodeAt(0)]=62,fK["_".charCodeAt(0)]=63}function fW(e){var t;fV||f$();for(var n=e.length,r=n%3,i="",o=[],a=0,s=n-r;a>18&63]+fq[r>>12&63]+fq[r>>6&63]+fq[63&r]);return i.join("")}(e,a,a+16383>s?s:a+16383));return 1===r?i+=fq[(t=e[n-1])>>2]+fq[t<<4&63]+"==":2===r&&(i+=fq[(t=(e[n-2]<<8)+e[n-1])>>10]+fq[t>>4&63]+fq[t<<2&63]+"="),o.push(i),o.join("")}function fY(e,t,n,r,i){var o,a,s=8*i-r-1,l=(1<>1,c=-7,d=n?i-1:0,f=n?-1:1,h=e[t+d];for(d+=f,o=h&(1<<-c)-1,h>>=-c,c+=s;c>0;o=256*o+e[t+d],d+=f,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=r;c>0;a=256*a+e[t+d],d+=f,c-=8);if(0===o)o=1-u;else{if(o===l)return a?NaN:1/0*(h?-1:1);a+=Math.pow(2,r),o-=u}return(h?-1:1)*a*Math.pow(2,o-r)}function fG(e,t,n,r,i,o){var a,s,l,u=8*o-i-1,c=(1<>1,f=23===i?5960464477539062e-23:0,h=r?0:o-1,p=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(isNaN(t=Math.abs(t))||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),(t+=a+d>=1?f/l:f*Math.pow(2,1-d))*l>=2&&(a++,l/=2),a+d>=c?(s=0,a=c):a+d>=1?(s=(t*l-1)*Math.pow(2,i),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),a=0));i>=8;e[n+h]=255&s,h+=p,s/=256,i-=8);for(a=a<0;e[n+h]=255&a,h+=p,a/=256,u-=8);e[n+h-p]|=128*m}var fQ={}.toString,fZ=Array.isArray||function(e){return"[object Array]"==fQ.call(e)};function fJ(){return f0.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function fX(e,t){if(fJ()=fJ())throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+fJ().toString(16)+" bytes");return 0|e}function f8(e){return!(null==e||!e._isBuffer)}function f5(e,t){if(f8(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return hf(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return hh(e).length;default:if(r)return hf(e).length;t=(""+t).toLowerCase(),r=!0}}function f7(e,t,n){var r,i,o=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===n||n>this.length)&&(n=this.length),n<=0)||(n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,n){var r,i=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>i)&&(n=i);for(var o="",a=t;a2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),isNaN(n=+n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return -1;n=e.length-1}else if(n<0){if(!i)return -1;n=0}if("string"==typeof t&&(t=f0.from(t,r)),f8(t))return 0===t.length?-1:ht(e,t,n,r,i);if("number"==typeof t)return t&=255,f0.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):ht(e,[t],n,r,i);throw TypeError("val must be string, number or Buffer")}function ht(e,t,n,r,i){var o,a=1,s=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return -1;a=2,s/=2,l/=2,n/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var c=-1;for(o=n;os&&(n=s-l),o=n;o>=0;o--){for(var d=!0,f=0;f239?4:u>223?3:u>191?2:1;if(i+d<=n)switch(d){case 1:u<128&&(c=u);break;case 2:128==(192&(o=e[i+1]))&&(l=(31&u)<<6|63&o)>127&&(c=l);break;case 3:o=e[i+1],a=e[i+2],128==(192&o)&&128==(192&a)&&(l=(15&u)<<12|(63&o)<<6|63&a)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:o=e[i+1],a=e[i+2],s=e[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(l=(15&u)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&l<1114112&&(c=l)}null===c?(c=65533,d=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),i+=d}return function(e){var t=e.length;if(t<=hr)return String.fromCharCode.apply(String,e);for(var n="",r=0;r0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),""},f0.prototype.compare=function(e,t,n,r,i){if(!f8(e))throw TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return -1;if(t>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0),s=Math.min(o,a),l=this.slice(r,i),u=e.slice(t,n),c=0;cp)&&(n=p),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var m=!1;;)switch(r){case"hex":return function(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=t.length;if(o%2!=0)throw TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a>8,i.push(n%256),i.push(r);return i}(e,this.length-f),this,f,h);default:if(m)throw TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),m=!0}},f0.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var hr=4096;function hi(e,t,n){if(e%1!=0||e<0)throw RangeError("offset is not uint");if(e+t>n)throw RangeError("Trying to access beyond buffer length")}function ho(e,t,n,r,i,o){if(!f8(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw RangeError("Index out of range")}function ha(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function hs(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function hl(e,t,n,r,i,o){if(n+r>e.length||n<0)throw RangeError("Index out of range")}function hu(e,t,n,r,i){return i||hl(e,0,n,4),fG(e,t,n,r,23,4),n+4}function hc(e,t,n,r,i){return i||hl(e,0,n,8),fG(e,t,n,r,52,8),n+8}f0.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(i*=256);)r+=this[e+--t]*i;return r},f0.prototype.readUInt8=function(e,t){return t||hi(e,1,this.length),this[e]},f0.prototype.readUInt16LE=function(e,t){return t||hi(e,2,this.length),this[e]|this[e+1]<<8},f0.prototype.readUInt16BE=function(e,t){return t||hi(e,2,this.length),this[e]<<8|this[e+1]},f0.prototype.readUInt32LE=function(e,t){return t||hi(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},f0.prototype.readUInt32BE=function(e,t){return t||hi(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},f0.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||hi(e,t,this.length);for(var r=this[e],i=1,o=0;++o=(i*=128)&&(r-=Math.pow(2,8*t)),r},f0.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||hi(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},f0.prototype.readInt8=function(e,t){return t||hi(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},f0.prototype.readInt16LE=function(e,t){t||hi(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},f0.prototype.readInt16BE=function(e,t){t||hi(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},f0.prototype.readInt32LE=function(e,t){return t||hi(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},f0.prototype.readInt32BE=function(e,t){return t||hi(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},f0.prototype.readFloatLE=function(e,t){return t||hi(e,4,this.length),fY(this,e,!0,23,4)},f0.prototype.readFloatBE=function(e,t){return t||hi(e,4,this.length),fY(this,e,!1,23,4)},f0.prototype.readDoubleLE=function(e,t){return t||hi(e,8,this.length),fY(this,e,!0,52,8)},f0.prototype.readDoubleBE=function(e,t){return t||hi(e,8,this.length),fY(this,e,!1,52,8)},f0.prototype.writeUIntLE=function(e,t,n,r){e=+e,t|=0,n|=0,r||ho(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o=0&&(o*=256);)this[t+i]=e/o&255;return t+n},f0.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||ho(this,e,t,1,255,0),f0.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},f0.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||ho(this,e,t,2,65535,0),f0.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):ha(this,e,t,!0),t+2},f0.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||ho(this,e,t,2,65535,0),f0.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):ha(this,e,t,!1),t+2},f0.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||ho(this,e,t,4,4294967295,0),f0.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):hs(this,e,t,!0),t+4},f0.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||ho(this,e,t,4,4294967295,0),f0.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):hs(this,e,t,!1),t+4},f0.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);ho(this,e,t,n,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+n},f0.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);ho(this,e,t,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},f0.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||ho(this,e,t,1,127,-128),f0.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},f0.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||ho(this,e,t,2,32767,-32768),f0.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):ha(this,e,t,!0),t+2},f0.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||ho(this,e,t,2,32767,-32768),f0.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):ha(this,e,t,!1),t+2},f0.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||ho(this,e,t,4,2147483647,-2147483648),f0.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):hs(this,e,t,!0),t+4},f0.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||ho(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),f0.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):hs(this,e,t,!1),t+4},f0.prototype.writeFloatLE=function(e,t,n){return hu(this,e,t,!0,n)},f0.prototype.writeFloatBE=function(e,t,n){return hu(this,e,t,!1,n)},f0.prototype.writeDoubleLE=function(e,t,n){return hc(this,e,t,!0,n)},f0.prototype.writeDoubleBE=function(e,t,n){return hc(this,e,t,!1,n)},f0.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw RangeError("sourceStart out of bounds");if(r<0)throw RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(o<1e3||!f0.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i55295&&n<57344){if(!i){if(n>56319||a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function hh(e){return function(e){fV||f$();var t,n,r,i,o,a,s=e.length;if(s%4>0)throw Error("Invalid string. Length must be a multiple of 4");o="="===e[s-2]?2:"="===e[s-1]?1:0,a=new fH(3*s/4-o),r=o>0?s-4:s;var l=0;for(t=0,n=0;t>16&255,a[l++]=i>>8&255,a[l++]=255&i;return 2===o?(i=fK[e.charCodeAt(t)]<<2|fK[e.charCodeAt(t+1)]>>4,a[l++]=255&i):1===o&&(i=fK[e.charCodeAt(t)]<<10|fK[e.charCodeAt(t+1)]<<4|fK[e.charCodeAt(t+2)]>>2,a[l++]=i>>8&255,a[l++]=255&i),a}(function(e){var t;if((e=((t=e).trim?t.trim():t.replace(/^\s+|\s+$/g,"")).replace(hd,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function hp(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function hm(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}class hg{constructor(e){this.enabled=!0,(null==e?void 0:e.debug)&&fO.enable("Ecies:Layer"),(null==e?void 0:e.privateKey)?this.ecies=ee.PrivateKey.fromHex(e.privateKey):this.ecies=new ee.PrivateKey,fB.Ecies("[ECIES constructor()] initialized secret: ",this.ecies.toHex()),fB.Ecies("[ECIES constructor()] initialized public: ",this.ecies.publicKey.toHex()),fB.Ecies("[ECIES constructor()] init with",this)}generateECIES(){this.ecies=new ee.PrivateKey}getPublicKey(){return this.ecies.publicKey.toHex()}encrypt(e,t){let n=e;if(this.enabled)try{fB.Ecies("[ECIES: encrypt()] using otherPublicKey",t);let r=f0.from(e),i=ee.encrypt(t,r);n=f0.from(i).toString("base64")}catch(n){throw fB.Ecies("[ECIES: encrypt()] error encrypt:",n),fB.Ecies("[ECIES: encrypt()] private: ",this.ecies.toHex()),fB.Ecies("[ECIES: encrypt()] data: ",e),fB.Ecies("[ECIES: encrypt()] otherkey: ",t),n}return n}decrypt(e){let t=e;if(this.enabled)try{fB.Ecies("[ECIES: decrypt()] using privateKey",this.ecies.toHex());let n=f0.from(e.toString(),"base64");t=ee.decrypt(this.ecies.toHex(),n).toString()}catch(t){throw fB.Ecies("[ECIES: decrypt()] error decrypt",t),fB.Ecies("[ECIES: decrypt()] private: ",this.ecies.toHex()),fB.Ecies("[ECIES: decrypt()] encryptedData: ",e),t}return t}getKeyInfo(){return{private:this.ecies.toHex(),public:this.ecies.publicKey.toHex()}}toString(){fB.Ecies("[ECIES: toString()]",this.getKeyInfo())}}var hv="0.20.5";let hb="https://metamask-sdk.api.cx.metamask.io/",hy=["websocket"],hA={ETH_REQUESTACCOUNTS:"eth_requestAccounts"};function hw(e){let{context:t}=e;fB.RemoteCommunication(`[RemoteCommunication: clean()] context=${t}`),e.channelConfig=void 0,e.ready=!1,e.originatorConnectStarted=!1}e.ConnectionStatus=void 0,e.EventType=void 0,e.MessageType=void 0,(vn=e.ConnectionStatus||(e.ConnectionStatus={})).DISCONNECTED="disconnected",vn.WAITING="waiting",vn.TIMEOUT="timeout",vn.LINKED="linked",vn.PAUSED="paused",vn.TERMINATED="terminated",(vr=e.EventType||(e.EventType={})).KEY_INFO="key_info",vr.SERVICE_STATUS="service_status",vr.PROVIDER_UPDATE="provider_update",vr.RPC_UPDATE="rpc_update",vr.KEYS_EXCHANGED="keys_exchanged",vr.JOIN_CHANNEL="join_channel",vr.CHANNEL_CREATED="channel_created",vr.CLIENTS_CONNECTED="clients_connected",vr.CLIENTS_DISCONNECTED="clients_disconnected",vr.CLIENTS_WAITING="clients_waiting",vr.CLIENTS_READY="clients_ready",vr.CHANNEL_PERSISTENCE="channel_persistence",vr.MESSAGE_ACK="ack",vr.SOCKET_DISCONNECTED="socket_disconnected",vr.SOCKET_RECONNECT="socket_reconnect",vr.OTP="otp",vr.SDK_RPC_CALL="sdk_rpc_call",vr.AUTHORIZED="authorized",vr.CONNECTION_STATUS="connection_status",vr.MESSAGE="message",vr.TERMINATE="terminate",(vc||(vc={})).KEY_EXCHANGE="key_exchange",(vi=vd||(vd={})).KEY_HANDSHAKE_START="key_handshake_start",vi.KEY_HANDSHAKE_CHECK="key_handshake_check",vi.KEY_HANDSHAKE_SYN="key_handshake_SYN",vi.KEY_HANDSHAKE_SYNACK="key_handshake_SYNACK",vi.KEY_HANDSHAKE_ACK="key_handshake_ACK",vi.KEY_HANDSHAKE_NONE="none";class h_ extends dl.EventEmitter2{constructor({communicationLayer:e,otherPublicKey:t,context:n,ecies:r,logging:i}){super(),this.keysExchanged=!1,this.step=vd.KEY_HANDSHAKE_NONE,this.debug=!1,this.context=n,this.communicationLayer=e,(null==r?void 0:r.privateKey)&&t&&(fB.KeyExchange(`[KeyExchange: constructor()] otherPubKey=${t} set keysExchanged to true!`,r),this.keysExchanged=!0),this.myECIES=new hg(Object.assign(Object.assign({},r),{debug:null==i?void 0:i.eciesLayer})),this.myPublicKey=this.myECIES.getPublicKey(),this.debug=!0===(null==i?void 0:i.keyExchangeLayer),t&&this.setOtherPublicKey(t),this.communicationLayer.on(vc.KEY_EXCHANGE,this.onKeyExchangeMessage.bind(this))}onKeyExchangeMessage(t){let{relayPersistence:n}=this.communicationLayer.remote.state;if(fB.KeyExchange(`[KeyExchange: onKeyExchangeMessage()] context=${this.context} keysExchanged=${this.keysExchanged} relayPersistence=${n}`,t),n)return void fB.KeyExchange("[KeyExchange: onKeyExchangeMessage()] Ignoring key exchange message because relay persistence is activated");let{message:r}=t;this.keysExchanged&&fB.KeyExchange(`[KeyExchange: onKeyExchangeMessage()] context=${this.context} received handshake while already exchanged. step=${this.step} otherPubKey=${this.otherPublicKey}`),this.emit(e.EventType.KEY_INFO,r.type),r.type===vd.KEY_HANDSHAKE_SYN?(this.checkStep([vd.KEY_HANDSHAKE_NONE,vd.KEY_HANDSHAKE_ACK]),fB.KeyExchange("[KeyExchange: onKeyExchangeMessage()] KEY_HANDSHAKE_SYN",r),r.pubkey&&this.setOtherPublicKey(r.pubkey),this.communicationLayer.sendMessage({type:vd.KEY_HANDSHAKE_SYNACK,pubkey:this.myPublicKey}),this.setStep(vd.KEY_HANDSHAKE_ACK)):r.type===vd.KEY_HANDSHAKE_SYNACK?(this.checkStep([vd.KEY_HANDSHAKE_SYNACK,vd.KEY_HANDSHAKE_ACK,vd.KEY_HANDSHAKE_NONE]),fB.KeyExchange("[KeyExchange: onKeyExchangeMessage()] KEY_HANDSHAKE_SYNACK"),r.pubkey&&this.setOtherPublicKey(r.pubkey),this.communicationLayer.sendMessage({type:vd.KEY_HANDSHAKE_ACK}),this.keysExchanged=!0,this.setStep(vd.KEY_HANDSHAKE_ACK),this.emit(e.EventType.KEYS_EXCHANGED)):r.type===vd.KEY_HANDSHAKE_ACK&&(fB.KeyExchange("[KeyExchange: onKeyExchangeMessage()] KEY_HANDSHAKE_ACK set keysExchanged to true!"),this.checkStep([vd.KEY_HANDSHAKE_ACK,vd.KEY_HANDSHAKE_NONE]),this.keysExchanged=!0,this.setStep(vd.KEY_HANDSHAKE_ACK),this.emit(e.EventType.KEYS_EXCHANGED))}resetKeys(e){this.clean(),this.myECIES=new hg(e)}clean(){fB.KeyExchange(`[KeyExchange: clean()] context=${this.context} reset handshake state`),this.setStep(vd.KEY_HANDSHAKE_NONE),this.emit(e.EventType.KEY_INFO,this.step),this.keysExchanged=!1}start({isOriginator:e,force:t}){let{relayPersistence:n,protocolVersion:r}=this.communicationLayer.remote.state;if(n)return fB.KeyExchange("[KeyExchange: start()] Ignoring key exchange message because relay persistence is activated"),void console.log(`[KeyExchange: start()] relayPersistence=${n}`);fB.KeyExchange(`[KeyExchange: start()] context=${this.context} protocolVersion=${r} isOriginator=${e} step=${this.step} force=${t} relayPersistence=${n} keysExchanged=${this.keysExchanged}`),e?!(this.keysExchanged||this.step!==vd.KEY_HANDSHAKE_NONE&&this.step!==vd.KEY_HANDSHAKE_SYNACK)||t?(fB.KeyExchange(`[KeyExchange: start()] context=${this.context} -- start key exchange (force=${t}) -- step=${this.step}`,this.step),this.clean(),this.setStep(vd.KEY_HANDSHAKE_SYNACK),this.communicationLayer.sendMessage({type:vd.KEY_HANDSHAKE_SYN,pubkey:this.myPublicKey,v:2})):fB.KeyExchange(`[KeyExchange: start()] context=${this.context} -- key exchange already ${this.keysExchanged?"done":"in progress"} -- aborted.`,this.step):this.keysExchanged&&!0!==t?fB.KeyExchange("[KeyExchange: start()] don't send KEY_HANDSHAKE_START -- exchange already done."):r>=2?this.communicationLayer.sendMessage({type:vd.KEY_HANDSHAKE_SYNACK,pubkey:this.myPublicKey,v:2}):(this.communicationLayer.sendMessage({type:vd.KEY_HANDSHAKE_START}),this.clean())}setStep(t){this.step=t,this.emit(e.EventType.KEY_INFO,t)}checkStep(e){e.length>0&&-1===e.indexOf(this.step.toString())&&console.warn(`[KeyExchange: checkStep()] Wrong Step "${this.step}" not within ${e}`)}setRelayPersistence({localKey:e,otherKey:t}){this.otherPublicKey=t,this.myECIES=new hg({privateKey:e,debug:this.debug}),this.keysExchanged=!0}setKeysExchanged(e){this.keysExchanged=e}areKeysExchanged(){return this.keysExchanged}getMyPublicKey(){return this.myPublicKey}getOtherPublicKey(){return this.otherPublicKey}setOtherPublicKey(e){fB.KeyExchange("[KeyExchange: setOtherPubKey()]",e),this.otherPublicKey=e}encryptMessage(e){if(!this.otherPublicKey)throw Error("encryptMessage: Keys not exchanged - missing otherPubKey");return this.myECIES.encrypt(e,this.otherPublicKey)}decryptMessage(e){if(!this.otherPublicKey)throw Error("decryptMessage: Keys not exchanged - missing otherPubKey");return this.myECIES.decrypt(e)}getKeyInfo(){return{ecies:Object.assign(Object.assign({},this.myECIES.getKeyInfo()),{otherPubKey:this.otherPublicKey}),step:this.step,keysExchanged:this.areKeysExchanged()}}toString(){return JSON.stringify({keyInfo:this.getKeyInfo(),keysExchanged:this.keysExchanged,step:this.step})}}(vo=e.MessageType||(e.MessageType={})).TERMINATE="terminate",vo.ANSWER="answer",vo.OFFER="offer",vo.CANDIDATE="candidate",vo.JSONRPC="jsonrpc",vo.WALLET_INFO="wallet_info",vo.ORIGINATOR_INFO="originator_info",vo.PAUSE="pause",vo.OTP="otp",vo.AUTHORIZED="authorized",vo.PING="ping",vo.READY="ready";let hE=e=>new Promise(t=>{setTimeout(t,e)}),hS=(e,t,n=200)=>fh(void 0,void 0,void 0,function*(){let r;let i=Date.now(),o=!1;for(;!o;){if(o=Date.now()-i>3e5,void 0!==(r=t[e]).elapsedTime)return r;yield hE(n)}throw Error(`RPC ${e} timed out`)}),hk=t=>fh(void 0,void 0,void 0,function*(){var n,r,i,o,a;return t.remote.state.terminated?(fB.SocketService(`[SocketService: reconnectSocket()] instance.remote.state.terminated=${t.remote.state.terminated} socket already terminated`,t),!1):(fB.SocketService(`[SocketService: reconnectSocket()] instance.state.socket?.connected=${null===(n=t.state.socket)||void 0===n?void 0:n.connected} trying to reconnect after socketio disconnection`,t),yield hE(200),(null===(r=t.state.socket)||void 0===r?void 0:r.connected)||(t.state.resumed=!0,null===(i=t.state.socket)||void 0===i||i.connect(),t.emit(e.EventType.SOCKET_RECONNECT),null===(o=t.state.socket)||void 0===o||o.emit(e.EventType.JOIN_CHANNEL,{channelId:t.state.channelId,context:`${t.state.context}connect_again`,clientType:t.state.isOriginator?"dapp":"wallet"})),yield hE(100),null===(a=t.state.socket)||void 0===a?void 0:a.connected)});(va=vf||(vf={})).REQUEST="sdk_connect_request_started",va.REQUEST_MOBILE="sdk_connect_request_started_mobile",va.RECONNECT="sdk_reconnect_request_started",va.CONNECTED="sdk_connection_established",va.CONNECTED_MOBILE="sdk_connection_established_mobile",va.AUTHORIZED="sdk_connection_authorized",va.REJECTED="sdk_connection_rejected",va.TERMINATED="sdk_connection_terminated",va.DISCONNECTED="sdk_disconnected",va.SDK_USE_EXTENSION="sdk_use_extension",va.SDK_RPC_REQUEST="sdk_rpc_request",va.SDK_RPC_REQUEST_RECEIVED="sdk_rpc_request_received",va.SDK_RPC_REQUEST_DONE="sdk_rpc_request_done",va.SDK_EXTENSION_UTILIZED="sdk_extension_utilized",va.SDK_USE_INAPP_BROWSER="sdk_use_inapp_browser",(vs=vh||(vh={})).RPC_CHECK="rpcCheck",vs.SKIPPED_RPC="skippedRpc";let hM=["eth_sendTransaction","eth_signTypedData","eth_signTransaction","personal_sign","wallet_requestPermissions","wallet_switchEthereumChain","eth_signTypedData_v3","eth_signTypedData_v4","metamask_connectSign","metamask_connectWith","metamask_batch"].map(e=>e.toLowerCase()),hC=[{event:"clients_connected",handler:function(t,n){return r=>fh(this,void 0,void 0,function*(){var r,i,o,a,s,l,u,c,d,f,h;let p=null!==(i=null===(r=t.remote.state.channelConfig)||void 0===r?void 0:r.relayPersistence)&&void 0!==i&&i;if(fB.SocketService(`[SocketService: handleClientsConnected()] context=${t.state.context} on 'clients_connected-${n}' relayPersistence=${p} resumed=${t.state.resumed} clientsPaused=${t.state.clientsPaused} keysExchanged=${null===(o=t.state.keyExchange)||void 0===o?void 0:o.areKeysExchanged()} isOriginator=${t.state.isOriginator}`),t.emit(e.EventType.CLIENTS_CONNECTED,{isOriginator:t.state.isOriginator,keysExchanged:null===(a=t.state.keyExchange)||void 0===a?void 0:a.areKeysExchanged(),context:t.state.context}),t.state.resumed)t.state.isOriginator||(fB.SocketService(`[SocketService: handleClientsConnected()] context=${t.state.context} 'clients_connected' / keysExchanged=${null===(s=t.state.keyExchange)||void 0===s?void 0:s.areKeysExchanged()} -- backward compatibility`),null===(l=t.state.keyExchange)||void 0===l||l.start({isOriginator:null!==(u=t.state.isOriginator)&&void 0!==u&&u})),t.state.resumed=!1;else if(t.state.clientsPaused)fB.SocketService("[SocketService: handleClientsConnected()] 'clients_connected' skip sending originatorInfo on pause");else if(!t.state.isOriginator){let e=!p;console.log(`[SocketService: handleClientsConnected()] context=${t.state.context} on 'clients_connected' / keysExchanged=${null===(c=t.state.keyExchange)||void 0===c?void 0:c.areKeysExchanged()} -- force=${e} -- backward compatibility`),fB.SocketService(`[SocketService: handleClientsConnected()] context=${t.state.context} on 'clients_connected' / keysExchanged=${null===(d=t.state.keyExchange)||void 0===d?void 0:d.areKeysExchanged()} -- force=${e} -- backward compatibility`),null===(f=t.state.keyExchange)||void 0===f||f.start({isOriginator:null!==(h=t.state.isOriginator)&&void 0!==h&&h,force:e})}t.state.clientsConnected=!0,t.state.clientsPaused=!1})}},{event:"channel_created",handler:function(t,n){return r=>{fB.SocketService(`[SocketService: handleChannelCreated()] context=${t.state.context} on 'channel_created-${n}'`,r),t.emit(e.EventType.CHANNEL_CREATED,r)}}},{event:"clients_disconnected",handler:function(t,n){return()=>{var r;t.state.clientsConnected=!1,fB.SocketService(`[SocketService: handlesClientsDisconnected()] context=${t.state.context} on 'clients_disconnected-${n}'`),t.remote.state.relayPersistence?fB.SocketService(`[SocketService: handlesClientsDisconnected()] context=${t.state.context} on 'clients_disconnected-${n}' - relayPersistence enabled, skipping key exchange cleanup.`):(t.state.isOriginator&&!t.state.clientsPaused&&(null===(r=t.state.keyExchange)||void 0===r||r.clean()),t.emit(e.EventType.CLIENTS_DISCONNECTED,n))}}},{event:"config",handler:function(t,n){return r=>fh(this,void 0,void 0,function*(){var i,o;fB.SocketService(`[SocketService: handleChannelConfig()] update relayPersistence on 'config-${n}'`,r),t.remote.state.relayPersistence=!0,t.remote.emit(e.EventType.CHANNEL_PERSISTENCE),null===(i=t.state.keyExchange)||void 0===i||i.setKeysExchanged(!0),t.state.isOriginator&&t.remote.state.channelConfig&&!t.remote.state.channelConfig.relayPersistence&&(t.remote.state.channelConfig.relayPersistence=!0,null===(o=t.remote.state.storageManager)||void 0===o||o.persistChannelConfig(t.remote.state.channelConfig))})}},{event:"message",handler:function(t,n){return r=>{var i,o,a,s,l,u,c,d,f,h,p,m,g,v,b,y,A,w;let{id:_,ackId:E,message:S,error:k}=r,M=null!==(i=t.remote.state.relayPersistence)&&void 0!==i&&i;if(fB.SocketService(`[SocketService handleMessage()] relayPersistence=${M} context=${t.state.context} on 'message' ${n} keysExchanged=${null===(o=t.state.keyExchange)||void 0===o?void 0:o.areKeysExchanged()}`,r),k)throw fB.SocketService(` + [SocketService handleMessage()] context=${t.state.context}::on 'message' error=${k}`),Error(k);try{!function(e,t){if(t!==e.channelId)throw e.debug&&console.error(`Wrong id ${t} - should be ${e.channelId}`),Error("Wrong id")}(t.state,_)}catch(e){return void console.error("ignore message --- wrong id ",S)}let C="string"==typeof S;if(!C&&(null==S?void 0:S.type)===vd.KEY_HANDSHAKE_START)return M?void console.warn("[SocketService handleMessage()] Ignoring key exchange message because relay persistence is activated",S):(fB.SocketService(`[SocketService handleMessage()] context=${t.state.context}::on 'message' received HANDSHAKE_START isOriginator=${t.state.isOriginator}`,S),void(null===(a=t.state.keyExchange)||void 0===a||a.start({isOriginator:null!==(s=t.state.isOriginator)&&void 0!==s&&s,force:!0})));if(!C&&(null===(l=null==S?void 0:S.type)||void 0===l?void 0:l.startsWith("key_handshake")))return M?void console.warn("[SocketService handleMessage()] Ignoring key exchange message because relay persistence is activated",S):(fB.SocketService(`[SocketService handleMessage()] context=${t.state.context}::on 'message' emit KEY_EXCHANGE`,S),void t.emit(vc.KEY_EXCHANGE,{message:S,context:t.state.context}));if(!C||(null===(u=t.state.keyExchange)||void 0===u?void 0:u.areKeysExchanged())){if(!C&&(null==S?void 0:S.type))return console.warn("[SocketService handleMessage() ::on 'message' received non encrypted unkwown message"),void t.emit(e.EventType.MESSAGE,S)}else{let e=!1;try{fB.SocketService(`[SocketService handleMessage()] context=${t.state.context}::on 'message' trying to decrypt message`),null===(c=t.state.keyExchange)||void 0===c||c.decryptMessage(S),e=!0}catch(e){fB.SocketService(`[SocketService handleMessage()] context=${t.state.context}::on 'message' error`,e)}if(!e)return t.state.isOriginator?null===(f=t.state.keyExchange)||void 0===f||f.start({isOriginator:null!==(h=t.state.isOriginator)&&void 0!==h&&h}):t.sendMessage({type:vd.KEY_HANDSHAKE_START}),void fB.SocketService(`Message ignored because invalid key exchange status. step=${null===(p=t.state.keyExchange)||void 0===p?void 0:p.getKeyInfo().step}`,null===(m=t.state.keyExchange)||void 0===m?void 0:m.getKeyInfo(),S);fB.SocketService("Invalid key exchange status detected --- updating it."),null===(d=t.state.keyExchange)||void 0===d||d.setKeysExchanged(!0)}if(!C)return console.warn("[SocketService handleMessage() ::on 'message' received unkwown message",S),void t.emit(e.EventType.MESSAGE,S);let x=null===(g=t.state.keyExchange)||void 0===g?void 0:g.decryptMessage(S),R=JSON.parse(null!=x?x:"{}");if(E&&(null==E?void 0:E.length)>0&&(fB.SocketService(`[SocketService handleMessage()] context=${t.state.context}::on 'message' ackid=${E} channelId=${_}`),null===(v=t.state.socket)||void 0===v||v.emit(e.EventType.MESSAGE_ACK,{ackId:E,channelId:_,clientType:t.state.isOriginator?"dapp":"wallet"})),(null==R?void 0:R.type)===e.MessageType.PAUSE?t.state.clientsPaused=!0:t.state.clientsPaused=!1,t.state.isOriginator&&R.data){let n=R.data,r=t.state.rpcMethodTracker[n.id];if(r){let i=Date.now()-r.timestamp;fB.SocketService(`[SocketService handleMessage()] context=${t.state.context}::on 'message' received answer for id=${n.id} method=${r.method} responseTime=${i}`,R),t.remote.state.analytics&&hM.includes(r.method.toLowerCase())&&fU({id:null!==(b=t.remote.state.channelId)&&void 0!==b?b:"",event:vf.SDK_RPC_REQUEST_DONE,sdkVersion:t.remote.state.sdkVersion,commLayerVersion:hv,walletVersion:null===(y=t.remote.state.walletInfo)||void 0===y?void 0:y.version,params:{method:r.method,from:"mobile"}},t.remote.state.communicationServerUrl).catch(e=>{console.error("Cannot send analytics",e)});let o=Object.assign(Object.assign({},r),{result:n.result,error:n.error?{code:null===(A=n.error)||void 0===A?void 0:A.code,message:null===(w=n.error)||void 0===w?void 0:w.message}:void 0,elapsedTime:i});t.state.rpcMethodTracker[n.id]=o,t.emit(e.EventType.RPC_UPDATE,o)}}t.emit(e.EventType.MESSAGE,{message:R})}}},{event:"clients_waiting_to_join",handler:function(t,n){return r=>{fB.SocketService(`[SocketService: handleClientsWaitingToJoin()] context=${t.state.context} on 'clients_waiting_to_join-${n}'`,r),t.emit(e.EventType.CLIENTS_WAITING,r)}}}],hx=[{event:e.EventType.KEY_INFO,handler:function(t){return n=>{fB.SocketService("[SocketService: handleKeyInfo()] on 'KEY_INFO'",n),t.emit(e.EventType.KEY_INFO,n)}}},{event:e.EventType.KEYS_EXCHANGED,handler:function(t){return()=>{var n,r,i;fB.SocketService(`[SocketService: handleKeysExchanged()] on 'keys_exchanged' keyschanged=${null===(n=t.state.keyExchange)||void 0===n?void 0:n.areKeysExchanged()}`);let{channelConfig:o}=t.remote.state;if(o){let e=t.getKeyExchange().getKeyInfo().ecies;o.localKey=e.private,o.otherKey=e.otherPubKey,t.remote.state.channelConfig=o,null===(r=t.remote.state.storageManager)||void 0===r||r.persistChannelConfig(o).catch(e=>{console.error("Error persisting channel config",e)})}t.emit(e.EventType.KEYS_EXCHANGED,{keysExchanged:null===(i=t.state.keyExchange)||void 0===i?void 0:i.areKeysExchanged(),isOriginator:t.state.isOriginator});let a={keyInfo:t.getKeyInfo()};t.emit(e.EventType.SERVICE_STATUS,a)}}}];function hR(t,n){fB.SocketService(`[SocketService: setupChannelListener()] context=${t.state.context} setting socket listeners for channel ${n}...`);let{socket:r}=t.state,{keyExchange:i}=t.state;t.state.setupChannelListeners&&console.warn(`[SocketService: setupChannelListener()] context=${t.state.context} socket listeners already set up for channel ${n}`),r&&t.state.isOriginator&&(t.state.debug&&(null==r||r.io.on("error",e=>{fB.SocketService(`[SocketService: setupChannelListener()] context=${t.state.context} socket event=error`,e)}),null==r||r.io.on("reconnect",e=>{fB.SocketService(`[SocketService: setupChannelListener()] context=${t.state.context} socket event=reconnect`,e)}),null==r||r.io.on("reconnect_error",e=>{fB.SocketService(`[SocketService: setupChannelListener()] context=${t.state.context} socket event=reconnect_error`,e)}),null==r||r.io.on("reconnect_failed",()=>{fB.SocketService(`[SocketService: setupChannelListener()] context=${t.state.context} socket event=reconnect_failed`)}),null==r||r.io.on("ping",()=>{fB.SocketService(`[SocketService: setupChannelListener()] context=${t.state.context} socket`)})),null==r||r.on("disconnect",n=>{var r;return fB.SocketService(`[SocketService: setupChannelListener()] on 'disconnect' -- MetaMaskSDK socket disconnected '${n}' begin recovery...`),r=n,void(fB.SocketService(`[SocketService: handleDisconnect()] on 'disconnect' manualDisconnect=${t.state.manualDisconnect}`,r),t.state.manualDisconnect||(t.emit(e.EventType.SOCKET_DISCONNECTED),"undefined"!=typeof window&&"undefined"!=typeof document&&(fB.SocketService(`[SocketService: checkFocusAndReconnect()] hasFocus=${document.hasFocus()}`,t),document.hasFocus()?hk(t).then(e=>{fB.SocketService(`SocketService::checkFocus reconnectSocket success=${e}`,t)}).catch(e=>{console.error("SocketService::checkFocus Error reconnecting socket",e)}):window.addEventListener("focus",()=>{hk(t).catch(e=>{console.error("SocketService::checkFocus Error reconnecting socket",e)})},{once:!0}))))})),hC.forEach(({event:e,handler:i})=>{let o=`${e}-${n}`;null==r||r.on(o,i(t,n))}),hx.forEach(({event:e,handler:n})=>{null==i||i.on(e,n(t))}),t.state.setupChannelListeners=!0}class hI extends dl.EventEmitter2{constructor({otherPublicKey:e,reconnect:t,communicationLayerPreference:n,transports:r,communicationServerUrl:i,context:o,ecies:a,remote:s,logging:l}){super(),this.state={clientsConnected:!1,clientsPaused:!1,manualDisconnect:!1,lastRpcId:void 0,rpcMethodTracker:{},hasPlaintext:!1,communicationServerUrl:""},this.state.resumed=t,this.state.context=o,this.state.isOriginator=s.state.isOriginator,this.state.communicationLayerPreference=n,this.state.debug=!0===(null==l?void 0:l.serviceLayer),this.remote=s,!0===(null==l?void 0:l.serviceLayer)&&fO.enable("SocketService:Layer"),this.state.communicationServerUrl=i,this.state.hasPlaintext=this.state.communicationServerUrl!==hb&&!0===(null==l?void 0:l.plaintext);let u={autoConnect:!1,transports:hy,withCredentials:!0};r&&(u.transports=r),fB.SocketService(`[SocketService: constructor()] Socket IO url: ${this.state.communicationServerUrl}`),this.state.socket=ff(i,u);let c={communicationLayer:this,otherPublicKey:e,sendPublicKey:!1,context:this.state.context,ecies:a,logging:l};this.state.keyExchange=new h_(c)}resetKeys(){var e;return fB.SocketService("[SocketService: resetKeys()] Resetting keys."),void(null===(e=this.state.keyExchange)||void 0===e||e.resetKeys())}createChannel(){return function(t){var n,r,i,o;if(fB.SocketService(`[SocketService: createChannel()] context=${t.state.context}`),null===(n=t.state.socket)||void 0===n?void 0:n.connected)throw console.error("[SocketService: createChannel()] socket already connected"),Error("socket already connected");console.log("create channel",t.state.socket),null===(r=t.state.socket)||void 0===r||r.connect(),t.state.manualDisconnect=!1,t.state.isOriginator=!0;let a=dp();return t.state.channelId=a,hR(t,a),null===(i=t.state.socket)||void 0===i||i.emit(e.EventType.JOIN_CHANNEL,{channelId:a,context:`${t.state.context}createChannel`,clientType:"dapp"}),{channelId:a,pubKey:(null===(o=t.state.keyExchange)||void 0===o?void 0:o.getMyPublicKey())||""}}(this)}connectToChannel({channelId:t,withKeyExchange:n=!1}){return function({options:t,instance:n}){var r,i,o,a,s,l,u,c;let{channelId:d,withKeyExchange:f}=t,h=null!==(r=n.state.isOriginator)&&void 0!==r&&r;if(fB.SocketService(`[SocketService: connectToChannel()] context=${n.state.context} channelId=${d} isOriginator=${h}`,null===(i=n.state.keyExchange)||void 0===i?void 0:i.toString()),null===(o=n.state.socket)||void 0===o?void 0:o.connected)throw console.error("[SocketService: connectToChannel()] socket already connected"),Error("socket already connected");let{channelConfig:p}=n.remote.state;h&&(null==p?void 0:p.relayPersistence)&&(p.localKey&&(null===(a=null==p?void 0:p.localKey)||void 0===a?void 0:a.length)>0&&p.otherKey&&(null===(s=null==p?void 0:p.otherKey)||void 0===s?void 0:s.length)>0?null===(l=n.state.keyExchange)||void 0===l||l.setRelayPersistence({localKey:p.localKey,otherKey:p.otherKey}):console.warn("Missing keys in relay persistence",p)),n.state.manualDisconnect=!1,null===(u=n.state.socket)||void 0===u||u.connect(),n.state.withKeyExchange=f,n.state.isOriginator=h,n.state.channelId=d,hR(n,d),null===(c=n.state.socket)||void 0===c||c.emit(e.EventType.JOIN_CHANNEL,{channelId:d,context:`${n.state.context}_connectToChannel`,clientType:h?"dapp":"wallet"},(t,r)=>{"error_terminated"===t?n.emit(e.EventType.TERMINATE):"object"==typeof r&&r.persistence&&n.emit(e.EventType.CHANNEL_PERSISTENCE)})}({options:{channelId:t,withKeyExchange:n},instance:this})}getKeyInfo(){return this.state.keyExchange.getKeyInfo()}keyCheck(){var t;null===(t=this.state.socket)||void 0===t||t.emit(e.EventType.MESSAGE,{id:this.state.channelId,context:this.state.context,message:{type:vd.KEY_HANDSHAKE_CHECK,pubkey:this.getKeyInfo().ecies.otherPubKey}})}getKeyExchange(){return this.state.keyExchange}sendMessage(t){return function(t,n){var r,i,o,a,s;if(!t.state.channelId)throw Error("Create a channel first");fB.SocketService(`[SocketService: handleSendMessage()] context=${t.state.context} areKeysExchanged=${null===(r=t.state.keyExchange)||void 0===r?void 0:r.areKeysExchanged()}`,n),(null===(i=null==n?void 0:n.type)||void 0===i?void 0:i.startsWith("key_handshake"))?(fB.SocketService(`[SocketService: handleKeyHandshake()] context=${t.state.context}`,n),null===(s=t.state.socket)||void 0===s||s.emit(e.EventType.MESSAGE,{id:t.state.channelId,context:t.state.context,clientType:t.state.isOriginator?"dapp":"wallet",message:n})):(function(e,t){var n;if(!(null===(n=e.state.keyExchange)||void 0===n?void 0:n.areKeysExchanged())&&!e.remote.state.relayPersistence)throw fB.SocketService(`[SocketService: validateKeyExchange()] context=${e.state.context} ERROR keys not exchanged`,t),console.error("[SocketService: validateKeyExchange()] ERROR keys not exchanged",t),Error("Keys not exchanged BBB")}(t,n),function(t,n){var r;let i=null!==(r=null==n?void 0:n.method)&&void 0!==r?r:"",o=null==n?void 0:n.id;t.state.isOriginator&&o&&(t.state.rpcMethodTracker[o]={id:o,timestamp:Date.now(),method:i},t.emit(e.EventType.RPC_UPDATE,t.state.rpcMethodTracker[o]))}(t,n),function(t,n){var r,i;let o=null===(r=t.state.keyExchange)||void 0===r?void 0:r.encryptMessage(JSON.stringify(n)),a={id:t.state.channelId,context:t.state.context,clientType:t.state.isOriginator?"dapp":"wallet",message:o,plaintext:t.state.hasPlaintext?JSON.stringify(n):void 0};fB.SocketService(`[SocketService: encryptAndSendMessage()] context=${t.state.context}`,a),n.type===e.MessageType.TERMINATE&&(t.state.manualDisconnect=!0),null===(i=t.state.socket)||void 0===i||i.emit(e.EventType.MESSAGE,a)}(t,n),t.remote.state.analytics&&t.remote.state.isOriginator&&n.method&&hM.includes(n.method.toLowerCase())&&fU({id:null!==(o=t.remote.state.channelId)&&void 0!==o?o:"",event:vf.SDK_RPC_REQUEST,sdkVersion:t.remote.state.sdkVersion,commLayerVersion:hv,walletVersion:null===(a=t.remote.state.walletInfo)||void 0===a?void 0:a.version,params:{method:n.method,from:"mobile"}},t.remote.state.communicationServerUrl).catch(e=>{console.error("Cannot send analytics",e)}),(function(t,n){var r;return fh(this,void 0,void 0,function*(){let i=null==n?void 0:n.id,o=null!==(r=null==n?void 0:n.method)&&void 0!==r?r:"";if(t.state.isOriginator&&i)try{let r=hS(i,t.state.rpcMethodTracker,200).then(e=>({type:vh.RPC_CHECK,result:e})),a=fh(this,void 0,void 0,function*(){let e=yield(({rpcId:e,instance:t})=>fh(void 0,void 0,void 0,function*(){for(;t.state.lastRpcId===e||void 0===t.state.lastRpcId;)yield hE(200);return t.state.lastRpcId}))({instance:t,rpcId:i}),n=yield hS(e,t.state.rpcMethodTracker,200);return{type:vh.SKIPPED_RPC,result:n}}),s=yield Promise.race([r,a]);if(s.type===vh.RPC_CHECK){let e=s.result;fB.SocketService(`[SocketService:handleRpcReplies()] id=${n.id} ${o} ( ${e.elapsedTime} ms)`,e.result)}else{if(s.type!==vh.SKIPPED_RPC)throw Error(`Error handling RPC replies for ${i}`);{let{result:n}=s;console.warn(`[SocketService handleRpcReplies()] RPC METHOD HAS BEEN SKIPPED rpcid=${i} method=${o}`,n);let r=Object.assign(Object.assign({},t.state.rpcMethodTracker[i]),{error:Error("SDK_CONNECTION_ISSUE")});t.emit(e.EventType.RPC_UPDATE,r);let a={data:Object.assign(Object.assign({},r),{jsonrpc:"2.0"}),name:"metamask-provider"};t.emit(e.EventType.MESSAGE,{message:a})}}}catch(e){throw console.warn(`[SocketService handleRpcReplies()] Error rpcId=${n.id} ${o}`,e),e}})})(t,n).catch(e=>{console.warn("Error handleRpcReplies",e)}))}(this,t)}ping(){var t,n,r,i,o;return fB.SocketService(`[SocketService: ping()] context=${this.state.context} originator=${this.state.isOriginator} keysExchanged=${null===(t=this.state.keyExchange)||void 0===t?void 0:t.areKeysExchanged()}`),this.state.isOriginator&&((null===(n=this.state.keyExchange)||void 0===n?void 0:n.areKeysExchanged())?(console.warn(`[SocketService:ping()] context=${this.state.context} sending READY message`),this.sendMessage({type:e.MessageType.READY})):(console.warn(`[SocketService: ping()] context=${this.state.context} starting key exchange`),null===(r=this.state.keyExchange)||void 0===r||r.start({isOriginator:null!==(i=this.state.isOriginator)&&void 0!==i&&i}))),void(null===(o=this.state.socket)||void 0===o||o.emit(e.EventType.MESSAGE,{id:this.state.channelId,context:this.state.context,clientType:this.remote.state.isOriginator?"dapp":"wallet",message:{type:e.MessageType.PING}}))}pause(){var t,n;return fB.SocketService(`[SocketService: pause()] context=${this.state.context}`),this.state.manualDisconnect=!0,(null===(t=this.state.keyExchange)||void 0===t?void 0:t.areKeysExchanged())&&this.sendMessage({type:e.MessageType.PAUSE}),void(null===(n=this.state.socket)||void 0===n||n.disconnect())}isConnected(){var e;return null===(e=this.state.socket)||void 0===e?void 0:e.connected}resume(){var t,n,r,i,o,a,s,l,u;return fB.SocketService(`[SocketService: resume()] context=${this.state.context} connected=${null===(t=this.state.socket)||void 0===t?void 0:t.connected} manualDisconnect=${this.state.manualDisconnect} resumed=${this.state.resumed} keysExchanged=${null===(n=this.state.keyExchange)||void 0===n?void 0:n.areKeysExchanged()}`),(null===(r=this.state.socket)||void 0===r?void 0:r.connected)?fB.SocketService("[SocketService: resume()] already connected."):(null===(i=this.state.socket)||void 0===i||i.connect(),fB.SocketService(`[SocketService: resume()] after connecting socket --> connected=${null===(o=this.state.socket)||void 0===o?void 0:o.connected}`),null===(a=this.state.socket)||void 0===a||a.emit(e.EventType.JOIN_CHANNEL,{channelId:this.state.channelId,context:`${this.state.context}_resume`,clientType:this.remote.state.isOriginator?"dapp":"wallet"})),(null===(s=this.state.keyExchange)||void 0===s?void 0:s.areKeysExchanged())?this.state.isOriginator||this.sendMessage({type:e.MessageType.READY}):this.state.isOriginator||null===(l=this.state.keyExchange)||void 0===l||l.start({isOriginator:null!==(u=this.state.isOriginator)&&void 0!==u&&u}),this.state.manualDisconnect=!1,void(this.state.resumed=!0)}getRPCMethodTracker(){return this.state.rpcMethodTracker}disconnect(e){var t,n;fB.SocketService(`[SocketService: disconnect()] context=${this.state.context}`,e),(null==e?void 0:e.terminate)&&(this.state.channelId=e.channelId,null===(t=this.state.keyExchange)||void 0===t||t.clean(),this.state.rpcMethodTracker={}),this.state.manualDisconnect=!0,null===(n=this.state.socket)||void 0===n||n.disconnect()}}function hT({options:t,instance:n}){var r,i,o,a,s,l;let{state:u}=n;fB.RemoteCommunication(`[RemoteCommunication: disconnect()] channel=${u.channelId}`,t),u.ready=!1,u.paused=!1,(null==t?void 0:t.terminate)?(null===(r=u.storageManager)||void 0===r||r.terminate(null!==(i=u.channelId)&&void 0!==i?i:""),n.state.terminated=!0,t.sendMessage&&(null===(o=u.communicationLayer)||void 0===o?void 0:o.getKeyInfo().keysExchanged)&&(null===(a=u.communicationLayer)||void 0===a||a.sendMessage({type:e.MessageType.TERMINATE})),u.relayPersistence=!1,u.channelId=dp(),t.channelId=u.channelId,u.channelConfig=void 0,u.originatorConnectStarted=!1,null===(s=u.communicationLayer)||void 0===s||s.disconnect(t),n.setConnectionStatus(e.ConnectionStatus.TERMINATED)):(null===(l=u.communicationLayer)||void 0===l||l.disconnect(t),n.setConnectionStatus(e.ConnectionStatus.DISCONNECTED))}e.CommunicationLayerPreference=void 0,e.PlatformType=void 0,(e.CommunicationLayerPreference||(e.CommunicationLayerPreference={})).SOCKET="socket",(vl=e.PlatformType||(e.PlatformType={})).NonBrowser="nodejs",vl.MetaMaskMobileWebview="in-app-browser",vl.DesktopWeb="web-desktop",vl.MobileWeb="web-mobile",vl.ReactNative="react-native";class hO extends dl.EventEmitter2{constructor({platformType:t,communicationLayerPreference:n,otherPublicKey:r,reconnect:i,walletInfo:o,dappMetadata:a,protocolVersion:s,transports:l,context:u,relayPersistence:c,ecies:d,analytics:f=!1,storage:h,sdkVersion:p,communicationServerUrl:m=hb,logging:g,autoConnect:v={timeout:3e3}}){super(),this.state={ready:!1,authorized:!1,isOriginator:!1,terminated:!1,protocolVersion:1,paused:!1,platformType:"metamask-mobile",analytics:!1,reconnection:!1,originatorInfoSent:!1,communicationServerUrl:hb,context:"",persist:!1,clientsConnected:!1,sessionDuration:6048e5,originatorConnectStarted:!1,debug:!1,_connectionStatus:e.ConnectionStatus.DISCONNECTED},this.state.otherPublicKey=r,this.state.dappMetadata=a,this.state.walletInfo=o,this.state.transports=l,this.state.platformType=t,this.state.analytics=f,this.state.protocolVersion=null!=s?s:1,this.state.isOriginator=!r,this.state.relayPersistence=c,this.state.communicationServerUrl=m,this.state.context=u,this.state.terminated=!1,this.state.sdkVersion=p,this.setMaxListeners(50),this.setConnectionStatus(e.ConnectionStatus.DISCONNECTED),(null==h?void 0:h.duration)&&(this.state.sessionDuration=6048e5),this.state.storageOptions=h,this.state.autoConnectOptions=v,this.state.debug=!0===(null==g?void 0:g.remoteLayer),!0===(null==g?void 0:g.remoteLayer)&&fO.enable("RemoteCommunication:Layer"),!0===(null==g?void 0:g.serviceLayer)&&fO.enable("SocketService:Layer"),!0===(null==g?void 0:g.eciesLayer)&&fO.enable("ECIES:Layer"),!0===(null==g?void 0:g.keyExchangeLayer)&&fO.enable("KeyExchange:Layer"),this.state.logging=g,(null==h?void 0:h.storageManager)&&(this.state.storageManager=h.storageManager),fB.RemoteCommunication(`[RemoteCommunication: constructor()] protocolVersion=${s} relayPersistence=${c} isOriginator=${this.state.isOriginator} communicationLayerPreference=${n} otherPublicKey=${r} reconnect=${i}`),this.initCommunicationLayer({communicationLayerPreference:n,otherPublicKey:r,reconnect:i,ecies:d,communicationServerUrl:m}),this.emitServiceStatusEvent({context:"constructor"})}initCommunicationLayer({communicationLayerPreference:t,otherPublicKey:n,reconnect:r,ecies:i,communicationServerUrl:o=hb}){return function({communicationLayerPreference:t,otherPublicKey:n,reconnect:r,ecies:i,communicationServerUrl:o=hb,instance:a}){var s,l,u,c,d,f,h,p,m;let{state:g}=a;if(fB.RemoteCommunication("[initCommunicationLayer()] ",JSON.stringify(g,null,2)),t!==e.CommunicationLayerPreference.SOCKET)throw Error("Invalid communication protocol");g.communicationLayer=new hI({communicationLayerPreference:t,otherPublicKey:n,reconnect:r,transports:g.transports,communicationServerUrl:o,context:g.context,ecies:i,logging:g.logging,remote:a});let v="undefined"!=typeof document&&document.URL||"",b="undefined"!=typeof document&&document.title||"";(null===(s=g.dappMetadata)||void 0===s?void 0:s.url)&&(v=g.dappMetadata.url),(null===(l=g.dappMetadata)||void 0===l?void 0:l.name)&&(b=g.dappMetadata.name);let y="undefined"!=typeof window&&void 0!==window.location?window.location.hostname:null!==(f=null!==(c=null===(u=g.dappMetadata)||void 0===u?void 0:u.name)&&void 0!==c?c:null===(d=g.dappMetadata)||void 0===d?void 0:d.url)&&void 0!==f?f:"unkown",A={url:v,title:b,source:null===(h=g.dappMetadata)||void 0===h?void 0:h.source,dappId:y,icon:(null===(p=g.dappMetadata)||void 0===p?void 0:p.iconUrl)||(null===(m=g.dappMetadata)||void 0===m?void 0:m.base64Icon),platform:g.platformType,apiVersion:hv};for(let[n,r]of(g.originatorInfo=A,Object.entries({[e.EventType.AUTHORIZED]:function(t){return()=>fh(this,void 0,void 0,function*(){var n,r,i;let{state:o}=t;if(o.authorized)return;yield fh(this,void 0,void 0,function*(){for(;!o.walletInfo;)yield hE(500)});let a="7.3".localeCompare((null===(n=o.walletInfo)||void 0===n?void 0:n.version)||"");if(fB.RemoteCommunication(`[RemoteCommunication: handleAuthorizedEvent()] HACK 'authorized' version=${null===(r=o.walletInfo)||void 0===r?void 0:r.version} compareValue=${a}`),1!==a)return;let s=o.platformType===e.PlatformType.MobileWeb||o.platformType===e.PlatformType.ReactNative||o.platformType===e.PlatformType.MetaMaskMobileWebview;fB.RemoteCommunication(`[RemoteCommunication: handleAuthorizedEvent()] HACK 'authorized' platform=${o.platformType} secure=${s} channel=${o.channelId} walletVersion=${null===(i=o.walletInfo)||void 0===i?void 0:i.version}`),s&&(o.authorized=!0,t.emit(e.EventType.AUTHORIZED))})}(a),[e.EventType.MESSAGE]:t=>{let n=t;t.message&&(n=n.message),function(t,n){let{state:r}=n;if(fB.RemoteCommunication(`[RemoteCommunication: onCommunicationLayerMessage()] context=${r.context} on 'message' typeof=${typeof t}`,t),n.state.ready=!0,r.isOriginator||t.type!==e.MessageType.ORIGINATOR_INFO){if(r.isOriginator&&t.type===e.MessageType.WALLET_INFO)!function(e,t){let{state:n}=e;n.walletInfo=t.walletInfo,n.paused=!1}(n,t);else{if(t.type===e.MessageType.TERMINATE)!function(t){let{state:n}=t;n.isOriginator&&(hT({options:{terminate:!0,sendMessage:!1},instance:t}),console.debug(),t.emit(e.EventType.TERMINATE))}(n);else if(t.type===e.MessageType.PAUSE)!function(t){let{state:n}=t;n.paused=!0,t.setConnectionStatus(e.ConnectionStatus.PAUSED)}(n);else if(t.type===e.MessageType.READY&&r.isOriginator)!function(t){let{state:n}=t;t.setConnectionStatus(e.ConnectionStatus.LINKED);let r=n.paused;n.paused=!1,t.emit(e.EventType.CLIENTS_READY,{isOriginator:n.isOriginator,walletInfo:n.walletInfo}),r&&(n.authorized=!0,t.emit(e.EventType.AUTHORIZED))}(n);else{if(t.type===e.MessageType.OTP&&r.isOriginator)return void function(t,n){var r;let{state:i}=t;t.emit(e.EventType.OTP,n.otpAnswer),1==="6.6".localeCompare((null===(r=i.walletInfo)||void 0===r?void 0:r.version)||"")&&(console.warn("RemoteCommunication::on 'otp' -- backward compatibility <6.6 -- triger eth_requestAccounts"),t.emit(e.EventType.SDK_RPC_CALL,{method:hA.ETH_REQUESTACCOUNTS,params:[]}))}(n,t);t.type===e.MessageType.AUTHORIZED&&r.isOriginator&&function(t){let{state:n}=t;n.authorized=!0,t.emit(e.EventType.AUTHORIZED)}(n)}n.emit(e.EventType.MESSAGE,t)}}else!function(t,n){var r;let{state:i}=t;null===(r=i.communicationLayer)||void 0===r||r.sendMessage({type:e.MessageType.WALLET_INFO,walletInfo:i.walletInfo}),i.originatorInfo=n.originatorInfo||n.originator,t.emit(e.EventType.CLIENTS_READY,{isOriginator:i.isOriginator,originatorInfo:i.originatorInfo}),i.paused=!1}(n,t)}(n,a)},[e.EventType.CHANNEL_PERSISTENCE]:function(t){return()=>fh(this,void 0,void 0,function*(){var n,r,i,o,a,s,l;let{state:u}=t;fB.RemoteCommunication(`[RemoteCommunication: handleFullPersistenceEvent()] context=${u.context}`),t.state.ready=!0,t.state.clientsConnected=!0,t.state.authorized=!0,t.state.relayPersistence=!0,null===(n=t.state.communicationLayer)||void 0===n||n.getKeyExchange().setKeysExchanged(!0),t.emit(e.EventType.KEYS_EXCHANGED,{keysExchanged:!0,isOriginator:!0}),t.emit(e.EventType.AUTHORIZED),t.emit(e.EventType.CLIENTS_READY),t.emit(e.EventType.CHANNEL_PERSISTENCE);try{u.channelConfig=Object.assign(Object.assign({},u.channelConfig),{localKey:null===(r=u.communicationLayer)||void 0===r?void 0:r.getKeyExchange().getKeyInfo().ecies.private,otherKey:null===(i=u.communicationLayer)||void 0===i?void 0:i.getKeyExchange().getOtherPublicKey(),channelId:null!==(o=u.channelId)&&void 0!==o?o:"",validUntil:null!==(s=null===(a=u.channelConfig)||void 0===a?void 0:a.validUntil)&&void 0!==s?s:6048e5,relayPersistence:!0}),yield null===(l=u.storageManager)||void 0===l?void 0:l.persistChannelConfig(u.channelConfig)}catch(e){console.error("Error persisting channel config",e)}})}(a),[e.EventType.CLIENTS_CONNECTED]:()=>{var n,r,i,o;let{state:s}=a;if(fB.RemoteCommunication(`[RemoteCommunication: handleClientsConnectedEvent()] on 'clients_connected' channel=${s.channelId} keysExchanged=${null===(r=null===(n=s.communicationLayer)||void 0===n?void 0:n.getKeyInfo())||void 0===r?void 0:r.keysExchanged}`),s.analytics){let e=s.isOriginator?vf.REQUEST:vf.REQUEST_MOBILE;fU(Object.assign(Object.assign({id:null!==(i=s.channelId)&&void 0!==i?i:"",event:s.reconnection?vf.RECONNECT:e},s.originatorInfo),{commLayer:t,sdkVersion:s.sdkVersion,walletVersion:null===(o=s.walletInfo)||void 0===o?void 0:o.version,commLayerVersion:hv}),s.communicationServerUrl).catch(e=>{console.error("Cannot send analytics",e)})}s.clientsConnected=!0,s.originatorInfoSent=!1,a.emit(e.EventType.CLIENTS_CONNECTED)},[e.EventType.KEYS_EXCHANGED]:n=>{var r,i,o,s,l,u,c,d;let{state:f}=a;if(fB.RemoteCommunication(`[RemoteCommunication: handleKeysExchangedEvent()] context=${f.context} on commLayer.'keys_exchanged' channel=${f.channelId}`,n),null===(i=null===(r=f.communicationLayer)||void 0===r?void 0:r.getKeyInfo())||void 0===i?void 0:i.keysExchanged){let t=Object.assign(Object.assign({},f.channelConfig),{channelId:null!==(o=f.channelId)&&void 0!==o?o:"",validUntil:(null===(s=f.channelConfig)||void 0===s?void 0:s.validUntil)||6048e5,localKey:f.communicationLayer.getKeyInfo().ecies.private,otherKey:f.communicationLayer.getKeyInfo().ecies.otherPubKey});null===(l=f.storageManager)||void 0===l||l.persistChannelConfig(t).catch(e=>{console.error("Error persisting channel config",e)}),a.setConnectionStatus(e.ConnectionStatus.LINKED)}(function(e,t){var n,r,i,o,a,s,l,u;let{state:c}=e;fB.RemoteCommunication(`[RemoteCommunication: setLastActiveDate()] channel=${c.channelId}`,t);let d=Object.assign(Object.assign({},c.channelConfig),{channelId:null!==(n=c.channelId)&&void 0!==n?n:"",validUntil:null!==(i=null===(r=c.channelConfig)||void 0===r?void 0:r.validUntil)&&void 0!==i?i:0,relayPersistence:c.relayPersistence,localKey:null===(a=null===(o=c.communicationLayer)||void 0===o?void 0:o.state.keyExchange)||void 0===a?void 0:a.getKeyInfo().ecies.private,otherKey:null===(l=null===(s=c.communicationLayer)||void 0===s?void 0:s.state.keyExchange)||void 0===l?void 0:l.getKeyInfo().ecies.otherPubKey,lastActive:t.getTime()});null===(u=c.storageManager)||void 0===u||u.persistChannelConfig(d)})(a,new Date),f.analytics&&f.channelId&&fU({id:f.channelId,event:n.isOriginator?vf.CONNECTED:vf.CONNECTED_MOBILE,sdkVersion:f.sdkVersion,commLayer:t,commLayerVersion:hv,walletVersion:null===(u=f.walletInfo)||void 0===u?void 0:u.version},f.communicationServerUrl).catch(e=>{console.error("Cannot send analytics",e)}),f.isOriginator=n.isOriginator,n.isOriginator||(null===(c=f.communicationLayer)||void 0===c||c.sendMessage({type:e.MessageType.READY}),f.ready=!0,f.paused=!1),n.isOriginator&&!f.originatorInfoSent&&(null===(d=f.communicationLayer)||void 0===d||d.sendMessage({type:e.MessageType.ORIGINATOR_INFO,originatorInfo:f.originatorInfo,originator:f.originatorInfo}),f.originatorInfoSent=!0)},[e.EventType.SOCKET_DISCONNECTED]:()=>{let{state:e}=a;fB.RemoteCommunication("[RemoteCommunication: handleSocketDisconnectedEvent()] on 'socket_Disconnected' set ready to false"),e.ready=!1},[e.EventType.SOCKET_RECONNECT]:()=>{let{state:e}=a;fB.RemoteCommunication("[RemoteCommunication: handleSocketReconnectEvent()] on 'socket_reconnect' -- reset key exchange status / set ready to false"),e.ready=!1,e.authorized=!1,hw(e),a.emitServiceStatusEvent({context:"socket_reconnect"})},[e.EventType.CLIENTS_DISCONNECTED]:n=>{var r;let{state:i}=a;fB.RemoteCommunication(`[RemoteCommunication: handleClientsDisconnectedEvent()] context=${i.context} on 'clients_disconnected' channelId=${n}`),i.relayPersistence||(i.clientsConnected=!1,i.ready=!1,i.authorized=!1),a.emit(e.EventType.CLIENTS_DISCONNECTED,i.channelId),a.setConnectionStatus(e.ConnectionStatus.DISCONNECTED),i.analytics&&i.channelId&&fU({id:i.channelId,event:vf.DISCONNECTED,sdkVersion:i.sdkVersion,commLayer:t,commLayerVersion:hv,walletVersion:null===(r=i.walletInfo)||void 0===r?void 0:r.version},i.communicationServerUrl).catch(e=>{console.error("Cannot send analytics",e)})},[e.EventType.KEY_INFO]:()=>{},[e.EventType.CHANNEL_CREATED]:t=>{let{state:n}=a;fB.RemoteCommunication(`[RemoteCommunication: handleChannelCreatedEvent()] context=${n.context} on 'channel_created' channelId=${t}`),a.emit(e.EventType.CHANNEL_CREATED,t)},[e.EventType.CLIENTS_WAITING]:t=>{var n;let{state:r}=a;if(fB.RemoteCommunication(`[RemoteCommunication: handleClientsWaitingEvent()] context=${r.context} on 'clients_waiting' numberUsers=${t} ready=${r.ready} autoStarted=${r.originatorConnectStarted}`),a.setConnectionStatus(e.ConnectionStatus.WAITING),a.emit(e.EventType.CLIENTS_WAITING,t),r.originatorConnectStarted){fB.RemoteCommunication(`[RemoteCommunication: handleClientsWaitingEvent()] on 'clients_waiting' watch autoStarted=${r.originatorConnectStarted} timeout`,r.autoConnectOptions);let t=(null===(n=r.autoConnectOptions)||void 0===n?void 0:n.timeout)||3e3,i=setTimeout(()=>{fB.RemoteCommunication(`[RemoteCommunication: handleClientsWaitingEvent()] setTimeout(${t}) terminate channelConfig`,r.autoConnectOptions),r.originatorConnectStarted=!1,r.ready||a.setConnectionStatus(e.ConnectionStatus.TIMEOUT),clearTimeout(i)},t)}},[e.EventType.RPC_UPDATE]:t=>{a.emit(e.EventType.RPC_UPDATE,t)}})))try{g.communicationLayer.on(n,r)}catch(e){console.error(`Error registering handler for ${n}:`,e)}}({communicationLayerPreference:t,otherPublicKey:n,reconnect:r,ecies:i,communicationServerUrl:o,instance:this})}originatorSessionConnect(){return fh(this,void 0,void 0,function*(){return yield function(e){var t;return fh(this,void 0,void 0,function*(){let{state:n}=e;if(!n.storageManager)return void fB.RemoteCommunication("[RemoteCommunication: originatorSessionConnect()] no storage manager defined - skip");let r=yield n.storageManager.getPersistedChannelConfig();if(fB.RemoteCommunication(`[RemoteCommunication: originatorSessionConnect()] autoStarted=${n.originatorConnectStarted} channelConfig`,r),null===(t=n.communicationLayer)||void 0===t?void 0:t.isConnected())return fB.RemoteCommunication("[RemoteCommunication: originatorSessionConnect()] socket already connected - skip"),r;if(r){if(r.validUntil>Date.now())return n.channelConfig=r,n.originatorConnectStarted=!0,n.channelId=null==r?void 0:r.channelId,n.reconnection=!0,r;fB.RemoteCommunication("[RemoteCommunication: autoConnect()] Session has expired")}n.originatorConnectStarted=!1})}(this)})}generateChannelIdConnect(){return fh(this,void 0,void 0,function*(){return function(e){var t,n,r,i;if(!e.communicationLayer)throw Error("communication layer not initialized");if(e.ready)throw Error("Channel already connected");if(e.channelId&&(null===(t=e.communicationLayer)||void 0===t?void 0:t.isConnected()))return console.warn("Channel already exists -- interrupt generateChannelId",e.channelConfig),e.channelConfig=Object.assign(Object.assign({},e.channelConfig),{channelId:e.channelId,validUntil:Date.now()+e.sessionDuration}),null===(n=e.storageManager)||void 0===n||n.persistChannelConfig(e.channelConfig),{channelId:e.channelId,pubKey:null===(i=null===(r=e.communicationLayer)||void 0===r?void 0:r.getKeyInfo())||void 0===i?void 0:i.ecies.public};fB.RemoteCommunication("[RemoteCommunication: generateChannelId()]");let o=e.communicationLayer.createChannel();fB.RemoteCommunication("[RemoteCommunication: generateChannelId()] channel created",o);let a=Object.assign(Object.assign({},e.channelConfig),{channelId:o.channelId,validUntil:Date.now()+e.sessionDuration});return e.channelId=o.channelId,e.channelConfig=a,{channelId:e.channelId,pubKey:o.pubKey}}(this.state)})}clean(){return hw(this.state)}connectToChannel({channelId:e,withKeyExchange:t}){return function({channelId:e,withKeyExchange:t,state:n}){var r,i,o;if(!dd(e))throw fB.RemoteCommunication(`[RemoteCommunication: connectToChannel()] context=${n.context} invalid channel channelId=${e}`),Error(`Invalid channel ${e}`);if(fB.RemoteCommunication(`[RemoteCommunication: connectToChannel()] context=${n.context} channelId=${e} withKeyExchange=${t}`),null===(r=n.communicationLayer)||void 0===r?void 0:r.isConnected())return void fB.RemoteCommunication(`[RemoteCommunication: connectToChannel()] context=${n.context} already connected - interrupt connection.`);n.channelId=e,null===(i=n.communicationLayer)||void 0===i||i.connectToChannel({channelId:e,withKeyExchange:t});let a=Object.assign(Object.assign({},n.channelConfig),{channelId:e,validUntil:Date.now()+n.sessionDuration});n.channelConfig=a,null===(o=n.storageManager)||void 0===o||o.persistChannelConfig(a)}({channelId:e,withKeyExchange:t,state:this.state})}sendMessage(t){return function(t,n){var r,i;return fh(this,void 0,void 0,function*(){let{state:o}=t;fB.RemoteCommunication(`[RemoteCommunication: sendMessage()] context=${o.context} paused=${o.paused} ready=${o.ready} relayPersistence=${o.relayPersistence} authorized=${o.authorized} socket=${null===(r=o.communicationLayer)||void 0===r?void 0:r.isConnected()} clientsConnected=${o.clientsConnected} status=${o._connectionStatus}`,n),o.relayPersistence||o.ready&&(null===(i=o.communicationLayer)||void 0===i?void 0:i.isConnected())&&o.clientsConnected||(fB.RemoteCommunication(`[RemoteCommunication: sendMessage()] context=${o.context} SKIP message waiting for MM mobile readiness.`),yield new Promise(n=>{t.once(e.EventType.CLIENTS_READY,n)}),fB.RemoteCommunication(`[RemoteCommunication: sendMessage()] context=${o.context} AFTER SKIP / READY -- sending pending message`));try{yield function(t,n){return fh(this,void 0,void 0,function*(){return new Promise(r=>{var i,o,a,s;let{state:l}=t;if(fB.RemoteCommunication(`[RemoteCommunication: handleAuthorization()] context=${l.context} ready=${l.ready} authorized=${l.authorized} method=${n.method}`),1==="7.3".localeCompare((null===(i=l.walletInfo)||void 0===i?void 0:i.version)||""))return fB.RemoteCommunication(`[RemoteCommunication: handleAuthorization()] compatibility hack wallet version > ${null===(o=l.walletInfo)||void 0===o?void 0:o.version}`),null===(a=l.communicationLayer)||void 0===a||a.sendMessage(n),void r();!l.isOriginator||l.authorized||l.relayPersistence?(null===(s=l.communicationLayer)||void 0===s||s.sendMessage(n),r()):t.once(e.EventType.AUTHORIZED,()=>{var e;fB.RemoteCommunication(`[RemoteCommunication: handleAuthorization()] context=${l.context} AFTER SKIP / AUTHORIZED -- sending pending message`),null===(e=l.communicationLayer)||void 0===e||e.sendMessage(n),r()})})})}(t,n)}catch(e){throw console.error(`[RemoteCommunication: sendMessage()] context=${o.context} ERROR`,e),e}})}(this,t)}testStorage(){return fh(this,void 0,void 0,function*(){return function(e){var t;return fh(this,void 0,void 0,function*(){let n=yield null===(t=e.storageManager)||void 0===t?void 0:t.getPersistedChannelConfig();fB.RemoteCommunication("[RemoteCommunication: testStorage()] res",n)})}(this.state)})}getChannelConfig(){return this.state.channelConfig}isReady(){return this.state.ready}isConnected(){var e;return null===(e=this.state.communicationLayer)||void 0===e?void 0:e.isConnected()}isAuthorized(){return this.state.authorized}isPaused(){return this.state.paused}getCommunicationLayer(){return this.state.communicationLayer}ping(){var e;fB.RemoteCommunication(`[RemoteCommunication: ping()] channel=${this.state.channelId}`),null===(e=this.state.communicationLayer)||void 0===e||e.ping()}testLogger(){fB.RemoteCommunication(`testLogger() channel=${this.state.channelId}`),fB.SocketService(`testLogger() channel=${this.state.channelId}`),fB.Ecies(`testLogger() channel=${this.state.channelId}`),fB.KeyExchange(`testLogger() channel=${this.state.channelId}`)}keyCheck(){var e;fB.RemoteCommunication(`[RemoteCommunication: keyCheck()] channel=${this.state.channelId}`),null===(e=this.state.communicationLayer)||void 0===e||e.keyCheck()}setConnectionStatus(t){this.state._connectionStatus!==t&&(this.state._connectionStatus=t,this.emit(e.EventType.CONNECTION_STATUS,t),this.emitServiceStatusEvent({context:"setConnectionStatus"}))}emitServiceStatusEvent(t={}){this.emit(e.EventType.SERVICE_STATUS,this.getServiceStatus())}getConnectionStatus(){return this.state._connectionStatus}getServiceStatus(){return{originatorInfo:this.state.originatorInfo,keyInfo:this.getKeyInfo(),connectionStatus:this.state._connectionStatus,channelConfig:this.state.channelConfig,channelId:this.state.channelId}}getKeyInfo(){var e;return null===(e=this.state.communicationLayer)||void 0===e?void 0:e.getKeyInfo()}resetKeys(){var e;null===(e=this.state.communicationLayer)||void 0===e||e.resetKeys()}setOtherPublicKey(e){var t;let n=null===(t=this.state.communicationLayer)||void 0===t?void 0:t.getKeyExchange();if(!n)throw Error("KeyExchange is not initialized.");n.getOtherPublicKey()!==e&&n.setOtherPublicKey(e)}pause(){var t;fB.RemoteCommunication(`[RemoteCommunication: pause()] channel=${this.state.channelId}`),null===(t=this.state.communicationLayer)||void 0===t||t.pause(),this.setConnectionStatus(e.ConnectionStatus.PAUSED)}getVersion(){return hv}hasRelayPersistence(){var e;return null!==(e=this.state.relayPersistence)&&void 0!==e&&e}resume(){return function(t){var n;let{state:r}=t;fB.RemoteCommunication(`[RemoteCommunication: resume()] channel=${r.channelId}`),null===(n=r.communicationLayer)||void 0===n||n.resume(),t.setConnectionStatus(e.ConnectionStatus.LINKED)}(this)}getChannelId(){return this.state.channelId}getRPCMethodTracker(){var e;return null===(e=this.state.communicationLayer)||void 0===e?void 0:e.getRPCMethodTracker()}disconnect(e){return hT({options:e,instance:this})}}function hP(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(a,s)}l((r=r.apply(e,t||[])).next())})}function hL(e,t,n,r){if("a"===n&&!r)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}function hN(e,t,n,r,i){if("m"===r)throw TypeError("Private method is not writable");if("a"===r&&!i)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(e,n):i?i.value=n:t.set(e,n),n}(vu=vp||(vp={})).RENEW="renew",vu.LINK="link","function"==typeof SuppressedError&&SuppressedError;var hD={errors:{disconnected:()=>"MetaMask: Disconnected from chain. Attempting to connect.",permanentlyDisconnected:()=>"MetaMask: Disconnected from MetaMask background. Page reload required.",sendSiteMetadata:()=>"MetaMask: Failed to send site metadata. This is an internal error, please report this bug.",unsupportedSync:e=>`MetaMask: The MetaMask Ethereum provider does not support synchronous methods like ${e} without a callback parameter.`,invalidDuplexStream:()=>"Must provide a Node.js-style duplex stream.",invalidNetworkParams:()=>"MetaMask: Received invalid network parameters. Please report this bug.",invalidRequestArgs:()=>"Expected a single, non-array, object argument.",invalidRequestMethod:()=>"'args.method' must be a non-empty string.",invalidRequestParams:()=>"'args.params' must be an object or array if provided.",invalidLoggerObject:()=>"'args.logger' must be an object if provided.",invalidLoggerMethod:e=>`'args.logger' must include required method '${e}'.`},info:{connected:e=>`MetaMask: Connected to chain with ID "${e}".`},warnings:{chainIdDeprecation:"MetaMask: 'ethereum.chainId' is deprecated and may be removed in the future. Please use the 'eth_chainId' RPC method instead.\nFor more information, see: https://github.com/MetaMask/metamask-improvement-proposals/discussions/23",networkVersionDeprecation:"MetaMask: 'ethereum.networkVersion' is deprecated and may be removed in the future. Please use the 'net_version' RPC method instead.\nFor more information, see: https://github.com/MetaMask/metamask-improvement-proposals/discussions/23",selectedAddressDeprecation:"MetaMask: 'ethereum.selectedAddress' is deprecated and may be removed in the future. Please use the 'eth_accounts' RPC method instead.\nFor more information, see: https://github.com/MetaMask/metamask-improvement-proposals/discussions/23",enableDeprecation:"MetaMask: 'ethereum.enable()' is deprecated and may be removed in the future. Please use the 'eth_requestAccounts' RPC method instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1102",sendDeprecation:"MetaMask: 'ethereum.send(...)' is deprecated and may be removed in the future. Please use 'ethereum.sendAsync(...)' or 'ethereum.request(...)' instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1193",events:{close:"MetaMask: The event 'close' is deprecated and may be removed in the future. Please use 'disconnect' instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1193#disconnect",data:"MetaMask: The event 'data' is deprecated and will be removed in the future. Use 'message' instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1193#message",networkChanged:"MetaMask: The event 'networkChanged' is deprecated and may be removed in the future. Use 'chainChanged' instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1193#chainchanged",notification:"MetaMask: The event 'notification' is deprecated and may be removed in the future. Use 'message' instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1193#message"},rpc:{ethDecryptDeprecation:"MetaMask: The RPC method 'eth_decrypt' is deprecated and may be removed in the future.\nFor more information, see: https://medium.com/metamask/metamask-api-method-deprecation-2b0564a84686",ethGetEncryptionPublicKeyDeprecation:"MetaMask: The RPC method 'eth_getEncryptionPublicKey' is deprecated and may be removed in the future.\nFor more information, see: https://medium.com/metamask/metamask-api-method-deprecation-2b0564a84686",walletWatchAssetNFTExperimental:"MetaMask: The RPC method 'wallet_watchAsset' is experimental for ERC721/ERC1155 assets and may change in the future.\nFor more information, see: https://github.com/MetaMask/metamask-improvement-proposals/blob/main/MIPs/mip-1.md and https://github.com/MetaMask/metamask-improvement-proposals/blob/main/PROCESS-GUIDE.md#proposal-lifecycle"},experimentalMethods:"MetaMask: 'ethereum._metamask' exposes non-standard, experimental methods. They may be removed or changed without warning."}},hB={},hj={},hF=l&&l.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(a,s)}l((r=r.apply(e,t||[])).next())})};Object.defineProperty(hj,"__esModule",{value:!0}),hj.createAsyncMiddleware=void 0,hj.createAsyncMiddleware=function(e){return(t,n,r,i)=>hF(this,void 0,void 0,function*(){let o;let a=new Promise(e=>{o=e}),s=null,l=!1;try{yield e(t,n,()=>hF(this,void 0,void 0,function*(){return l=!0,r(e=>{s=e,o()}),a})),l?(yield a,s(null)):i(null)}catch(e){s?s(e):i(e)}})};var hz={};Object.defineProperty(hz,"__esModule",{value:!0}),hz.createScaffoldMiddleware=void 0,hz.createScaffoldMiddleware=function(e){return(t,n,r,i)=>{let o=e[t.method];return void 0===o?r():"function"==typeof o?o(t,n,r,i):(n.result=o,i())}};var hU={};Object.defineProperty(hU,"__esModule",{value:!0}),hU.getUniqueId=void 0;let hq=Math.floor(4294967295*Math.random());hU.getUniqueId=function(){return hq=(hq+1)%4294967295};var hK={};Object.defineProperty(hK,"__esModule",{value:!0}),hK.createIdRemapMiddleware=void 0,hK.createIdRemapMiddleware=function(){return(e,t,n,r)=>{let i=e.id,o=(0,hU.getUniqueId)();e.id=o,t.id=o,n(n=>{e.id=i,t.id=i,n()})}};var hH={},hV={},h$={},hW={},hY={},hG={};Object.defineProperty(hG,"__esModule",{value:!0}),hG.errorCodes={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901}},hG.errorValues={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}};var hQ={},hZ={},hJ={},hX={},h0={},h1={};Object.defineProperty(h1,"__esModule",{value:!0});var h2=((o=h2||{})[o.Null=4]="Null",o[o.Comma=1]="Comma",o[o.Wrapper=1]="Wrapper",o[o.True=4]="True",o[o.False=5]="False",o[o.Quote=1]="Quote",o[o.Colon=1]="Colon",o[o.Date=24]="Date",o),h3=/"|\\|\n|\r|\t/gu;function h6(e){return 127>=e.charCodeAt(0)}h1.isNonEmptyArray=function(e){return Array.isArray(e)&&e.length>0},h1.isNullOrUndefined=function(e){return null==e},h1.isObject=function(e){return!!e&&"object"==typeof e&&!Array.isArray(e)},h1.hasProperty=(e,t)=>Object.hasOwnProperty.call(e,t),h1.getKnownPropertyNames=function(e){return Object.getOwnPropertyNames(e)},h1.JsonSize=h2,h1.ESCAPE_CHARACTERS_REGEXP=h3,h1.isPlainObject=function(e){if("object"!=typeof e||null===e)return!1;try{let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}catch(e){return!1}},h1.isASCII=h6,h1.calculateStringSize=function(e){var t,n;return e.split("").reduce((e,t)=>h6(t)?e+1:e+2,0)+(t=e.match(h3),n=()=>[],null!=t?t:n()).length},h1.calculateNumberSize=function(e){return e.toString().length};var h4=c(Object.freeze({__proto__:null,ErrorWithCause:class e extends Error{constructor(t,{cause:n}={}){super(t),this.name=e.name,n&&(this.cause=n),this.message=t}}}));let h8=e=>{if(e&&"object"==typeof e&&"cause"in e){if("function"==typeof e.cause){let t=e.cause();return t instanceof Error?t:void 0}return e.cause instanceof Error?e.cause:void 0}},h5=(e,t)=>{if(!(e instanceof Error))return"";let n=e.stack||"";if(t.has(e))return n+"\ncauses have become circular...";let r=h8(e);return r?(t.add(e),n+"\ncaused by: "+h5(r,t)):n},h7=(e,t,n)=>{if(!(e instanceof Error))return"";let r=n?"":e.message||"";if(t.has(e))return r+": ...";let i=h8(e);if(i){t.add(e);let n="cause"in e&&"function"==typeof e.cause;return r+(n?"":": ")+h7(i,t,n)}return r};var h9=c(Object.freeze({__proto__:null,findCauseByReference:(e,t)=>{if(!e||!t||!(e instanceof Error)||!(t.prototype instanceof Error)&&t!==Error)return;let n=new Set,r=e;for(;r&&!n.has(r);){if(n.add(r),r instanceof t)return r;r=h8(r)}},getErrorCause:h8,messageWithCauses:e=>h7(e,new Set),stackWithCauses:e=>h5(e,new Set)}));let{ErrorWithCause:pe}=h4,{findCauseByReference:pt,getErrorCause:pn,messageWithCauses:pr,stackWithCauses:pi}=h9;Object.defineProperty(h0,"__esModule",{value:!0});var po={ErrorWithCause:pe};function pa(e){return"object"==typeof e&&null!==e&&"code"in e}function ps(e){return"object"==typeof e&&null!==e&&"message"in e}h0.isErrorWithCode=pa,h0.isErrorWithMessage=ps,h0.isErrorWithStack=function(e){return"object"==typeof e&&null!==e&&"stack"in e},h0.getErrorMessage=function(e){return ps(e)&&"string"==typeof e.message?e.message:h1.isNullOrUndefined.call(void 0,e)?"":String(e)},h0.wrapError=function(e,t){if(e instanceof Error||h1.isObject.call(void 0,e)&&"Error"===e.constructor.name){let n;return n=2===Error.length?Error(t,{cause:e}):new po.ErrorWithCause(t,{cause:e}),pa(e)&&(n.code=e.code),n}return t.length>0?Error(`${String(e)}: ${t}`):Error(String(e))};class pl extends TypeError{constructor(e,t){let n;let{message:r,explanation:i,...o}=e,{path:a}=e,s=0===a.length?r:`At path: ${a.join(".")} -- ${r}`;super(i??s),null!=i&&(this.cause=s),Object.assign(this,o),this.name=this.constructor.name,this.failures=()=>n??(n=[e,...t()])}}function pu(e){return"object"==typeof e&&null!=e}function pc(e){if("[object Object]"!==Object.prototype.toString.call(e))return!1;let t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function pd(e){return"symbol"==typeof e?e.toString():"string"==typeof e?JSON.stringify(e):`${e}`}function*pf(e,t,n,r){var i;for(let o of(pu(i=e)&&"function"==typeof i[Symbol.iterator]||(e=[e]),e)){let e=function(e,t,n,r){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});let{path:i,branch:o}=t,{type:a}=n,{refinement:s,message:l=`Expected a value of type \`${a}\`${s?` with refinement \`${s}\``:""}, but received: \`${pd(r)}\``}=e;return{value:r,type:a,refinement:s,key:i[i.length-1],path:i,branch:o,...e,message:l}}(o,t,n,r);e&&(yield e)}}function*ph(e,t,n={}){let{path:r=[],branch:i=[e],coerce:o=!1,mask:a=!1}=n,s={path:r,branch:i};if(o&&(e=t.coercer(e,s),a&&"type"!==t.type&&pu(t.schema)&&pu(e)&&!Array.isArray(e)))for(let n in e)void 0===t.schema[n]&&delete e[n];let l="valid";for(let r of t.validator(e,s))r.explanation=n.message,l="not_valid",yield[r,void 0];for(let[u,c,d]of t.entries(e,s))for(let t of ph(c,d,{path:void 0===u?r:[...r,u],branch:void 0===u?i:[...i,c],coerce:o,mask:a,message:n.message}))t[0]?(l=null!=t[0].refinement?"not_refined":"not_valid",yield[t[0],void 0]):o&&(c=t[1],void 0===u?e=c:e instanceof Map?e.set(u,c):e instanceof Set?e.add(c):pu(e)&&(void 0!==c||u in e)&&(e[u]=c));if("not_valid"!==l)for(let r of t.refiner(e,s))r.explanation=n.message,l="not_refined",yield[r,void 0];"valid"===l&&(yield[void 0,e])}class pp{constructor(e){let{type:t,schema:n,validator:r,refiner:i,coercer:o=e=>e,entries:a=function*(){}}=e;this.type=t,this.schema=n,this.entries=a,this.coercer=o,this.validator=r?(e,t)=>pf(r(e,t),t,this,e):()=>[],this.refiner=i?(e,t)=>pf(i(e,t),t,this,e):()=>[]}assert(e,t){return pm(e,this,t)}create(e,t){return pg(e,this,t)}is(e){return pb(e,this)}mask(e,t){return pv(e,this,t)}validate(e,t={}){return py(e,this,t)}}function pm(e,t,n){let r=py(e,t,{message:n});if(r[0])throw r[0]}function pg(e,t,n){let r=py(e,t,{coerce:!0,message:n});if(r[0])throw r[0];return r[1]}function pv(e,t,n){let r=py(e,t,{coerce:!0,mask:!0,message:n});if(r[0])throw r[0];return r[1]}function pb(e,t){return!py(e,t)[0]}function py(e,t,n={}){let r=ph(e,t,n),i=function(e){let{done:t,value:n}=e.next();return t?void 0:n}(r);return i[0]?[new pl(i[0],function*(){for(let e of r)e[0]&&(yield e[0])}),void 0]:[void 0,i[1]]}function pA(e,t){return new pp({type:e,schema:null,validator:t})}function pw(e){let t;return new pp({type:"lazy",schema:null,*entries(n,r){t??(t=e()),yield*t.entries(n,r)},validator:(n,r)=>(t??(t=e()),t.validator(n,r)),coercer:(n,r)=>(t??(t=e()),t.coercer(n,r)),refiner:(n,r)=>(t??(t=e()),t.refiner(n,r))})}function p_(){return pA("any",()=>!0)}function pE(e){return new pp({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(let[n,r]of t.entries())yield[n,r,e]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||`Expected an array value, but received: ${pd(e)}`})}function pS(){return pA("boolean",e=>"boolean"==typeof e)}function pk(){return pA("integer",e=>"number"==typeof e&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${pd(e)}`)}function pM(e){let t=pd(e),n=typeof e;return new pp({type:"literal",schema:"string"===n||"number"===n||"boolean"===n?e:null,validator:n=>n===e||`Expected the literal \`${t}\`, but received: ${pd(n)}`})}function pC(){return pA("never",()=>!1)}function px(e){return new pp({...e,validator:(t,n)=>null===t||e.validator(t,n),refiner:(t,n)=>null===t||e.refiner(t,n)})}function pR(){return pA("number",e=>"number"==typeof e&&!isNaN(e)||`Expected a number, but received: ${pd(e)}`)}function pI(e){let t=e?Object.keys(e):[],n=pC();return new pp({type:"object",schema:e||null,*entries(r){if(e&&pu(r)){let i=new Set(Object.keys(r));for(let n of t)i.delete(n),yield[n,r[n],e[n]];for(let e of i)yield[e,r[e],n]}},validator:e=>pu(e)||`Expected an object, but received: ${pd(e)}`,coercer:e=>pu(e)?{...e}:e})}function pT(e){return new pp({...e,validator:(t,n)=>void 0===t||e.validator(t,n),refiner:(t,n)=>void 0===t||e.refiner(t,n)})}function pO(e,t){return new pp({type:"record",schema:null,*entries(n){if(pu(n))for(let r in n){let i=n[r];yield[r,r,e],yield[r,i,t]}},validator:e=>pu(e)||`Expected an object, but received: ${pd(e)}`})}function pP(){return pA("string",e=>"string"==typeof e||`Expected a string, but received: ${pd(e)}`)}function pL(e){let t=Object.keys(e);return new pp({type:"type",schema:e,*entries(n){if(pu(n))for(let r of t)yield[r,n[r],e[r]]},validator:e=>pu(e)||`Expected an object, but received: ${pd(e)}`,coercer:e=>pu(e)?{...e}:e})}function pN(e){let t=e.map(e=>e.type).join(" | ");return new pp({type:"union",schema:null,coercer(t){for(let n of e){let[e,r]=n.validate(t,{coerce:!0});if(!e)return r}return t},validator(n,r){let i=[];for(let t of e){let[...e]=ph(n,t,r),[o]=e;if(!o[0])return[];for(let[t]of e)t&&i.push(t)}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${pd(n)}`,...i]}})}function pD(){return pA("unknown",()=>!0)}function pB(e,t,n){return new pp({...e,coercer:(r,i)=>pb(r,t)?e.coercer(n(r,i),i):e.coercer(r,i)})}function pj(e){return e instanceof Map||e instanceof Set?e.size:e.length}function pF(e,t,n){return new pp({...e,*refiner(r,i){for(let o of(yield*e.refiner(r,i),pf(n(r,i),i,e,r)))yield{...o,refinement:t}}})}var pz=c(Object.freeze({__proto__:null,Struct:pp,StructError:pl,any:p_,array:pE,assert:pm,assign:function(...e){let t="type"===e[0].type,n=Object.assign({},...e.map(e=>e.schema));return t?pL(n):pI(n)},bigint:function(){return pA("bigint",e=>"bigint"==typeof e)},boolean:pS,coerce:pB,create:pg,date:function(){return pA("date",e=>e instanceof Date&&!isNaN(e.getTime())||`Expected a valid \`Date\` object, but received: ${pd(e)}`)},defaulted:function(e,t,n={}){return pB(e,pD(),e=>{let r="function"==typeof t?t():t;if(void 0===e)return r;if(!n.strict&&pc(e)&&pc(r)){let t={...e},n=!1;for(let e in r)void 0===t[e]&&(t[e]=r[e],n=!0);if(n)return t}return e})},define:pA,deprecated:function(e,t){return new pp({...e,refiner:(t,n)=>void 0===t||e.refiner(t,n),validator:(n,r)=>void 0===n||(t(n,r),e.validator(n,r))})},dynamic:function(e){return new pp({type:"dynamic",schema:null,*entries(t,n){let r=e(t,n);yield*r.entries(t,n)},validator:(t,n)=>e(t,n).validator(t,n),coercer:(t,n)=>e(t,n).coercer(t,n),refiner:(t,n)=>e(t,n).refiner(t,n)})},empty:function(e){return pF(e,"empty",t=>{let n=pj(t);return 0===n||`Expected an empty ${e.type} but received one with a size of \`${n}\``})},enums:function(e){let t={},n=e.map(e=>pd(e)).join();for(let n of e)t[n]=n;return new pp({type:"enums",schema:t,validator:t=>e.includes(t)||`Expected one of \`${n}\`, but received: ${pd(t)}`})},func:function(){return pA("func",e=>"function"==typeof e||`Expected a function, but received: ${pd(e)}`)},instance:function(e){return pA("instance",t=>t instanceof e||`Expected a \`${e.name}\` instance, but received: ${pd(t)}`)},integer:pk,intersection:function(e){return new pp({type:"intersection",schema:null,*entries(t,n){for(let r of e)yield*r.entries(t,n)},*validator(t,n){for(let r of e)yield*r.validator(t,n)},*refiner(t,n){for(let r of e)yield*r.refiner(t,n)}})},is:pb,lazy:pw,literal:pM,map:function(e,t){return new pp({type:"map",schema:null,*entries(n){if(e&&t&&n instanceof Map)for(let[r,i]of n.entries())yield[r,r,e],yield[r,i,t]},coercer:e=>e instanceof Map?new Map(e):e,validator:e=>e instanceof Map||`Expected a \`Map\` object, but received: ${pd(e)}`})},mask:pv,max:function(e,t,n={}){let{exclusive:r}=n;return pF(e,"max",n=>r?nr?n>t:n>=t||`Expected a ${e.type} greater than ${r?"":"or equal to "}${t} but received \`${n}\``)},never:pC,nonempty:function(e){return pF(e,"nonempty",t=>pj(t)>0||`Expected a nonempty ${e.type} but received an empty one`)},nullable:px,number:pR,object:pI,omit:function(e,t){let{schema:n}=e,r={...n};for(let e of t)delete r[e];return"type"===e.type?pL(r):pI(r)},optional:pT,partial:function(e){let t=e instanceof pp?{...e.schema}:{...e};for(let e in t)t[e]=pT(t[e]);return pI(t)},pattern:function(e,t){return pF(e,"pattern",n=>t.test(n)||`Expected a ${e.type} matching \`/${t.source}/\` but received "${n}"`)},pick:function(e,t){let{schema:n}=e,r={};for(let e of t)r[e]=n[e];return pI(r)},record:pO,refine:pF,regexp:function(){return pA("regexp",e=>e instanceof RegExp)},set:function(e){return new pp({type:"set",schema:null,*entries(t){if(e&&t instanceof Set)for(let n of t)yield[n,n,e]},coercer:e=>e instanceof Set?new Set(e):e,validator:e=>e instanceof Set||`Expected a \`Set\` object, but received: ${pd(e)}`})},size:function(e,t,n=t){let r=`Expected a ${e.type}`,i=t===n?`of \`${t}\``:`between \`${t}\` and \`${n}\``;return pF(e,"size",e=>{if("number"==typeof e||e instanceof Date)return t<=e&&e<=n||`${r} ${i} but received \`${e}\``;if(e instanceof Map||e instanceof Set){let{size:o}=e;return t<=o&&o<=n||`${r} with a size ${i} but received one with a size of \`${o}\``}{let{length:o}=e;return t<=o&&o<=n||`${r} with a length ${i} but received one with a length of \`${o}\``}})},string:pP,struct:function(e,t){return console.warn("superstruct@0.11 - The `struct` helper has been renamed to `define`."),pA(e,t)},trimmed:function(e){return pB(e,pP(),e=>e.trim())},tuple:function(e){let t=pC();return new pp({type:"tuple",schema:null,*entries(n){if(Array.isArray(n)){let r=Math.max(e.length,n.length);for(let i=0;iArray.isArray(e)||`Expected an array, but received: ${pd(e)}`})},type:pL,union:pN,unknown:pD,validate:py}));function pU(e,t){return"string"==typeof function(e){let t,n=e[0],r=1;for(;rn.call(t,...e)),t=void 0)}return n}([e,"optionalAccess",e=>e.prototype,"optionalAccess",e=>e.constructor,"optionalAccess",e=>e.name])?new e({message:t}):e({message:t})}Object.defineProperty(hX,"__esModule",{value:!0});var pq=class extends Error{constructor(e){super(e.message),this.code="ERR_ASSERTION"}};hX.AssertionError=pq,hX.assert=function(e,t="Assertion failed.",n=pq){if(!e){if(t instanceof Error)throw t;throw pU(n,t)}},hX.assertStruct=function(e,t,n="Assertion failed",r=pq){try{pz.assert.call(void 0,e,t)}catch(e){throw pU(r,`${n}: ${h0.getErrorMessage.call(void 0,e).replace(/\.$/u,"")}.`)}},hX.assertExhaustive=function(e){throw Error("Invalid branch reached. Should be detected during compilation.")};var pK={},pH={};function pV(e){if(!Number.isSafeInteger(e)||e<0)throw Error(`Wrong positive integer: ${e}`)}function p$(e){if("boolean"!=typeof e)throw Error(`Expected boolean, not ${e}`)}function pW(e,...t){if(!(e instanceof Uint8Array))throw Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function pY(e){if("function"!=typeof e||"function"!=typeof e.create)throw Error("Hash should be wrapped by utils.wrapConstructor");pV(e.outputLen),pV(e.blockLen)}function pG(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}function pQ(e,t){pW(e);let n=t.outputLen;if(e.length>pX&pJ)}:{h:0|Number(e>>pX&pJ),l:0|Number(e&pJ)}}function p1(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let i=0;iBigInt(e>>>0)<>>0);pZ.toBig=p2;let p3=(e,t,n)=>e>>>n;pZ.shrSH=p3;let p6=(e,t,n)=>e<<32-n|t>>>n;pZ.shrSL=p6;let p4=(e,t,n)=>e>>>n|t<<32-n;pZ.rotrSH=p4;let p8=(e,t,n)=>e<<32-n|t>>>n;pZ.rotrSL=p8;let p5=(e,t,n)=>e<<64-n|t>>>n-32;pZ.rotrBH=p5;let p7=(e,t,n)=>e>>>n-32|t<<64-n;pZ.rotrBL=p7;let p9=(e,t)=>t;pZ.rotr32H=p9;let me=(e,t)=>e;pZ.rotr32L=me;let mt=(e,t,n)=>e<>>32-n;pZ.rotlSH=mt;let mn=(e,t,n)=>t<>>32-n;pZ.rotlSL=mn;let mr=(e,t,n)=>t<>>64-n;pZ.rotlBH=mr;let mi=(e,t,n)=>e<>>64-n;function mo(e,t,n,r){let i=(t>>>0)+(r>>>0);return{h:e+n+(i/4294967296|0)|0,l:0|i}}pZ.rotlBL=mi,pZ.add=mo;let ma=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0);pZ.add3L=ma;let ms=(e,t,n,r)=>t+n+r+(e/4294967296|0)|0;pZ.add3H=ms;let ml=(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0);pZ.add4L=ml;let mu=(e,t,n,r,i)=>t+n+r+i+(e/4294967296|0)|0;pZ.add4H=mu;let mc=(e,t,n,r,i)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(i>>>0);pZ.add5L=mc;let md=(e,t,n,r,i,o)=>t+n+r+i+o+(e/4294967296|0)|0;pZ.add5H=md,pZ.default={fromBig:p0,split:p1,toBig:p2,shrSH:p3,shrSL:p6,rotrSH:p4,rotrSL:p8,rotrBH:p5,rotrBL:p7,rotr32H:p9,rotr32L:me,rotlSH:mt,rotlSL:mn,rotlBH:mr,rotlBL:mi,add:mo,add3L:ma,add3H:ms,add4L:ml,add4H:mu,add5H:md,add5L:mc};var mf={},mh={};Object.defineProperty(mh,"__esModule",{value:!0}),mh.crypto=void 0,mh.crypto="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,function(e){/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(e,"__esModule",{value:!0}),e.randomBytes=e.wrapXOFConstructorWithOpts=e.wrapConstructorWithOpts=e.wrapConstructor=e.checkOpts=e.Hash=e.concatBytes=e.toBytes=e.utf8ToBytes=e.asyncLoop=e.nextTick=e.hexToBytes=e.bytesToHex=e.isLE=e.rotr=e.createView=e.u32=e.u8=void 0;let t=e=>e instanceof Uint8Array;if(e.u8=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),e.u32=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),e.createView=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),e.rotr=(e,t)=>e<<32-t|e>>>t,e.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],!e.isLE)throw Error("Non little-endian hardware is not supported");let n=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function r(e){if("string"!=typeof e)throw Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}function i(e){if("string"==typeof e&&(e=r(e)),!t(e))throw Error("expected Uint8Array, got "+typeof e);return e}e.bytesToHex=function(e){if(!t(e))throw Error("Uint8Array expected");let r="";for(let t=0;t{},e.asyncLoop=async function(t,n,r){let i=Date.now();for(let o=0;o=0&&te+t.length,0)),r=0;return e.forEach(e=>{if(!t(e))throw Error("Uint8Array expected");n.set(e,r),r+=e.length}),n},e.Hash=class{clone(){return this._cloneInto()}};let o={}.toString;e.checkOpts=function(e,t){if(void 0!==t&&"[object Object]"!==o.call(t))throw Error("Options should be object or undefined");return Object.assign(e,t)},e.wrapConstructor=function(e){let t=t=>e().update(i(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t},e.wrapConstructorWithOpts=function(e){let t=(t,n)=>e(n).update(i(t)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=t=>e(t),t},e.wrapXOFConstructorWithOpts=function(e){let t=(t,n)=>e(n).update(i(t)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=t=>e(t),t},e.randomBytes=function(e=32){if(mh.crypto&&"function"==typeof mh.crypto.getRandomValues)return mh.crypto.getRandomValues(new Uint8Array(e));throw Error("crypto.getRandomValues must be defined")}}(mf),Object.defineProperty(pK,"__esModule",{value:!0}),pK.shake256=pK.shake128=pK.keccak_512=pK.keccak_384=pK.keccak_256=pK.keccak_224=pK.sha3_512=pK.sha3_384=pK.sha3_256=pK.sha3_224=pK.Keccak=pK.keccakP=void 0;let mp=mf,[mm,mg,mv]=[[],[],[]],mb=BigInt(0),my=BigInt(1),mA=BigInt(2),mw=BigInt(7),m_=BigInt(256),mE=BigInt(113);for(let e=0,t=my,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],mm.push(2*(5*r+n)),mg.push((e+1)*(e+2)/2%64);let i=mb;for(let e=0;e<7;e++)(t=(t<>mw)*mE)%m_)&mA&&(i^=my<<(my<n>32?(0,pZ.rotlBH)(e,t,n):(0,pZ.rotlSH)(e,t,n),mC=(e,t,n)=>n>32?(0,pZ.rotlBL)(e,t,n):(0,pZ.rotlSL)(e,t,n);function mx(e,t=24){let n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let t=0;t<10;t++)n[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){let r=(t+8)%10,i=(t+2)%10,o=n[i],a=n[i+1],s=mM(o,a,1)^n[r],l=mC(o,a,1)^n[r+1];for(let n=0;n<50;n+=10)e[t+n]^=s,e[t+n+1]^=l}let t=e[2],i=e[3];for(let n=0;n<24;n++){let r=mg[n],o=mM(t,i,r),a=mC(t,i,r),s=mm[n];t=e[s],i=e[s+1],e[s]=o,e[s+1]=a}for(let t=0;t<50;t+=10){for(let r=0;r<10;r++)n[r]=e[t+r];for(let r=0;r<10;r++)e[t+r]^=~n[(r+2)%10]&n[(r+4)%10]}e[0]^=mS[r],e[1]^=mk[r]}n.fill(0)}pK.keccakP=mx;class mR extends mp.Hash{constructor(e,t,n,r=!1,i=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=n,this.enableXOF=r,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,(0,pH.number)(n),0>=this.blockLen||this.blockLen>=200)throw Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,mp.u32)(this.state)}keccak(){mx(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){(0,pH.exists)(this);let{blockLen:t,state:n}=this,r=(e=(0,mp.toBytes)(e)).length;for(let i=0;i=n&&this.keccak();let o=Math.min(n-this.posOut,i-r);e.set(t.subarray(this.posOut,this.posOut+o),r),this.posOut+=o,r+=o}return e}xofInto(e){if(!this.enableXOF)throw Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return(0,pH.number)(e),this.xofInto(new Uint8Array(e))}digestInto(e){if((0,pH.output)(e,this),this.finished)throw Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){let{blockLen:t,suffix:n,outputLen:r,rounds:i,enableXOF:o}=this;return e||(e=new mR(t,n,r,o,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=n,e.outputLen=r,e.enableXOF=o,e.destroyed=this.destroyed,e}}pK.Keccak=mR;let mI=(e,t,n)=>(0,mp.wrapConstructor)(()=>new mR(t,e,n));pK.sha3_224=mI(6,144,28),pK.sha3_256=mI(6,136,32),pK.sha3_384=mI(6,104,48),pK.sha3_512=mI(6,72,64),pK.keccak_224=mI(1,144,28),pK.keccak_256=mI(1,136,32),pK.keccak_384=mI(1,104,48),pK.keccak_512=mI(1,72,64);let mT=(e,t,n)=>(0,mp.wrapXOFConstructorWithOpts)((r={})=>new mR(t,e,void 0===r.dkLen?n:r.dkLen,!0));pK.shake128=mT(31,168,16),pK.shake256=mT(31,136,32);var mO={};(function(e){function t(...e){let n=(e,t)=>n=>e(t(n));return{encode:Array.from(e).reverse().reduce((e,t)=>e?n(e,t.encode):t.encode,void 0),decode:e.reduce((e,t)=>e?n(e,t.decode):t.decode,void 0)}}function n(e){return{encode:t=>{if(!Array.isArray(t)||t.length&&"number"!=typeof t[0])throw Error("alphabet.encode input should be an array of numbers");return t.map(t=>{if(t<0||t>=e.length)throw Error(`Digit index outside alphabet: ${t} (alphabet: ${e.length})`);return e[t]})},decode:t=>{if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw Error("alphabet.decode input should be array of strings");return t.map(t=>{if("string"!=typeof t)throw Error(`alphabet.decode: not string element=${t}`);let n=e.indexOf(t);if(-1===n)throw Error(`Unknown letter: "${t}". Allowed: ${e}`);return n})}}}function r(e=""){if("string"!=typeof e)throw Error("join separator should be string");return{encode:t=>{if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw Error("join.encode input should be array of strings");for(let e of t)if("string"!=typeof e)throw Error(`join.encode: non-string input=${e}`);return t.join(e)},decode:t=>{if("string"!=typeof t)throw Error("join.decode input should be string");return t.split(e)}}}function i(e,t="="){if("string"!=typeof t)throw Error("padding chr should be string");return{encode(n){if(!Array.isArray(n)||n.length&&"string"!=typeof n[0])throw Error("padding.encode input should be array of strings");for(let e of n)if("string"!=typeof e)throw Error(`padding.encode: non-string input=${e}`);for(;n.length*e%8;)n.push(t);return n},decode(n){if(!Array.isArray(n)||n.length&&"string"!=typeof n[0])throw Error("padding.encode input should be array of strings");for(let e of n)if("string"!=typeof e)throw Error(`padding.decode: non-string input=${e}`);let r=n.length;if(r*e%8)throw Error("Invalid padding: string should have whole number of bytes");for(;r>0&&n[r-1]===t;r--)if(!((r-1)*e%8))throw Error("Invalid padding: string has too much padding");return n.slice(0,r)}}}function o(e){if("function"!=typeof e)throw Error("normalize fn should be function");return{encode:e=>e,decode:t=>e(t)}}function a(e,t,n){if(t<2)throw Error(`convertRadix: wrong from=${t}, base cannot be less than 2`);if(n<2)throw Error(`convertRadix: wrong to=${n}, base cannot be less than 2`);if(!Array.isArray(e))throw Error("convertRadix: data should be array");if(!e.length)return[];let r=0,i=[],o=Array.from(e);for(o.forEach(e=>{if(e<0||e>=t)throw Error(`Wrong integer: ${e}`)});;){let e=0,a=!0;for(let i=r;it?s(t,e%t):e,l=(e,t)=>e+(t-s(e,t));function u(e,t,n,r){if(!Array.isArray(e))throw Error("convertRadix2: data should be array");if(t<=0||t>32)throw Error(`convertRadix2: wrong from=${t}`);if(n<=0||n>32)throw Error(`convertRadix2: wrong to=${n}`);if(l(t,n)>32)throw Error(`convertRadix2: carry overflow from=${t} to=${n} carryBits=${l(t,n)}`);let i=0,o=0,a=2**n-1,s=[];for(let r of e){if(r>=2**t)throw Error(`convertRadix2: invalid data word=${r} from=${t}`);if(i=i<32)throw Error(`convertRadix2: carry overflow pos=${o} from=${t}`);for(o+=t;o>=n;o-=n)s.push((i>>o-n&a)>>>0);i&=2**o-1}if(i=i<=t)throw Error("Excess padding");if(!r&&i)throw Error(`Non-zero padding: ${i}`);return r&&o>0&&s.push(i>>>0),s}function c(e){return{encode:t=>{if(!(t instanceof Uint8Array))throw Error("radix.encode input should be Uint8Array");return a(Array.from(t),256,e)},decode:t=>{if(!Array.isArray(t)||t.length&&"number"!=typeof t[0])throw Error("radix.decode input should be array of strings");return Uint8Array.from(a(t,e,256))}}}function d(e,t=!1){if(e<=0||e>32)throw Error("radix2: bits should be in (0..32]");if(l(8,e)>32||l(e,8)>32)throw Error("radix2: carry overflow");return{encode:n=>{if(!(n instanceof Uint8Array))throw Error("radix2.encode input should be Uint8Array");return u(Array.from(n),8,e,!t)},decode:n=>{if(!Array.isArray(n)||n.length&&"number"!=typeof n[0])throw Error("radix2.decode input should be array of strings");return Uint8Array.from(u(n,e,8,t))}}}function f(e){if("function"!=typeof e)throw Error("unsafeWrapper fn should be function");return function(...t){try{return e.apply(null,t)}catch(e){}}}function h(e,t){if("function"!=typeof t)throw Error("checksum fn should be function");return{encode(n){if(!(n instanceof Uint8Array))throw Error("checksum.encode: input should be Uint8Array");let r=t(n).slice(0,e),i=new Uint8Array(n.length+e);return i.set(n),i.set(r,n.length),i},decode(n){if(!(n instanceof Uint8Array))throw Error("checksum.decode: input should be Uint8Array");let r=n.slice(0,-e),i=t(r).slice(0,e),o=n.slice(-e);for(let t=0;te.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1"))),e.base64=t(d(6),n("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),i(6),r("")),e.base64url=t(d(6),n("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),i(6),r("")),e.base64urlnopad=t(d(6),n("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),r(""));let p=e=>t(c(58),n(e),r(""));e.base58=p("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),e.base58flickr=p("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"),e.base58xrp=p("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");let m=[0,2,3,5,6,7,9,10,11];e.base58xmr={encode(t){let n="";for(let r=0;rt(h(4,e=>n(n(e))),e.base58);let g=t(n("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),r("")),v=[996825010,642813549,513874426,1027748829,705979059];function b(e){let t=e>>25,n=(33554431&e)<<5;for(let e=0;e>e&1)&&(n^=v[e]);return n}function y(e,t,n=1){let r=e.length,i=1;for(let t=0;t126)throw Error(`Invalid prefix (${e})`);i=b(i)^n>>5}i=b(i);for(let t=0;tn)throw TypeError(`Wrong string length: ${e.length} (${e}). Expected (8..${n})`);let r=e.toLowerCase();if(e!==r&&e!==e.toUpperCase())throw Error("String must be lowercase or uppercase");let i=(e=r).lastIndexOf("1");if(0===i||-1===i)throw Error('Letter "1" must be present between prefix and data only');let o=e.slice(0,i),a=e.slice(i+1);if(a.length<6)throw Error("Data must be at least 6 characters long");let s=g.decode(a).slice(0,-6),l=y(o,s,t);if(!a.endsWith(l))throw Error(`Invalid checksum in ${e}: expected "${l}"`);return{prefix:o,words:s}}return{encode:function(e,n,r=90){if("string"!=typeof e)throw Error("bech32.encode prefix should be string, not "+typeof e);if(!Array.isArray(n)||n.length&&"number"!=typeof n[0])throw Error("bech32.encode words should be array of numbers, not "+typeof n);let i=e.length+7+n.length;if(!1!==r&&i>r)throw TypeError(`Length ${i} exceeds limit ${r}`);let o=e.toLowerCase(),a=y(o,n,t);return`${o}1${g.encode(n)}${a}`},decode:a,decodeToBytes:function(e){let{prefix:t,words:n}=a(e,!1);return{prefix:t,words:n,bytes:r(n)}},decodeUnsafe:f(a),fromWords:r,fromWordsUnsafe:o,toWords:i}}e.bech32=A("bech32"),e.bech32m=A("bech32m"),e.utf8={encode:e=>(new TextDecoder).decode(e),decode:e=>(new TextEncoder).encode(e)},e.hex=t(d(4),n("0123456789abcdef"),r(""),o(e=>{if("string"!=typeof e||e.length%2)throw TypeError(`hex.decode: expected string, got ${typeof e} with length ${e.length}`);return e.toLowerCase()}));let w={utf8:e.utf8,hex:e.hex,base16:e.base16,base32:e.base32,base64:e.base64,base64url:e.base64url,base58:e.base58,base58xmr:e.base58xmr},_="Invalid encoding type. Available types: utf8, hex, base16, base32, base64, base64url, base58, base58xmr";e.bytesToString=(e,t)=>{if("string"!=typeof e||!w.hasOwnProperty(e))throw TypeError(_);if(!(t instanceof Uint8Array))throw TypeError("bytesToString() expects Uint8Array");return w[e].encode(t)},e.str=e.bytesToString,e.stringToBytes=(e,t)=>{if(!w.hasOwnProperty(e))throw TypeError(_);if("string"!=typeof t)throw TypeError("stringToBytes() expects string");return w[e].decode(t)},e.bytes=e.stringToBytes})(mO),Object.defineProperty(hJ,"__esModule",{value:!0});var mP=function(){let e=[];return()=>{if(0===e.length)for(let t=0;t<256;t++)e.push(t.toString(16).padStart(2,"0"));return e}}();function mL(e){return e instanceof Uint8Array}function mN(e){hX.assert.call(void 0,mL(e),"Value must be a Uint8Array.")}function mD(e){if(mN(e),0===e.length)return"0x";let t=mP(),n=Array(e.length);for(let r=0;rn.call(t,...e)),t=void 0)}return n}([e,"optionalAccess",e=>e.toLowerCase,"optionalCall",e=>e()]))return new Uint8Array;mG(e);let t=mX(e).toLowerCase(),n=t.length%2==0?t:`0${t}`,r=new Uint8Array(n.length/2);for(let e=0;e=BigInt(0),"Value must be a non-negative bigint."),mj(e.toString(16))}function mz(e){return hX.assert.call(void 0,"number"==typeof e,"Value must be a number."),hX.assert.call(void 0,e>=0,"Value must be a non-negative number."),hX.assert.call(void 0,Number.isSafeInteger(e),"Value is not a safe integer. Use `bigIntToBytes` instead."),mj(e.toString(16))}function mU(e){return hX.assert.call(void 0,"string"==typeof e,"Value must be a string."),(new TextEncoder).encode(e)}function mq(e){if("bigint"==typeof e)return mF(e);if("number"==typeof e)return mz(e);if("string"==typeof e)return e.startsWith("0x")?mj(e):mU(e);if(mL(e))return e;throw TypeError(`Unsupported value type: "${typeof e}".`)}var mK=pz.pattern.call(void 0,pz.string.call(void 0),/^(?:0x)?[0-9a-f]+$/iu),mH=pz.pattern.call(void 0,pz.string.call(void 0),/^0x[0-9a-f]+$/iu),mV=pz.pattern.call(void 0,pz.string.call(void 0),/^0x[0-9a-f]{40}$/u),m$=pz.pattern.call(void 0,pz.string.call(void 0),/^0x[0-9a-fA-F]{40}$/u);function mW(e){return pz.is.call(void 0,e,mK)}function mY(e){return pz.is.call(void 0,e,mH)}function mG(e){hX.assert.call(void 0,mW(e),"Value must be a hexadecimal string.")}function mQ(e){hX.assert.call(void 0,pz.is.call(void 0,e,m$),"Invalid hex address.");let t=mX(e.toLowerCase()),n=mX(mD(pK.keccak_256.call(void 0,t)));return`0x${t.split("").map((e,t)=>{let r=n[t];return hX.assert.call(void 0,pz.is.call(void 0,r,pz.string.call(void 0)),"Hash shorter than address."),parseInt(r,16)>7?e.toUpperCase():e}).join("")}`}function mZ(e){return!!pz.is.call(void 0,e,m$)&&mQ(e)===e}function mJ(e){return e.startsWith("0x")?e:e.startsWith("0X")?`0x${e.substring(2)}`:`0x${e}`}function mX(e){return e.startsWith("0x")||e.startsWith("0X")?e.substring(2):e}hJ.HexStruct=mK,hJ.StrictHexStruct=mH,hJ.HexAddressStruct=mV,hJ.HexChecksumAddressStruct=m$,hJ.isHexString=mW,hJ.isStrictHexString=mY,hJ.assertIsHexString=mG,hJ.assertIsStrictHexString=function(e){hX.assert.call(void 0,mY(e),'Value must be a hexadecimal string, starting with "0x".')},hJ.isValidHexAddress=function(e){return pz.is.call(void 0,e,mV)||mZ(e)},hJ.getChecksumAddress=mQ,hJ.isValidChecksumAddress=mZ,hJ.add0x=mJ,hJ.remove0x=mX,hJ.isBytes=mL,hJ.assertIsBytes=mN,hJ.bytesToHex=mD,hJ.bytesToBigInt=mB,hJ.bytesToSignedBigInt=function(e){mN(e);let t=BigInt(0);for(let n of e)t=(t<0,"Byte length must be greater than 0."),hX.assert.call(void 0,function(e,t){hX.assert.call(void 0,t>0);let n=e>>BigInt(31);return!((~e&n)+(e&~n)>>BigInt(8*t-1))}(e,t),"Byte length is too small to represent the given value.");let n=e,r=new Uint8Array(t);for(let e=0;e>=BigInt(8);return r.reverse()},hJ.numberToBytes=mz,hJ.stringToBytes=mU,hJ.base64ToBytes=function(e){return hX.assert.call(void 0,"string"==typeof e,"Value must be a string."),mO.base64.decode(e)},hJ.valueToBytes=mq,hJ.concatBytes=function(e){let t=Array(e.length),n=0;for(let r=0;r(hX.assert.call(void 0,"number"==typeof e,"Value must be a number."),hX.assert.call(void 0,e>=0,"Value must be a non-negative number."),hX.assert.call(void 0,Number.isSafeInteger(e),"Value is not a safe integer. Use `bigIntToHex` instead."),hJ.add0x.call(void 0,e.toString(16))),hZ.bigIntToHex=e=>(hX.assert.call(void 0,"bigint"==typeof e,"Value must be a bigint."),hX.assert.call(void 0,e>=0,"Value must be a non-negative bigint."),hJ.add0x.call(void 0,e.toString(16))),hZ.hexToNumber=e=>{hJ.assertIsHexString.call(void 0,e);let t=parseInt(e,16);return hX.assert.call(void 0,Number.isSafeInteger(t),"Value is not a safe integer. Use `hexToBigInt` instead."),t},hZ.hexToBigInt=e=>(hJ.assertIsHexString.call(void 0,e),BigInt(hJ.add0x.call(void 0,e)));var m0={};Object.defineProperty(m0,"__esModule",{value:!0}),m0.createDeferredPromise=function({suppressUnhandledRejection:e=!1}={}){let t,n;let r=new Promise((e,r)=>{t=e,n=r});return e&&r.catch(e=>{}),{promise:r,resolve:t,reject:n}};var m1={};Object.defineProperty(m1,"__esModule",{value:!0});var m2=((a=m2||{})[a.Millisecond=1]="Millisecond",a[a.Second=1e3]="Second",a[a.Minute=6e4]="Minute",a[a.Hour=36e5]="Hour",a[a.Day=864e5]="Day",a[a.Week=6048e5]="Week",a[a.Year=31536e6]="Year",a),m3=(e,t)=>{if(!(Number.isInteger(e)&&e>=0))throw Error(`"${t}" must be a non-negative integer. Received: "${e}".`)};m1.Duration=m2,m1.inMilliseconds=function(e,t){return m3(e,"count"),e*t},m1.timeSince=function(e){return m3(e,"timestamp"),Date.now()-e};var m6={},m4={exports:{}},m8={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||9007199254740991,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},m5="object"==typeof ex&&ex.env&&ex.env.NODE_DEBUG&&/\bsemver\b/i.test(ex.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};!function(e,t){let{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:i}=m8,o=(t=e.exports={}).re=[],a=t.safeRe=[],s=t.src=[],l=t.t={},u=0,c="[a-zA-Z0-9-]",d=[["\\s",1],["\\d",i],[c,r]],f=(e,t,n)=>{let r=(e=>{for(let[t,n]of d)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e})(t),i=u++;m5(e,i,t),l[e]=i,s[i]=t,o[i]=new RegExp(t,n?"g":void 0),a[i]=new RegExp(r,n?"g":void 0)};f("NUMERICIDENTIFIER","0|[1-9]\\d*"),f("NUMERICIDENTIFIERLOOSE","\\d+"),f("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${c}*`),f("MAINVERSION",`(${s[l.NUMERICIDENTIFIER]})\\.(${s[l.NUMERICIDENTIFIER]})\\.(${s[l.NUMERICIDENTIFIER]})`),f("MAINVERSIONLOOSE",`(${s[l.NUMERICIDENTIFIERLOOSE]})\\.(${s[l.NUMERICIDENTIFIERLOOSE]})\\.(${s[l.NUMERICIDENTIFIERLOOSE]})`),f("PRERELEASEIDENTIFIER",`(?:${s[l.NUMERICIDENTIFIER]}|${s[l.NONNUMERICIDENTIFIER]})`),f("PRERELEASEIDENTIFIERLOOSE",`(?:${s[l.NUMERICIDENTIFIERLOOSE]}|${s[l.NONNUMERICIDENTIFIER]})`),f("PRERELEASE",`(?:-(${s[l.PRERELEASEIDENTIFIER]}(?:\\.${s[l.PRERELEASEIDENTIFIER]})*))`),f("PRERELEASELOOSE",`(?:-?(${s[l.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${s[l.PRERELEASEIDENTIFIERLOOSE]})*))`),f("BUILDIDENTIFIER",`${c}+`),f("BUILD",`(?:\\+(${s[l.BUILDIDENTIFIER]}(?:\\.${s[l.BUILDIDENTIFIER]})*))`),f("FULLPLAIN",`v?${s[l.MAINVERSION]}${s[l.PRERELEASE]}?${s[l.BUILD]}?`),f("FULL",`^${s[l.FULLPLAIN]}$`),f("LOOSEPLAIN",`[v=\\s]*${s[l.MAINVERSIONLOOSE]}${s[l.PRERELEASELOOSE]}?${s[l.BUILD]}?`),f("LOOSE",`^${s[l.LOOSEPLAIN]}$`),f("GTLT","((?:<|>)?=?)"),f("XRANGEIDENTIFIERLOOSE",`${s[l.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),f("XRANGEIDENTIFIER",`${s[l.NUMERICIDENTIFIER]}|x|X|\\*`),f("XRANGEPLAIN",`[v=\\s]*(${s[l.XRANGEIDENTIFIER]})(?:\\.(${s[l.XRANGEIDENTIFIER]})(?:\\.(${s[l.XRANGEIDENTIFIER]})(?:${s[l.PRERELEASE]})?${s[l.BUILD]}?)?)?`),f("XRANGEPLAINLOOSE",`[v=\\s]*(${s[l.XRANGEIDENTIFIERLOOSE]})(?:\\.(${s[l.XRANGEIDENTIFIERLOOSE]})(?:\\.(${s[l.XRANGEIDENTIFIERLOOSE]})(?:${s[l.PRERELEASELOOSE]})?${s[l.BUILD]}?)?)?`),f("XRANGE",`^${s[l.GTLT]}\\s*${s[l.XRANGEPLAIN]}$`),f("XRANGELOOSE",`^${s[l.GTLT]}\\s*${s[l.XRANGEPLAINLOOSE]}$`),f("COERCE",`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?(?:$|[^\\d])`),f("COERCERTL",s[l.COERCE],!0),f("LONETILDE","(?:~>?)"),f("TILDETRIM",`(\\s*)${s[l.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",f("TILDE",`^${s[l.LONETILDE]}${s[l.XRANGEPLAIN]}$`),f("TILDELOOSE",`^${s[l.LONETILDE]}${s[l.XRANGEPLAINLOOSE]}$`),f("LONECARET","(?:\\^)"),f("CARETTRIM",`(\\s*)${s[l.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",f("CARET",`^${s[l.LONECARET]}${s[l.XRANGEPLAIN]}$`),f("CARETLOOSE",`^${s[l.LONECARET]}${s[l.XRANGEPLAINLOOSE]}$`),f("COMPARATORLOOSE",`^${s[l.GTLT]}\\s*(${s[l.LOOSEPLAIN]})$|^$`),f("COMPARATOR",`^${s[l.GTLT]}\\s*(${s[l.FULLPLAIN]})$|^$`),f("COMPARATORTRIM",`(\\s*)${s[l.GTLT]}\\s*(${s[l.LOOSEPLAIN]}|${s[l.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",f("HYPHENRANGE",`^\\s*(${s[l.XRANGEPLAIN]})\\s+-\\s+(${s[l.XRANGEPLAIN]})\\s*$`),f("HYPHENRANGELOOSE",`^\\s*(${s[l.XRANGEPLAINLOOSE]})\\s+-\\s+(${s[l.XRANGEPLAINLOOSE]})\\s*$`),f("STAR","(<|>)?=?\\s*\\*"),f("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),f("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(m4,m4.exports);var m7=m4.exports;let m9=Object.freeze({loose:!0}),ge=Object.freeze({});var gt=e=>e?"object"!=typeof e?m9:e:ge;let gn=/^[0-9]+$/,gr=(e,t)=>{let n=gn.test(e),r=gn.test(t);return n&&r&&(e=+e,t=+t),e===t?0:n&&!r?-1:r&&!n?1:egr(t,e)};let{MAX_LENGTH:go,MAX_SAFE_INTEGER:ga}=m8,{safeRe:gs,t:gl}=m7,{compareIdentifiers:gu}=gi;var gc=class e{constructor(t,n){if(n=gt(n),t instanceof e){if(!!n.loose===t.loose&&!!n.includePrerelease===t.includePrerelease)return t;t=t.version}else if("string"!=typeof t)throw TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>go)throw TypeError(`version is longer than ${go} characters`);m5("SemVer",t,n),this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease;let r=t.trim().match(n.loose?gs[gl.LOOSE]:gs[gl.FULL]);if(!r)throw TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>ga||this.major<0)throw TypeError("Invalid major version");if(this.minor>ga||this.minor<0)throw TypeError("Invalid minor version");if(this.patch>ga||this.patch<0)throw TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map(e=>{if(/^[0-9]+$/.test(e)){let t=+e;if(t>=0&&t=0;)"number"==typeof this.prerelease[r]&&(this.prerelease[r]++,r=-2);if(-1===r){if(t===this.prerelease.join(".")&&!1===n)throw Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let r=[t,e];!1===n&&(r=[t]),0===gu(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=r):this.prerelease=r}break}default:throw Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}},gd=(e,t,n=!1)=>{if(e instanceof gc)return e;try{return new gc(e,t)}catch(e){if(!n)return null;throw e}},gf=(e,t,n)=>new gc(e,n).compare(new gc(t,n)),gh=(e,t,n)=>{let r=new gc(e,n),i=new gc(t,n);return r.compare(i)||r.compareBuild(i)},gp=(e,t,n)=>gf(e,t,n)>0,gm=(e,t,n)=>0>gf(e,t,n),gg=(e,t,n)=>0===gf(e,t,n),gv=(e,t,n)=>0!==gf(e,t,n),gb=(e,t,n)=>gf(e,t,n)>=0,gy=(e,t,n)=>0>=gf(e,t,n),gA=(e,t,n,r)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof n&&(n=n.version),e===n;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof n&&(n=n.version),e!==n;case"":case"=":case"==":return gg(e,n,r);case"!=":return gv(e,n,r);case">":return gp(e,n,r);case">=":return gb(e,n,r);case"<":return gm(e,n,r);case"<=":return gy(e,n,r);default:throw TypeError(`Invalid operator: ${t}`)}};let{safeRe:gw,t:g_}=m7;function gE(){if(v_)return vw;v_=1;class e{constructor(t,i){if(i=n(i),t instanceof e)return!!i.loose===t.loose&&!!i.includePrerelease===t.includePrerelease?t:new e(t.raw,i);if(t instanceof r)return this.raw=t.value,this.set=[[t]],this.format(),this;if(this.options=i,this.loose=!!i.loose,this.includePrerelease=!!i.includePrerelease,this.raw=t.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let e=this.set[0];if(this.set=this.set.filter(e=>!h(e[0])),0===this.set.length)this.set=[e];else if(this.set.length>1){for(let e of this.set)if(1===e.length&&p(e[0])){this.set=[e];break}}}this.format()}format(){return this.range=this.set.map(e=>e.join(" ").trim()).join("||").trim(),this.range}toString(){return this.range}parseRange(e){let n=((this.options.includePrerelease&&d)|(this.options.loose&&f))+":"+e,o=t.get(n);if(o)return o;let p=this.options.loose,m=p?a[s.HYPHENRANGELOOSE]:a[s.HYPHENRANGE];i("hyphen replace",e=e.replace(m,M(this.options.includePrerelease))),i("comparator trim",e=e.replace(a[s.COMPARATORTRIM],l)),i("tilde trim",e=e.replace(a[s.TILDETRIM],u)),i("caret trim",e=e.replace(a[s.CARETTRIM],c));let v=e.split(" ").map(e=>g(e,this.options)).join(" ").split(/\s+/).map(e=>k(e,this.options));p&&(v=v.filter(e=>(i("loose invalid filter",e,this.options),!!e.match(a[s.COMPARATORLOOSE])))),i("range list",v);let b=new Map;for(let e of v.map(e=>new r(e,this.options))){if(h(e))return[e];b.set(e.value,e)}b.size>1&&b.has("")&&b.delete("");let y=[...b.values()];return t.set(n,y),y}intersects(t,n){if(!(t instanceof e))throw TypeError("a Range is required");return this.set.some(e=>m(e,n)&&t.set.some(t=>m(t,n)&&e.every(e=>t.every(t=>e.intersects(t,n)))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new o(e,this.options)}catch(e){return!1}for(let t=0;t0)for(var r=0,i=arguments.length;r1)n=t;else{if(!this.head)throw TypeError("Reduce of empty list with no initial value");r=this.head.next,n=this.head.value}for(var i=0;null!==r;i++)n=e(n,r.value,i),r=r.next;return n},e.prototype.reduceReverse=function(e,t){var n,r=this.tail;if(arguments.length>1)n=t;else{if(!this.tail)throw TypeError("Reduce of empty list with no initial value");r=this.tail.prev,n=this.tail.value}for(var i=this.length-1;null!==r;i--)n=e(n,r.value,i),r=r.prev;return n},e.prototype.toArray=function(){for(var e=Array(this.length),t=0,n=this.head;null!==n;t++)e[t]=n.value,n=n.next;return e},e.prototype.toArrayReverse=function(){for(var e=Array(this.length),t=0,n=this.tail;null!==n;t++)e[t]=n.value,n=n.prev;return e},e.prototype.slice=function(t,n){(n=n||this.length)<0&&(n+=this.length),(t=t||0)<0&&(t+=this.length);var r=new e;if(nthis.length&&(n=this.length);for(var i=0,o=this.head;null!==o&&ithis.length&&(n=this.length);for(var i=this.length,o=this.tail;null!==o&&i>n;i--)o=o.prev;for(;null!==o&&i>t;i--,o=o.prev)r.push(o.value);return r},e.prototype.splice=function(e,n,...r){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var i=0,o=this.head;null!==o&&i1,f=(e,t,n)=>{let r=e[u].get(t);if(r){let t=r.value;if(h(e,t)){if(m(e,r),!e[i])return}else n&&(e[c]&&(r.value.now=Date.now()),e[l].unshiftNode(r));return t.value}},h=(e,t)=>{if(!t||!t.maxAge&&!e[o])return!1;let n=Date.now()-t.now;return t.maxAge?n>t.maxAge:e[o]&&n>e[o]},p=e=>{if(e[n]>e[t])for(let r=e[l].tail;e[n]>e[t]&&null!==r;){let t=r.prev;m(e,r),r=t}},m=(e,t)=>{if(t){let r=t.value;e[a]&&e[a](r.key,r.value),e[n]-=r.length,e[u].delete(r.key),e[l].removeNode(t)}};class g{constructor(e,t,n,r,i){this.key=e,this.value=t,this.length=n,this.now=r,this.maxAge=i||0}}let v=(e,t,n,r)=>{let o=n.value;h(e,o)&&(m(e,n),e[i]||(o=void 0)),o&&t.call(r,o.value,o.key,e)};return vy=class{constructor(e){if("number"==typeof e&&(e={max:e}),e||(e={}),e.max&&("number"!=typeof e.max||e.max<0))throw TypeError("max must be a non-negative number");this[t]=e.max||1/0;let n=e.length||d;if(this[r]="function"!=typeof n?d:n,this[i]=e.stale||!1,e.maxAge&&"number"!=typeof e.maxAge)throw TypeError("maxAge must be a number");this[o]=e.maxAge||0,this[a]=e.dispose,this[s]=e.noDisposeOnSet||!1,this[c]=e.updateAgeOnGet||!1,this.reset()}set max(e){if("number"!=typeof e||e<0)throw TypeError("max must be a non-negative number");this[t]=e||1/0,p(this)}get max(){return this[t]}set allowStale(e){this[i]=!!e}get allowStale(){return this[i]}set maxAge(e){if("number"!=typeof e)throw TypeError("maxAge must be a non-negative number");this[o]=e,p(this)}get maxAge(){return this[o]}set lengthCalculator(e){"function"!=typeof e&&(e=d),e!==this[r]&&(this[r]=e,this[n]=0,this[l].forEach(e=>{e.length=this[r](e.value,e.key),this[n]+=e.length})),p(this)}get lengthCalculator(){return this[r]}get length(){return this[n]}get itemCount(){return this[l].length}rforEach(e,t){t=t||this;for(let n=this[l].tail;null!==n;){let r=n.prev;v(this,e,n,t),n=r}}forEach(e,t){t=t||this;for(let n=this[l].head;null!==n;){let r=n.next;v(this,e,n,t),n=r}}keys(){return this[l].toArray().map(e=>e.key)}values(){return this[l].toArray().map(e=>e.value)}reset(){this[a]&&this[l]&&this[l].length&&this[l].forEach(e=>this[a](e.key,e.value)),this[u]=new Map,this[l]=new e,this[n]=0}dump(){return this[l].map(e=>!h(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}).toArray().filter(e=>e)}dumpLru(){return this[l]}set(e,i,c){if((c=c||this[o])&&"number"!=typeof c)throw TypeError("maxAge must be a number");let d=c?Date.now():0,f=this[r](i,e);if(this[u].has(e)){if(f>this[t])return m(this,this[u].get(e)),!1;let r=this[u].get(e).value;return this[a]&&(this[s]||this[a](e,r.value)),r.now=d,r.maxAge=c,r.value=i,this[n]+=f-r.length,r.length=f,this.get(e),p(this),!0}let h=new g(e,i,f,d,c);return h.length>this[t]?(this[a]&&this[a](e,i),!1):(this[n]+=h.length,this[l].unshift(h),this[u].set(e,this[l].head),p(this),!0)}has(e){return!!this[u].has(e)&&!h(this,this[u].get(e).value)}get(e){return f(this,e,!0)}peek(e){return f(this,e,!1)}pop(){let e=this[l].tail;return e?(m(this,e),e.value):null}del(e){m(this,this[u].get(e))}load(e){this.reset();let t=Date.now();for(let n=e.length-1;n>=0;n--){let r=e[n],i=r.e||0;if(0===i)this.set(r.k,r.v);else{let e=i-t;e>0&&this.set(r.k,r.v,e)}}}prune(){this[u].forEach((e,t)=>f(this,t,!1))}}}())({max:1e3}),n=gt,r=gS(),i=m5,o=gc,{safeRe:a,t:s,comparatorTrimReplace:l,tildeTrimReplace:u,caretTrimReplace:c}=m7,{FLAG_INCLUDE_PRERELEASE:d,FLAG_LOOSE:f}=m8,h=e=>"<0.0.0-0"===e.value,p=e=>""===e.value,m=(e,t)=>{let n=!0,r=e.slice(),i=r.pop();for(;n&&r.length;)n=r.every(e=>i.intersects(e,t)),i=r.pop();return n},g=(e,t)=>(i("comp",e,t),i("caret",e=A(e,t)),i("tildes",e=b(e,t)),i("xrange",e=_(e,t)),i("stars",e=S(e,t)),e),v=e=>!e||"x"===e.toLowerCase()||"*"===e,b=(e,t)=>e.trim().split(/\s+/).map(e=>y(e,t)).join(" "),y=(e,t)=>{let n=t.loose?a[s.TILDELOOSE]:a[s.TILDE];return e.replace(n,(t,n,r,o,a)=>{let s;return i("tilde",e,t,n,r,o,a),v(n)?s="":v(r)?s=`>=${n}.0.0 <${+n+1}.0.0-0`:v(o)?s=`>=${n}.${r}.0 <${n}.${+r+1}.0-0`:a?(i("replaceTilde pr",a),s=`>=${n}.${r}.${o}-${a} <${n}.${+r+1}.0-0`):s=`>=${n}.${r}.${o} <${n}.${+r+1}.0-0`,i("tilde return",s),s})},A=(e,t)=>e.trim().split(/\s+/).map(e=>w(e,t)).join(" "),w=(e,t)=>{i("caret",e,t);let n=t.loose?a[s.CARETLOOSE]:a[s.CARET],r=t.includePrerelease?"-0":"";return e.replace(n,(t,n,o,a,s)=>{let l;return i("caret",e,t,n,o,a,s),v(n)?l="":v(o)?l=`>=${n}.0.0${r} <${+n+1}.0.0-0`:v(a)?l="0"===n?`>=${n}.${o}.0${r} <${n}.${+o+1}.0-0`:`>=${n}.${o}.0${r} <${+n+1}.0.0-0`:s?(i("replaceCaret pr",s),l="0"===n?"0"===o?`>=${n}.${o}.${a}-${s} <${n}.${o}.${+a+1}-0`:`>=${n}.${o}.${a}-${s} <${n}.${+o+1}.0-0`:`>=${n}.${o}.${a}-${s} <${+n+1}.0.0-0`):(i("no pr"),l="0"===n?"0"===o?`>=${n}.${o}.${a}${r} <${n}.${o}.${+a+1}-0`:`>=${n}.${o}.${a}${r} <${n}.${+o+1}.0-0`:`>=${n}.${o}.${a} <${+n+1}.0.0-0`),i("caret return",l),l})},_=(e,t)=>(i("replaceXRanges",e,t),e.split(/\s+/).map(e=>E(e,t)).join(" ")),E=(e,t)=>{e=e.trim();let n=t.loose?a[s.XRANGELOOSE]:a[s.XRANGE];return e.replace(n,(n,r,o,a,s,l)=>{i("xRange",e,n,r,o,a,s,l);let u=v(o),c=u||v(a),d=c||v(s);return"="===r&&d&&(r=""),l=t.includePrerelease?"-0":"",u?n=">"===r||"<"===r?"<0.0.0-0":"*":r&&d?(c&&(a=0),s=0,">"===r?(r=">=",c?(o=+o+1,a=0):a=+a+1,s=0):"<="===r&&(r="<",c?o=+o+1:a=+a+1),"<"===r&&(l="-0"),n=`${r+o}.${a}.${s}${l}`):c?n=`>=${o}.0.0${l} <${+o+1}.0.0-0`:d&&(n=`>=${o}.${a}.0${l} <${o}.${+a+1}.0-0`),i("xRange return",n),n})},S=(e,t)=>(i("replaceStars",e,t),e.trim().replace(a[s.STAR],"")),k=(e,t)=>(i("replaceGTE0",e,t),e.trim().replace(a[t.includePrerelease?s.GTE0PRE:s.GTE0],"")),M=e=>(t,n,r,i,o,a,s,l,u,c,d,f,h)=>`${n=v(r)?"":v(i)?`>=${r}.0.0${e?"-0":""}`:v(o)?`>=${r}.${i}.0${e?"-0":""}`:a?`>=${n}`:`>=${n}${e?"-0":""}`} ${l=v(u)?"":v(c)?`<${+u+1}.0.0-0`:v(d)?`<${u}.${+c+1}.0-0`:f?`<=${u}.${c}.${d}-${f}`:e?`<${u}.${c}.${+d+1}-0`:`<=${l}`}`.trim(),C=(e,t,n)=>{for(let n=0;n0){let r=e[n].semver;if(r.major===t.major&&r.minor===t.minor&&r.patch===t.patch)return!0}return!1}return!0};return vw}function gS(){if(vS)return vE;vS=1;let e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(r,i){if(i=n(i),r instanceof t){if(!!i.loose===r.loose)return r;r=r.value}a("comparator",r=r.trim().split(/\s+/).join(" "),i),this.options=i,this.loose=!!i.loose,this.parse(r),this.semver===e?this.value="":this.value=this.operator+this.semver.version,a("comp",this)}parse(t){let n=this.options.loose?r[i.COMPARATORLOOSE]:r[i.COMPARATOR],o=t.match(n);if(!o)throw TypeError(`Invalid comparator: ${t}`);this.operator=void 0!==o[1]?o[1]:"","="===this.operator&&(this.operator=""),o[2]?this.semver=new s(o[2],this.options.loose):this.semver=e}toString(){return this.value}test(t){if(a("Comparator.test",t,this.options.loose),this.semver===e||t===e)return!0;if("string"==typeof t)try{t=new s(t,this.options)}catch(e){return!1}return o(t,this.operator,this.semver,this.options)}intersects(e,r){if(!(e instanceof t))throw TypeError("a Comparator is required");return""===this.operator?""===this.value||new l(e.value,r).test(this.value):""===e.operator?""===e.value||new l(this.value,r).test(e.semver):(!(r=n(r)).includePrerelease||"<0.0.0-0"!==this.value&&"<0.0.0-0"!==e.value)&&!(!r.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0")))&&(!(!this.operator.startsWith(">")||!e.operator.startsWith(">"))||!(!this.operator.startsWith("<")||!e.operator.startsWith("<"))||!(this.semver.version!==e.semver.version||!this.operator.includes("=")||!e.operator.includes("="))||!!(o(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))||!!(o(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}}vE=t;let n=gt,{safeRe:r,t:i}=m7,o=gA,a=m5,s=gc,l=gE();return vE}let gk=gE();var gM=(e,t,n)=>{try{t=new gk(t,n)}catch(e){return!1}return t.test(e)};let gC=gE(),gx=gE(),gR=gE(),gI=gE(),gT=gE(),gO=gS(),{ANY:gP}=gO,gL=gE();var gN=(e,t,n,r)=>{let i,o,a,s,l;switch(e=new gc(e,r),t=new gL(t,r),n){case">":i=gp,o=gy,a=gm,s=">",l=">=";break;case"<":i=gm,o=gb,a=gp,s="<",l="<=";break;default:throw TypeError('Must provide a hilo val of "<" or ">"')}if(gM(e,t,r))return!1;for(let n=0;n{e.semver===gP&&(e=new gO(">=0.0.0")),c=c||e,d=d||e,i(e.semver,c.semver,r)?c=e:a(e.semver,d.semver,r)&&(d=e)}),c.operator===s||c.operator===l||(!d.operator||d.operator===s)&&o(e,d.semver)||d.operator===l&&a(e,d.semver))return!1}return!0};let gD=gE(),gB=gE(),gj=gS(),{ANY:gF}=gj,gz=[new gj(">=0.0.0-0")],gU=[new gj(">=0.0.0")],gq=(e,t,n)=>{let r,i,o,a,s,l,u;if(e===t)return!0;if(1===e.length&&e[0].semver===gF){if(1===t.length&&t[0].semver===gF)return!0;e=n.includePrerelease?gz:gU}if(1===t.length&&t[0].semver===gF){if(n.includePrerelease)return!0;t=gU}let c=new Set;for(let t of e)">"===t.operator||">="===t.operator?r=gK(r,t,n):"<"===t.operator||"<="===t.operator?i=gH(i,t,n):c.add(t.semver);if(c.size>1||r&&i&&((o=gf(r.semver,i.semver,n))>0||0===o&&(">="!==r.operator||"<="!==i.operator)))return null;for(let e of c){if(r&&!gM(e,String(r),n)||i&&!gM(e,String(i),n))return null;for(let r of t)if(!gM(e,String(r),n))return!1;return!0}let d=!(!i||n.includePrerelease||!i.semver.prerelease.length)&&i.semver,f=!(!r||n.includePrerelease||!r.semver.prerelease.length)&&r.semver;for(let e of(d&&1===d.prerelease.length&&"<"===i.operator&&0===d.prerelease[0]&&(d=!1),t)){if(u=u||">"===e.operator||">="===e.operator,l=l||"<"===e.operator||"<="===e.operator,r){if(f&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===f.major&&e.semver.minor===f.minor&&e.semver.patch===f.patch&&(f=!1),">"===e.operator||">="===e.operator){if((a=gK(r,e,n))===e&&a!==r)return!1}else if(">="===r.operator&&!gM(r.semver,String(e),n))return!1}if(i){if(d&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===d.major&&e.semver.minor===d.minor&&e.semver.patch===d.patch&&(d=!1),"<"===e.operator||"<="===e.operator){if((s=gH(i,e,n))===e&&s!==i)return!1}else if("<="===i.operator&&!gM(i.semver,String(e),n))return!1}if(!e.operator&&(i||r)&&0!==o)return!1}return!(r&&l&&!i&&0!==o)&&!(i&&u&&!r&&0!==o)&&!f&&!d},gK=(e,t,n)=>{if(!e)return t;let r=gf(e.semver,t.semver,n);return r>0?e:r<0||">"===t.operator&&">="===e.operator?t:e},gH=(e,t,n)=>{if(!e)return t;let r=gf(e.semver,t.semver,n);return r<0?e:r>0||"<"===t.operator&&"<="===e.operator?t:e};var gV={parse:gd,valid:(e,t)=>{let n=gd(e,t);return n?n.version:null},clean:(e,t)=>{let n=gd(e.trim().replace(/^[=v]+/,""),t);return n?n.version:null},inc:(e,t,n,r,i)=>{"string"==typeof n&&(i=r,r=n,n=void 0);try{return new gc(e instanceof gc?e.version:e,n).inc(t,r,i).version}catch(e){return null}},diff:(e,t)=>{let n=gd(e,null,!0),r=gd(t,null,!0),i=n.compare(r);if(0===i)return null;let o=i>0,a=o?n:r,s=o?r:n,l=!!a.prerelease.length;if(s.prerelease.length&&!l)return s.patch||s.minor?a.patch?"patch":a.minor?"minor":"major":"major";let u=l?"pre":"";return n.major!==r.major?u+"major":n.minor!==r.minor?u+"minor":n.patch!==r.patch?u+"patch":"prerelease"},major:(e,t)=>new gc(e,t).major,minor:(e,t)=>new gc(e,t).minor,patch:(e,t)=>new gc(e,t).patch,prerelease:(e,t)=>{let n=gd(e,t);return n&&n.prerelease.length?n.prerelease:null},compare:gf,rcompare:(e,t,n)=>gf(t,e,n),compareLoose:(e,t)=>gf(e,t,!0),compareBuild:gh,sort:(e,t)=>e.sort((e,n)=>gh(e,n,t)),rsort:(e,t)=>e.sort((e,n)=>gh(n,e,t)),gt:gp,lt:gm,eq:gg,neq:gv,gte:gb,lte:gy,cmp:gA,coerce:(e,t)=>{if(e instanceof gc)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;let n=null;if((t=t||{}).rtl){let t;for(;(t=gw[g_.COERCERTL].exec(e))&&(!n||n.index+n[0].length!==e.length);)n&&t.index+t[0].length===n.index+n[0].length||(n=t),gw[g_.COERCERTL].lastIndex=t.index+t[1].length+t[2].length;gw[g_.COERCERTL].lastIndex=-1}else n=e.match(gw[g_.COERCE]);return null===n?null:gd(`${n[2]}.${n[3]||"0"}.${n[4]||"0"}`,t)},Comparator:gS(),Range:gE(),satisfies:gM,toComparators:(e,t)=>new gC(e,t).set.map(e=>e.map(e=>e.value).join(" ").trim().split(" ")),maxSatisfying:(e,t,n)=>{let r=null,i=null,o=null;try{o=new gx(t,n)}catch(e){return null}return e.forEach(e=>{o.test(e)&&(r&&-1!==i.compare(e)||(i=new gc(r=e,n)))}),r},minSatisfying:(e,t,n)=>{let r=null,i=null,o=null;try{o=new gR(t,n)}catch(e){return null}return e.forEach(e=>{o.test(e)&&(r&&1!==i.compare(e)||(i=new gc(r=e,n)))}),r},minVersion:(e,t)=>{e=new gI(e,t);let n=new gc("0.0.0");if(e.test(n)||(n=new gc("0.0.0-0"),e.test(n)))return n;n=null;for(let t=0;t{let t=new gc(e.semver.version);switch(e.operator){case">":0===t.prerelease.length?t.patch++:t.prerelease.push(0),t.raw=t.format();case"":case">=":i&&!gp(t,i)||(i=t);break;case"<":case"<=":break;default:throw Error(`Unexpected operation: ${e.operator}`)}}),i&&(!n||gp(n,i))&&(n=i)}return n&&e.test(n)?n:null},validRange:(e,t)=>{try{return new gT(e,t).range||"*"}catch(e){return null}},outside:gN,gtr:(e,t,n)=>gN(e,t,">",n),ltr:(e,t,n)=>gN(e,t,"<",n),intersects:(e,t,n)=>(e=new gD(e,n),t=new gD(t,n),e.intersects(t,n)),simplifyRange:(e,t,n)=>{let r=[],i=null,o=null,a=e.sort((e,t)=>gf(e,t,n));for(let e of a)gM(e,t,n)?(o=e,i||(i=e)):(o&&r.push([i,o]),o=null,i=null);i&&r.push([i,null]);let s=[];for(let[e,t]of r)e===t?s.push(e):t||e!==a[0]?t?e===a[0]?s.push(`<=${t}`):s.push(`${e} - ${t}`):s.push(`>=${e}`):s.push("*");let l=s.join(" || "),u="string"==typeof t.raw?t.raw:String(t);return l.length{if(e===t)return!0;e=new gB(e,n),t=new gB(t,n);let r=!1;e:for(let i of e.set){for(let e of t.set){let t=gq(i,e,n);if(r=r||null!==t,t)continue e}if(r)return!1}return!0},SemVer:gc,re:m7.re,src:m7.src,tokens:m7.t,SEMVER_SPEC_VERSION:m8.SEMVER_SPEC_VERSION,RELEASE_TYPES:m8.RELEASE_TYPES,compareIdentifiers:gi.compareIdentifiers,rcompareIdentifiers:gi.rcompareIdentifiers};Object.defineProperty(m6,"__esModule",{value:!0});var g$=pz.refine.call(void 0,pz.string.call(void 0),"Version",e=>null!==gV.valid.call(void 0,e)||`Expected SemVer version, got "${e}"`),gW=pz.refine.call(void 0,pz.string.call(void 0),"Version range",e=>null!==gV.validRange.call(void 0,e)||`Expected SemVer range, got "${e}"`);m6.VersionStruct=g$,m6.VersionRangeStruct=gW,m6.isValidSemVerVersion=function(e){return pz.is.call(void 0,e,g$)},m6.isValidSemVerRange=function(e){return pz.is.call(void 0,e,gW)},m6.assertIsSemVerVersion=function(e){hX.assertStruct.call(void 0,e,g$)},m6.assertIsSemVerRange=function(e){hX.assertStruct.call(void 0,e,gW)},m6.gtVersion=function(e,t){return gV.gt.call(void 0,e,t)},m6.gtRange=function(e,t){return gV.gtr.call(void 0,e,t)},m6.satisfiesVersionRange=function(e,t){return gV.satisfies.call(void 0,e,t,{includePrerelease:!0})};var gY={};Object.defineProperty(gY,"__esModule",{value:!0});var gG=e=>pz.object.call(void 0,e);function gQ({path:e,branch:t}){let n=e[e.length-1];return h1.hasProperty.call(void 0,t[t.length-2],n)}function gZ(e){return new pz.Struct({...e,type:`optional ${e.type}`,validator:(t,n)=>!gQ(n)||e.validator(t,n),refiner:(t,n)=>!gQ(n)||e.refiner(t,n)})}var gJ=pz.union.call(void 0,[pz.literal.call(void 0,null),pz.boolean.call(void 0),pz.define.call(void 0,"finite number",e=>pz.is.call(void 0,e,pz.number.call(void 0))&&Number.isFinite(e)),pz.string.call(void 0),pz.array.call(void 0,pz.lazy.call(void 0,()=>gJ)),pz.record.call(void 0,pz.string.call(void 0),pz.lazy.call(void 0,()=>gJ))]),gX=pz.coerce.call(void 0,gJ,pz.any.call(void 0),e=>(hX.assertStruct.call(void 0,e,gJ),JSON.parse(JSON.stringify(e,(e,t)=>{if("__proto__"!==e&&"constructor"!==e)return t}))));function g0(e){return pz.create.call(void 0,e,gX)}var g1=pz.literal.call(void 0,"2.0"),g2=pz.nullable.call(void 0,pz.union.call(void 0,[pz.number.call(void 0),pz.string.call(void 0)])),g3=gG({code:pz.integer.call(void 0),message:pz.string.call(void 0),data:gZ(gX),stack:gZ(pz.string.call(void 0))}),g6=pz.union.call(void 0,[pz.record.call(void 0,pz.string.call(void 0),gX),pz.array.call(void 0,gX)]),g4=gG({id:g2,jsonrpc:g1,method:pz.string.call(void 0),params:gZ(g6)}),g8=gG({jsonrpc:g1,method:pz.string.call(void 0),params:gZ(g6)}),g5=pz.object.call(void 0,{id:g2,jsonrpc:g1,result:pz.optional.call(void 0,pz.unknown.call(void 0)),error:pz.optional.call(void 0,g3)}),g7=gG({id:g2,jsonrpc:g1,result:gX}),g9=gG({id:g2,jsonrpc:g1,error:g3}),ve=pz.union.call(void 0,[g7,g9]);gY.object=gG,gY.exactOptional=gZ,gY.UnsafeJsonStruct=gJ,gY.JsonStruct=gX,gY.isValidJson=function(e){try{return g0(e),!0}catch(e){return!1}},gY.getSafeJson=g0,gY.getJsonSize=function(e){hX.assertStruct.call(void 0,e,gX,"Invalid JSON value");let t=JSON.stringify(e);return(new TextEncoder).encode(t).byteLength},gY.jsonrpc2="2.0",gY.JsonRpcVersionStruct=g1,gY.JsonRpcIdStruct=g2,gY.JsonRpcErrorStruct=g3,gY.JsonRpcParamsStruct=g6,gY.JsonRpcRequestStruct=g4,gY.JsonRpcNotificationStruct=g8,gY.isJsonRpcNotification=function(e){return pz.is.call(void 0,e,g8)},gY.assertIsJsonRpcNotification=function(e,t){hX.assertStruct.call(void 0,e,g8,"Invalid JSON-RPC notification",t)},gY.isJsonRpcRequest=function(e){return pz.is.call(void 0,e,g4)},gY.assertIsJsonRpcRequest=function(e,t){hX.assertStruct.call(void 0,e,g4,"Invalid JSON-RPC request",t)},gY.PendingJsonRpcResponseStruct=g5,gY.JsonRpcSuccessStruct=g7,gY.JsonRpcFailureStruct=g9,gY.JsonRpcResponseStruct=ve,gY.isPendingJsonRpcResponse=function(e){return pz.is.call(void 0,e,g5)},gY.assertIsPendingJsonRpcResponse=function(e,t){hX.assertStruct.call(void 0,e,g5,"Invalid pending JSON-RPC response",t)},gY.isJsonRpcResponse=function(e){return pz.is.call(void 0,e,ve)},gY.assertIsJsonRpcResponse=function(e,t){hX.assertStruct.call(void 0,e,ve,"Invalid JSON-RPC response",t)},gY.isJsonRpcSuccess=function(e){return pz.is.call(void 0,e,g7)},gY.assertIsJsonRpcSuccess=function(e,t){hX.assertStruct.call(void 0,e,g7,"Invalid JSON-RPC success response",t)},gY.isJsonRpcFailure=function(e){return pz.is.call(void 0,e,g9)},gY.assertIsJsonRpcFailure=function(e,t){hX.assertStruct.call(void 0,e,g9,"Invalid JSON-RPC failure response",t)},gY.isJsonRpcError=function(e){return pz.is.call(void 0,e,g3)},gY.assertIsJsonRpcError=function(e,t){hX.assertStruct.call(void 0,e,g3,"Invalid JSON-RPC error",t)},gY.getJsonRpcIdValidator=function(e){let{permitEmptyString:t,permitFractions:n,permitNull:r}={permitEmptyString:!0,permitFractions:!1,permitNull:!0,...e};return e=>!!("number"==typeof e&&(n||Number.isInteger(e))||"string"==typeof e&&(t||e.length>0)||r&&null===e)};var vt,vn,vr,vi,vo,va,vs,vl,vu,vc,vd,vf,vh,vp,vm,vg,vv,vb,vy,vA,vw,v_,vE,vS,vk,vM,vC={},vx={exports:{}},vR=function(e){function t(e){let r,i,o,a=null;function s(...e){if(!s.enabled)return;let n=Number(new Date),i=n-(r||n);s.diff=i,s.prev=r,s.curr=n,r=n,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let o=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(n,r)=>{if("%%"===n)return"%";o++;let i=t.formatters[r];if("function"==typeof i){let t=e[o];n=i.call(s,t),e.splice(o,1),o--}return n}),t.formatArgs.call(s,e),(s.log||t.log).apply(s,e)}return s.namespace=e,s.useColors=t.useColors(),s.color=t.selectColor(e),s.extend=n,s.destroy=t.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==a?a:(i!==t.namespaces&&(i=t.namespaces,o=t.enabled(e)),o),set:e=>{a=e}}),"function"==typeof t.init&&t.init(s),s}function n(e,n){let r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function r(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){let e=[...t.names.map(r),...t.skips.map(r).map(e=>"-"+e)].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.namespaces=e,t.names=[],t.skips=[];let r=("string"==typeof e?e:"").split(/[\s,]+/),i=r.length;for(n=0;n=1.5*n?"s":"")}return vM=1,vk=function(t,n){n=n||{};var r,i,o=typeof t;if("string"===o&&t.length>0)return function(e){if(!((e=String(e)).length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*n;case"weeks":case"week":case"w":return 6048e5*n;case"days":case"day":case"d":return 864e5*n;case"hours":case"hour":case"hrs":case"hr":case"h":return 36e5*n;case"minutes":case"minute":case"mins":case"min":case"m":return 6e4*n;case"seconds":case"second":case"secs":case"sec":case"s":return 1e3*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}(t);if("number"===o&&isFinite(t))return n.long?(r=Math.abs(t))>=864e5?e(t,r,864e5,"day"):r>=36e5?e(t,r,36e5,"hour"):r>=6e4?e(t,r,6e4,"minute"):r>=1e3?e(t,r,1e3,"second"):t+" ms":(i=Math.abs(t))>=864e5?Math.round(t/864e5)+"d":i>=36e5?Math.round(t/36e5)+"h":i>=6e4?Math.round(t/6e4)+"m":i>=1e3?Math.round(t/1e3)+"s":t+"ms";throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}}(),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach(n=>{t[n]=e[n]}),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t{"%%"!==e&&(r++,"%c"===e&&(i=r))}),t.splice(i,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&void 0!==ex&&"env"in ex&&(e=ex.env.DEBUG),e},t.useColors=function(){return"undefined"!=typeof window&&!!window.process&&("renderer"===window.process.type||!!window.process.__nwjs)||!("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(n=!1,()=>{n||(n=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=vR(t);let{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(vx,vx.exports);var vI=vx.exports,vT=u(vI);Object.defineProperty(vC,"__esModule",{value:!0});var vO=(vI&&vI.__esModule?vI:{default:vI}).default.call(void 0,"metamask");vC.createProjectLogger=function(e){return vO.extend(e)},vC.createModuleLogger=function(e,t){return e.extend(t)};var vP={};function vL(e){let t,n=e[0],r=1;for(;rn.call(t,...e)),t=void 0)}return n}Object.defineProperty(vP,"__esModule",{value:!0});var vN=/^(?[-a-z0-9]{3,8}):(?[-_a-zA-Z0-9]{1,32})$/u,vD=/^[-a-z0-9]{3,8}$/u,vB=/^[-_a-zA-Z0-9]{1,32}$/u,vj=/^(?(?[-a-z0-9]{3,8}):(?[-_a-zA-Z0-9]{1,32})):(?[-.%a-zA-Z0-9]{1,128})$/u,vF=/^[-.%a-zA-Z0-9]{1,128}$/u,vz=pz.pattern.call(void 0,pz.string.call(void 0),vN),vU=pz.pattern.call(void 0,pz.string.call(void 0),vD),vq=pz.pattern.call(void 0,pz.string.call(void 0),vB),vK=pz.pattern.call(void 0,pz.string.call(void 0),vj),vH=pz.pattern.call(void 0,pz.string.call(void 0),vF);vP.CAIP_CHAIN_ID_REGEX=vN,vP.CAIP_NAMESPACE_REGEX=vD,vP.CAIP_REFERENCE_REGEX=vB,vP.CAIP_ACCOUNT_ID_REGEX=vj,vP.CAIP_ACCOUNT_ADDRESS_REGEX=vF,vP.CaipChainIdStruct=vz,vP.CaipNamespaceStruct=vU,vP.CaipReferenceStruct=vq,vP.CaipAccountIdStruct=vK,vP.CaipAccountAddressStruct=vH,vP.isCaipChainId=function(e){return pz.is.call(void 0,e,vz)},vP.isCaipNamespace=function(e){return pz.is.call(void 0,e,vU)},vP.isCaipReference=function(e){return pz.is.call(void 0,e,vq)},vP.isCaipAccountId=function(e){return pz.is.call(void 0,e,vK)},vP.isCaipAccountAddress=function(e){return pz.is.call(void 0,e,vH)},vP.parseCaipChainId=function(e){let t=vN.exec(e);if(!vL([t,"optionalAccess",e=>e.groups]))throw Error("Invalid CAIP chain ID.");return{namespace:t.groups.namespace,reference:t.groups.reference}},vP.parseCaipAccountId=function(e){let t=vj.exec(e);if(!vL([t,"optionalAccess",e=>e.groups]))throw Error("Invalid CAIP account ID.");return{address:t.groups.accountAddress,chainId:t.groups.chainId,chain:{namespace:t.groups.namespace,reference:t.groups.reference}}};var vV={},v$={};Object.defineProperty(v$,"__esModule",{value:!0}),v$.base64=(e,t={})=>{var n,r;let i,o;let a=(n=t.paddingRequired,null!=n&&n),s=(r=t.characterSet,null!=r?r:"base64");return"base64"===s?i=String.raw`[A-Za-z0-9+\/]`:(hX.assert.call(void 0,"base64url"===s),i=String.raw`[-_A-Za-z0-9]`),o=a?RegExp(`^(?:${i}{4})*(?:${i}{3}=|${i}{2}==)?$`,"u"):RegExp(`^(?:${i}{4})*(?:${i}{2,3}|${i}{3}=|${i}{2}==)?$`,"u"),pz.pattern.call(void 0,e,o)},Object.defineProperty(vV,"__esModule",{value:!0});var vW=pz.size.call(void 0,v$.base64.call(void 0,pz.string.call(void 0),{paddingRequired:!0}),44,44);vV.ChecksumStruct=vW;var vY={};Object.defineProperty(vY,"__esModule",{value:!0});var vG=pz.union.call(void 0,[pz.number.call(void 0),pz.bigint.call(void 0),pz.string.call(void 0),hJ.StrictHexStruct]),vQ=pz.coerce.call(void 0,pz.number.call(void 0),vG,Number),vZ=pz.coerce.call(void 0,pz.bigint.call(void 0),vG,BigInt);pz.union.call(void 0,[hJ.StrictHexStruct,pz.instance.call(void 0,Uint8Array)]);var vJ=pz.coerce.call(void 0,pz.instance.call(void 0,Uint8Array),pz.union.call(void 0,[hJ.StrictHexStruct]),hJ.hexToBytes),vX=pz.coerce.call(void 0,hJ.StrictHexStruct,pz.instance.call(void 0,Uint8Array),hJ.bytesToHex);vY.createNumber=function(e){try{let t=pz.create.call(void 0,e,vQ);return hX.assert.call(void 0,Number.isFinite(t),`Expected a number-like value, got "${e}".`),t}catch(t){if(t instanceof pz.StructError)throw Error(`Expected a number-like value, got "${e}".`);throw t}},vY.createBigInt=function(e){try{return pz.create.call(void 0,e,vZ)}catch(e){if(e instanceof pz.StructError)throw Error(`Expected a number-like value, got "${String(e.value)}".`);throw e}},vY.createBytes=function(e){if("string"==typeof e&&"0x"===e.toLowerCase())return new Uint8Array;try{return pz.create.call(void 0,e,vJ)}catch(e){if(e instanceof pz.StructError)throw Error(`Expected a bytes-like value, got "${String(e.value)}".`);throw e}},vY.createHex=function(e){if(e instanceof Uint8Array&&0===e.length||"string"==typeof e&&"0x"===e.toLowerCase())return"0x";try{return pz.create.call(void 0,e,vX)}catch(e){if(e instanceof pz.StructError)throw Error(`Expected a bytes-like value, got "${String(e.value)}".`);throw e}};var v0={},v1={};Object.defineProperty(v1,"__esModule",{value:!0});var v2=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)};v1.__privateGet=(e,t,n)=>(v2(e,t,"read from private field"),n?n.call(e):t.get(e)),v1.__privateAdd=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},v1.__privateSet=(e,t,n,r)=>(v2(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),Object.defineProperty(v0,"__esModule",{value:!0});var v3,v6,v4=class{constructor(e){v1.__privateAdd.call(void 0,this,v3,void 0),v1.__privateSet.call(void 0,this,v3,new Map(e)),Object.freeze(this)}get size(){return v1.__privateGet.call(void 0,this,v3).size}[Symbol.iterator](){return v1.__privateGet.call(void 0,this,v3)[Symbol.iterator]()}entries(){return v1.__privateGet.call(void 0,this,v3).entries()}forEach(e,t){return v1.__privateGet.call(void 0,this,v3).forEach((n,r,i)=>e.call(t,n,r,this))}get(e){return v1.__privateGet.call(void 0,this,v3).get(e)}has(e){return v1.__privateGet.call(void 0,this,v3).has(e)}keys(){return v1.__privateGet.call(void 0,this,v3).keys()}values(){return v1.__privateGet.call(void 0,this,v3).values()}toString(){return`FrozenMap(${this.size}) {${this.size>0?` ${[...this.entries()].map(([e,t])=>`${String(e)} => ${String(t)}`).join(", ")} `:""}}`}};v3=new WeakMap;var v8=class{constructor(e){v1.__privateAdd.call(void 0,this,v6,void 0),v1.__privateSet.call(void 0,this,v6,new Set(e)),Object.freeze(this)}get size(){return v1.__privateGet.call(void 0,this,v6).size}[Symbol.iterator](){return v1.__privateGet.call(void 0,this,v6)[Symbol.iterator]()}entries(){return v1.__privateGet.call(void 0,this,v6).entries()}forEach(e,t){return v1.__privateGet.call(void 0,this,v6).forEach((n,r,i)=>e.call(t,n,r,this))}has(e){return v1.__privateGet.call(void 0,this,v6).has(e)}keys(){return v1.__privateGet.call(void 0,this,v6).keys()}values(){return v1.__privateGet.call(void 0,this,v6).values()}toString(){return`FrozenSet(${this.size}) {${this.size>0?` ${[...this.values()].map(e=>String(e)).join(", ")} `:""}}`}};v6=new WeakMap,Object.freeze(v4),Object.freeze(v4.prototype),Object.freeze(v8),Object.freeze(v8.prototype),v0.FrozenMap=v4,v0.FrozenSet=v8,Object.defineProperty(hQ,"__esModule",{value:!0}),hQ.AssertionError=hX.AssertionError,hQ.CAIP_ACCOUNT_ADDRESS_REGEX=vP.CAIP_ACCOUNT_ADDRESS_REGEX,hQ.CAIP_ACCOUNT_ID_REGEX=vP.CAIP_ACCOUNT_ID_REGEX,hQ.CAIP_CHAIN_ID_REGEX=vP.CAIP_CHAIN_ID_REGEX,hQ.CAIP_NAMESPACE_REGEX=vP.CAIP_NAMESPACE_REGEX,hQ.CAIP_REFERENCE_REGEX=vP.CAIP_REFERENCE_REGEX,hQ.CaipAccountAddressStruct=vP.CaipAccountAddressStruct,hQ.CaipAccountIdStruct=vP.CaipAccountIdStruct,hQ.CaipChainIdStruct=vP.CaipChainIdStruct,hQ.CaipNamespaceStruct=vP.CaipNamespaceStruct,hQ.CaipReferenceStruct=vP.CaipReferenceStruct,hQ.ChecksumStruct=vV.ChecksumStruct,hQ.Duration=m1.Duration,hQ.ESCAPE_CHARACTERS_REGEXP=h1.ESCAPE_CHARACTERS_REGEXP,hQ.FrozenMap=v0.FrozenMap,hQ.FrozenSet=v0.FrozenSet,hQ.HexAddressStruct=hJ.HexAddressStruct,hQ.HexChecksumAddressStruct=hJ.HexChecksumAddressStruct,hQ.HexStruct=hJ.HexStruct,hQ.JsonRpcErrorStruct=gY.JsonRpcErrorStruct,hQ.JsonRpcFailureStruct=gY.JsonRpcFailureStruct,hQ.JsonRpcIdStruct=gY.JsonRpcIdStruct,hQ.JsonRpcNotificationStruct=gY.JsonRpcNotificationStruct,hQ.JsonRpcParamsStruct=gY.JsonRpcParamsStruct,hQ.JsonRpcRequestStruct=gY.JsonRpcRequestStruct,hQ.JsonRpcResponseStruct=gY.JsonRpcResponseStruct,hQ.JsonRpcSuccessStruct=gY.JsonRpcSuccessStruct,hQ.JsonRpcVersionStruct=gY.JsonRpcVersionStruct,hQ.JsonSize=h1.JsonSize,hQ.JsonStruct=gY.JsonStruct,hQ.PendingJsonRpcResponseStruct=gY.PendingJsonRpcResponseStruct,hQ.StrictHexStruct=hJ.StrictHexStruct,hQ.UnsafeJsonStruct=gY.UnsafeJsonStruct,hQ.VersionRangeStruct=m6.VersionRangeStruct,hQ.VersionStruct=m6.VersionStruct,hQ.add0x=hJ.add0x,hQ.assert=hX.assert,hQ.assertExhaustive=hX.assertExhaustive,hQ.assertIsBytes=hJ.assertIsBytes,hQ.assertIsHexString=hJ.assertIsHexString,hQ.assertIsJsonRpcError=gY.assertIsJsonRpcError,hQ.assertIsJsonRpcFailure=gY.assertIsJsonRpcFailure,hQ.assertIsJsonRpcNotification=gY.assertIsJsonRpcNotification,hQ.assertIsJsonRpcRequest=gY.assertIsJsonRpcRequest,hQ.assertIsJsonRpcResponse=gY.assertIsJsonRpcResponse,hQ.assertIsJsonRpcSuccess=gY.assertIsJsonRpcSuccess,hQ.assertIsPendingJsonRpcResponse=gY.assertIsPendingJsonRpcResponse,hQ.assertIsSemVerRange=m6.assertIsSemVerRange,hQ.assertIsSemVerVersion=m6.assertIsSemVerVersion,hQ.assertIsStrictHexString=hJ.assertIsStrictHexString,hQ.assertStruct=hX.assertStruct,hQ.base64=v$.base64,hQ.base64ToBytes=hJ.base64ToBytes,hQ.bigIntToBytes=hJ.bigIntToBytes,hQ.bigIntToHex=hZ.bigIntToHex,hQ.bytesToBase64=hJ.bytesToBase64,hQ.bytesToBigInt=hJ.bytesToBigInt,hQ.bytesToHex=hJ.bytesToHex,hQ.bytesToNumber=hJ.bytesToNumber,hQ.bytesToSignedBigInt=hJ.bytesToSignedBigInt,hQ.bytesToString=hJ.bytesToString,hQ.calculateNumberSize=h1.calculateNumberSize,hQ.calculateStringSize=h1.calculateStringSize,hQ.concatBytes=hJ.concatBytes,hQ.createBigInt=vY.createBigInt,hQ.createBytes=vY.createBytes,hQ.createDataView=hJ.createDataView,hQ.createDeferredPromise=m0.createDeferredPromise,hQ.createHex=vY.createHex,hQ.createModuleLogger=vC.createModuleLogger,hQ.createNumber=vY.createNumber,hQ.createProjectLogger=vC.createProjectLogger,hQ.exactOptional=gY.exactOptional,hQ.getChecksumAddress=hJ.getChecksumAddress,hQ.getErrorMessage=h0.getErrorMessage,hQ.getJsonRpcIdValidator=gY.getJsonRpcIdValidator,hQ.getJsonSize=gY.getJsonSize,hQ.getKnownPropertyNames=h1.getKnownPropertyNames,hQ.getSafeJson=gY.getSafeJson,hQ.gtRange=m6.gtRange,hQ.gtVersion=m6.gtVersion,hQ.hasProperty=h1.hasProperty,hQ.hexToBigInt=hZ.hexToBigInt,hQ.hexToBytes=hJ.hexToBytes,hQ.hexToNumber=hZ.hexToNumber,hQ.inMilliseconds=m1.inMilliseconds,hQ.isASCII=h1.isASCII,hQ.isBytes=hJ.isBytes,hQ.isCaipAccountAddress=vP.isCaipAccountAddress,hQ.isCaipAccountId=vP.isCaipAccountId,hQ.isCaipChainId=vP.isCaipChainId,hQ.isCaipNamespace=vP.isCaipNamespace,hQ.isCaipReference=vP.isCaipReference,hQ.isErrorWithCode=h0.isErrorWithCode,hQ.isErrorWithMessage=h0.isErrorWithMessage,hQ.isErrorWithStack=h0.isErrorWithStack,hQ.isHexString=hJ.isHexString,hQ.isJsonRpcError=gY.isJsonRpcError,hQ.isJsonRpcFailure=gY.isJsonRpcFailure,hQ.isJsonRpcNotification=gY.isJsonRpcNotification,hQ.isJsonRpcRequest=gY.isJsonRpcRequest,hQ.isJsonRpcResponse=gY.isJsonRpcResponse,hQ.isJsonRpcSuccess=gY.isJsonRpcSuccess,hQ.isNonEmptyArray=h1.isNonEmptyArray,hQ.isNullOrUndefined=h1.isNullOrUndefined,hQ.isObject=h1.isObject,hQ.isPendingJsonRpcResponse=gY.isPendingJsonRpcResponse,hQ.isPlainObject=h1.isPlainObject,hQ.isStrictHexString=hJ.isStrictHexString,hQ.isValidChecksumAddress=hJ.isValidChecksumAddress,hQ.isValidHexAddress=hJ.isValidHexAddress,hQ.isValidJson=gY.isValidJson,hQ.isValidSemVerRange=m6.isValidSemVerRange,hQ.isValidSemVerVersion=m6.isValidSemVerVersion,hQ.jsonrpc2=gY.jsonrpc2,hQ.numberToBytes=hJ.numberToBytes,hQ.numberToHex=hZ.numberToHex,hQ.object=gY.object,hQ.parseCaipAccountId=vP.parseCaipAccountId,hQ.parseCaipChainId=vP.parseCaipChainId,hQ.remove0x=hJ.remove0x,hQ.satisfiesVersionRange=m6.satisfiesVersionRange,hQ.signedBigIntToBytes=hJ.signedBigIntToBytes,hQ.stringToBytes=hJ.stringToBytes,hQ.timeSince=m1.timeSince,hQ.valueToBytes=hJ.valueToBytes,hQ.wrapError=h0.wrapError,Object.defineProperty(hY,"__esModule",{value:!0});var v5=hG.errorCodes.rpc.internal,v7={code:v5,message:be(v5)},v9="Unspecified server error.";function be(e,t="Unspecified error message. This is a bug, please report it."){if(bt(e)){let t=e.toString();if(hQ.hasProperty.call(void 0,hG.errorValues,t))return hG.errorValues[t].message;if(e>=-32099&&e<=-32e3)return v9}return t}function bt(e){return Number.isInteger(e)}function bn(e){return Array.isArray(e)?e.map(e=>hQ.isValidJson.call(void 0,e)?e:hQ.isObject.call(void 0,e)?br(e):null):hQ.isObject.call(void 0,e)?br(e):hQ.isValidJson.call(void 0,e)?e:null}function br(e){return Object.getOwnPropertyNames(e).reduce((t,n)=>{let r=e[n];return hQ.isValidJson.call(void 0,r)&&(t[n]=r),t},{})}hY.JSON_RPC_SERVER_ERROR_MESSAGE=v9,hY.getMessageFromCode=be,hY.isValidCode=bt,hY.serializeError=function(e,{fallbackError:t=v7,shouldIncludeStack:n=!0}={}){if(!hQ.isJsonRpcError.call(void 0,t))throw Error("Must provide fallback error with integer number code and string message.");let r=function(e,t){if(e&&"object"==typeof e&&"serialize"in e&&"function"==typeof e.serialize)return e.serialize();if(hQ.isJsonRpcError.call(void 0,e))return e;let n=bn(e);return{...t,data:{cause:n}}}(e,t);return n||delete r.stack,r},hY.serializeCause=bn,bu.default=bu,bu.stable=bf,bu.stableStringify=bf;var bi="[...]",bo="[Circular]",ba=[],bs=[];function bl(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function bu(e,t,n,r){var i;void 0===r&&(r=bl()),function e(t,n,r,i,o,a,s){var l;if(a+=1,"object"==typeof t&&null!==t){for(l=0;ls.depthLimit||void 0!==s.edgesLimit&&r+1>s.edgesLimit)return void bc(bi,t,n,o);if(i.push(t),Array.isArray(t))for(l=0;lt?1:0}function bf(e,t,n,r){void 0===r&&(r=bl());var i,o=function e(t,n,r,i,o,a,s){var l;if(a+=1,"object"==typeof t&&null!==t){for(l=0;ls.depthLimit||void 0!==s.edgesLimit&&r+1>s.edgesLimit)return void bc(bi,t,n,o);if(i.push(t),Array.isArray(t))for(l=0;l0)for(var r=0;rhY.getMessageFromCode.call(void 0,e)),r)}function bA(e,t){let[n,r]=bw(t);return new hW.EthereumProviderError(e,bb(n,()=>hY.getMessageFromCode.call(void 0,e)),r)}function bw(e){if(e){if("string"==typeof e)return[e];if("object"==typeof e&&!Array.isArray(e)){let{message:t,data:n}=e;if(t&&"string"!=typeof t)throw Error("Must specify string message.");return[bb(t,()=>{}),n]}}return[]}hW.JsonRpcError=bg,hW.EthereumProviderError=class extends bg{constructor(e,t,n){if(!(Number.isInteger(e)&&e>=1e3&&e<=4999))throw Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,t,n)}},Object.defineProperty(h$,"__esModule",{value:!0}),h$.rpcErrors={parse:e=>by(hG.errorCodes.rpc.parse,e),invalidRequest:e=>by(hG.errorCodes.rpc.invalidRequest,e),invalidParams:e=>by(hG.errorCodes.rpc.invalidParams,e),methodNotFound:e=>by(hG.errorCodes.rpc.methodNotFound,e),internal:e=>by(hG.errorCodes.rpc.internal,e),server:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw Error("Ethereum RPC Server errors must provide single object argument.");let{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw Error('"code" must be an integer such that: -32099 <= code <= -32005');return by(t,e)},invalidInput:e=>by(hG.errorCodes.rpc.invalidInput,e),resourceNotFound:e=>by(hG.errorCodes.rpc.resourceNotFound,e),resourceUnavailable:e=>by(hG.errorCodes.rpc.resourceUnavailable,e),transactionRejected:e=>by(hG.errorCodes.rpc.transactionRejected,e),methodNotSupported:e=>by(hG.errorCodes.rpc.methodNotSupported,e),limitExceeded:e=>by(hG.errorCodes.rpc.limitExceeded,e)},h$.providerErrors={userRejectedRequest:e=>bA(hG.errorCodes.provider.userRejectedRequest,e),unauthorized:e=>bA(hG.errorCodes.provider.unauthorized,e),unsupportedMethod:e=>bA(hG.errorCodes.provider.unsupportedMethod,e),disconnected:e=>bA(hG.errorCodes.provider.disconnected,e),chainDisconnected:e=>bA(hG.errorCodes.provider.chainDisconnected,e),custom:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw Error("Ethereum Provider custom errors must provide single object argument.");let{code:t,message:n,data:r}=e;if(!n||"string"!=typeof n)throw Error('"message" must be a nonempty string');return new hW.EthereumProviderError(t,n,r)}},Object.defineProperty(hV,"__esModule",{value:!0}),hV.EthereumProviderError=hW.EthereumProviderError,hV.JsonRpcError=hW.JsonRpcError,hV.errorCodes=hG.errorCodes,hV.getMessageFromCode=hY.getMessageFromCode,hV.providerErrors=h$.providerErrors,hV.rpcErrors=h$.rpcErrors,hV.serializeCause=hY.serializeCause,hV.serializeError=hY.serializeError;var b_={};Object.defineProperty(b_,"__esModule",{value:!0});let bE=eV;function bS(e,t,n){try{Reflect.apply(e,t,n)}catch(e){setTimeout(()=>{throw e})}}class bk extends bE.EventEmitter{emit(e,...t){let n="error"===e,r=this._events;if(void 0!==r)n=n&&void 0===r.error;else if(!n)return!1;if(n){let e;if(t.length>0&&([e]=t),e instanceof Error)throw e;let n=Error("Unhandled error."+(e?` (${e.message})`:""));throw n.context=e,n}let i=r[e];if(void 0===i)return!1;if("function"==typeof i)bS(i,this,t);else{let e=i.length,n=function(e){let t=e.length,n=Array(t);for(let r=0;r{"destroy"in e&&"function"==typeof e.destroy&&e.destroy()}),bU(this,bR,[],"f"),bU(this,bx,!0,"f")}push(e){bq(this,bM,"m",bT).call(this),bq(this,bR,"f").push(e)}handle(e,t){if(bq(this,bM,"m",bT).call(this),t&&"function"!=typeof t)throw Error('"callback" must be a function if provided.');return Array.isArray(e)?t?bq(this,bM,"m",bO).call(this,e,t):bq(this,bM,"m",bO).call(this,e):t?bq(this,bM,"m",bP).call(this,e,t):this._promiseHandle(e)}asMiddleware(){return bq(this,bM,"m",bT).call(this),(e,t,n,r)=>bz(this,void 0,void 0,function*(){try{let[i,o,a]=yield bq(bV,bC,"m",bN).call(bV,e,t,bq(this,bR,"f"));return o?(yield bq(bV,bC,"m",bB).call(bV,a),r(i)):n(e=>bz(this,void 0,void 0,function*(){try{yield bq(bV,bC,"m",bB).call(bV,a)}catch(t){return e(t)}return e()}))}catch(e){return r(e)}})}_promiseHandle(e){return bz(this,void 0,void 0,function*(){return new Promise((t,n)=>{bq(this,bM,"m",bP).call(this,e,(e,r)=>{e&&void 0===r?n(e):t(r)}).catch(n)})})}}function b$(e){return JSON.stringify(e,null,2)}hH.JsonRpcEngine=bV,bC=bV,bx=new WeakMap,bR=new WeakMap,bI=new WeakMap,bM=new WeakSet,bT=function(){if(bq(this,bx,"f"))throw Error("This engine is destroyed and can no longer be used.")},bO=function(e,t){return bz(this,void 0,void 0,function*(){try{if(0===e.length){let e=[{id:null,jsonrpc:"2.0",error:new hV.JsonRpcError(hV.errorCodes.rpc.invalidRequest,"Request batch must contain plain objects. Received an empty array")}];return t?t(null,e):e}let n=(yield Promise.all(e.map(this._promiseHandle.bind(this)))).filter(e=>void 0!==e);return t?t(null,n):n}catch(e){if(t)return t(e);throw e}})},bP=function(e,t){var n;return bz(this,void 0,void 0,function*(){if(!e||Array.isArray(e)||"object"!=typeof e){let n=new hV.JsonRpcError(hV.errorCodes.rpc.invalidRequest,"Requests must be plain objects. Received: "+typeof e,{request:e});return t(n,{id:null,jsonrpc:"2.0",error:n})}if("string"!=typeof e.method){let r=new hV.JsonRpcError(hV.errorCodes.rpc.invalidRequest,"Must specify a string method. Received: "+typeof e.method,{request:e});return bq(this,bI,"f")&&!(0,hQ.isJsonRpcRequest)(e)?t(null):t(r,{id:null!==(n=e.id)&&void 0!==n?n:null,jsonrpc:"2.0",error:r})}if(bq(this,bI,"f")&&!(0,hQ.isJsonRpcRequest)(e)){try{yield bq(this,bI,"f").call(this,e)}catch(e){return t(e)}return t(null)}let r=null,i=Object.assign({},e),o={id:i.id,jsonrpc:i.jsonrpc};try{yield bq(bV,bC,"m",bL).call(bV,i,o,bq(this,bR,"f"))}catch(e){r=e}return r&&(delete o.result,o.error||(o.error=(0,hV.serializeError)(r))),t(r,o)})},bL=function(e,t,n){return bz(this,void 0,void 0,function*(){let[r,i,o]=yield bq(bV,bC,"m",bN).call(bV,e,t,n);if(bq(bV,bC,"m",bj).call(bV,e,t,i),yield bq(bV,bC,"m",bB).call(bV,o),r)throw r})},bN=function(e,t,n){return bz(this,void 0,void 0,function*(){let r=[],i=null,o=!1;for(let a of n)if([i,o]=yield bq(bV,bC,"m",bD).call(bV,e,t,a,r),o)break;return[i,o,r.reverse()]})},bD=function(e,t,n,r){return bz(this,void 0,void 0,function*(){return new Promise(i=>{let o=e=>{let n=e||t.error;n&&(t.error=(0,hV.serializeError)(n)),i([n,!0])};try{n(e,t,n=>{t.error?o(t.error):(n&&("function"!=typeof n&&o(new hV.JsonRpcError(hV.errorCodes.rpc.internal,`JsonRpcEngine: "next" return handlers must be functions. Received "${typeof n}" for request: +${b$(e)}`,{request:e})),r.push(n)),i([null,!1]))},o)}catch(e){o(e)}})})},bB=function(e){return bz(this,void 0,void 0,function*(){for(let t of e)yield new Promise((e,n)=>{t(t=>t?n(t):e())})})},bj=function(e,t,n){if(!(0,hQ.hasProperty)(t,"result")&&!(0,hQ.hasProperty)(t,"error"))throw new hV.JsonRpcError(hV.errorCodes.rpc.internal,`JsonRpcEngine: Response has no error or result for request: +${b$(e)}`,{request:e});if(!n)throw new hV.JsonRpcError(hV.errorCodes.rpc.internal,`JsonRpcEngine: Nothing ended request: +${b$(e)}`,{request:e})};var bW={};Object.defineProperty(bW,"__esModule",{value:!0}),bW.mergeMiddleware=void 0,bW.mergeMiddleware=function(e){let t=new hH.JsonRpcEngine;return e.forEach(e=>t.push(e)),t.asMiddleware()},yd=l&&l.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),yf=l&&l.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||yd(t,e,n)},Object.defineProperty(hB,"__esModule",{value:!0}),yf(hj,hB),yf(hz,hB),yf(hU,hB),yf(hK,hB),yf(hH,hB),yf(bW,hB);var bY={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}};function bG(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}var bQ=(e,t)=>Object.hasOwnProperty.call(e,t),bZ=class extends Error{constructor(e){super(e.message),this.code="ERR_ASSERTION"}},bJ=e=>pI(e);function bX({path:e,branch:t}){let n=e[e.length-1];return bQ(t[t.length-2],n)}function b0(e){return new pp({...e,type:`optional ${e.type}`,validator:(t,n)=>!bX(n)||e.validator(t,n),refiner:(t,n)=>!bX(n)||e.refiner(t,n)})}var b1=pN([pM(null),pS(),pA("finite number",e=>pb(e,pR())&&Number.isFinite(e)),pP(),pE(pw(()=>b1)),pO(pP(),pw(()=>b1))]),b2=pB(b1,p_(),e=>((function(e,t,n="Assertion failed",r=bZ){try{pm(e,t)}catch(e){var i;throw i=`${n}: ${("object"==typeof e&&null!==e&&"message"in e&&"string"==typeof e.message?e.message:null==e?"":String(e)).replace(/\.$/u,"")}.`,"string"==typeof r?.prototype?.constructor?.name?new r({message:i}):r({message:i})}})(e,b1),JSON.parse(JSON.stringify(e,(e,t)=>{if("__proto__"!==e&&"constructor"!==e)return t}))));function b3(e){try{return pg(e,b2),!0}catch{return!1}}var b6=pM("2.0"),b4=px(pN([pR(),pP()])),b8=bJ({code:pk(),message:pP(),data:b0(b2),stack:b0(pP())}),b5=pN([pO(pP(),b2),pE(b2)]);function b7(e,t="Unspecified error message. This is a bug, please report it."){if(Number.isInteger(e)){let t=e.toString();if(bQ(bY,t))return bY[t].message;if(e>=-32099&&e<=-32e3)return"Unspecified server error."}return t}function b9(e){return Object.getOwnPropertyNames(e).reduce((t,n)=>{let r=e[n];return b3(r)&&(t[n]=r),t},{})}bJ({id:b4,jsonrpc:b6,method:pP(),params:b0(b5)}),bJ({jsonrpc:b6,method:pP(),params:b0(b5)}),pI({id:b4,jsonrpc:b6,result:pT(pD()),error:pT(b8)}),pN([bJ({id:b4,jsonrpc:b6,result:b2}),bJ({id:b4,jsonrpc:b6,error:b8})]),b7(-32603);var ye=class extends Error{constructor(e,t,n){if(!Number.isInteger(e))throw Error('"code" must be an integer.');if(!t||"string"!=typeof t)throw Error('"message" must be a non-empty string.');super(t),this.code=e,void 0!==n&&(this.data=n)}serialize(){var e;let t={code:this.code,message:this.message};return void 0!==this.data&&(t.data=this.data,function(e){if("object"!=typeof e||null===e)return!1;try{let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}catch(e){return!1}}(this.data)&&(t.data.cause=Array.isArray(e=this.data.cause)?e.map(e=>b3(e)?e:bG(e)?b9(e):null):bG(e)?b9(e):b3(e)?e:null)),this.stack&&(t.stack=this.stack),t}toString(){return bp(this.serialize(),yt,2)}};function yt(e,t){if("[Circular]"!==t)return t}var yn=e=>(function(e,t){let[n,r]=function(e){if(e){if("string"==typeof e)return[e];if("object"==typeof e&&!Array.isArray(e)){let{message:t,data:n}=e;if(t&&"string"!=typeof t)throw Error("Must specify string message.");return[t??void 0,n]}}return[]}(t);return new ye(-32600,n??b7(-32600),r)})(-32600,e),yr=Object.freeze(["eth_subscription"]),yi=(e=console)=>[hB.createIdRemapMiddleware(),(t,n,r)=>{"string"==typeof t.method&&t.method||(n.error=yn({message:"The request 'method' must be a non-empty string.",data:t})),r(t=>{let{error:r}=n;return r&&e.error(`MetaMask - RPC Error: ${r.message}`,r),t()})},function(e){let t={ethDecryptDeprecation:!1,ethGetEncryptionPublicKeyDeprecation:!1,walletWatchAssetNFTExperimental:!1};return(n,r,i)=>{t.ethDecryptDeprecation||"eth_decrypt"!==n.method?t.ethGetEncryptionPublicKeyDeprecation||"eth_getEncryptionPublicKey"!==n.method?!t.walletWatchAssetNFTExperimental&&"wallet_watchAsset"===n.method&&["ERC721","ERC1155"].includes(n.params?.type||"")&&(e.warn(hD.warnings.rpc.walletWatchAssetNFTExperimental),t.walletWatchAssetNFTExperimental=!0):(e.warn(hD.warnings.rpc.ethGetEncryptionPublicKeyDeprecation),t.ethGetEncryptionPublicKeyDeprecation=!0):(e.warn(hD.warnings.rpc.ethDecryptDeprecation),t.ethDecryptDeprecation=!0),i()}}(e)],yo=(e,t,n=!0)=>(r,i)=>{r||i.error?t(r||i.error):!n||Array.isArray(i)?e(i):e(i.result)},ya=e=>!!e&&"string"==typeof e&&e.startsWith("0x"),ys=()=>{};async function yl(e,t){try{let t=await async function(){return{name:function(e){let{document:t}=e,n=t.querySelector('head > meta[property="og:site_name"]');if(n)return n.content;let r=t.querySelector('head > meta[name="title"]');return r?r.content:t.title&&t.title.length>0?t.title:window.location.hostname}(window),icon:await yu(window)}}();e.handle({jsonrpc:"2.0",id:1,method:"metamask_sendDomainMetadata",params:t},ys)}catch(e){t.error({message:hD.errors.sendSiteMetadata(),originalError:e})}}async function yu(e){let{document:t}=e;for(let e of Array.from(t.querySelectorAll('head > link[rel~="icon"]')))if(e&&await yc(e.href))return e.href;return null}async function yc(e){return new Promise((t,n)=>{try{let n=document.createElement("img");n.onload=()=>t(!0),n.onerror=()=>t(!1),n.src=e}catch(e){n(e)}})}var yd,yf,yh,yp,ym=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},yg=(e,t,n)=>(ym(e,t,"read from private field"),n?n.call(e):t.get(e)),yv=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},yb=(e,t,n,r)=>(ym(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),yy=u(function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;if(Array.isArray(t)){if((r=t.length)!=n.length)return!1;for(i=r;0!=i--;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((r=(o=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(i=r;0!=i--;)if(!Object.prototype.hasOwnProperty.call(n,o[i]))return!1;for(i=r;0!=i--;){var r,i,o,a=o[i];if(!e(t[a],n[a]))return!1}return!0}return t!=t&&n!=n}),yA=class e extends bF{constructor({logger:t=console,maxEventListeners:n=100,rpcMiddleware:r=[]}={}){super(),yv(this,yh,void 0),yv(this,yp,void 0),this._log=t,this.setMaxListeners(n),this._state={...e._defaultState},yb(this,yp,null),yb(this,yh,null),this._handleAccountsChanged=this._handleAccountsChanged.bind(this),this._handleConnect=this._handleConnect.bind(this),this._handleChainChanged=this._handleChainChanged.bind(this),this._handleDisconnect=this._handleDisconnect.bind(this),this._handleUnlockStateChanged=this._handleUnlockStateChanged.bind(this),this._rpcRequest=this._rpcRequest.bind(this),this.request=this.request.bind(this);let i=new hB.JsonRpcEngine;r.forEach(e=>i.push(e)),this._rpcEngine=i}get chainId(){return yg(this,yh)}get selectedAddress(){return yg(this,yp)}isConnected(){return this._state.isConnected}async request(e){if(!e||"object"!=typeof e||Array.isArray(e))throw yn({message:hD.errors.invalidRequestArgs(),data:e});let{method:t,params:n}=e;if("string"!=typeof t||0===t.length)throw yn({message:hD.errors.invalidRequestMethod(),data:e});if(void 0!==n&&!Array.isArray(n)&&("object"!=typeof n||null===n))throw yn({message:hD.errors.invalidRequestParams(),data:e});let r=null==n?{method:t}:{method:t,params:n};return new Promise((e,t)=>{this._rpcRequest(r,yo(e,t))})}_initializeState(e){if(this._state.initialized)throw Error("Provider already initialized.");if(e){let{accounts:t,chainId:n,isUnlocked:r,networkVersion:i}=e;this._handleConnect(n),this._handleChainChanged({chainId:n,networkVersion:i}),this._handleUnlockStateChanged({accounts:t,isUnlocked:r}),this._handleAccountsChanged(t)}this._state.initialized=!0,this.emit("_initialized")}_rpcRequest(e,t){let n=t;return Array.isArray(e)||(e.jsonrpc||(e.jsonrpc="2.0"),"eth_accounts"!==e.method&&"eth_requestAccounts"!==e.method||(n=(n,r)=>{this._handleAccountsChanged(r.result??[],"eth_accounts"===e.method),t(n,r)})),this._rpcEngine.handle(e,n)}_handleConnect(e){this._state.isConnected||(this._state.isConnected=!0,this.emit("connect",{chainId:e}),this._log.debug(hD.info.connected(e)))}_handleDisconnect(e,t){if(this._state.isConnected||!this._state.isPermanentlyDisconnected&&!e){let n;this._state.isConnected=!1,e?(n=new ye(1013,t??hD.errors.disconnected()),this._log.debug(n)):(n=new ye(1011,t??hD.errors.permanentlyDisconnected()),this._log.error(n),yb(this,yh,null),this._state.accounts=null,yb(this,yp,null),this._state.isUnlocked=!1,this._state.isPermanentlyDisconnected=!0),this.emit("disconnect",n)}}_handleChainChanged({chainId:e}={}){ya(e)?(this._handleConnect(e),e!==yg(this,yh)&&(yb(this,yh,e),this._state.initialized&&this.emit("chainChanged",yg(this,yh)))):this._log.error(hD.errors.invalidNetworkParams(),{chainId:e})}_handleAccountsChanged(e,t=!1){let n=e;for(let t of(Array.isArray(e)||(this._log.error("MetaMask: Received invalid accounts parameter. Please report this bug.",e),n=[]),e))if("string"!=typeof t){this._log.error("MetaMask: Received non-string account. Please report this bug.",e),n=[];break}if(!yy(this._state.accounts,n)&&(t&&null!==this._state.accounts&&this._log.error("MetaMask: 'eth_accounts' unexpectedly updated accounts. Please report this bug.",n),this._state.accounts=n,yg(this,yp)!==n[0]&&yb(this,yp,n[0]||null),this._state.initialized)){let e=[...n];this.emit("accountsChanged",e)}}_handleUnlockStateChanged({accounts:e,isUnlocked:t}={}){"boolean"==typeof t?t!==this._state.isUnlocked&&(this._state.isUnlocked=t,this._handleAccountsChanged(e??[])):this._log.error("MetaMask: Received invalid isUnlocked parameter. Please report this bug.")}};yh=new WeakMap,yp=new WeakMap,yA._defaultState={accounts:null,isConnected:!1,isUnlocked:!1,initialized:!1,isPermanentlyDisconnected:!1};var yw=yA,y_={},yE={};Object.defineProperty(yE,"__esModule",{value:!0}),yE.default=function(e){if(!(null==e?void 0:e.engine))throw Error("Missing engine parameter!");let{engine:t}=e,n=new ni.Duplex({objectMode:!0,read:()=>{},write:function(e,r,i){t.handle(e,(e,t)=>{n.push(t)}),i()}});return t.on&&t.on("notification",e=>{n.push(e)}),n};var yS={},yk=l&&l.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(yS,"__esModule",{value:!0});let yM=yk(b_);yS.default=function(e={}){let t={},n=new ni.Duplex({objectMode:!0,read:()=>{},write:function(i,o,a){let s=null;try{i.id?function(e){let{id:n}=e;if(null===n)return;let r=t[n];if(!r)return void console.warn(`StreamMiddleware - Unknown response id "${n}"`);delete t[n],Object.assign(r.res,e),setTimeout(r.end)}(i):((null==e?void 0:e.retryOnMessage)&&i.method===e.retryOnMessage&&Object.values(t).forEach(({req:e,retryCount:r=0})=>{if(!e.id)return;if(r>=3)throw Error(`StreamMiddleware - Retry limit exceeded for request id "${e.id}"`);let i=t[e.id];i&&(i.retryCount=r+1),n.push(e)}),r.emit("notification",i))}catch(e){s=e}a(s)}}),r=new yM.default;return{events:r,middleware:(e,r,i,o)=>{t[e.id]={req:e,res:r,next:i,end:o},n.push(e)},stream:n}};var yC=l&&l.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(y_,"__esModule",{value:!0});var yx=y_.createStreamMiddleware=y_.createEngineStream=void 0;let yR=yC(yE);y_.createEngineStream=yR.default;let yI=yC(yS);yx=y_.createStreamMiddleware=yI.default;var yT={},yO={exports:{}},yP=function e(t,n){if(t&&n)return e(t)(n);if("function"!=typeof t)throw TypeError("need wrapper function");return Object.keys(t).forEach(function(e){r[e]=t[e]}),r;function r(){for(var e=Array(arguments.length),n=0;nt.destroy(e||void 0)),t}ignoreStream(e){if(!e)throw Error("ObjectMultiplex - name must not be empty");if(this._substreams[e])throw Error(`ObjectMultiplex - Substream for name "${e}" already exists`);this._substreams[e]=yK}_read(){}_write(e,t,n){let{name:r,data:i}=e;if(!r)return console.warn(`ObjectMultiplex - malformed chunk without name "${e}"`),n();let o=this._substreams[r];return o?o!==yK&&o.push(i):console.warn(`ObjectMultiplex - orphaned data for stream "${r}"`),n()}};yT.ObjectMultiplex=yH;var yV=u(yT.ObjectMultiplex);let y$=e=>null!==e&&"object"==typeof e&&"function"==typeof e.pipe;y$.writable=e=>y$(e)&&!1!==e.writable&&"function"==typeof e._write&&"object"==typeof e._writableState,y$.readable=e=>y$(e)&&!1!==e.readable&&"function"==typeof e._read&&"object"==typeof e._readableState,y$.duplex=e=>y$.writable(e)&&y$.readable(e),y$.transform=e=>y$.duplex(e)&&"function"==typeof e._transform;var yW,yY=class extends yw{constructor(e,{jsonRpcStreamName:t,logger:n=console,maxEventListeners:r=100,rpcMiddleware:i=[]}){if(super({logger:n,maxEventListeners:r,rpcMiddleware:i}),!y$.duplex(e))throw Error(hD.errors.invalidDuplexStream());this._handleStreamDisconnect=this._handleStreamDisconnect.bind(this);let o=new yV;ni.pipeline(e,o,e,this._handleStreamDisconnect.bind(this,"MetaMask")),this._jsonRpcConnection=yx({retryOnMessage:"METAMASK_EXTENSION_CONNECT_CAN_RETRY"}),ni.pipeline(this._jsonRpcConnection.stream,o.createStream(t),this._jsonRpcConnection.stream,this._handleStreamDisconnect.bind(this,"MetaMask RpcProvider")),this._rpcEngine.push(this._jsonRpcConnection.middleware),this._jsonRpcConnection.events.on("notification",t=>{let{method:n,params:r}=t;"metamask_accountsChanged"===n?this._handleAccountsChanged(r):"metamask_unlockStateChanged"===n?this._handleUnlockStateChanged(r):"metamask_chainChanged"===n?this._handleChainChanged(r):yr.includes(n)?this.emit("message",{type:n,data:r}):"METAMASK_STREAM_FAILURE"===n&&e.destroy(Error(hD.errors.permanentlyDisconnected()))})}async _initializeStateAsync(){let e;try{e=await this.request({method:"metamask_getProviderState"})}catch(e){this._log.error("MetaMask: Failed to get initial state. Please report this bug.",e)}this._initializeState(e)}_handleStreamDisconnect(e,t){let n=`MetaMask: Lost connection to "${e}".`;t?.stack&&(n+=` +${t.stack}`),this._log.warn(n),this.listenerCount("error")>0&&this.emit("error",n),this._handleDisconnect(!1,t?t.message:void 0)}_handleChainChanged({chainId:e,networkVersion:t}={}){let n;ya(e)&&(n=t)&&"string"==typeof n?"loading"===t?this._handleDisconnect(!0):super._handleChainChanged({chainId:e}):this._log.error(hD.errors.invalidNetworkParams(),{chainId:e,networkVersion:t})}},yG=class extends yY{constructor(e,{jsonRpcStreamName:t="metamask-provider",logger:n=console,maxEventListeners:r=100,shouldSendMetadata:i}={}){if(super(e,{jsonRpcStreamName:t,logger:n,maxEventListeners:r,rpcMiddleware:yi(n)}),this._sentWarnings={chainId:!1,networkVersion:!1,selectedAddress:!1,enable:!1,experimentalMethods:!1,send:!1,events:{close:!1,data:!1,networkChanged:!1,notification:!1}},yv(this,yW,void 0),this._initializeStateAsync(),yb(this,yW,null),this.isMetaMask=!0,this._sendSync=this._sendSync.bind(this),this.enable=this.enable.bind(this),this.send=this.send.bind(this),this.sendAsync=this.sendAsync.bind(this),this._warnOfDeprecation=this._warnOfDeprecation.bind(this),this._metamask=this._getExperimentalApi(),this._jsonRpcConnection.events.on("notification",e=>{let{method:t}=e;yr.includes(t)&&(this.emit("data",e),this.emit("notification",e.params.result))}),i){if("complete"===document.readyState)yl(this._rpcEngine,this._log);else{let e=()=>{yl(this._rpcEngine,this._log),window.removeEventListener("DOMContentLoaded",e)};window.addEventListener("DOMContentLoaded",e)}}}get chainId(){return this._sentWarnings.chainId||(this._log.warn(hD.warnings.chainIdDeprecation),this._sentWarnings.chainId=!0),super.chainId}get networkVersion(){return this._sentWarnings.networkVersion||(this._log.warn(hD.warnings.networkVersionDeprecation),this._sentWarnings.networkVersion=!0),yg(this,yW)}get selectedAddress(){return this._sentWarnings.selectedAddress||(this._log.warn(hD.warnings.selectedAddressDeprecation),this._sentWarnings.selectedAddress=!0),super.selectedAddress}sendAsync(e,t){this._rpcRequest(e,t)}addListener(e,t){return this._warnOfDeprecation(e),super.addListener(e,t)}on(e,t){return this._warnOfDeprecation(e),super.on(e,t)}once(e,t){return this._warnOfDeprecation(e),super.once(e,t)}prependListener(e,t){return this._warnOfDeprecation(e),super.prependListener(e,t)}prependOnceListener(e,t){return this._warnOfDeprecation(e),super.prependOnceListener(e,t)}_handleDisconnect(e,t){super._handleDisconnect(e,t),yg(this,yW)&&!e&&yb(this,yW,null)}_warnOfDeprecation(e){!1===this._sentWarnings?.events[e]&&(this._log.warn(hD.warnings.events[e]),this._sentWarnings.events[e]=!0)}async enable(){return this._sentWarnings.enable||(this._log.warn(hD.warnings.enableDeprecation),this._sentWarnings.enable=!0),new Promise((e,t)=>{try{this._rpcRequest({method:"eth_requestAccounts",params:[]},yo(e,t))}catch(e){t(e)}})}send(e,t){return this._sentWarnings.send||(this._log.warn(hD.warnings.sendDeprecation),this._sentWarnings.send=!0),"string"!=typeof e||t&&!Array.isArray(t)?e&&"object"==typeof e&&"function"==typeof t?this._rpcRequest(e,t):this._sendSync(e):new Promise((n,r)=>{try{this._rpcRequest({method:e,params:t},yo(n,r,!1))}catch(e){r(e)}})}_sendSync(e){let t;switch(e.method){case"eth_accounts":t=this.selectedAddress?[this.selectedAddress]:[];break;case"eth_coinbase":t=this.selectedAddress??null;break;case"eth_uninstallFilter":this._rpcRequest(e,ys),t=!0;break;case"net_version":t=yg(this,yW)??null;break;default:throw Error(hD.errors.unsupportedSync(e.method))}return{id:e.id,jsonrpc:e.jsonrpc,result:t}}_getExperimentalApi(){return new Proxy({isUnlocked:async()=>(this._state.initialized||await new Promise(e=>{this.on("_initialized",()=>e())}),this._state.isUnlocked),requestBatch:async e=>{if(!Array.isArray(e))throw yn({message:"Batch requests must be made with an array of request objects.",data:e});return new Promise((t,n)=>{this._rpcRequest(e,yo(t,n))})}},{get:(e,t,...n)=>(this._sentWarnings.experimentalMethods||(this._log.warn(hD.warnings.experimentalMethods),this._sentWarnings.experimentalMethods=!0),Reflect.get(e,t,...n))})}_handleChainChanged({chainId:e,networkVersion:t}={}){super._handleChainChanged({chainId:e,networkVersion:t}),this._state.isConnected&&t!==yg(this,yW)&&(yb(this,yW,t),this._state.initialized&&this.emit("networkChanged",yg(this,yW)))}};yW=new WeakMap;let yQ=vT("MM_SDK");yQ.color="#FFAC1C";var yZ={},yJ={};Object.defineProperty(yJ,"__esModule",{value:!0}),yJ.EthereumProviderError=yJ.EthereumRpcError=void 0;class yX extends Error{constructor(e,t,n){if(!Number.isInteger(e))throw Error('"code" must be an integer.');if(!t||"string"!=typeof t)throw Error('"message" must be a nonempty string.');super(t),this.code=e,void 0!==n&&(this.data=n)}serialize(){let e={code:this.code,message:this.message};return void 0!==this.data&&(e.data=this.data),this.stack&&(e.stack=this.stack),e}toString(){return bu.default(this.serialize(),y0,2)}}function y0(e,t){if("[Circular]"!==t)return t}yJ.EthereumRpcError=yX,yJ.EthereumProviderError=class extends yX{constructor(e,t,n){if(!(Number.isInteger(e)&&e>=1e3&&e<=4999))throw Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,t,n)}};var y1={},y2={};Object.defineProperty(y2,"__esModule",{value:!0}),y2.errorValues=y2.errorCodes=void 0,y2.errorCodes={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901}},y2.errorValues={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.serializeError=e.isValidCode=e.getMessageFromCode=e.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;let t=y2.errorCodes.rpc.internal,n={code:t,message:r(t)};function r(t,n="Unspecified error message. This is a bug, please report it."){if(Number.isInteger(t)){let n=t.toString();if(a(y2.errorValues,n))return y2.errorValues[n].message;if(t>=-32099&&t<=-32e3)return e.JSON_RPC_SERVER_ERROR_MESSAGE}return n}function i(e){if(!Number.isInteger(e))return!1;let t=e.toString();return!!y2.errorValues[t]||!!(e>=-32099&&e<=-32e3)}function o(e){return e&&"object"==typeof e&&!Array.isArray(e)?Object.assign({},e):e}function a(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.",e.getMessageFromCode=r,e.isValidCode=i,e.serializeError=function(e,{fallbackError:t=n,shouldIncludeStack:s=!1}={}){if(!t||!Number.isInteger(t.code)||"string"!=typeof t.message)throw Error("Must provide fallback error with integer number code and string message.");if(e instanceof yJ.EthereumRpcError)return e.serialize();let l={};if(e&&"object"==typeof e&&!Array.isArray(e)&&a(e,"code")&&i(e.code))l.code=e.code,e.message&&"string"==typeof e.message?(l.message=e.message,a(e,"data")&&(l.data=e.data)):(l.message=r(l.code),l.data={originalError:o(e)});else{l.code=t.code;let n=null==e?void 0:e.message;l.message=n&&"string"==typeof n?n:t.message,l.data={originalError:o(e)}}let u=null==e?void 0:e.stack;return s&&e&&u&&"string"==typeof u&&(l.stack=u),l}}(y1);var y3={};function y6(e,t){let[n,r]=y8(t);return new yJ.EthereumRpcError(e,n||y1.getMessageFromCode(e),r)}function y4(e,t){let[n,r]=y8(t);return new yJ.EthereumProviderError(e,n||y1.getMessageFromCode(e),r)}function y8(e){if(e){if("string"==typeof e)return[e];if("object"==typeof e&&!Array.isArray(e)){let{message:t,data:n}=e;if(t&&"string"!=typeof t)throw Error("Must specify string message.");return[t||void 0,n]}}return[]}Object.defineProperty(y3,"__esModule",{value:!0}),y3.ethErrors=void 0,y3.ethErrors={rpc:{parse:e=>y6(y2.errorCodes.rpc.parse,e),invalidRequest:e=>y6(y2.errorCodes.rpc.invalidRequest,e),invalidParams:e=>y6(y2.errorCodes.rpc.invalidParams,e),methodNotFound:e=>y6(y2.errorCodes.rpc.methodNotFound,e),internal:e=>y6(y2.errorCodes.rpc.internal,e),server:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw Error("Ethereum RPC Server errors must provide single object argument.");let{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw Error('"code" must be an integer such that: -32099 <= code <= -32005');return y6(t,e)},invalidInput:e=>y6(y2.errorCodes.rpc.invalidInput,e),resourceNotFound:e=>y6(y2.errorCodes.rpc.resourceNotFound,e),resourceUnavailable:e=>y6(y2.errorCodes.rpc.resourceUnavailable,e),transactionRejected:e=>y6(y2.errorCodes.rpc.transactionRejected,e),methodNotSupported:e=>y6(y2.errorCodes.rpc.methodNotSupported,e),limitExceeded:e=>y6(y2.errorCodes.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>y4(y2.errorCodes.provider.userRejectedRequest,e),unauthorized:e=>y4(y2.errorCodes.provider.unauthorized,e),unsupportedMethod:e=>y4(y2.errorCodes.provider.unsupportedMethod,e),disconnected:e=>y4(y2.errorCodes.provider.disconnected,e),chainDisconnected:e=>y4(y2.errorCodes.provider.chainDisconnected,e),custom:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw Error("Ethereum Provider custom errors must provide single object argument.");let{code:t,message:n,data:r}=e;if(!n||"string"!=typeof n)throw Error('"message" must be a nonempty string');return new yJ.EthereumProviderError(t,n,r)}}},Object.defineProperty(yZ,"__esModule",{value:!0}),yZ.getMessageFromCode=yZ.serializeError=yZ.EthereumProviderError=yZ.EthereumRpcError=yZ.ethErrors=yZ.errorCodes=void 0,Object.defineProperty(yZ,"EthereumRpcError",{enumerable:!0,get:function(){return yJ.EthereumRpcError}}),Object.defineProperty(yZ,"EthereumProviderError",{enumerable:!0,get:function(){return yJ.EthereumProviderError}}),Object.defineProperty(yZ,"serializeError",{enumerable:!0,get:function(){return y1.serializeError}}),Object.defineProperty(yZ,"getMessageFromCode",{enumerable:!0,get:function(){return y1.getMessageFromCode}}),Object.defineProperty(yZ,"ethErrors",{enumerable:!0,get:function(){return y3.ethErrors}}),Object.defineProperty(yZ,"errorCodes",{enumerable:!0,get:function(){return y2.errorCodes}});let y5={METAMASK_GETPROVIDERSTATE:"metamask_getProviderState",METAMASK_CONNECTSIGN:"metamask_connectSign",METAMASK_CONNECTWITH:"metamask_connectWith",METAMASK_OPEN:"metamask_open",METAMASK_BATCH:"metamask_batch",PERSONAL_SIGN:"personal_sign",WALLET_REQUESTPERMISSIONS:"wallet_requestPermissions",WALLET_GETPERMISSIONS:"wallet_getPermissions",WALLET_WATCHASSET:"wallet_watchAsset",WALLET_ADDETHEREUMCHAIN:"wallet_addEthereumChain",WALLET_SWITCHETHETHEREUMCHAIN:"wallet_switchEthereumChain",ETH_REQUESTACCOUNTS:"eth_requestAccounts",ETH_ACCOUNTS:"eth_accounts",ETH_CHAINID:"eth_chainId",ETH_SENDTRANSACTION:"eth_sendTransaction",ETH_SIGNTYPEDDATA:"eth_signTypedData",ETH_SIGNTYPEDDATA_V3:"eth_signTypedData_v3",ETH_SIGNTYPEDDATA_V4:"eth_signTypedData_v4",ETH_SIGNTRANSACTION:"eth_signTransaction",ETH_SIGN:"eth_sign",PERSONAL_EC_RECOVER:"personal_ecRecover"},y7={[y5.ETH_REQUESTACCOUNTS]:!0,[y5.ETH_SENDTRANSACTION]:!0,[y5.ETH_SIGNTRANSACTION]:!0,[y5.ETH_SIGN]:!0,[y5.ETH_ACCOUNTS]:!0,[y5.PERSONAL_SIGN]:!0,[y5.ETH_SIGNTYPEDDATA]:!0,[y5.ETH_SIGNTYPEDDATA_V3]:!0,[y5.ETH_SIGNTYPEDDATA_V4]:!0,[y5.WALLET_REQUESTPERMISSIONS]:!0,[y5.WALLET_GETPERMISSIONS]:!0,[y5.WALLET_WATCHASSET]:!0,[y5.WALLET_ADDETHEREUMCHAIN]:!0,[y5.WALLET_SWITCHETHETHEREUMCHAIN]:!0,[y5.METAMASK_CONNECTSIGN]:!0,[y5.METAMASK_CONNECTWITH]:!0,[y5.PERSONAL_EC_RECOVER]:!0,[y5.METAMASK_BATCH]:!0,[y5.METAMASK_OPEN]:!0},y9=Object.keys(y7).map(e=>e.toLowerCase()),Ae=["eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sign"].map(e=>e.toLowerCase()),At=".sdk-comm",An="providerType",Ar=".MMSDK_cached_address",Ai=".MMSDK_cached_chainId",Ao={CHAIN_CHANGED:"chainChanged",ACCOUNTS_CHANGED:"accountsChanged",DISCONNECT:"disconnect",CONNECT:"connect",CONNECTED:"connected"};class Aa{constructor({enabled:e}={enabled:!1}){this.enabled=!1,this.enabled=e}persistChannelConfig(e){return hP(this,void 0,void 0,function*(){let t=JSON.stringify(e);yQ(`[StorageManagerWeb: persistChannelConfig()] enabled=${this.enabled}`,e),localStorage.setItem(At,t)})}getPersistedChannelConfig(){return hP(this,void 0,void 0,function*(){let e;try{if(yQ(`[StorageManagerWeb: getPersistedChannelConfig()] enabled=${this.enabled}`),e=localStorage.getItem(At),yQ("[StorageManagerWeb: getPersistedChannelConfig()]",e),!e)return;let t=JSON.parse(e);return yQ("[StorageManagerWeb: getPersistedChannelConfig()] channelConfig",t),t}catch(e){return void console.error("[StorageManagerWeb: getPersistedChannelConfig()] Can't find existing channel config",e)}})}persistAccounts(e){return hP(this,void 0,void 0,function*(){yQ(`[StorageManagerWeb: persistAccounts()] enabled=${this.enabled}`,e);let t=JSON.stringify(e);localStorage.setItem(Ar,t)})}getCachedAccounts(){return hP(this,void 0,void 0,function*(){try{let e=localStorage.getItem(Ar);return e?JSON.parse(e):[]}catch(e){throw console.error("[StorageManagerWeb: getCachedAccounts()] Error reading cached accounts",e),e}})}persistChainId(e){return hP(this,void 0,void 0,function*(){yQ(`[StorageManagerWeb: persistChainId()] enabled=${this.enabled}`,e),localStorage.setItem(Ai,e)})}getCachedChainId(){return hP(this,void 0,void 0,function*(){try{let e=localStorage.getItem(Ai);return null!=e?e:void 0}catch(e){throw console.error("[StorageManagerWeb: getCachedChainId()] Error reading cached chainId",e),e}})}terminate(){return hP(this,void 0,void 0,function*(){yQ(`[StorageManagerWeb: terminate()] enabled=${this.enabled}`),localStorage.removeItem(At)})}}let As=e=>new Aa(e);class Al extends yG{constructor({connectionStream:e,shouldSendMetadata:t,autoRequestAccounts:n=!1}){super(e,{logger:console,maxEventListeners:100,shouldSendMetadata:t}),this.state={autoRequestAccounts:!1,providerStateRequested:!1,chainId:"",networkVersion:""},yQ(`[SDKProvider: constructor()] autoRequestAccounts=${n}`),this.state.autoRequestAccounts=n}forceInitializeState(){return hP(this,void 0,void 0,function*(){return yQ(`[SDKProvider: forceInitializeState()] autoRequestAccounts=${this.state.autoRequestAccounts}`),this._initializeStateAsync()})}_setConnected(){yQ("[SDKProvider: _setConnected()] Setting connected state"),this._state.isConnected=!0}getState(){return this._state}getSDKProviderState(){return this.state}getSelectedAddress(){var e;let{accounts:t}=this._state;return t&&0!==t.length?(null===(e=t[0])||void 0===e?void 0:e.toLowerCase())||"":(yQ("[SDKProvider: getSelectedAddress] No accounts found"),null)}getChainId(){return this.state.chainId}getNetworkVersion(){return this.state.networkVersion}setSDKProviderState(e){this.state=Object.assign(Object.assign({},this.state),e)}handleDisconnect({terminate:e=!1}){!function({terminate:e=!1,instance:t}){let{state:n}=t;t.isConnected()?(yQ(`[SDKProvider: handleDisconnect()] cleaning up provider state terminate=${e}`,t),e&&(t._state.accounts=null,t._state.isUnlocked=!1,t._state.isPermanentlyDisconnected=!0,t._state.initialized=!1),t._handleAccountsChanged([]),t._state.isConnected=!1,t.emit("disconnect",yZ.ethErrors.provider.disconnected()),n.providerStateRequested=!1):yQ("[SDKProvider: handleDisconnect()] not connected --- interrupt disconnection")}({terminate:e,instance:this})}_initializeStateAsync(){return hP(this,void 0,void 0,function*(){return function(e){var t,n;return hP(this,void 0,void 0,function*(){let r;void 0===e.state&&(e.state={autoRequestAccounts:!1,providerStateRequested:!1,chainId:""});let{state:i}=e;if(i.providerStateRequested)yQ("[SDKProvider: initializeStateAsync()] initialization already in progress");else{let o;i.providerStateRequested=!0;let a=null,s=!1,l=!1,u=As({enabled:!0});if(u){let e=yield u.getPersistedChannelConfig();s=null!==(t=null==e?void 0:e.relayPersistence)&&void 0!==t&&t,o=yield u.getCachedChainId();let n=yield u.getCachedAccounts();n.length>0&&(a=n[0])}if(yQ(`[SDKProvider: initializeStateAsync()] relayPersistence=${s}`,{relayPersistence:s,cachedChainId:o,cachedSelectedAddress:a}),s){if(o&&a)r={accounts:[a],chainId:o,isUnlocked:!1},l=!0;else try{r=yield e.request({method:"metamask_getProviderState"})}catch(t){return e._log.error("MetaMask: Failed to get initial state. Please report this bug.",t),void(i.providerStateRequested=!1)}}if(0===(null===(n=null==r?void 0:r.accounts)||void 0===n?void 0:n.length)){if(e.getSelectedAddress())r.accounts=[e.getSelectedAddress()];else{yQ("[SDKProvider: initializeStateAsync()] Fetch accounts remotely.");let t=yield e.request({method:"eth_requestAccounts",params:[]});r.accounts=t}}e._initializeState(r),i.providerStateRequested=!1,l&&(e._state.isConnected=!0,e.emit("connect",{chainId:null==r?void 0:r.chainId}))}})}(this)})}_initializeState(e){var t;return yQ("[SDKProvider: _initializeState()]",e),t=super._initializeState.bind(this),yQ("[SDKProvider: initializeState()] set state._initialized to false"),this._state.initialized=!1,t(e)}_handleChainChanged({chainId:e,networkVersion:t}={}){this.state.chainId=e,this.state.networkVersion=t,function({instance:e,chainId:t,networkVersion:n,superHandleChainChanged:r}){yQ(`[SDKProvider: handleChainChanged()] chainId=${t} networkVersion=${n}`);let i=n;n||(yQ("[SDKProvider: handleChainChanged()] forced network version to prevent provider error"),i="1"),e._state.isConnected=!0,e.emit("connect",{chainId:t}),r({chainId:t,networkVersion:i})}({instance:this,chainId:e,networkVersion:t,superHandleChainChanged:super._handleChainChanged.bind(this)})}}var Au={exports:{}};!function(e){var t=Object.hasOwnProperty,n=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},r="object"==typeof ex,i="function"==typeof Symbol,o="object"==typeof Reflect,a="function"==typeof setImmediate?setImmediate:setTimeout,s=i?o&&"function"==typeof Reflect.ownKeys?Reflect.ownKeys:function(e){var t=Object.getOwnPropertyNames(e);return t.push.apply(t,Object.getOwnPropertySymbols(e)),t}:Object.keys;function l(){this._events={},this._conf&&u.call(this,this._conf)}function u(t){t&&(this._conf=t,t.delimiter&&(this.delimiter=t.delimiter),t.maxListeners!==e&&(this._maxListeners=t.maxListeners),t.wildcard&&(this.wildcard=t.wildcard),t.newListener&&(this._newListener=t.newListener),t.removeListener&&(this._removeListener=t.removeListener),t.verboseMemoryLeak&&(this.verboseMemoryLeak=t.verboseMemoryLeak),t.ignoreErrors&&(this.ignoreErrors=t.ignoreErrors),this.wildcard&&(this.listenerTree={}))}function c(e,t){var n="(node) warning: possible EventEmitter memory leak detected. "+e+" listeners added. Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak&&(n+=" Event name: "+t+"."),void 0!==ex&&ex.emitWarning){var r=Error(n);r.name="MaxListenersExceededWarning",r.emitter=this,r.count=e,ex.emitWarning(r)}else console.error(n),console.trace&&console.trace()}var d=function(e,t,n){var r=arguments.length;switch(r){case 0:return[];case 1:return[e];case 2:return[e,t];case 3:return[e,t,n];default:for(var i=Array(r);r--;)i[r]=arguments[r];return i}};function f(t,n){for(var r={},i=t.length,o=n?n.length:0,a=0;a0;)if(o===e[a])return r;i(t)}}Object.assign(h.prototype,{subscribe:function(e,t,n){var r=this,i=this._target,o=this._emitter,a=this._listeners,s=function(){var r=d.apply(null,arguments),a={data:r,name:t,original:e};n?!1!==n.call(i,a)&&o.emit.apply(o,[a.name].concat(r)):o.emit.apply(o,[t].concat(r))};if(a[e])throw Error("Event '"+e+"' is already listening");this._listenersCount++,o._newListener&&o._removeListener&&!r._onNewListener?(this._onNewListener=function(n){n===t&&null===a[e]&&(a[e]=s,r._on.call(i,e,s))},o.on("newListener",this._onNewListener),this._onRemoveListener=function(n){n===t&&!o.hasListeners(n)&&a[e]&&(a[e]=null,r._off.call(i,e,s))},a[e]=null,o.on("removeListener",this._onRemoveListener)):(a[e]=s,r._on.call(i,e,s))},unsubscribe:function(e){var t,n,r,i=this,o=this._listeners,a=this._emitter,l=this._off,u=this._target;if(e&&"string"!=typeof e)throw TypeError("event must be a string");function c(){i._onNewListener&&(a.off("newListener",i._onNewListener),a.off("removeListener",i._onRemoveListener),i._onNewListener=null,i._onRemoveListener=null);var e=A.call(a,i);a._observers.splice(e,1)}if(e){if(!(t=o[e]))return;l.call(u,e,t),delete o[e],--this._listenersCount||c()}else{for(r=(n=s(o)).length;r-- >0;)e=n[r],l.call(u,e,o[e]);this._listeners={},this._listenersCount=0,c()}}});var v=g(["function"]),b=g(["object","function"]);function y(e,t,n){var r,i,o,a=0,s=new e(function(l,u,c){function d(){i&&(i=null),a&&(clearTimeout(a),a=0)}r=!(n=p(n,{timeout:0,overload:!1},{timeout:function(e,t){return("number"!=typeof(e*=1)||e<0||!Number.isFinite(e))&&t("timeout must be a positive number"),e}})).overload&&"function"==typeof e.prototype.cancel&&"function"==typeof c;var f=function(e){d(),l(e)},h=function(e){d(),u(e)};r?t(f,h,c):(i=[function(e){h(e||Error("canceled"))}],t(f,h,function(e){if(o)throw Error("Unable to subscribe on cancel event asynchronously");if("function"!=typeof e)throw TypeError("onCancel callback must be a function");i.push(e)}),o=!0),n.timeout>0&&(a=setTimeout(function(){var e=Error("timeout");e.code="ETIMEDOUT",a=0,s.cancel(e),u(e)},n.timeout))});return r||(s.cancel=function(e){if(i){for(var t=i.length,n=1;n0;)"_listeners"!==(h=b[l])&&(y=w(e,t,n[h],r+1,i))&&(A?A.push.apply(A,y):A=y);return A}if("**"===_){for((v=r+1===i||r+2===i&&"*"===E)&&n._listeners&&(A=w(e,t,n,i,i)),l=(b=s(n)).length;l-- >0;)"_listeners"!==(h=b[l])&&("*"===h||"**"===h?(n[h]._listeners&&!v&&(y=w(e,t,n[h],i,i))&&(A?A.push.apply(A,y):A=y),y=w(e,t,n[h],r,i)):y=w(e,t,n[h],h===E?r+2:r,i),y&&(A?A.push.apply(A,y):A=y));return A}n[_]&&(A=w(e,t,n[_],r+1,i))}if((p=n["*"])&&w(e,t,p,r+1,i),m=n["**"]){if(r0;)"_listeners"!==(h=b[l])&&(h===E?w(e,t,m[h],r+2,i):h===_?w(e,t,m[h],r+1,i):((g={})[h]=m[h],w(e,t,{"**":g},r+1,i)));else m._listeners?w(e,t,m,i,i):m["*"]&&m["*"]._listeners&&w(e,t,m["*"],i,i)}return A}function _(e,t,n){var r,i,o=0,a=0,s=this.delimiter,l=s.length;if("string"==typeof e){if(-1!==(r=e.indexOf(s))){i=[,,,,,];do i[o++]=e.slice(a,r),a=r+l;while(-1!==(r=e.indexOf(s,a)));i[o++]=e.slice(a)}else i=[e],o=1}else i=e,o=e.length;if(o>1){for(r=0;r+10&&d._listeners.length>this._maxListeners&&(d._listeners.warned=!0,c.call(this,d._listeners.length,u))):d._listeners=t,!0;return!0}function E(e,t,n,r){for(var i,o,a,l,u=s(e),c=u.length,d=e._listeners;c-- >0;)i=e[o=u[c]],a="_listeners"===o?n:n?n.concat(o):[o],l=r||"symbol"==typeof o,d&&t.push(l?a:a.join(this.delimiter)),"object"==typeof i&&E.call(this,i,t,a,l);return t}function S(e){for(var t,n,r,i=s(e),o=i.length;o-- >0;)(t=e[n=i[o]])&&(r=!0,"_listeners"===n||S(t)||delete e[n]);return r}function k(e,t,n){this.emitter=e,this.event=t,this.listener=n}function M(t,n,i){if(!0===i)s=!0;else if(!1===i)o=!0;else{if(!i||"object"!=typeof i)throw TypeError("options should be an object or true");var o=i.async,s=i.promisify,l=i.nextTick,u=i.objectify}if(o||l||s){var c=n,d=n._origin||n;if(l&&!r)throw Error("process.nextTick is not supported");s===e&&(s="AsyncFunction"===n.constructor.name),(n=function(){var e=arguments,t=this,n=this.event;return s?l?Promise.resolve():new Promise(function(e){a(e)}).then(function(){return t.event=n,c.apply(t,e)}):(l?ew:a)(function(){t.event=n,c.apply(t,e)})})._async=!0,n._origin=d}return[n,u?new k(this,t,n):this]}function C(e){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,u.call(this,e)}k.prototype.off=function(){return this.emitter.off(this.event,this.listener),this},C.EventEmitter2=C,C.prototype.listenTo=function(t,r,i){if("object"!=typeof t)throw TypeError("target musts be an object");var o=this;return i=p(i,{on:e,off:e,reducers:e},{on:v,off:v,reducers:b}),function(e){if("object"!=typeof e)throw TypeError("events must be an object");var n,r=i.reducers,a=A.call(o,t);n=-1===a?new h(o,t,i):o._observers[a];for(var l,u=s(e),c=u.length,d="function"==typeof r,f=0;f0;)r=n[i],e&&r._target!==e||(r.unsubscribe(t),o=!0);return o},C.prototype.delimiter=".",C.prototype.setMaxListeners=function(t){t!==e&&(this._maxListeners=t,this._conf||(this._conf={}),this._conf.maxListeners=t)},C.prototype.getMaxListeners=function(){return this._maxListeners},C.prototype.event="",C.prototype.once=function(e,t,n){return this._once(e,t,!1,n)},C.prototype.prependOnceListener=function(e,t,n){return this._once(e,t,!0,n)},C.prototype._once=function(e,t,n,r){return this._many(e,1,t,n,r)},C.prototype.many=function(e,t,n,r){return this._many(e,t,n,!1,r)},C.prototype.prependMany=function(e,t,n,r){return this._many(e,t,n,!0,r)},C.prototype._many=function(e,t,n,r,i){var o=this;if("function"!=typeof n)throw Error("many only accepts instances of Function");function a(){return 0==--t&&o.off(e,a),n.apply(this,arguments)}return a._origin=n,this._on(e,a,r,i)},C.prototype.emit=function(){if(!this._events&&!this._all)return!1;this._events||l.call(this);var e,t,n,r,o,a,s=arguments[0],u=this.wildcard;if("newListener"===s&&!this._newListener&&!this._events.newListener)return!1;if(u&&(e=s,"newListener"!==s&&"removeListener"!==s&&"object"==typeof s)){if(n=s.length,i){for(r=0;r3)for(t=Array(d-1),o=1;o3)for(n=Array(f-1),a=1;a0&&this._events[t].length>this._maxListeners&&(this._events[t].warned=!0,c.call(this,this._events[t].length,t))):this._events[t]=n,a},C.prototype.off=function(e,t){if("function"!=typeof t)throw Error("removeListener only takes instances of Function");var r,i=[];if(this.wildcard){var o="string"==typeof e?e.split(this.delimiter):e.slice();if(!(i=w.call(this,null,o,this.listenerTree,0)))return this}else{if(!this._events[e])return this;r=this._events[e],i.push({_listeners:r})}for(var a=0;a0){for(n=0,r=(t=this._all).length;n0;)"function"==typeof(r=l[n[o]])?i.push(r):i.push.apply(i,r);return i}if(this.wildcard){if(!(a=this.listenerTree))return[];var u=[],c="string"==typeof t?t.split(this.delimiter):t.slice();return w.call(this,u,c,a,0),u}return l&&(r=l[t])?"function"==typeof r?[r]:r:[]},C.prototype.eventNames=function(e){var t=this._events;return this.wildcard?E.call(this,this.listenerTree,[],null,e):t?s(t):[]},C.prototype.listenerCount=function(e){return this.listeners(e).length},C.prototype.hasListeners=function(t){if(this.wildcard){var n=[],r="string"==typeof t?t.split(this.delimiter):t.slice();return w.call(this,n,r,this.listenerTree,0),n.length>0}var i=this._events,o=this._all;return!!(o&&o.length||i&&(t===e?s(i).length:i[t]))},C.prototype.listenersAny=function(){return this._all?this._all:[]},C.prototype.waitFor=function(t,n){var r=this,i=typeof n;return"number"===i?n={timeout:n}:"function"===i&&(n={filter:n}),y((n=p(n,{timeout:0,filter:e,handleError:!1,Promise:Promise,overload:!1},{filter:v,Promise:m})).Promise,function(e,i,o){function a(){var o=n.filter;if(!o||o.apply(r,arguments)){if(r.off(t,a),n.handleError){var s=arguments[0];s?i(s):e(d.apply(null,arguments).slice(1))}else e(d.apply(null,arguments))}}o(function(){r.off(t,a)}),r._on(t,a,!1)},{timeout:n.timeout,overload:n.overload})};var x=C.prototype;Object.defineProperties(C,{defaultMaxListeners:{get:function(){return x._maxListeners},set:function(e){if("number"!=typeof e||e<0||Number.isNaN(e))throw TypeError("n must be a non-negative number");x._maxListeners=e},enumerable:!0},once:{value:function(e,t,n){return y((n=p(n,{Promise:Promise,timeout:0,overload:!1},{Promise:m})).Promise,function(n,r,i){if("function"==typeof e.addEventListener)return o=function(){n(d.apply(null,arguments))},i(function(){e.removeEventListener(t,o)}),void e.addEventListener(t,o,{once:!0});var o,a,s=function(){a&&e.removeListener("error",a),n(d.apply(null,arguments))};"error"!==t&&(a=function(n){e.removeListener(t,s),r(n)},e.once("error",a)),i(function(){a&&e.removeListener("error",a),e.removeListener(t,s)}),e.once(t,s)},{timeout:n.timeout,overload:n.overload})},writable:!0,configurable:!0}}),Object.defineProperties(x,{_maxListeners:{value:10,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),"function"==typeof e&&e.amd?e(function(){return C}):Au.exports=C}();var Ac=u(Au.exports);function Ad(e){return(Ad="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Af(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function Ah(e){var t=function(e,t){if("object"!==Ad(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==Ad(r))return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Ad(t)?t:String(t)}function Ap(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=Array(t);n1&&void 0!==arguments[1]?arguments[1]:{};Af(this,e),this.init(t,n)}return Am(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||Ak,this.options=t,this.debug=t.debug}},{key:"setDebug",value:function(e){this.debug=e}},{key:"log",value:function(){for(var e=arguments.length,t=Array(e),n=0;n1?t-1:0),r=1;r-1?e.replace(/###/g,"."):e}function i(){return!e||"string"==typeof e}for(var o="string"!=typeof t?[].concat(t):t.split(".");o.length>1;){if(i())return{};var a=r(o.shift());!e[a]&&n&&(e[a]=new n),e=Object.prototype.hasOwnProperty.call(e,a)?e[a]:{}}return i()?{}:{obj:e,k:r(o.shift())}}function AT(e,t,n){var r=AI(e,t,Object);r.obj[r.k]=n}function AO(e,t){var n=AI(e,t),r=n.obj,i=n.k;if(r)return r[i]}function AP(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var AL={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function AN(e){return"string"==typeof e?e.replace(/[&<>"'\/]/g,function(e){return AL[e]}):e}var AD="undefined"!=typeof window&&window.navigator&&void 0===window.navigator.userAgentData&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,AB=[" ",",","?","!",";"];function Aj(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".";if(e){if(e[t])return e[t];for(var r=t.split(n),i=e,o=0;oo+a;)a++,l=i[s=r.slice(o,o+a).join(n)];if(void 0===l)return;if(null===l)return null;if(t.endsWith(s)){if("string"==typeof l)return l;if(s&&"string"==typeof l[s])return l[s]}var u=r.slice(o+a).join(n);return u?Aj(l,u,n):void 0}i=i[r[o]]}return i}}function AF(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Az(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};return Af(this,r),t=n.call(this),AD&&AC.call(Ag(t)),t.data=e||{},t.options=i,void 0===t.options.keySeparator&&(t.options.keySeparator="."),void 0===t.options.ignoreJSONStructure&&(t.options.ignoreJSONStructure=!0),t}return Am(r,[{key:"addNamespaces",value:function(e){0>this.options.ns.indexOf(e)&&this.options.ns.push(e)}},{key:"removeNamespaces",value:function(e){var t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}},{key:"getResource",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator,o=void 0!==r.ignoreJSONStructure?r.ignoreJSONStructure:this.options.ignoreJSONStructure,a=[e,t];n&&"string"!=typeof n&&(a=a.concat(n)),n&&"string"==typeof n&&(a=a.concat(i?n.split(i):n)),e.indexOf(".")>-1&&(a=e.split("."));var s=AO(this.data,a);return s||!o||"string"!=typeof n?s:Aj(this.data&&this.data[e]&&this.data[e][t],n,i)}},{key:"addResource",value:function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1},o=void 0!==i.keySeparator?i.keySeparator:this.options.keySeparator,a=[e,t];n&&(a=a.concat(o?n.split(o):n)),e.indexOf(".")>-1&&(r=t,t=(a=e.split("."))[1]),this.addNamespaces(t),AT(this.data,a,r),i.silent||this.emit("added",e,t,n,r)}},{key:"addResources",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(var i in n)"string"!=typeof n[i]&&"[object Array]"!==Object.prototype.toString.apply(n[i])||this.addResource(e,t,i,n[i],{silent:!0});r.silent||this.emit("added",e,t,n)}},{key:"addResourceBundle",value:function(e,t,n,r,i){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1},a=[e,t];e.indexOf(".")>-1&&(r=n,n=t,t=(a=e.split("."))[1]),this.addNamespaces(t);var s=AO(this.data,a)||{};r?function e(t,n,r){for(var i in n)"__proto__"!==i&&"constructor"!==i&&(i in t?"string"==typeof t[i]||t[i]instanceof String||"string"==typeof n[i]||n[i]instanceof String?r&&(t[i]=n[i]):e(t[i],n[i],r):t[i]=n[i]);return t}(s,n,i):s=Az(Az({},s),n),AT(this.data,a,s),o.silent||this.emit("added",e,t,n)}},{key:"removeResourceBundle",value:function(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}},{key:"hasResourceBundle",value:function(e,t){return void 0!==this.getResource(e,t)}},{key:"getResourceBundle",value:function(e,t){return t||(t=this.options.defaultNS),"v1"===this.options.compatibilityAPI?Az(Az({},{}),this.getResource(e,t)):this.getResource(e,t)}},{key:"getDataByLanguage",value:function(e){return this.data[e]}},{key:"hasLanguageSomeTranslations",value:function(e){var t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(function(e){return t[e]&&Object.keys(t[e]).length>0})}},{key:"toJSON",value:function(){return this.data}}]),r}(AC),Aq={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,t,n,r,i){var o=this;return e.forEach(function(e){o.processors[e]&&(t=o.processors[e].process(t,n,r,i))}),t}};function AK(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function AH(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:{};return Af(this,r),t=n.call(this),AD&&AC.call(Ag(t)),function(e,t,n){e.forEach(function(e){t[e]&&(n[e]=t[e])})}(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,Ag(t)),t.options=i,void 0===t.options.keySeparator&&(t.options.keySeparator="."),t.logger=AM.create("translator"),t}return Am(r,[{key:"changeLanguage",value:function(e){e&&(this.language=e)}},{key:"exists",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};if(null==e)return!1;var n=this.resolve(e,t);return n&&void 0!==n.res}},{key:"extractFromKey",value:function(e,t){var n=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===n&&(n=":");var r=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,i=t.ns||this.options.defaultNS||[],o=n&&e.indexOf(n)>-1,a=!(this.options.userDefinedKeySeparator||t.keySeparator||this.options.userDefinedNsSeparator||t.nsSeparator||function(e,t,n){t=t||"",n=n||"";var r=AB.filter(function(e){return 0>t.indexOf(e)&&0>n.indexOf(e)});if(0===r.length)return!0;var i=new RegExp("(".concat(r.map(function(e){return"?"===e?"\\?":e}).join("|"),")")),o=!i.test(e);if(!o){var a=e.indexOf(n);a>0&&!i.test(e.substring(0,a))&&(o=!0)}return o}(e,n,r));if(o&&!a){var s=e.match(this.interpolator.nestingRegexp);if(s&&s.length>0)return{key:e,namespaces:i};var l=e.split(n);(n!==r||n===r&&this.options.ns.indexOf(l[0])>-1)&&(i=l.shift()),e=l.join(r)}return"string"==typeof i&&(i=[i]),{key:e,namespaces:i}}},{key:"translate",value:function(e,t,n){var i=this;if("object"!==Ad(t)&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),"object"===Ad(t)&&(t=AH({},t)),t||(t={}),null==e)return"";Array.isArray(e)||(e=[String(e)]);var o=void 0!==t.returnDetails?t.returnDetails:this.options.returnDetails,a=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,s=this.extractFromKey(e[e.length-1],t),l=s.key,u=s.namespaces,c=u[u.length-1],d=t.lng||this.language,f=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d&&"cimode"===d.toLowerCase()){if(f){var h=t.nsSeparator||this.options.nsSeparator;return o?{res:"".concat(c).concat(h).concat(l),usedKey:l,exactUsedKey:l,usedLng:d,usedNS:c}:"".concat(c).concat(h).concat(l)}return o?{res:l,usedKey:l,exactUsedKey:l,usedLng:d,usedNS:c}:l}var p=this.resolve(e,t),m=p&&p.res,g=p&&p.usedKey||l,v=p&&p.exactUsedKey||l,b=Object.prototype.toString.apply(m),y=void 0!==t.joinArrays?t.joinArrays:this.options.joinArrays,A=!this.i18nFormat||this.i18nFormat.handleAsObject;if(A&&m&&"string"!=typeof m&&"boolean"!=typeof m&&"number"!=typeof m&&0>["[object Number]","[object Function]","[object RegExp]"].indexOf(b)&&("string"!=typeof y||"[object Array]"!==b)){if(!t.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");var w=this.options.returnedObjectHandler?this.options.returnedObjectHandler(g,m,AH(AH({},t),{},{ns:u})):"key '".concat(l," (").concat(this.language,")' returned an object instead of string.");return o?(p.res=w,p):w}if(a){var _="[object Array]"===b,E=_?[]:{},S=_?v:g;for(var k in m)if(Object.prototype.hasOwnProperty.call(m,k)){var M="".concat(S).concat(a).concat(k);E[k]=this.translate(M,AH(AH({},t),{joinArrays:!1,ns:u})),E[k]===M&&(E[k]=m[k])}m=E}}else if(A&&"string"==typeof y&&"[object Array]"===b)(m=m.join(y))&&(m=this.extendTranslation(m,e,t,n));else{var C=!1,x=!1,R=void 0!==t.count&&"string"!=typeof t.count,I=r.hasDefaultValue(t),T=R?this.pluralResolver.getSuffix(d,t.count,t):"",O=t["defaultValue".concat(T)]||t.defaultValue;!this.isValidLookup(m)&&I&&(C=!0,m=O),this.isValidLookup(m)||(x=!0,m=l);var P=(t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&x?void 0:m,L=I&&O!==m&&this.options.updateMissing;if(x||C||L){if(this.logger.log(L?"updateKey":"missingKey",d,c,l,L?O:m),a){var N=this.resolve(l,AH(AH({},t),{},{keySeparator:!1}));N&&N.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}var D=[],B=this.languageUtils.getFallbackCodes(this.options.fallbackLng,t.lng||this.language);if("fallback"===this.options.saveMissingTo&&B&&B[0])for(var j=0;j1&&void 0!==arguments[1]?arguments[1]:{};return"string"==typeof e&&(e=[e]),e.forEach(function(e){if(!a.isValidLookup(t)){var l=a.extractFromKey(e,s),u=l.key;n=u;var c=l.namespaces;a.options.fallbackNS&&(c=c.concat(a.options.fallbackNS));var d=void 0!==s.count&&"string"!=typeof s.count,f=d&&!s.ordinal&&0===s.count&&a.pluralResolver.shouldUseIntlApi(),h=void 0!==s.context&&("string"==typeof s.context||"number"==typeof s.context)&&""!==s.context,p=s.lngs?s.lngs:a.languageUtils.toResolveHierarchy(s.lng||a.language,s.fallbackLng);c.forEach(function(e){a.isValidLookup(t)||(o=e,!AV["".concat(p[0],"-").concat(e)]&&a.utils&&a.utils.hasLoadedNamespace&&!a.utils.hasLoadedNamespace(o)&&(AV["".concat(p[0],"-").concat(e)]=!0,a.logger.warn('key "'.concat(n,'" for languages "').concat(p.join(", "),'" won\'t get resolved as namespace "').concat(o,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),p.forEach(function(n){if(!a.isValidLookup(t)){i=n;var o,l=[u];if(a.i18nFormat&&a.i18nFormat.addLookupKeys)a.i18nFormat.addLookupKeys(l,u,n,e,s);else{d&&(c=a.pluralResolver.getSuffix(n,s.count,s));var c,p="".concat(a.options.pluralSeparator,"zero");if(d&&(l.push(u+c),f&&l.push(u+p)),h){var m="".concat(u).concat(a.options.contextSeparator).concat(s.context);l.push(m),d&&(l.push(m+c),f&&l.push(m+p))}}for(;o=l.pop();)a.isValidLookup(t)||(r=o,t=a.getResource(n,e,o,s))}}))})}}),{res:t,usedKey:n,exactUsedKey:r,usedLng:i,usedNS:o}}},{key:"isValidLookup",value:function(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}},{key:"getResource",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,n,r):this.resourceStore.getResource(e,t,n,r)}}],[{key:"hasDefaultValue",value:function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&"defaultValue"===t.substring(0,12)&&void 0!==e[t])return!0;return!1}}]),r}(AC);function AW(e){return e.charAt(0).toUpperCase()+e.slice(1)}var AY=function(){function e(t){Af(this,e),this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=AM.create("languageUtils")}return Am(e,[{key:"getScriptPartFromCode",value:function(e){if(!e||0>e.indexOf("-"))return null;var t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}},{key:"getLanguagePartFromCode",value:function(e){if(!e||0>e.indexOf("-"))return e;var t=e.split("-");return this.formatLanguageCode(t[0])}},{key:"formatLanguageCode",value:function(e){if("string"==typeof e&&e.indexOf("-")>-1){var t=["hans","hant","latn","cyrl","cans","mong","arab"],n=e.split("-");return this.options.lowerCaseLng?n=n.map(function(e){return e.toLowerCase()}):2===n.length?(n[0]=n[0].toLowerCase(),n[1]=n[1].toUpperCase(),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=AW(n[1].toLowerCase()))):3===n.length&&(n[0]=n[0].toLowerCase(),2===n[1].length&&(n[1]=n[1].toUpperCase()),"sgn"!==n[0]&&2===n[2].length&&(n[2]=n[2].toUpperCase()),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=AW(n[1].toLowerCase())),t.indexOf(n[2].toLowerCase())>-1&&(n[2]=AW(n[2].toLowerCase()))),n.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}},{key:"isSupportedCode",value:function(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}},{key:"getBestMatchFromCodes",value:function(e){var t,n=this;return e?(e.forEach(function(e){if(!t){var r=n.formatLanguageCode(e);n.options.supportedLngs&&!n.isSupportedCode(r)||(t=r)}}),!t&&this.options.supportedLngs&&e.forEach(function(e){if(!t){var r=n.getLanguagePartFromCode(e);if(n.isSupportedCode(r))return t=r;t=n.options.supportedLngs.find(function(e){return e===r?e:0>e.indexOf("-")&&0>r.indexOf("-")?void 0:0===e.indexOf(r)?e:void 0})}}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t):null}},{key:"getFallbackCodes",value:function(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),"string"==typeof e&&(e=[e]),"[object Array]"===Object.prototype.toString.apply(e))return e;if(!t)return e.default||[];var n=e[t];return n||(n=e[this.getScriptPartFromCode(t)]),n||(n=e[this.formatLanguageCode(t)]),n||(n=e[this.getLanguagePartFromCode(t)]),n||(n=e.default),n||[]}},{key:"toResolveHierarchy",value:function(e,t){var n=this,r=this.getFallbackCodes(t||this.options.fallbackLng||[],e),i=[],o=function(e){e&&(n.isSupportedCode(e)?i.push(e):n.logger.warn("rejecting language code not found in supportedLngs: ".concat(e)))};return"string"==typeof e&&e.indexOf("-")>-1?("languageOnly"!==this.options.load&&o(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&o(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&o(this.getLanguagePartFromCode(e))):"string"==typeof e&&o(this.formatLanguageCode(e)),r.forEach(function(e){0>i.indexOf(e)&&o(n.formatLanguageCode(e))}),i}}]),e}(),AG=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],AQ={1:function(e){return Number(e>1)},2:function(e){return Number(1!=e)},3:function(e){return 0},4:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},5:function(e){return Number(0==e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5)},6:function(e){return Number(1==e?0:e>=2&&e<=4?1:2)},7:function(e){return Number(1==e?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},8:function(e){return Number(1==e?0:2==e?1:8!=e&&11!=e?2:3)},9:function(e){return Number(e>=2)},10:function(e){return Number(1==e?0:2==e?1:e<7?2:e<11?3:4)},11:function(e){return Number(1==e||11==e?0:2==e||12==e?1:e>2&&e<20?2:3)},12:function(e){return Number(e%10!=1||e%100==11)},13:function(e){return Number(0!==e)},14:function(e){return Number(1==e?0:2==e?1:3==e?2:3)},15:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2)},16:function(e){return Number(e%10==1&&e%100!=11?0:0!==e?1:2)},17:function(e){return Number(1==e||e%10==1&&e%100!=11?0:1)},18:function(e){return Number(0==e?0:1==e?1:2)},19:function(e){return Number(1==e?0:0==e||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3)},20:function(e){return Number(1==e?0:0==e||e%100>0&&e%100<20?1:2)},21:function(e){return Number(e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0)},22:function(e){return Number(1==e?0:2==e?1:(e<0||e>10)&&e%10==0?2:3)}},AZ=["v1","v2","v3"],AJ={zero:0,one:1,two:2,few:3,many:4,other:5},AX=function(){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Af(this,e),this.languageUtils=t,this.options=r,this.logger=AM.create("pluralResolver"),this.options.compatibilityJSON&&"v4"!==this.options.compatibilityJSON||"undefined"!=typeof Intl&&Intl.PluralRules||(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=(n={},AG.forEach(function(e){e.lngs.forEach(function(t){n[t]={numbers:e.nr,plurals:AQ[e.fc]}})}),n)}return Am(e,[{key:"addRule",value:function(e,t){this.rules[e]=t}},{key:"getRule",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(e,{type:t.ordinal?"ordinal":"cardinal"})}catch(e){return}return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}},{key:"needsPlural",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.getRule(e,t);return this.shouldUseIntlApi()?n&&n.resolvedOptions().pluralCategories.length>1:n&&n.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.getSuffixes(e,n).map(function(e){return"".concat(t).concat(e)})}},{key:"getSuffixes",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this.getRule(e,n);return r?this.shouldUseIntlApi()?r.resolvedOptions().pluralCategories.sort(function(e,t){return AJ[e]-AJ[t]}).map(function(e){return"".concat(t.options.prepend).concat(e)}):r.numbers.map(function(r){return t.getSuffix(e,r,n)}):[]}},{key:"getSuffix",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=this.getRule(e,n);return r?this.shouldUseIntlApi()?"".concat(this.options.prepend).concat(r.select(t)):this.getSuffixRetroCompatible(r,t):(this.logger.warn("no plural rule found for: ".concat(e)),"")}},{key:"getSuffixRetroCompatible",value:function(e,t){var n=this,r=e.noAbs?e.plurals(t):e.plurals(Math.abs(t)),i=e.numbers[r];this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]&&(2===i?i="plural":1===i&&(i=""));var o=function(){return n.options.prepend&&i.toString()?n.options.prepend+i.toString():i.toString()};return"v1"===this.options.compatibilityJSON?1===i?"":"number"==typeof i?"_plural_".concat(i.toString()):o():"v2"===this.options.compatibilityJSON||this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]?o():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}},{key:"shouldUseIntlApi",value:function(){return!AZ.includes(this.options.compatibilityJSON)}}]),e}();function A0(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function A1(e){for(var t=1;t3&&void 0!==arguments[3]?arguments[3]:".",o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=void 0!==(r=AO(e,n))?r:AO(t,n);return!a&&o&&"string"==typeof n&&void 0===(a=Aj(e,n,i))&&(a=Aj(t,n,i)),a}var A3=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Af(this,e),this.logger=AM.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||function(e){return e},this.init(t)}return Am(e,[{key:"init",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});var t=e.interpolation;this.escape=void 0!==t.escape?t.escape:AN,this.escapeValue=void 0===t.escapeValue||t.escapeValue,this.useRawValueToEscape=void 0!==t.useRawValueToEscape&&t.useRawValueToEscape,this.prefix=t.prefix?AP(t.prefix):t.prefixEscaped||"{{",this.suffix=t.suffix?AP(t.suffix):t.suffixEscaped||"}}",this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||",",this.unescapePrefix=t.unescapeSuffix?"":t.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":t.unescapeSuffix||"",this.nestingPrefix=t.nestingPrefix?AP(t.nestingPrefix):t.nestingPrefixEscaped||AP("$t("),this.nestingSuffix=t.nestingSuffix?AP(t.nestingSuffix):t.nestingSuffixEscaped||AP(")"),this.nestingOptionsSeparator=t.nestingOptionsSeparator?t.nestingOptionsSeparator:t.nestingOptionsSeparator||",",this.maxReplaces=t.maxReplaces?t.maxReplaces:1e3,this.alwaysFormat=void 0!==t.alwaysFormat&&t.alwaysFormat,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var e="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=RegExp(e,"g");var t="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=RegExp(t,"g");var n="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=RegExp(n,"g")}},{key:"interpolate",value:function(e,t,n,r){var i,o,a,s=this,l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function u(e){return e.replace(/\$/g,"$$$$")}var c=function(e){if(0>e.indexOf(s.formatSeparator)){var i=A2(t,l,e,s.options.keySeparator,s.options.ignoreJSONStructure);return s.alwaysFormat?s.format(i,void 0,n,A1(A1(A1({},r),t),{},{interpolationkey:e})):i}var o=e.split(s.formatSeparator),a=o.shift().trim(),u=o.join(s.formatSeparator).trim();return s.format(A2(t,l,a,s.options.keySeparator,s.options.ignoreJSONStructure),u,n,A1(A1(A1({},r),t),{},{interpolationkey:a}))};this.resetRegExp();var d=r&&r.missingInterpolationHandler||this.options.missingInterpolationHandler,f=r&&r.interpolation&&void 0!==r.interpolation.skipOnVariables?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:function(e){return u(e)}},{regex:this.regexp,safeValue:function(e){return s.escapeValue?u(s.escape(e)):u(e)}}].forEach(function(t){for(a=0;i=t.regex.exec(e);){var n=i[1].trim();if(void 0===(o=c(n))){if("function"==typeof d){var l=d(e,i,r);o="string"==typeof l?l:""}else if(r&&Object.prototype.hasOwnProperty.call(r,n))o="";else{if(f){o=i[0];continue}s.logger.warn("missed to pass in variable ".concat(n," for interpolating ").concat(e)),o=""}}else"string"==typeof o||s.useRawValueToEscape||(o=AR(o));var u=t.safeValue(o);if(e=e.replace(i[0],u),f?(t.regex.lastIndex+=o.length,t.regex.lastIndex-=i[0].length):t.regex.lastIndex=0,++a>=s.maxReplaces)break}}),e}},{key:"nest",value:function(e,t){var n,r,i,o=this,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};function s(e,t){var n=this.nestingOptionsSeparator;if(0>e.indexOf(n))return e;var r=e.split(new RegExp("".concat(n,"[ ]*{"))),o="{".concat(r[1]);e=r[0];var a=(o=this.interpolate(o,i)).match(/'/g),s=o.match(/"/g);(a&&a.length%2==0&&!s||s.length%2!=0)&&(o=o.replace(/'/g,'"'));try{i=JSON.parse(o),t&&(i=A1(A1({},t),i))}catch(t){return this.logger.warn("failed parsing options string in nesting for key ".concat(e),t),"".concat(e).concat(n).concat(o)}return delete i.defaultValue,e}for(;n=this.nestingRegexp.exec(e);){var l=[];(i=(i=A1({},a)).replace&&"string"!=typeof i.replace?i.replace:i).applyPostProcessor=!1,delete i.defaultValue;var u=!1;if(-1!==n[0].indexOf(this.formatSeparator)&&!/{.*}/.test(n[1])){var c=n[1].split(this.formatSeparator).map(function(e){return e.trim()});n[1]=c.shift(),l=c,u=!0}if((r=t(s.call(this,n[1].trim(),i),i))&&n[0]===e&&"string"!=typeof r)return r;"string"!=typeof r&&(r=AR(r)),r||(this.logger.warn("missed to resolve ".concat(n[1]," for nesting ").concat(e)),r=""),u&&(r=l.reduce(function(e,t){return o.format(e,t,a.lng,A1(A1({},a),{},{interpolationkey:n[1].trim()}))},r.trim())),e=e.replace(n[0],r),this.regexp.lastIndex=0}return e}}]),e}();function A6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function A4(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{};Af(this,e),this.logger=AM.create("formatter"),this.options=t,this.formats={number:A8(function(e,t){var n=new Intl.NumberFormat(e,A4({},t));return function(e){return n.format(e)}}),currency:A8(function(e,t){var n=new Intl.NumberFormat(e,A4(A4({},t),{},{style:"currency"}));return function(e){return n.format(e)}}),datetime:A8(function(e,t){var n=new Intl.DateTimeFormat(e,A4({},t));return function(e){return n.format(e)}}),relativetime:A8(function(e,t){var n=new Intl.RelativeTimeFormat(e,A4({},t));return function(e){return n.format(e,t.range||"day")}}),list:A8(function(e,t){var n=new Intl.ListFormat(e,A4({},t));return function(e){return n.format(e)}})},this.init(t)}return Am(e,[{key:"init",value:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||","}},{key:"add",value:function(e,t){this.formats[e.toLowerCase().trim()]=t}},{key:"addCached",value:function(e,t){this.formats[e.toLowerCase().trim()]=A8(t)}},{key:"format",value:function(e,t,n){var r=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return t.split(this.formatSeparator).reduce(function(e,t){var o=function(e){var t=e.toLowerCase().trim(),n={};if(e.indexOf("(")>-1){var r=e.split("(");t=r[0].toLowerCase().trim();var i=r[1].substring(0,r[1].length-1);"currency"===t&&0>i.indexOf(":")?n.currency||(n.currency=i.trim()):"relativetime"===t&&0>i.indexOf(":")?n.range||(n.range=i.trim()):i.split(";").forEach(function(e){if(e){var t,r=function(e){if(Array.isArray(e))return e}(t=e.split(":"))||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return A_(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?A_(e,void 0):void 0}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),i=r[0],o=r.slice(1).join(":").trim().replace(/^'+|'+$/g,"");n[i.trim()]||(n[i.trim()]=o),"false"===o&&(n[i.trim()]=!1),"true"===o&&(n[i.trim()]=!0),isNaN(o)||(n[i.trim()]=parseInt(o,10))}})}return{formatName:t,formatOptions:n}}(t),a=o.formatName,s=o.formatOptions;if(r.formats[a]){var l=e;try{var u=i&&i.formatParams&&i.formatParams[i.interpolationkey]||{},c=u.locale||u.lng||i.locale||i.lng||n;l=r.formats[a](e,c,A4(A4(A4({},s),i),u))}catch(e){r.logger.warn(e)}return l}return r.logger.warn("there was no format function for ".concat(a)),e},e)}}]),e}();function A7(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function A9(e){for(var t=1;t3&&void 0!==arguments[3]?arguments[3]:{};return Af(this,r),o=n.call(this),AD&&AC.call(Ag(o)),o.backend=e,o.store=t,o.services=i,o.languageUtils=i.languageUtils,o.options=a,o.logger=AM.create("backendConnector"),o.waitingReads=[],o.maxParallelReads=a.maxParallelReads||10,o.readingCalls=0,o.maxRetries=a.maxRetries>=0?a.maxRetries:5,o.retryTimeout=a.retryTimeout>=1?a.retryTimeout:350,o.state={},o.queue=[],o.backend&&o.backend.init&&o.backend.init(i,a.backend,a),o}return Am(r,[{key:"queueLoad",value:function(e,t,n,r){var i=this,o={},a={},s={},l={};return e.forEach(function(e){var r=!0;t.forEach(function(t){var s="".concat(e,"|").concat(t);!n.reload&&i.store.hasResourceBundle(e,t)?i.state[s]=2:i.state[s]<0||(1===i.state[s]?void 0===a[s]&&(a[s]=!0):(i.state[s]=1,r=!1,void 0===a[s]&&(a[s]=!0),void 0===o[s]&&(o[s]=!0),void 0===l[t]&&(l[t]=!0)))}),r||(s[e]=!0)}),(Object.keys(o).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(o),pending:Object.keys(a),toLoadLanguages:Object.keys(s),toLoadNamespaces:Object.keys(l)}}},{key:"loaded",value:function(e,t,n){var r=e.split("|"),i=r[0],o=r[1];t&&this.emit("failedLoading",i,o,t),n&&this.store.addResourceBundle(i,o,n),this.state[e]=t?-1:2;var a={};this.queue.forEach(function(n){var r,s,l,u;(l=(s=AI(n.loaded,[i],Object)).obj)[u=s.k]=l[u]||[],r||l[u].push(o),void 0!==n.pending[e]&&(delete n.pending[e],n.pendingCount--),t&&n.errors.push(t),0!==n.pendingCount||n.done||(Object.keys(n.loaded).forEach(function(e){a[e]||(a[e]={});var t=n.loaded[e];t.length&&t.forEach(function(t){void 0===a[e][t]&&(a[e][t]=!0)})}),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(function(e){return!e.done})}},{key:"read",value:function(e,t,n){var r=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.retryTimeout,a=arguments.length>5?arguments[5]:void 0;if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads)this.waitingReads.push({lng:e,ns:t,fcName:n,tried:i,wait:o,callback:a});else{this.readingCalls++;var s=function(s,l){if(r.readingCalls--,r.waitingReads.length>0){var u=r.waitingReads.shift();r.read(u.lng,u.ns,u.fcName,u.tried,u.wait,u.callback)}s&&l&&i2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();"string"==typeof e&&(e=this.languageUtils.toResolveHierarchy(e)),"string"==typeof t&&(t=[t]);var o=this.queueLoad(e,t,r,i);if(!o.toLoad.length)return o.pending.length||i(),null;o.toLoad.forEach(function(e){n.loadOne(e)})}},{key:"load",value:function(e,t,n){this.prepareLoading(e,t,{},n)}},{key:"reload",value:function(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}},{key:"loadOne",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=e.split("|"),i=r[0],o=r[1];this.read(i,o,"read",void 0,void 0,function(r,a){r&&t.logger.warn("".concat(n,"loading namespace ").concat(o," for language ").concat(i," failed"),r),!r&&a&&t.logger.log("".concat(n,"loaded namespace ").concat(o," for language ").concat(i),a),t.loaded(e,r,a)})}},{key:"saveMissing",value:function(e,t,n,r,i){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:function(){};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(t))this.logger.warn('did not save key "'.concat(n,'" as the namespace "').concat(t,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");else if(null!=n&&""!==n){if(this.backend&&this.backend.create){var s,l=A9(A9({},o),{},{isUpdate:i}),u=this.backend.create.bind(this.backend);if(u.length<6)try{(s=5===u.length?u(e,t,n,r,l):u(e,t,n,r))&&"function"==typeof s.then?s.then(function(e){return a(null,e)}).catch(a):a(null,s)}catch(e){a(e)}else u(e,t,n,r,a,l)}e&&e[0]&&this.store.addResource(e[0],t,n,r)}}}]),r}(AC);function wt(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){var t={};if("object"===Ad(e[1])&&(t=e[1]),"string"==typeof e[1]&&(t.defaultValue=e[1]),"string"==typeof e[2]&&(t.tDescription=e[2]),"object"===Ad(e[2])||"object"===Ad(e[3])){var n=e[3]||e[2];Object.keys(n).forEach(function(e){t[e]=n[e]})}return t},interpolation:{escapeValue:!0,format:function(e,t,n,r){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function wn(e){return"string"==typeof e.ns&&(e.ns=[e.ns]),"string"==typeof e.fallbackLng&&(e.fallbackLng=[e.fallbackLng]),"string"==typeof e.fallbackNS&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&0>e.supportedLngs.indexOf("cimode")&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function wr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function wi(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1?arguments[1]:void 0;if(Af(this,r),e=n.call(this),AD&&AC.call(Ag(e)),e.options=wn(i),e.services={},e.logger=AM,e.modules={external:[]},Object.getOwnPropertyNames(Object.getPrototypeOf(t=Ag(e))).forEach(function(e){"function"==typeof t[e]&&(t[e]=t[e].bind(t))}),o&&!e.isInitialized&&!i.isClone){if(!e.options.initImmediate)return e.init(i,o),Ay(e,Ag(e));setTimeout(function(){e.init(i,o)},0)}return e}return Am(r,[{key:"init",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;"function"==typeof t&&(n=t,t={}),!t.defaultNS&&!1!==t.defaultNS&&t.ns&&("string"==typeof t.ns?t.defaultNS=t.ns:0>t.ns.indexOf("translation")&&(t.defaultNS=t.ns[0]));var r=wt();function i(e){return e?"function"==typeof e?new e:e:null}if(this.options=wi(wi(wi({},r),this.options),wn(t)),"v1"!==this.options.compatibilityAPI&&(this.options.interpolation=wi(wi({},r.interpolation),this.options.interpolation)),void 0!==t.keySeparator&&(this.options.userDefinedKeySeparator=t.keySeparator),void 0!==t.nsSeparator&&(this.options.userDefinedNsSeparator=t.nsSeparator),!this.options.isClone){this.modules.logger?AM.init(i(this.modules.logger),this.options):AM.init(null,this.options),this.modules.formatter?o=this.modules.formatter:"undefined"!=typeof Intl&&(o=A5);var o,a=new AY(this.options);this.store=new AU(this.options.resources,this.options);var s=this.services;s.logger=AM,s.resourceStore=this.store,s.languageUtils=a,s.pluralResolver=new AX(a,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),!o||this.options.interpolation.format&&this.options.interpolation.format!==r.interpolation.format||(s.formatter=i(o),s.formatter.init(s,this.options),this.options.interpolation.format=s.formatter.format.bind(s.formatter)),s.interpolator=new A3(this.options),s.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},s.backendConnector=new we(i(this.modules.backend),s.resourceStore,s,this.options),s.backendConnector.on("*",function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i1?n-1:0),i=1;i0&&"dev"!==l[0]&&(this.options.lng=l[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(function(t){e[t]=function(){var n;return(n=e.store)[t].apply(n,arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(function(t){e[t]=function(){var n;return(n=e.store)[t].apply(n,arguments),e}});var u=Ax(),c=function(){var t=function(t,r){e.isInitialized&&!e.initializedStoreOnce&&e.logger.warn("init: i18next is already initialized. You should call init just once!"),e.isInitialized=!0,e.options.isClone||e.logger.log("initialized",e.options),e.emit("initialized",e.options),u.resolve(r),n(t,r)};if(e.languages&&"v1"!==e.options.compatibilityAPI&&!e.isInitialized)return t(null,e.t.bind(e));e.changeLanguage(e.options.lng,t)};return this.options.resources||!this.options.initImmediate?c():setTimeout(c,0),u}},{key:"loadResources",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:wo,r="string"==typeof e?e:this.language;if("function"==typeof e&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if(r&&"cimode"===r.toLowerCase())return n();var i=[],o=function(e){e&&t.services.languageUtils.toResolveHierarchy(e).forEach(function(e){0>i.indexOf(e)&&i.push(e)})};r?o(r):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(function(e){return o(e)}),this.options.preload&&this.options.preload.forEach(function(e){return o(e)}),this.services.backendConnector.load(i,this.options.ns,function(e){e||t.resolvedLanguage||!t.language||t.setResolvedLanguage(t.language),n(e)})}else n(null)}},{key:"reloadResources",value:function(e,t,n){var r=Ax();return e||(e=this.languages),t||(t=this.options.ns),n||(n=wo),this.services.backendConnector.reload(e,t,function(e){r.resolve(),n(e)}),r}},{key:"use",value:function(e){if(!e)throw Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&Aq.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}},{key:"setResolvedLanguage",value:function(e){if(e&&this.languages&&!(["cimode","dev"].indexOf(e)>-1))for(var t=0;t-1)&&this.store.hasLanguageSomeTranslations(n)){this.resolvedLanguage=n;break}}}},{key:"changeLanguage",value:function(e,t){var n=this;this.isLanguageChangingTo=e;var r=Ax();this.emit("languageChanging",e);var i=function(e){n.language=e,n.languages=n.services.languageUtils.toResolveHierarchy(e),n.resolvedLanguage=void 0,n.setResolvedLanguage(e)},o=function(o){e||o||!n.services.languageDetector||(o=[]);var a="string"==typeof o?o:n.services.languageUtils.getBestMatchFromCodes(o);a&&(n.language||i(a),n.translator.language||n.translator.changeLanguage(a),n.services.languageDetector&&n.services.languageDetector.cacheUserLanguage&&n.services.languageDetector.cacheUserLanguage(a)),n.loadResources(a,function(e){a?(i(a),n.translator.changeLanguage(a),n.isLanguageChangingTo=void 0,n.emit("languageChanged",a),n.logger.log("languageChanged",a)):n.isLanguageChangingTo=void 0,r.resolve(function(){return n.t.apply(n,arguments)}),t&&t(e,function(){return n.t.apply(n,arguments)})})};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?0===this.services.languageDetector.detect.length?this.services.languageDetector.detect().then(o):this.services.languageDetector.detect(o):o(e):o(this.services.languageDetector.detect()),r}},{key:"getFixedT",value:function(e,t,n){var r=this,i=function e(t,i){if("object"!==Ad(i)){for(var o=arguments.length,a=Array(o>2?o-2:0),s=2;s1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var r=n.lng||this.resolvedLanguage||this.languages[0],i=!!this.options&&this.options.fallbackLng,o=this.languages[this.languages.length-1];if("cimode"===r.toLowerCase())return!0;var a=function(e,n){var r=t.services.backendConnector.state["".concat(e,"|").concat(n)];return -1===r||2===r};if(n.precheck){var s=n.precheck(this,a);if(void 0!==s)return s}return!!this.hasResourceBundle(r,e)||!(this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages))||!(!a(r,e)||i&&!a(o,e))}},{key:"loadNamespaces",value:function(e,t){var n=this,r=Ax();return this.options.ns?("string"==typeof e&&(e=[e]),e.forEach(function(e){0>n.options.ns.indexOf(e)&&n.options.ns.push(e)}),this.loadResources(function(e){r.resolve(),t&&t(e)}),r):(t&&t(),Promise.resolve())}},{key:"loadLanguages",value:function(e,t){var n=Ax();"string"==typeof e&&(e=[e]);var r=this.options.preload||[],i=e.filter(function(e){return 0>r.indexOf(e)});return i.length?(this.options.preload=r.concat(i),this.loadResources(function(e){n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}},{key:"dir",value:function(e){return(e||(e=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),e)?["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf((this.services&&this.services.languageUtils||new AY(wt())).getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr":"rtl"}},{key:"cloneInstance",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:wo,i=wi(wi(wi({},this.options),t),{isClone:!0}),o=new r(i);return void 0===t.debug&&void 0===t.prefix||(o.logger=o.logger.clone(t)),["store","services","language"].forEach(function(t){o[t]=e[t]}),o.services=wi({},this.services),o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o.translator=new A$(o.services,o.options),o.translator.on("*",function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r0&&void 0!==arguments[0]?arguments[0]:{},arguments.length>1?arguments[1]:void 0)});var ws=wa.createInstance();ws.createInstance=wa.createInstance;var wl=ws.createInstance;ws.dir,ws.init,ws.loadResources,ws.reloadResources,ws.use,ws.changeLanguage,ws.getFixedT,ws.t,ws.exists,ws.setDefaultNamespace,ws.hasLoadedNamespace,ws.loadNamespaces,ws.loadLanguages;var wu,wc="0.20.5";(wR=wu||(wu={})).INPAGE="metamask-inpage",wR.CONTENT_SCRIPT="metamask-contentscript",wR.PROVIDER="metamask-provider";let wd="direct",wf="https://metamask.app.link/connect",wh="metamask://connect",wp={NAME:"MetaMask",RDNS:"io.metamask"},wm=/(?:^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}$)|(?:^0{8}-0{4}-0{4}-0{4}-0{12}$)/u;e.PROVIDER_UPDATE_TYPE=void 0,(wD=e.PROVIDER_UPDATE_TYPE||(e.PROVIDER_UPDATE_TYPE={})).TERMINATE="terminate",wD.EXTENSION="extension",wD.INITIALIZED="initialized";let wg="undefined"!=typeof window&&window.localStorage;function wv(t){var n,r;return hP(this,void 0,void 0,function*(){yQ("[MetaMaskSDK: connectWithExtensionProvider()] ",t),t.sdkProvider=t.activeProvider,t.activeProvider=window.extension,window.ethereum=window.extension;try{let e=yield null===(n=window.extension)||void 0===n?void 0:n.request({method:"eth_requestAccounts"});yQ(`[MetaMaskSDK: connectWithExtensionProvider()] accounts=${e}`)}catch(e){return void console.warn("[MetaMaskSDK: connectWithExtensionProvider()] can't request accounts error",e)}localStorage.setItem(An,"extension"),t.extensionActive=!0,t.emit(e.EventType.PROVIDER_UPDATE,e.PROVIDER_UPDATE_TYPE.EXTENSION),t.options.enableAnalytics&&(null===(r=t.analytics)||void 0===r||r.send({event:vf.SDK_USE_EXTENSION}))})}class wb{constructor({shouldSetOnWindow:e,connectionStream:t,shouldSendMetadata:n=!1,shouldShimWeb3:r}){var i;let o=new Proxy(new Al({connectionStream:t,shouldSendMetadata:n,shouldSetOnWindow:e,shouldShimWeb3:r,autoRequestAccounts:!1}),{deleteProperty:()=>!0});this.provider=o,e&&"undefined"!=typeof window&&(i=this.provider,window.ethereum=i,window.dispatchEvent(new Event("ethereum#initialized"))),r&&"undefined"!=typeof window&&function(e,t=console){let n=!1,r=!1;if(!window.web3){let i="__isMetaMaskShim__",o={currentProvider:e};Object.defineProperty(o,i,{value:!0,enumerable:!0,configurable:!1,writable:!1}),Object.defineProperty(window,"web3",{value:o=new Proxy(o,{get:(o,a,...s)=>("currentProvider"!==a||n?"currentProvider"===a||a===i||r||(r=!0,t.error("MetaMask no longer injects web3. For details, see: https://docs.metamask.io/guide/provider-migration.html#replacing-window-web3"),e.request({method:"metamask_logWeb3ShimUsage"}).catch(e=>{t.debug("MetaMask: Failed to log web3 shim usage.",e)})):(n=!0,t.warn("You are accessing the MetaMask window.web3.currentProvider shim. This property is deprecated; use window.ethereum instead. For details, see: https://docs.metamask.io/guide/provider-migration.html#replacing-window-web3")),Reflect.get(o,a,...s)),set:(...e)=>(t.warn("You are accessing the MetaMask window.web3 shim. This object is deprecated; use window.ethereum instead. For details, see: https://docs.metamask.io/guide/provider-migration.html#replacing-window-web3"),Reflect.set(...e))}),enumerable:!1,configurable:!0,writable:!0})}}(this.provider),this.provider.on("_initialized",()=>{yQ("[Ethereum: constructor()] provider initialized",{chainId:this.provider.getChainId(),isConnected:this.provider.isConnected(),isMetaNask:this.provider.isMetaMask,selectedAddress:this.provider.getSelectedAddress(),networkVersion:this.provider.getNetworkVersion()})})}static init(e){var t;return yQ("[Ethereum: init()] Initializing Ethereum service"),this.instance=new wb(e),null===(t=this.instance)||void 0===t?void 0:t.provider}static destroy(){wb.instance=void 0}static getInstance(){var e;if(!(null===(e=this.instance)||void 0===e?void 0:e.provider))throw Error("Ethereum instance not intiialized - call Ethereum.factory first.");return this.instance}static getProvider(){var e;if(!(null===(e=this.instance)||void 0===e?void 0:e.provider))throw Error("Ethereum instance not intiialized - call Ethereum.factory first.");return this.instance.provider}}class wy extends ni.Duplex{constructor({name:t,remote:n,platformManager:r}){super({objectMode:!0}),this.state={_name:null,remote:null,platformManager:null},this.state._name=t,this.state.remote=n,this.state.platformManager=r,this._onMessage=this._onMessage.bind(this),this.state.remote.on(e.EventType.MESSAGE,this._onMessage)}_write(e,t,n){return hP(this,void 0,void 0,function*(){return function(e,t,n,r){var i,o,a,s,l,u,c,d,f,h,p,m,g,v;return hP(this,void 0,void 0,function*(){var n;let b;let y=null===(i=e.state.remote)||void 0===i?void 0:i.isReady(),A=null===(o=e.state.remote)||void 0===o?void 0:o.isConnected(),w=null===(a=e.state.remote)||void 0===a?void 0:a.isPaused(),_=wb.getProvider(),E=null===(s=e.state.remote)||void 0===s?void 0:s.getChannelId(),S=null===(l=e.state.remote)||void 0===l?void 0:l.isAuthorized(),{method:k,data:C}=(M.isBuffer(t)?(b=t.toJSON())._isBuffer=!0:b=t,{method:null===(n=null==b?void 0:b.data)||void 0===n?void 0:n.method,data:b});if(yQ(`[RCPMS: write()] method='${k}' isRemoteReady=${y} channelId=${E} isSocketConnected=${A} isRemotePaused=${w} providerConnected=${_.isConnected()}`,t),!E)return k!==y5.METAMASK_GETPROVIDERSTATE&&yQ("[RCPMS: write()] Invalid channel id -- undefined"),r();yQ(`[RCPMS: write()] remote.isPaused()=${null===(u=e.state.remote)||void 0===u?void 0:u.isPaused()} authorized=${S} ready=${y} socketConnected=${A}`,t);try{if(null===(c=e.state.remote)||void 0===c||c.sendMessage(null==C?void 0:C.data).then(()=>{yQ(`[RCPMS: _write()] ${k} sent successfully`)}).catch(e=>{yQ("[RCPMS: _write()] error sending message",e)}),!(null===(d=e.state.platformManager)||void 0===d?void 0:d.isSecure()))return yQ(`[RCPMS: _write()] unsecure platform for method ${k} -- return callback`),r();if(!A&&!y)return yQ(`[RCPMS: _write()] invalid connection status targetMethod=${k} socketConnected=${A} ready=${y} providerConnected=${_.isConnected()}`),r();if(!A&&y)return console.warn("[RCPMS: _write()] invalid socket status -- shouldn't happen"),r();let t=null!==(p=null===(h=null===(f=e.state.remote)||void 0===f?void 0:f.getKeyInfo())||void 0===h?void 0:h.ecies.public)&&void 0!==p?p:"",n=encodeURI(`channelId=${E}&pubkey=${t}&comm=socket&t=d&v=2`);y7[k]?(yQ(`[RCPMS: _write()] redirect link for '${k}' socketConnected=${A} connect?${n}`),null===(m=e.state.platformManager)||void 0===m||m.openDeeplink(`${wf}?${n}`,`${wh}?${n}`,"_self")):(null===(g=e.state.remote)||void 0===g?void 0:g.isPaused())?(yQ(`[RCPMS: _write()] MM is PAUSED! deeplink with connect! targetMethod=${k}`),null===(v=e.state.platformManager)||void 0===v||v.openDeeplink(`${wf}?redirect=true&${n}`,`${wh}?redirect=true&${n}`,"_self")):yQ(`[RCPMS: _write()] method ${k} doesn't need redirect.`)}catch(e){return yQ("[RCPMS: _write()] error sending message",e),r(Error("RemoteCommunicationPostMessageStream - disconnected"))}return r()})}(this,e,0,n)})}_read(){}_onMessage(e){return function(e,t){try{if(yQ("[RCPMS: onMessage()] message",t),!t||"object"!=typeof t||"object"!=typeof(null==t?void 0:t.data))return;if(!(null==t?void 0:t.name))return void yQ(`[RCPMS: onMessage()] ignore message without name message=${t}`);if((null==t?void 0:t.name)!==wu.PROVIDER)return void yQ(`[RCPMS: onMessage()] ignore message with wrong name message=${t}`);if(M.isBuffer(t)){let n=M.from(t);e.push(n)}else e.push(t)}catch(e){yQ(`[RCPMS: onMessage()] ignore message error err=${e}`)}}(this,e)}start(){}}var wA={exports:{}};wI=wA.exports,wT="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==l&&l,wP=wO=function(){function e(){this.fetch=!1,this.DOMException=wT.DOMException}return e.prototype=wT,new e}(),function(e){var t=void 0!==wP&&wP||"undefined"!=typeof self&&self||void 0!==t&&t,n="URLSearchParams"in t,r="Symbol"in t&&"iterator"in Symbol,i="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(e){return!1}}(),o="FormData"in t,a="ArrayBuffer"in t;if(a)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],l=ArrayBuffer.isView||function(e){return e&&s.indexOf(Object.prototype.toString.call(e))>-1};function u(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||""===e)throw TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function c(e){return"string"!=typeof e&&(e=String(e)),e}function d(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return r&&(t[Symbol.iterator]=function(){return t}),t}function f(e){this.map={},e instanceof f?e.forEach(function(e,t){this.append(t,e)},this):Array.isArray(e)?e.forEach(function(e){this.append(e[0],e[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}function h(e){if(e.bodyUsed)return Promise.reject(TypeError("Already read"));e.bodyUsed=!0}function p(e){return new Promise(function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}})}function m(e){var t=new FileReader,n=p(t);return t.readAsArrayBuffer(e),n}function g(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function v(){return this.bodyUsed=!1,this._initBody=function(e){var t;this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:i&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:o&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:n&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():a&&i&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=g(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a&&(ArrayBuffer.prototype.isPrototypeOf(e)||l(e))?this._bodyArrayBuffer=g(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var e=h(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?h(this)||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer)):this.blob().then(m)}),this.text=function(){var e,t,n,r=h(this);if(r)return r;if(this._bodyBlob)return e=this._bodyBlob,n=p(t=new FileReader),t.readAsText(e),n;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=Array(t.length),r=0;r-1?r:n),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(i),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==t.cache&&"no-cache"!==t.cache)){var o=/([?&])_=[^&]*/;o.test(this.url)?this.url=this.url.replace(o,"$1_="+(new Date).getTime()):this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}function A(e){var t=new FormData;return e.trim().split("&").forEach(function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(i))}}),t}function w(e,t){if(!(this instanceof w))throw TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText=void 0===t.statusText?"":""+t.statusText,this.headers=new f(t.headers),this.url=t.url||"",this._initBody(e)}y.prototype.clone=function(){return new y(this,{body:this._bodyInit})},v.call(y.prototype),v.call(w.prototype),w.prototype.clone=function(){return new w(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},w.error=function(){var e=new w(null,{status:0,statusText:""});return e.type="error",e};var _=[301,302,303,307,308];w.redirect=function(e,t){if(-1===_.indexOf(t))throw RangeError("Invalid status code");return new w(null,{status:t,headers:{location:e}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function E(n,r){return new Promise(function(o,s){var l=new y(n,r);if(l.signal&&l.signal.aborted)return s(new e.DOMException("Aborted","AbortError"));var u=new XMLHttpRequest;function d(){u.abort()}u.onload=function(){var e,t,n={status:u.status,statusText:u.statusText,headers:(e=u.getAllResponseHeaders()||"",t=new f,e.replace(/\r?\n[\t ]+/g," ").split("\r").map(function(e){return 0===e.indexOf("\n")?e.substr(1,e.length):e}).forEach(function(e){var n=e.split(":"),r=n.shift().trim();if(r){var i=n.join(":").trim();t.append(r,i)}}),t)};n.url="responseURL"in u?u.responseURL:n.headers.get("X-Request-URL");var r="response"in u?u.response:u.responseText;setTimeout(function(){o(new w(r,n))},0)},u.onerror=function(){setTimeout(function(){s(TypeError("Network request failed"))},0)},u.ontimeout=function(){setTimeout(function(){s(TypeError("Network request failed"))},0)},u.onabort=function(){setTimeout(function(){s(new e.DOMException("Aborted","AbortError"))},0)},u.open(l.method,function(e){try{return""===e&&t.location.href?t.location.href:e}catch(t){return e}}(l.url),!0),"include"===l.credentials?u.withCredentials=!0:"omit"===l.credentials&&(u.withCredentials=!1),"responseType"in u&&(i?u.responseType="blob":a&&l.headers.get("Content-Type")&&-1!==l.headers.get("Content-Type").indexOf("application/octet-stream")&&(u.responseType="arraybuffer")),!r||"object"!=typeof r.headers||r.headers instanceof f?l.headers.forEach(function(e,t){u.setRequestHeader(t,e)}):Object.getOwnPropertyNames(r.headers).forEach(function(e){u.setRequestHeader(e,c(r.headers[e]))}),l.signal&&(l.signal.addEventListener("abort",d),u.onreadystatechange=function(){4===u.readyState&&l.signal.removeEventListener("abort",d)}),u.send(void 0===l._bodyInit?null:l._bodyInit)})}E.polyfill=!0,t.fetch||(t.fetch=E,t.Headers=f,t.Request=y,t.Response=w),e.Headers=f,e.Request=y,e.Response=w,e.fetch=E}({}),wO.fetch.ponyfill=!0,delete wO.fetch.polyfill,(wI=(wL=wT.fetch?wT:wO).fetch).default=wL.fetch,wI.fetch=wL.fetch,wI.Headers=wL.Headers,wI.Request=wL.Request,wI.Response=wL.Response,wA.exports=wI;var ww=u(wA.exports);let w_=1,wE=e=>new Promise(t=>{setTimeout(()=>{t(!0)},e)}),wS=({checkInstallationOnAllCalls:t=!1,communicationLayerPreference:n,injectProvider:r,shouldShimWeb3:i,platformManager:o,installer:a,sdk:s,remoteConnection:l,debug:u})=>hP(void 0,void 0,void 0,function*(){var c,d;let f=(({name:e,remoteConnection:t})=>{if(!t||!(null==t?void 0:t.getConnector()))throw Error("Missing remote connection parameter");return new wy({name:e,remote:null==t?void 0:t.getConnector(),platformManager:null==t?void 0:t.getPlatformManager()})})({name:wu.INPAGE,target:wu.CONTENT_SCRIPT,platformManager:o,communicationLayerPreference:n,remoteConnection:l}),h=o.getPlatformType(),p=s.options.dappMetadata,m=`Sdk/Javascript SdkVersion/${wc} Platform/${h} dApp/${null!==(c=p.url)&&void 0!==c?c:p.name} dAppTitle/${p.name}`,g=null,v=null,b=null===(d=s.options.storage)||void 0===d?void 0:d.storageManager;if(b){try{let e=yield b.getCachedAccounts();e.length>0&&(g=e[0])}catch(e){console.error(`[initializeMobileProvider] failed to get cached addresses: ${e}`)}try{let e=yield b.getCachedChainId();e&&(v=e)}catch(e){console.error(`[initializeMobileProvider] failed to parse cached chainId: ${e}`)}}yQ(`[initializeMobileProvider] cachedAccountAddress: ${g}, cachedChainId: ${v}`);let y=!(!r||h===e.PlatformType.NonBrowser||h===e.PlatformType.ReactNative),A=wb.init({shouldSetOnWindow:y,connectionStream:f,shouldShimWeb3:i}),w=!1,_=e=>{w=e},E=()=>w,S=(n,r,i,u)=>hP(void 0,void 0,void 0,function*(){var c,d,f,h,p,y,A,S,k;if(w){null==l||l.showActiveModal();let e=E();for(;e;)yield wE(1e3),e=E();return yQ("[initializeMobileProvider: sendRequest()] initial method completed -- prevent installation and call provider"),i(...r)}let M=o.isMetaMaskInstalled(),C=null==l?void 0:l.isConnected(),x=wb.getProvider(),R=null,I=null;if(R=null!==(c=x.getSelectedAddress())&&void 0!==c?c:g,I=x.getChainId()||v,R&&b&&R!==g&&b.persistAccounts([R]).catch(e=>{console.error(`[initializeMobileProvider] failed to persist account: ${e}`)}),I&&(v=I,b&&b.persistChainId(I).catch(e=>{console.error(`[initializeMobileProvider] failed to persist chainId: ${e}`)})),yQ("[initializeMobileProvider: sendRequest()]",{selectedAddress:R,chainId:I}),u&&yQ(`[initializeMobileProvider: sendRequest()] method=${n} ongoing=${w} selectedAddress=${R} isInstalled=${M} checkInstallationOnAllCalls=${t} socketConnected=${C}`),R&&n.toLowerCase()===y5.ETH_ACCOUNTS.toLowerCase())return[R];if(I&&n.toLowerCase()===y5.ETH_CHAINID.toLowerCase())return I;let T=[y5.ETH_REQUESTACCOUNTS,y5.WALLET_REQUESTPERMISSIONS,y5.METAMASK_CONNECTSIGN,y5.METAMASK_CONNECTWITH],O=!y7[n],P=null===(d=s.options.readonlyRPCMap)||void 0===d?void 0:d[I];if(P&&O)try{let e=null===(f=null==r?void 0:r[0])||void 0===f?void 0:f.params,t=yield(({rpcEndpoint:e,method:t,sdkInfo:n,params:r})=>hP(void 0,void 0,void 0,function*(){let i;let o=JSON.stringify({jsonrpc:"2.0",method:t,params:r,id:w_+=1}),a={Accept:"application/json","Content-Type":"application/json"};e.includes("infura")&&(a["Metamask-Sdk-Info"]=n);try{i=yield ww(e,{method:"POST",headers:a,body:o})}catch(e){throw e instanceof Error?Error(`Failed to fetch from RPC: ${e.message}`):Error(`Failed to fetch from RPC: ${e}`)}if(!i.ok)throw Error(`Server responded with a status of ${i.status}`);return(yield i.json()).result}))({rpcEndpoint:P,sdkInfo:m,method:n,params:e||[]});return u&&yQ(`initializeProvider::ReadOnlyRPCResponse ${t}`),t}catch(e){console.warn(`[initializeMobileProvider: sendRequest()] method=${n} readOnlyRPCRequest failed:`,e)}if((!M||M&&!C)&&n!==y5.METAMASK_GETPROVIDERSTATE){let u=(null===(h=null==r?void 0:r[0])||void 0===h?void 0:h.params)||[];if(-1!==T.indexOf(n)||t){_(!0);try{yield a.start({wait:!1})}catch(t){if(_(!1),e.PROVIDER_UPDATE_TYPE.EXTENSION===t){if(yQ(`[initializeMobileProvider: sendRequest()] extension provider detect: re-create ${n} on the active provider`),n.toLowerCase()===y5.METAMASK_CONNECTSIGN.toLowerCase()){let e=yield null===(p=s.getProvider())||void 0===p?void 0:p.request({method:y5.ETH_REQUESTACCOUNTS,params:[]});if(!e.length)throw Error("SDK state invalid -- undefined accounts");return yield null===(y=s.getProvider())||void 0===y?void 0:y.request({method:y5.PERSONAL_SIGN,params:[u[0],e[0]]})}if(n.toLowerCase()===y5.METAMASK_CONNECTWITH.toLowerCase()){let[e]=u;return yield(({method:e,sdk:t,params:n})=>hP(void 0,void 0,void 0,function*(){var r,i,o,a;if(!t.isExtensionActive())throw Error("SDK state invalid -- extension is not active");yQ("[MetaMaskProvider: extensionConnectWithOverwrite()] Overwriting request method",e,n);let s=yield null===(r=t.getProvider())||void 0===r?void 0:r.request({method:y5.ETH_REQUESTACCOUNTS,params:[]});if(!s.length)throw Error("SDK state invalid -- undefined accounts");if((null==e?void 0:e.toLowerCase())===y5.PERSONAL_SIGN.toLowerCase()){let r={method:e,params:[n[0],s[0]]};return yield null===(i=t.getProvider())||void 0===i?void 0:i.request(r)}if((null==e?void 0:e.toLowerCase())===y5.ETH_SENDTRANSACTION.toLowerCase()){let r={method:e,params:[Object.assign(Object.assign({},n[0]),{from:s[0]})]};return yield null===(o=t.getProvider())||void 0===o?void 0:o.request(r)}return Ae.includes(e.toLowerCase())?(console.warn(`MetaMaskSDK connectWith method=${e} -- not handled by the extension -- call separately`),s):yield null===(a=t.getProvider())||void 0===a?void 0:a.request({method:e,params:n})}))({method:e.method,sdk:s,params:e.params})}return yQ(`[initializeMobileProvider: sendRequest()] sending '${n}' on active provider`,u),yield null===(A=s.getProvider())||void 0===A?void 0:A.request({method:n,params:u})}throw yQ(`[initializeMobileProvider: sendRequest()] failed to start installer: ${t}`),t}let t=i(...r);try{yield new Promise((t,n)=>{null==l||l.getConnector().once(e.EventType.AUTHORIZED,()=>{t(!0)}),s.once(e.EventType.PROVIDER_UPDATE,t=>{yQ(`[initializeMobileProvider: sendRequest()] PROVIDER_UPDATE --- remote provider request interupted type=${t}`),t===e.PROVIDER_UPDATE_TYPE.EXTENSION?n(e.EventType.PROVIDER_UPDATE):n(Error("Connection Terminated"))})})}catch(t){if(_(!1),t===e.EventType.PROVIDER_UPDATE)return yield null===(S=s.getProvider())||void 0===S?void 0:S.request({method:n,params:u});throw t}return _(!1),t}if(o.isSecure()&&y7[n])return i(...r);if(s.isExtensionActive())return yQ(`[initializeMobileProvider: sendRequest()] EXTENSION active - redirect request '${n}' to it`,r,u),yield null===(k=s.getProvider())||void 0===k?void 0:k.request({method:n,params:u});throw yQ(`[initializeMobileProvider: sendRequest()] method=${n} --- skip --- not connected/installed`),Error("MetaMask is not connected/installed, please call eth_requestAccounts to connect first.")}let L=yield i(...r);return yQ(`[initializeMobileProvider: sendRequest()] method=${n} rpcResponse: ${L}`),L}),{request:k}=A;A.request=(...e)=>hP(void 0,void 0,void 0,function*(){return S(null==e?void 0:e[0].method,e,k,u)});let{send:M}=A;return A.send=(...e)=>hP(void 0,void 0,void 0,function*(){return S(null==e?void 0:e[0],e,M,u)}),yQ("[initializeMobileProvider: sendRequest()] metamaskStream.start()"),f.start(),A});class wk{constructor({serverUrl:e,enabled:t,originatorInfo:n}){wB.set(this,hb),wj.set(this,void 0),wF.set(this,void 0),hN(this,wB,e,"f"),hN(this,wF,n,"f"),hN(this,wj,null==t||t,"f")}send({event:e,params:t}){if(!hL(this,wj,"f"))return;let n={id:"sdk",event:e,sdkVersion:wc,originationInfo:hL(this,wF,"f"),params:t};yQ(`[Analytics: send()] event: ${e}`,n),fU(n,hL(this,wB,"f")).catch(e=>{yQ(`[Analytics: send()] error: ${e}`)})}}wB=new WeakMap,wj=new WeakMap,wF=new WeakMap;let wM=()=>{let e;if("undefined"==typeof document)return;let t=document.getElementsByTagName("link");for(let n=0;n{if("state"in e)throw Error("INVALID EXTENSION PROVIDER");return new Proxy(e,{get:(n,r)=>"request"===r?function(r){var i,o,a;return hP(this,void 0,void 0,function*(){let s;yQ("[wrapExtensionProvider()] Overwriting request method",r);let{method:l,params:u}=r,c=y9.includes(l.toLowerCase());if(c&&(null===(i=t.analytics)||void 0===i||i.send({event:vf.SDK_RPC_REQUEST,params:{method:l,from:"extension"}})),l===y5.METAMASK_BATCH&&Array.isArray(u)){for(let t of u)yield null==e?void 0:e.request({method:t.method,params:t.params});let i=yield n.request(r);return c&&(null===(o=t.analytics)||void 0===o||o.send({event:vf.SDK_RPC_REQUEST_DONE,params:{method:l,from:"extension"}})),i}try{return s=yield n.request(r)}catch(e){}finally{c&&(null===(a=t.analytics)||void 0===a||a.send({event:vf.SDK_RPC_REQUEST_DONE,params:{method:l,from:"extension"}}))}return s})}:"getChainId"===r?function(){return e.chainId}:"getNetworkVersion"===r?function(){return e.networkVersion}:"getSelectedAddress"===r?function(){return e.selectedAddress}:"isConnected"===r?function(){return e._state.isConnected}:n[r]})};(wN=wz||(wz={})).Announce="eip6963:announceProvider",wN.Request="eip6963:requestProvider";var wx={exports:{}};wx.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t||4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,(function(t){return e[t]}).bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=90)}({17:function(e,t,n){t.__esModule=!0,t.default=void 0;var r=n(18),i=function(){function e(){}return e.getFirstMatch=function(e,t){var n=t.match(e);return n&&n.length>0&&n[1]||""},e.getSecondMatch=function(e,t){var n=t.match(e);return n&&n.length>1&&n[2]||""},e.matchAndReturnConst=function(e,t,n){if(e.test(t))return n},e.getWindowsVersionName=function(e){switch(e){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map(function(e){return parseInt(e,10)||0});if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map(function(e){return parseInt(e,10)||0});if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,n,r){void 0===r&&(r=!1);var i=e.getVersionPrecision(t),o=e.getVersionPrecision(n),a=Math.max(i,o),s=0,l=e.map([t,n],function(t){var n=a-e.getVersionPrecision(t),r=t+Array(n+1).join(".0");return e.map(r.split("."),function(e){return Array(20-e.length).join("0")+e}).reverse()});for(r&&(s=a-Math.min(i,o)),a-=1;a>=s;){if(l[0][a]>l[1][a])return 1;if(l[0][a]===l[1][a]){if(a===s)return 0;a-=1}else if(l[0][a]1?r-1:0),o=1;o0){var a=Object.keys(n),l=s.default.find(a,function(e){return t.isOS(e)});if(l){var u=this.satisfies(n[l]);if(void 0!==u)return u}var c=s.default.find(a,function(e){return t.isPlatform(e)});if(c){var d=this.satisfies(n[c]);if(void 0!==d)return d}}if(o>0){var f=Object.keys(i),h=s.default.find(f,function(e){return t.isBrowser(e,!0)});if(void 0!==h)return this.compareVersion(i[h])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var n=this.getBrowserName().toLowerCase(),r=e.toLowerCase(),i=s.default.getBrowserTypeByAlias(r);return t&&i&&(r=i.toLowerCase()),r===n},t.compareVersion=function(e){var t=[0],n=e,r=!1,i=this.getBrowserVersion();if("string"==typeof i)return">"===e[0]||"<"===e[0]?(n=e.substr(1),"="===e[1]?(r=!0,n=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?n=e.substr(1):"~"===e[0]&&(r=!0,n=e.substr(1)),t.indexOf(s.default.compareVersions(i,n,r))>-1},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase()},t.is=function(e,t){return void 0===t&&(t=!1),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some(function(e){return t.is(e)})},e}();t.default=u,e.exports=t.default},92:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=/version\/(\d+(\.?_?\d+)+)/i,a=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},n=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},n=i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},n=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},n=i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},n=i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(e){var t={name:"Opera Touch"},n=i.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},n=i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},n=i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},n=i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},n=i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},n=i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},n=i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},n=i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},n=i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},n=i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return n&&(t.version=n),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},n=i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},n=i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},n=i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},n=i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},n=i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},n=i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},n=i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/electron/i],describe:function(e){var t={name:"Electron"},n=i.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},n=i.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},n=i.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},n=i.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},n=i.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t={name:"Android Browser"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:i.default.getFirstMatch(t,e),version:i.default.getSecondMatch(t,e)}}}];t.default=a,e.exports=t.default},93:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),a=[{test:[/Roku\/DVP/],describe:function(e){var t=i.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:o.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=i.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.WindowsPhone,version:t}}},{test:[/windows /i],describe:function(e){var t=i.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),n=i.default.getWindowsVersionName(t);return{name:o.OS_MAP.Windows,version:t,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:o.OS_MAP.iOS},n=i.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return n&&(t.version=n),t}},{test:[/macintosh/i],describe:function(e){var t=i.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),n=i.default.getMacOSVersionName(t),r={name:o.OS_MAP.MacOS,version:t};return n&&(r.versionName=n),r}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=i.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:o.OS_MAP.iOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t=i.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),n=i.default.getAndroidVersionName(t),r={name:o.OS_MAP.Android,version:t};return n&&(r.versionName=n),r}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=i.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),n={name:o.OS_MAP.WebOS};return t&&t.length&&(n.version=t),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=i.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||i.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||i.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:o.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=i.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:o.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:o.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.PlayStation4,version:t}}}];t.default=a,e.exports=t.default},94:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),a=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(e){var t=i.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",n={type:o.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(n.model=t),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),n=e.test(/like (ipod|iphone)/i);return t&&!n},describe:function(e){var t=i.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:o.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}}];t.default=a,e.exports=t.default},95:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),a=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:o.ENGINE_MAP.Blink};var t=i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:o.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:o.ENGINE_MAP.Trident},n=i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:o.ENGINE_MAP.Presto},n=i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=e.test(/gecko/i),n=e.test(/like gecko/i);return t&&!n},describe:function(e){var t={name:o.ENGINE_MAP.Gecko},n=i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:o.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:o.ENGINE_MAP.WebKit},n=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}}];t.default=a,e.exports=t.default}});var wR,wI,wT,wO,wP,wL,wN,wD,wB,wj,wF,wz,wU,wq=u(wx.exports);(w3=wU||(wU={})).Disabled="Disabled",w3.Temporary="Temporary",w3.UntilResponse="UntilResponse";let wK=()=>"wakeLock"in navigator,wH=()=>{if("undefined"==typeof navigator)return!1;let{userAgent:e}=navigator,t=/CPU (?:iPhone )?OS (\d+)(?:_\d+)?_?\d+ like Mac OS X/iu.exec(e);return!!t&&10>parseInt(t[1],10)&&!window.MSStream};class wV{constructor(e){this.enabled=!1,this._eventsAdded=!1,this.debug=null!=e&&e}start(){if(this.enabled=!1,wK()&&!this._eventsAdded){this._eventsAdded=!0,this._wakeLock=void 0;let e=()=>hP(this,void 0,void 0,function*(){null!==this._wakeLock&&"visible"===document.visibilityState&&(yield this.enable())});document.addEventListener("visibilitychange",e),document.addEventListener("fullscreenchange",e)}else wH()?this.noSleepTimer=void 0:(this.noSleepVideo=document.createElement("video"),this.noSleepVideo.setAttribute("title","MetaMask SDK - Listening for responses"),this.noSleepVideo.setAttribute("playsinline",""),this._addSourceToVideo(this.noSleepVideo,"webm","data:video/webm;base64,GkXfowEAAAAAAAAfQoaBAUL3gQFC8oEEQvOBCEKChHdlYm1Ch4EEQoWBAhhTgGcBAAAAAAAVkhFNm3RALE27i1OrhBVJqWZTrIHfTbuMU6uEFlSua1OsggEwTbuMU6uEHFO7a1OsghV17AEAAAAAAACkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmAQAAAAAAAEUq17GDD0JATYCNTGF2ZjU1LjMzLjEwMFdBjUxhdmY1NS4zMy4xMDBzpJBlrrXf3DCDVB8KcgbMpcr+RImIQJBgAAAAAAAWVK5rAQAAAAAAD++uAQAAAAAAADLXgQFzxYEBnIEAIrWcg3VuZIaFVl9WUDiDgQEj44OEAmJaAOABAAAAAAAABrCBsLqBkK4BAAAAAAAPq9eBAnPFgQKcgQAitZyDdW5khohBX1ZPUkJJU4OBAuEBAAAAAAAAEZ+BArWIQOdwAAAAAABiZIEgY6JPbwIeVgF2b3JiaXMAAAAAAoC7AAAAAAAAgLUBAAAAAAC4AQN2b3JiaXMtAAAAWGlwaC5PcmcgbGliVm9yYmlzIEkgMjAxMDExMDEgKFNjaGF1ZmVudWdnZXQpAQAAABUAAABlbmNvZGVyPUxhdmM1NS41Mi4xMDIBBXZvcmJpcyVCQ1YBAEAAACRzGCpGpXMWhBAaQlAZ4xxCzmvsGUJMEYIcMkxbyyVzkCGkoEKIWyiB0JBVAABAAACHQXgUhIpBCCGEJT1YkoMnPQghhIg5eBSEaUEIIYQQQgghhBBCCCGERTlokoMnQQgdhOMwOAyD5Tj4HIRFOVgQgydB6CCED0K4moOsOQghhCQ1SFCDBjnoHITCLCiKgsQwuBaEBDUojILkMMjUgwtCiJqDSTX4GoRnQXgWhGlBCCGEJEFIkIMGQcgYhEZBWJKDBjm4FITLQagahCo5CB+EIDRkFQCQAACgoiiKoigKEBqyCgDIAAAQQFEUx3EcyZEcybEcCwgNWQUAAAEACAAAoEiKpEiO5EiSJFmSJVmSJVmS5omqLMuyLMuyLMsyEBqyCgBIAABQUQxFcRQHCA1ZBQBkAAAIoDiKpViKpWiK54iOCISGrAIAgAAABAAAEDRDUzxHlETPVFXXtm3btm3btm3btm3btm1blmUZCA1ZBQBAAAAQ0mlmqQaIMAMZBkJDVgEACAAAgBGKMMSA0JBVAABAAACAGEoOogmtOd+c46BZDppKsTkdnEi1eZKbirk555xzzsnmnDHOOeecopxZDJoJrTnnnMSgWQqaCa0555wnsXnQmiqtOeeccc7pYJwRxjnnnCateZCajbU555wFrWmOmkuxOeecSLl5UptLtTnnnHPOOeecc84555zqxekcnBPOOeecqL25lpvQxTnnnE/G6d6cEM4555xzzjnnnHPOOeecIDRkFQAABABAEIaNYdwpCNLnaCBGEWIaMulB9+gwCRqDnELq0ehopJQ6CCWVcVJKJwgNWQUAAAIAQAghhRRSSCGFFFJIIYUUYoghhhhyyimnoIJKKqmooowyyyyzzDLLLLPMOuyssw47DDHEEEMrrcRSU2011lhr7jnnmoO0VlprrbVSSimllFIKQkNWAQAgAAAEQgYZZJBRSCGFFGKIKaeccgoqqIDQkFUAACAAgAAAAABP8hzRER3RER3RER3RER3R8RzPESVREiVREi3TMjXTU0VVdWXXlnVZt31b2IVd933d933d+HVhWJZlWZZlWZZlWZZlWZZlWZYgNGQVAAACAAAghBBCSCGFFFJIKcYYc8w56CSUEAgNWQUAAAIACAAAAHAUR3EcyZEcSbIkS9IkzdIsT/M0TxM9URRF0zRV0RVdUTdtUTZl0zVdUzZdVVZtV5ZtW7Z125dl2/d93/d93/d93/d93/d9XQdCQ1YBABIAADqSIymSIimS4ziOJElAaMgqAEAGAEAAAIriKI7jOJIkSZIlaZJneZaomZrpmZ4qqkBoyCoAABAAQAAAAAAAAIqmeIqpeIqoeI7oiJJomZaoqZoryqbsuq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq4LhIasAgAkAAB0JEdyJEdSJEVSJEdygNCQVQCADACAAAAcwzEkRXIsy9I0T/M0TxM90RM901NFV3SB0JBVAAAgAIAAAAAAAAAMybAUy9EcTRIl1VItVVMt1VJF1VNVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVN0zRNEwgNWQkAkAEAkBBTLS3GmgmLJGLSaqugYwxS7KWxSCpntbfKMYUYtV4ah5RREHupJGOKQcwtpNApJq3WVEKFFKSYYyoVUg5SIDRkhQAQmgHgcBxAsixAsiwAAAAAAAAAkDQN0DwPsDQPAAAAAAAAACRNAyxPAzTPAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABA0jRA8zxA8zwAAAAAAAAA0DwP8DwR8EQRAAAAAAAAACzPAzTRAzxRBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABA0jRA8zxA8zwAAAAAAAAAsDwP8EQR0DwRAAAAAAAAACzPAzxRBDzRAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAEOAAABBgIRQasiIAiBMAcEgSJAmSBM0DSJYFTYOmwTQBkmVB06BpME0AAAAAAAAAAAAAJE2DpkHTIIoASdOgadA0iCIAAAAAAAAAAAAAkqZB06BpEEWApGnQNGgaRBEAAAAAAAAAAAAAzzQhihBFmCbAM02IIkQRpgkAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAGHAAAAgwoQwUGrIiAIgTAHA4imUBAIDjOJYFAACO41gWAABYliWKAABgWZooAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAYcAAACDChDBQashIAiAIAcCiKZQHHsSzgOJYFJMmyAJYF0DyApgFEEQAIAAAocAAACLBBU2JxgEJDVgIAUQAABsWxLE0TRZKkaZoniiRJ0zxPFGma53meacLzPM80IYqiaJoQRVE0TZimaaoqME1VFQAAUOAAABBgg6bE4gCFhqwEAEICAByKYlma5nmeJ4qmqZokSdM8TxRF0TRNU1VJkqZ5niiKommapqqyLE3zPFEURdNUVVWFpnmeKIqiaaqq6sLzPE8URdE0VdV14XmeJ4qiaJqq6roQRVE0TdNUTVV1XSCKpmmaqqqqrgtETxRNU1Vd13WB54miaaqqq7ouEE3TVFVVdV1ZBpimaaqq68oyQFVV1XVdV5YBqqqqruu6sgxQVdd1XVmWZQCu67qyLMsCAAAOHAAAAoygk4wqi7DRhAsPQKEhKwKAKAAAwBimFFPKMCYhpBAaxiSEFEImJaXSUqogpFJSKRWEVEoqJaOUUmopVRBSKamUCkIqJZVSAADYgQMA2IGFUGjISgAgDwCAMEYpxhhzTiKkFGPOOScRUoox55yTSjHmnHPOSSkZc8w556SUzjnnnHNSSuacc845KaVzzjnnnJRSSuecc05KKSWEzkEnpZTSOeecEwAAVOAAABBgo8jmBCNBhYasBABSAQAMjmNZmuZ5omialiRpmud5niiapiZJmuZ5nieKqsnzPE8URdE0VZXneZ4oiqJpqirXFUXTNE1VVV2yLIqmaZqq6rowTdNUVdd1XZimaaqq67oubFtVVdV1ZRm2raqq6rqyDFzXdWXZloEsu67s2rIAAPAEBwCgAhtWRzgpGgssNGQlAJABAEAYg5BCCCFlEEIKIYSUUggJAAAYcAAACDChDBQashIASAUAAIyx1lprrbXWQGettdZaa62AzFprrbXWWmuttdZaa6211lJrrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmstpZRSSimllFJKKaWUUkoppZRSSgUA+lU4APg/2LA6wknRWGChISsBgHAAAMAYpRhzDEIppVQIMeacdFRai7FCiDHnJKTUWmzFc85BKCGV1mIsnnMOQikpxVZjUSmEUlJKLbZYi0qho5JSSq3VWIwxqaTWWoutxmKMSSm01FqLMRYjbE2ptdhqq7EYY2sqLbQYY4zFCF9kbC2m2moNxggjWywt1VprMMYY3VuLpbaaizE++NpSLDHWXAAAd4MDAESCjTOsJJ0VjgYXGrISAAgJACAQUooxxhhzzjnnpFKMOeaccw5CCKFUijHGnHMOQgghlIwx5pxzEEIIIYRSSsaccxBCCCGEkFLqnHMQQgghhBBKKZ1zDkIIIYQQQimlgxBCCCGEEEoopaQUQgghhBBCCKmklEIIIYRSQighlZRSCCGEEEIpJaSUUgohhFJCCKGElFJKKYUQQgillJJSSimlEkoJJYQSUikppRRKCCGUUkpKKaVUSgmhhBJKKSWllFJKIYQQSikFAAAcOAAABBhBJxlVFmGjCRcegEJDVgIAZAAAkKKUUiktRYIipRikGEtGFXNQWoqocgxSzalSziDmJJaIMYSUk1Qy5hRCDELqHHVMKQYtlRhCxhik2HJLoXMOAAAAQQCAgJAAAAMEBTMAwOAA4XMQdAIERxsAgCBEZohEw0JweFAJEBFTAUBigkIuAFRYXKRdXECXAS7o4q4DIQQhCEEsDqCABByccMMTb3jCDU7QKSp1IAAAAAAADADwAACQXAAREdHMYWRobHB0eHyAhIiMkAgAAAAAABcAfAAAJCVAREQ0cxgZGhscHR4fICEiIyQBAIAAAgAAAAAggAAEBAQAAAAAAAIAAAAEBB9DtnUBAAAAAAAEPueBAKOFggAAgACjzoEAA4BwBwCdASqwAJAAAEcIhYWIhYSIAgIABhwJ7kPfbJyHvtk5D32ych77ZOQ99snIe+2TkPfbJyHvtk5D32ych77ZOQ99YAD+/6tQgKOFggADgAqjhYIAD4AOo4WCACSADqOZgQArADECAAEQEAAYABhYL/QACIBDmAYAAKOFggA6gA6jhYIAT4AOo5mBAFMAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAGSADqOFggB6gA6jmYEAewAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIAj4AOo5mBAKMAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAKSADqOFggC6gA6jmYEAywAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIAz4AOo4WCAOSADqOZgQDzADECAAEQEAAYABhYL/QACIBDmAYAAKOFggD6gA6jhYIBD4AOo5iBARsAEQIAARAQFGAAYWC/0AAiAQ5gGACjhYIBJIAOo4WCATqADqOZgQFDADECAAEQEAAYABhYL/QACIBDmAYAAKOFggFPgA6jhYIBZIAOo5mBAWsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAXqADqOFggGPgA6jmYEBkwAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIBpIAOo4WCAbqADqOZgQG7ADECAAEQEAAYABhYL/QACIBDmAYAAKOFggHPgA6jmYEB4wAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIB5IAOo4WCAfqADqOZgQILADECAAEQEAAYABhYL/QACIBDmAYAAKOFggIPgA6jhYICJIAOo5mBAjMAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAjqADqOFggJPgA6jmYECWwAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYICZIAOo4WCAnqADqOZgQKDADECAAEQEAAYABhYL/QACIBDmAYAAKOFggKPgA6jhYICpIAOo5mBAqsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCArqADqOFggLPgA6jmIEC0wARAgABEBAUYABhYL/QACIBDmAYAKOFggLkgA6jhYIC+oAOo5mBAvsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAw+ADqOZgQMjADECAAEQEAAYABhYL/QACIBDmAYAAKOFggMkgA6jhYIDOoAOo5mBA0sAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCA0+ADqOFggNkgA6jmYEDcwAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIDeoAOo4WCA4+ADqOZgQObADECAAEQEAAYABhYL/QACIBDmAYAAKOFggOkgA6jhYIDuoAOo5mBA8MAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCA8+ADqOFggPkgA6jhYID+oAOo4WCBA+ADhxTu2sBAAAAAAAAEbuPs4EDt4r3gQHxghEr8IEK"),this._addSourceToVideo(this.noSleepVideo,"mp4","data:video/mp4;base64,AAAAHGZ0eXBNNFYgAAACAGlzb21pc28yYXZjMQAAAAhmcmVlAAAGF21kYXTeBAAAbGliZmFhYyAxLjI4AABCAJMgBDIARwAAArEGBf//rdxF6b3m2Ui3lizYINkj7u94MjY0IC0gY29yZSAxNDIgcjIgOTU2YzhkOCAtIEguMjY0L01QRUctNCBBVkMgY29kZWMgLSBDb3B5bGVmdCAyMDAzLTIwMTQgLSBodHRwOi8vd3d3LnZpZGVvbGFuLm9yZy94MjY0Lmh0bWwgLSBvcHRpb25zOiBjYWJhYz0wIHJlZj0zIGRlYmxvY2s9MTowOjAgYW5hbHlzZT0weDE6MHgxMTEgbWU9aGV4IHN1Ym1lPTcgcHN5PTEgcHN5X3JkPTEuMDA6MC4wMCBtaXhlZF9yZWY9MSBtZV9yYW5nZT0xNiBjaHJvbWFfbWU9MSB0cmVsbGlzPTEgOHg4ZGN0PTAgY3FtPTAgZGVhZHpvbmU9MjEsMTEgZmFzdF9wc2tpcD0xIGNocm9tYV9xcF9vZmZzZXQ9LTIgdGhyZWFkcz02IGxvb2thaGVhZF90aHJlYWRzPTEgc2xpY2VkX3RocmVhZHM9MCBucj0wIGRlY2ltYXRlPTEgaW50ZXJsYWNlZD0wIGJsdXJheV9jb21wYXQ9MCBjb25zdHJhaW5lZF9pbnRyYT0wIGJmcmFtZXM9MCB3ZWlnaHRwPTAga2V5aW50PTI1MCBrZXlpbnRfbWluPTI1IHNjZW5lY3V0PTQwIGludHJhX3JlZnJlc2g9MCByY19sb29rYWhlYWQ9NDAgcmM9Y3JmIG1idHJlZT0xIGNyZj0yMy4wIHFjb21wPTAuNjAgcXBtaW49MCBxcG1heD02OSBxcHN0ZXA9NCB2YnZfbWF4cmF0ZT03NjggdmJ2X2J1ZnNpemU9MzAwMCBjcmZfbWF4PTAuMCBuYWxfaHJkPW5vbmUgZmlsbGVyPTAgaXBfcmF0aW89MS40MCBhcT0xOjEuMDAAgAAAAFZliIQL8mKAAKvMnJycnJycnJycnXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXiEASZACGQAjgCEASZACGQAjgAAAAAdBmjgX4GSAIQBJkAIZACOAAAAAB0GaVAX4GSAhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZpgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGagC/AySEASZACGQAjgAAAAAZBmqAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZrAL8DJIQBJkAIZACOAAAAABkGa4C/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmwAvwMkhAEmQAhkAI4AAAAAGQZsgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGbQC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBm2AvwMkhAEmQAhkAI4AAAAAGQZuAL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGboC/AySEASZACGQAjgAAAAAZBm8AvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZvgL8DJIQBJkAIZACOAAAAABkGaAC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmiAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZpAL8DJIQBJkAIZACOAAAAABkGaYC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmoAvwMkhAEmQAhkAI4AAAAAGQZqgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGawC/AySEASZACGQAjgAAAAAZBmuAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZsAL8DJIQBJkAIZACOAAAAABkGbIC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBm0AvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZtgL8DJIQBJkAIZACOAAAAABkGbgCvAySEASZACGQAjgCEASZACGQAjgAAAAAZBm6AnwMkhAEmQAhkAI4AhAEmQAhkAI4AhAEmQAhkAI4AhAEmQAhkAI4AAAAhubW9vdgAAAGxtdmhkAAAAAAAAAAAAAAAAAAAD6AAABDcAAQAAAQAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAzB0cmFrAAAAXHRraGQAAAADAAAAAAAAAAAAAAABAAAAAAAAA+kAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAALAAAACQAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAAAPpAAAAAAABAAAAAAKobWRpYQAAACBtZGhkAAAAAAAAAAAAAAAAAAB1MAAAdU5VxAAAAAAALWhkbHIAAAAAAAAAAHZpZGUAAAAAAAAAAAAAAABWaWRlb0hhbmRsZXIAAAACU21pbmYAAAAUdm1oZAAAAAEAAAAAAAAAAAAAACRkaW5mAAAAHGRyZWYAAAAAAAAAAQAAAAx1cmwgAAAAAQAAAhNzdGJsAAAAr3N0c2QAAAAAAAAAAQAAAJ9hdmMxAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAALAAkABIAAAASAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGP//AAAALWF2Y0MBQsAN/+EAFWdCwA3ZAsTsBEAAAPpAADqYA8UKkgEABWjLg8sgAAAAHHV1aWRraEDyXyRPxbo5pRvPAyPzAAAAAAAAABhzdHRzAAAAAAAAAAEAAAAeAAAD6QAAABRzdHNzAAAAAAAAAAEAAAABAAAAHHN0c2MAAAAAAAAAAQAAAAEAAAABAAAAAQAAAIxzdHN6AAAAAAAAAAAAAAAeAAADDwAAAAsAAAALAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAAiHN0Y28AAAAAAAAAHgAAAEYAAANnAAADewAAA5gAAAO0AAADxwAAA+MAAAP2AAAEEgAABCUAAARBAAAEXQAABHAAAASMAAAEnwAABLsAAATOAAAE6gAABQYAAAUZAAAFNQAABUgAAAVkAAAFdwAABZMAAAWmAAAFwgAABd4AAAXxAAAGDQAABGh0cmFrAAAAXHRraGQAAAADAAAAAAAAAAAAAAACAAAAAAAABDcAAAAAAAAAAAAAAAEBAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAAAQkAAADcAABAAAAAAPgbWRpYQAAACBtZGhkAAAAAAAAAAAAAAAAAAC7gAAAykBVxAAAAAAALWhkbHIAAAAAAAAAAHNvdW4AAAAAAAAAAAAAAABTb3VuZEhhbmRsZXIAAAADi21pbmYAAAAQc21oZAAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAADT3N0YmwAAABnc3RzZAAAAAAAAAABAAAAV21wNGEAAAAAAAAAAQAAAAAAAAAAAAIAEAAAAAC7gAAAAAAAM2VzZHMAAAAAA4CAgCIAAgAEgICAFEAVBbjYAAu4AAAADcoFgICAAhGQBoCAgAECAAAAIHN0dHMAAAAAAAAAAgAAADIAAAQAAAAAAQAAAkAAAAFUc3RzYwAAAAAAAAAbAAAAAQAAAAEAAAABAAAAAgAAAAIAAAABAAAAAwAAAAEAAAABAAAABAAAAAIAAAABAAAABgAAAAEAAAABAAAABwAAAAIAAAABAAAACAAAAAEAAAABAAAACQAAAAIAAAABAAAACgAAAAEAAAABAAAACwAAAAIAAAABAAAADQAAAAEAAAABAAAADgAAAAIAAAABAAAADwAAAAEAAAABAAAAEAAAAAIAAAABAAAAEQAAAAEAAAABAAAAEgAAAAIAAAABAAAAFAAAAAEAAAABAAAAFQAAAAIAAAABAAAAFgAAAAEAAAABAAAAFwAAAAIAAAABAAAAGAAAAAEAAAABAAAAGQAAAAIAAAABAAAAGgAAAAEAAAABAAAAGwAAAAIAAAABAAAAHQAAAAEAAAABAAAAHgAAAAIAAAABAAAAHwAAAAQAAAABAAAA4HN0c3oAAAAAAAAAAAAAADMAAAAaAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAACMc3RjbwAAAAAAAAAfAAAALAAAA1UAAANyAAADhgAAA6IAAAO+AAAD0QAAA+0AAAQAAAAEHAAABC8AAARLAAAEZwAABHoAAASWAAAEqQAABMUAAATYAAAE9AAABRAAAAUjAAAFPwAABVIAAAVuAAAFgQAABZ0AAAWwAAAFzAAABegAAAX7AAAGFwAAAGJ1ZHRhAAAAWm1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAALWlsc3QAAAAlqXRvbwAAAB1kYXRhAAAAAQAAAABMYXZmNTUuMzMuMTAw"),this.noSleepVideo.addEventListener("loadedmetadata",()=>{yQ("[WakeLockManager: start()] video loadedmetadata",this.noSleepVideo),this.noSleepVideo&&(this.noSleepVideo.duration<=1?this.noSleepVideo.setAttribute("loop",""):this.noSleepVideo.addEventListener("timeupdate",()=>{this.noSleepVideo&&this.noSleepVideo.currentTime>.5&&(this.noSleepVideo.currentTime=Math.random())}))}))}_addSourceToVideo(e,t,n){let r=document.createElement("source");r.src=n,r.type=`video/${t}`,e.appendChild(r)}isEnabled(){return this.enabled}setDebug(e){yQ("[WakeLockManager: setDebug()] activate debug mode"),this.debug=e}enable(){return hP(this,void 0,void 0,function*(){this.enabled&&this.disable("from_enable");let e=wK(),t=wH();if(yQ(`[WakeLockManager: enable()] hasWakelock=${e} isOldIos=${t}`,this.noSleepVideo),this.start(),wK())try{let e=yield navigator.wakeLock.request("screen");this._wakeLock=e,this.enabled=!0}catch(e){return yQ("[WakeLockManager: enable()] failed to enable wake lock",e),this.enabled=!1,!1}else if(wH())return this.disable("from_enable_old_ios"),this.noSleepTimer=window.setInterval(()=>{document.hidden||(window.location.href=window.location.href.split("#")[0],window.setTimeout(window.stop,0))},15e3),this.enabled=!0,!0;return!!this.noSleepVideo&&(this.noSleepVideo.play().then(()=>{yQ("[WakeLockManager: enable()] video started playing successfully")}).catch(e=>{console.warn("[WakeLockManager: enable()] video failed to play",e)}),this.enabled=!0,!0)})}disable(e){if(this.enabled){if(yQ(`[WakeLockManager: disable()] context=${e}`),wK())this._wakeLock&&(yQ("[WakeLockManager: disable()] release wake lock"),this._wakeLock.release()),this._wakeLock=void 0;else if(wH())this.noSleepTimer&&(console.warn("\n NoSleep now disabled for older iOS devices.\n "),window.clearInterval(this.noSleepTimer),this.noSleepTimer=void 0);else try{if(!this.noSleepVideo)return void yQ("[WakeLockManager: disable()] noSleepVideo is undefined");yQ("[WakeLockManager: disable()] pause noSleepVideo"),this.noSleepVideo.firstChild&&(this.noSleepVideo.removeChild(this.noSleepVideo.firstChild),this.noSleepVideo.load()),this.noSleepVideo.pause(),this.noSleepVideo.src="",this.noSleepVideo.remove()}catch(e){console.log(e)}this.enabled=!1}}}class w${constructor({useDeepLink:e,preferredOpenLink:t,wakeLockStatus:n=wU.UntilResponse,debug:r=!1}){this.state={wakeLock:new wV,wakeLockStatus:wU.UntilResponse,wakeLockTimer:void 0,wakeLockFeatureActive:!1,platformType:void 0,useDeeplink:!1,preferredOpenLink:void 0,debug:!1},this.state.platformType=this.getPlatformType(),this.state.useDeeplink=e,this.state.preferredOpenLink=t,this.state.wakeLockStatus=n,this.state.debug=r,this.state.wakeLock.setDebug(r)}enableWakeLock(){return function(e){let{state:t}=e;if(t.wakeLockStatus===wU.Disabled)return void yQ("[PlatfformManager: enableWakeLock()] WakeLock is disabled");t.wakeLock.enable().catch(e=>{console.error("[PlatfformManager: enableWakeLock()] WakeLock is not supported",e)});let n=t.wakeLockStatus===wU.Temporary?2e3:4e4;t.wakeLockTimer=setTimeout(()=>{e.disableWakeLock()},n),t.wakeLockFeatureActive||t.wakeLockStatus!==wU.UntilResponse||(t.wakeLockFeatureActive=!0,window.addEventListener("focus",()=>{e.disableWakeLock()}))}(this)}disableWakeLock(){return function(e){let{state:t}=e;t.wakeLockStatus!==wU.Disabled&&(t.wakeLockTimer&&clearTimeout(t.wakeLockTimer),t.wakeLock.disable("disableWakeLock"))}(this)}openDeeplink(e,t,n){return function(e,t,n,r){let{state:i}=e;yQ(`[PlatfformManager: openDeeplink()] universalLink --> ${t}`),yQ(`[PlatfformManager: openDeeplink()] deepLink --> ${n}`),e.isBrowser()&&e.enableWakeLock();try{if(i.preferredOpenLink)return void i.preferredOpenLink(i.useDeeplink?n:t,r);if(yQ(`[PlatfformManager: openDeeplink()] open link now useDeepLink=${i.useDeeplink} link=${i.useDeeplink?n:t}`),"undefined"!=typeof window){let e;e=i.useDeeplink?window.open(n,"_blank"):window.open(t,"_blank"),setTimeout(()=>{var t;return null===(t=null==e?void 0:e.close)||void 0===t?void 0:t.call(e)},500)}}catch(e){console.log("[PlatfformManager: openDeeplink()] can't open link",e)}}(this,e,t,n)}isReactNative(){var e;return this.isNotBrowser()&&"undefined"!=typeof window&&(null==window?void 0:window.navigator)&&"ReactNative"===(null===(e=window.navigator)||void 0===e?void 0:e.product)}isMetaMaskInstalled(){return function(){let e=wb.getProvider()||(null==window?void 0:window.ethereum);return yQ(`[PlatfformManager: isMetaMaskInstalled()] isMetaMask=${null==e?void 0:e.isMetaMask} isConnected=${null==e?void 0:e.isConnected()}`),(null==e?void 0:e.isMetaMask)&&(null==e?void 0:e.isConnected())}()}isDesktopWeb(){return this.isBrowser()&&!this.isMobileWeb()}isMobile(){var e,t;let n=wq.parse(window.navigator.userAgent);return"mobile"===(null===(e=null==n?void 0:n.platform)||void 0===e?void 0:e.type)||"tablet"===(null===(t=null==n?void 0:n.platform)||void 0===t?void 0:t.type)}isSecure(){return this.isReactNative()||this.isMobileWeb()}isMetaMaskMobileWebView(){return"undefined"!=typeof window&&!!window.ReactNativeWebView&&!!navigator.userAgent.endsWith("MetaMaskMobile")}isMobileWeb(){return this.state.platformType===e.PlatformType.MobileWeb}isNotBrowser(){var e;return"undefined"==typeof window||!(null==window?void 0:window.navigator)||void 0!==n.g&&"ReactNative"===(null===(e=null===n.g||void 0===n.g?void 0:n.g.navigator)||void 0===e?void 0:e.product)||"ReactNative"===(null==navigator?void 0:navigator.product)}isNodeJS(){return this.isNotBrowser()&&!this.isReactNative()}isBrowser(){return!this.isNotBrowser()}isUseDeepLink(){return this.state.useDeeplink}getPlatformType(){return function(t){let{state:n}=t;return n.platformType?n.platformType:t.isReactNative()?e.PlatformType.ReactNative:t.isNotBrowser()?e.PlatformType.NonBrowser:t.isMetaMaskMobileWebView()?e.PlatformType.MetaMaskMobileWebview:t.isMobile()?e.PlatformType.MobileWeb:e.PlatformType.DesktopWeb}(this)}}var wW="INSTALLED",wY="NOT_INSTALLED",wG="REGISTERED",wQ="REGISTERING",wZ="RELOADING",wJ={CHROME:"https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn",FIREFOX:"https://addons.mozilla.org/firefox/addon/ether-metamask/",DEFAULT:"https://metamask.io"},wX="REGISTRATION_IN_PROGRESS",w0="FORWARDER_ID",w1=function(){function e(t){var n=void 0===t?{}:t,r=n.forwarderOrigin,i=n.forwarderMode,o=void 0===i?e.FORWARDER_MODE.INJECT:i;this.forwarderOrigin=void 0===r?"https://fwd.metamask.io":r,this.forwarderMode=o,this.state=e.isMetaMaskInstalled()?wW:wY;var a=e._detectBrowser();this.downloadUrl=a?wJ[a]:wJ.DEFAULT,this._onMessage=this._onMessage.bind(this),this._onMessageFromForwarder=this._onMessageFromForwarder.bind(this),this._openForwarder=this._openForwarder.bind(this),this._openDownloadPage=this._openDownloadPage.bind(this),this.startOnboarding=this.startOnboarding.bind(this),this.stopOnboarding=this.stopOnboarding.bind(this),window.addEventListener("message",this._onMessage),o===e.FORWARDER_MODE.INJECT&&"true"===sessionStorage.getItem(wX)&&e._injectForwarder(this.forwarderOrigin)}return e.prototype._onMessage=function(e){if(e.origin===this.forwarderOrigin)return"metamask:reload"===e.data.type?this._onMessageFromForwarder(e):void console.debug("Unknown message from '"+e.origin+"' with data "+JSON.stringify(e.data))},e.prototype._onMessageUnknownStateError=function(e){throw Error("Unknown state: '"+e+"'")},e.prototype._onMessageFromForwarder=function(t){var n,r,i,o;return n=this,r=void 0,i=void 0,o=function(){return function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]1?t-1:0),r=1;r1?t-1:0),r=1;r1){for(var c=Array(u),d=0;d1){for(var f=Array(d),h=0;h import('./MyComponent'))\n\nDid you accidentally put curly braces around the import?",n),"default"in n||S("lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))",n),n.default}throw e._result}function eo(e){return"string"==typeof e||"function"==typeof e||!!(e===r||e===o||e===i||e===u||e===c||e===h)||"object"==typeof e&&null!==e&&(e.$$typeof===f||e.$$typeof===d||e.$$typeof===a||e.$$typeof===s||e.$$typeof===l||e.$$typeof===es||void 0!==e.getModuleId)}function ea(){var e=g.current;return null===e&&S("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem."),e}es=Symbol.for("react.module.reference");var es,el,eu,ec,ed,ef,eh,ep,em=0;function eg(){}eg.__reactDisabledLog=!0;var ev,eb=_.ReactCurrentDispatcher;function ey(e,t,n){if(void 0===ev)try{throw Error()}catch(e){var r=e.stack.trim().match(/\n( *(at )?)/);ev=r&&r[1]||""}return"\n"+ev+e}var eA,ew=!1;function e_(e,t){if(!e||ew)return"";var n,r=eA.get(e);if(void 0!==r)return r;ew=!0;var i,o=Error.prepareStackTrace;Error.prepareStackTrace=void 0,i=eb.current,eb.current=null,function(){if(0===em){el=console.log,eu=console.info,ec=console.warn,ed=console.error,ef=console.group,eh=console.groupCollapsed,ep=console.groupEnd;var e={configurable:!0,enumerable:!0,value:eg,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}em++}();try{if(t){var a=function(){throw Error()};if(Object.defineProperty(a.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(a,[])}catch(e){n=e}Reflect.construct(e,[],a)}else{try{a.call()}catch(e){n=e}e.call(a.prototype)}}else{try{throw Error()}catch(e){n=e}e()}}catch(t){if(t&&n&&"string"==typeof t.stack){for(var s=t.stack.split("\n"),l=n.stack.split("\n"),u=s.length-1,c=l.length-1;u>=1&&c>=0&&s[u]!==l[c];)c--;for(;u>=1&&c>=0;u--,c--)if(s[u]!==l[c]){if(1!==u||1!==c)do if(u--,--c<0||s[u]!==l[c]){var d="\n"+s[u].replace(" at new "," at ");return e.displayName&&d.includes("")&&(d=d.replace("",e.displayName)),"function"==typeof e&&eA.set(e,d),d}while(u>=1&&c>=0);break}}}finally{ew=!1,eb.current=i,function(){if(0==--em){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:R({},e,{value:el}),info:R({},e,{value:eu}),warn:R({},e,{value:ec}),error:R({},e,{value:ed}),group:R({},e,{value:ef}),groupCollapsed:R({},e,{value:eh}),groupEnd:R({},e,{value:ep})})}em<0&&S("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=o}var f=e?e.displayName||e.name:"",h=f?ey(f):"";return"function"==typeof e&&eA.set(e,h),h}function eE(e,t,n){if(null==e)return"";if("function"==typeof e){var r;return e_(e,!(!(r=e.prototype)||!r.isReactComponent))}if("string"==typeof e)return ey(e);switch(e){case u:return ey("Suspense");case c:return ey("SuspenseList")}if("object"==typeof e)switch(e.$$typeof){case l:return e_(e.render,!1);case d:return eE(e.type,t,n);case f:var i=e._payload,o=e._init;try{return eE(o(i),t,n)}catch(e){}}return""}eA=new("function"==typeof WeakMap?WeakMap:Map);var eS,ek={},eM=_.ReactDebugCurrentFrame;function eC(e){if(e){var t=e._owner,n=eE(e.type,e._source,t?t.type:null);eM.setExtraStackFrame(n)}else eM.setExtraStackFrame(null)}function ex(e){if(e){var t=e._owner;w=eE(e.type,e._source,t?t.type:null)}else w=null}function eR(){if(y.current){var e=U(y.current.type);if(e)return"\n\nCheck the render method of `"+e+"`."}return""}eS=!1;var eI={};function eT(e,t){if(e._store&&!e._store.validated&&null==e.key){e._store.validated=!0;var n=function(e){var t=eR();if(!t){var n="string"==typeof e?e:e.displayName||e.name;n&&(t="\n\nCheck the top-level render call using <"+n+">.")}return t}(t);if(!eI[n]){eI[n]=!0;var r="";e&&e._owner&&e._owner!==y.current&&(r=" It was passed a child from "+U(e._owner.type)+"."),ex(e),S('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',n,r),ex(null)}}}function eO(e,t){if("object"==typeof e){if(j(e))for(var n=0;n",l=" Did you accidentally export a JSX literal instead of a component?"):s=typeof e,S("React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",s,l)}var u=Q.apply(this,arguments);if(null==u)return u;if(a)for(var c=2;c ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."));var t=new MessageChannel;t.port1.onmessage=e,t.port2.postMessage(void 0)}}eB(e)}(function(){0===r.length?(b.current=null,t(e)):eU(e,t,n)})}catch(e){n(e)}else t(e)}var eq=!1;function eK(e){if(!eq){eq=!0;var t=0;try{for(;t is not supported and will be removed in a future major release. Did you mean to render instead?")),t.Provider},set:function(e){t.Provider=e}},_currentValue:{get:function(){return t._currentValue},set:function(e){t._currentValue=e}},_currentValue2:{get:function(){return t._currentValue2},set:function(e){t._currentValue2=e}},_threadCount:{get:function(){return t._threadCount},set:function(e){t._threadCount=e}},Consumer:{get:function(){return n||(n=!0,S("Rendering is not supported and will be removed in a future major release. Did you mean to render instead?")),t.Consumer}},displayName:{get:function(){return t.displayName},set:function(e){i||(E("Setting `displayName` on Context.Consumer has no effect. You should set it directly on the context with Context.displayName = '%s'.",e),i=!0)}}}),t.Consumer=o,t._currentRenderer=null,t._currentRenderer2=null,t},e.createElement=eL,e.createFactory=function(e){var t=eL.bind(null,e);return t.type=e,eN||(eN=!0,E("React.createFactory() is deprecated and will be removed in a future major release. Consider using JSX or use React.createElement() directly instead.")),Object.defineProperty(t,"type",{enumerable:!1,get:function(){return E("Factory.type is deprecated. Access the class directly before passing it to createFactory."),Object.defineProperty(this,"type",{value:e}),e}}),t},e.createRef=function(){var e={current:null};return Object.seal(e),e},e.forwardRef=function(e){null!=e&&e.$$typeof===d?S("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):"function"!=typeof e?S("forwardRef requires a render function but was given %s.",null===e?"null":typeof e):0!==e.length&&2!==e.length&&S("forwardRef render functions accept exactly two parameters: props and ref. %s",1===e.length?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),null!=e&&(null==e.defaultProps&&null==e.propTypes||S("forwardRef render functions do not support propTypes or defaultProps. Did you accidentally pass a React component?"));var t,n={$$typeof:l,render:e};return Object.defineProperty(n,"displayName",{enumerable:!1,configurable:!0,get:function(){return t},set:function(n){t=n,e.name||e.displayName||(e.displayName=n)}}),n},e.isValidElement=J,e.lazy=function(e){var t,n,r={$$typeof:f,_payload:{_status:-1,_result:e},_init:ei};return Object.defineProperties(r,{defaultProps:{configurable:!0,get:function(){return t},set:function(e){S("React.lazy(...): It is not supported to assign `defaultProps` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."),t=e,Object.defineProperty(r,"defaultProps",{enumerable:!0})}},propTypes:{configurable:!0,get:function(){return n},set:function(e){S("React.lazy(...): It is not supported to assign `propTypes` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."),n=e,Object.defineProperty(r,"propTypes",{enumerable:!0})}}}),r},e.memo=function(e,t){eo(e)||S("memo: The first argument must be a component. Instead received: %s",null===e?"null":typeof e);var n,r={$$typeof:d,type:e,compare:void 0===t?null:t};return Object.defineProperty(r,"displayName",{enumerable:!1,configurable:!0,get:function(){return n},set:function(t){n=t,e.name||e.displayName||(e.displayName=t)}}),r},e.startTransition=function(e,t){var n=v.transition;v.transition={};var r=v.transition;v.transition._updatedFibers=new Set;try{e()}finally{v.transition=n,null===n&&r._updatedFibers&&(r._updatedFibers.size>10&&E("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table."),r._updatedFibers.clear())}},e.unstable_act=function(e){var t=ej;ej++,null===b.current&&(b.current=[]);var n,r=b.isBatchingLegacy;try{if(b.isBatchingLegacy=!0,n=e(),!r&&b.didScheduleLegacyUpdate){var i=b.current;null!==i&&(b.didScheduleLegacyUpdate=!1,eK(i))}}catch(e){throw ez(t),e}finally{b.isBatchingLegacy=r}if(null!==n&&"object"==typeof n&&"function"==typeof n.then){var o=n,a=!1;return eF||"undefined"==typeof Promise||Promise.resolve().then(function(){}).then(function(){a||(eF=!0,S("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"))}),{then:function(e,n){a=!0,o.then(function(r){ez(t),0===ej?eU(r,e,n):e(r)},function(e){ez(t),n(e)})}}}var s=n;if(ez(t),0===ej){var l=b.current;return null!==l&&(eK(l),b.current=null),{then:function(e,t){null===b.current?(b.current=[],eU(s,e,t)):e(s)}}}return{then:function(e,t){e(s)}}},e.useCallback=function(e,t){return ea().useCallback(e,t)},e.useContext=function(e){var t=ea();if(void 0!==e._context){var n=e._context;n.Consumer===e?S("Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be removed in a future major release. Did you mean to call useContext(Context) instead?"):n.Provider===e&&S("Calling useContext(Context.Provider) is not supported. Did you mean to call useContext(Context) instead?")}return t.useContext(e)},e.useDebugValue=function(e,t){return ea().useDebugValue(e,t)},e.useDeferredValue=function(e){return ea().useDeferredValue(e)},e.useEffect=function(e,t){return ea().useEffect(e,t)},e.useId=function(){return ea().useId()},e.useImperativeHandle=function(e,t,n){return ea().useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return ea().useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return ea().useLayoutEffect(e,t)},e.useMemo=function(e,t){return ea().useMemo(e,t)},e.useReducer=function(e,t,n){return ea().useReducer(e,t,n)},e.useRef=function(e){return ea().useRef(e)},e.useState=function(e){return ea().useState(e)},e.useSyncExternalStore=function(e,t,n){return ea().useSyncExternalStore(e,t,n)},e.useTransition=function(){return ea().useTransition()},e.version="18.2.0","undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),_e.exports)),w7.exports}_e.exports;var _n,_r,_i,_o,_a={},_s={exports:{}},_l={},_u={exports:{}},_c={},_d={};function _f(){return _i||(_i=1,"production"===ex.env.NODE_ENV?_u.exports=(_n||(_n=1,function(e){function t(e,t){var n=e.length;for(e.push(t);0>>1,o=e[r];if(!(0>>1;ri(l,n))ui(c,l)?(e[r]=c,e[u]=n,r=u):(e[r]=l,e[s]=n,r=s);else{if(!(ui(c,n)))break;e[r]=c,e[u]=n,r=u}}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if("object"==typeof performance&&"function"==typeof performance.now){var o=performance;e.unstable_now=function(){return o.now()}}else{var a=Date,s=a.now();e.unstable_now=function(){return a.now()-s}}var l=[],u=[],c=1,d=null,f=3,h=!1,p=!1,m=!1,g="function"==typeof setTimeout?setTimeout:null,v="function"==typeof clearTimeout?clearTimeout:null,b="undefined"!=typeof setImmediate?setImmediate:null;function y(e){for(var i=n(u);null!==i;){if(null===i.callback)r(u);else{if(!(i.startTime<=e))break;r(u),i.sortIndex=i.expirationTime,t(l,i)}i=n(u)}}function A(e){if(m=!1,y(e),!p){if(null!==n(l))p=!0,O(w);else{var t=n(u);null!==t&&P(A,t.startTime-e)}}}function w(t,i){p=!1,m&&(m=!1,v(k),k=-1),h=!0;var o=f;try{for(y(i),d=n(l);null!==d&&(!(d.expirationTime>i)||t&&!x());){var a=d.callback;if("function"==typeof a){d.callback=null,f=d.priorityLevel;var s=a(d.expirationTime<=i);i=e.unstable_now(),"function"==typeof s?d.callback=s:d===n(l)&&r(l),y(i)}else r(l);d=n(l)}if(null!==d)var c=!0;else{var g=n(u);null!==g&&P(A,g.startTime-i),c=!1}return c}finally{d=null,f=o,h=!1}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var _,E=!1,S=null,k=-1,M=5,C=-1;function x(){return!(e.unstable_now()-Ce||125a?(r.sortIndex=o,t(u,r),null===n(l)&&r===n(u)&&(m?(v(k),k=-1):m=!0,P(A,o-a))):(r.sortIndex=s,t(l,r),p||h||(p=!0,O(w))),r},e.unstable_shouldYield=x,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}}(_c)),_c):_u.exports=(_r||(_r=1,"production"!==ex.env.NODE_ENV&&function(){function e(e,t){var n=e.length;e.push(t),function(e,t,n){for(var i=n;i>0;){var o=i-1>>>1,a=e[o];if(!(r(a,t)>0))return;e[o]=t,e[i]=a,i=o}}(e,t,n)}function t(e){return 0===e.length?null:e[0]}function n(e){if(0===e.length)return null;var t=e[0],n=e.pop();return n!==t&&(e[0]=n,function(e,t,n){for(var i=0,o=e.length,a=o>>>1;ir(l,t))ur(c,l)?(e[i]=c,e[u]=t,i=u):(e[i]=l,e[s]=t,i=s);else{if(!(ur(c,t)))return;e[i]=c,e[u]=t,i=u}}}(e,n,0)),t}function r(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()),"object"==typeof performance&&"function"==typeof performance.now){var i=performance;_d.unstable_now=function(){return i.now()}}else{var o=Date,a=o.now();_d.unstable_now=function(){return o.now()-a}}var s=[],l=[],u=1,c=null,d=3,f=!1,h=!1,p=!1,m="function"==typeof setTimeout?setTimeout:null,g="function"==typeof clearTimeout?clearTimeout:null,v="undefined"!=typeof setImmediate?setImmediate:null;function b(r){for(var i=t(l);null!==i;){if(null===i.callback)n(l);else{if(!(i.startTime<=r))return;n(l),i.sortIndex=i.expirationTime,e(s,i)}i=t(l)}}function y(e){if(p=!1,b(e),!h){if(null!==t(s))h=!0,T(A);else{var n=t(l);null!==n&&O(y,n.startTime-e)}}}function A(e,r){h=!1,p&&(p=!1,g(E),E=-1),f=!0;var i=d;try{return function(e,r){var i=r;for(b(i),c=t(s);null!==c&&(!(c.expirationTime>i)||e&&!M());){var o=c.callback;if("function"==typeof o){c.callback=null,d=c.priorityLevel;var a=o(c.expirationTime<=i);i=_d.unstable_now(),"function"==typeof a?c.callback=a:c===t(s)&&n(s),b(i)}else n(s);c=t(s)}if(null!==c)return!0;var u=t(l);return null!==u&&O(y,u.startTime-i),!1}(e,r)}finally{c=null,d=i,f=!1}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var w=!1,_=null,E=-1,S=5,k=-1;function M(){return!(_d.unstable_now()-k125?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):S=e>0?Math.floor(1e3/e):5},_d.unstable_getCurrentPriorityLevel=function(){return d},_d.unstable_getFirstCallbackNode=function(){return t(s)},_d.unstable_next=function(e){switch(d){case 1:case 2:case 3:t=3;break;default:t=d}var t,n=d;d=t;try{return e()}finally{d=n}},_d.unstable_pauseExecution=function(){},_d.unstable_requestPaint=function(){},_d.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=d;d=e;try{return t()}finally{d=n}},_d.unstable_scheduleCallback=function(n,r,i){var o,a,c=_d.unstable_now();if("object"==typeof i&&null!==i){var d=i.delay;o="number"==typeof d&&d>0?c+d:c}else o=c;switch(n){case 1:a=-1;break;case 2:a=250;break;case 5:a=1073741823;break;case 4:a=1e4;break;default:a=5e3}var m=o+a,v={id:u++,callback:r,priorityLevel:n,startTime:o,expirationTime:m,sortIndex:-1};return o>c?(v.sortIndex=o,e(l,v),null===t(s)&&v===t(l)&&(p?(g(E),E=-1):p=!0,O(y,o-c))):(v.sortIndex=m,e(s,v),h||f||(h=!0,T(A))),v},_d.unstable_shouldYield=M,_d.unstable_wrapCallback=function(e){var t=d;return function(){var n=d;d=t;try{return e.apply(this,arguments)}finally{d=n}}},"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),_d)),_u.exports}var _h,_p,_m,_g,_v={},_b={exports:{}};function _y(){return _g||(_g=1,self,_b.exports=(()=>{var e={192:(e,t)=>{var n,r,i=function(){var e,t,n=function(e,t){var n=e,r=a[t],i=null,o=0,l=null,g=[],v={},y=function(e,t){i=function(e){for(var t=Array(e),n=0;n=7&&E(e),null==l&&(l=M(n,r,g)),k(l,t)},A=function(e,t){for(var n=-1;n<=7;n+=1)if(!(e+n<=-1||o<=e+n))for(var r=-1;r<=7;r+=1)t+r<=-1||o<=t+r||(i[e+n][t+r]=0<=n&&n<=6&&(0==r||6==r)||0<=r&&r<=6&&(0==n||6==n)||2<=n&&n<=4&&2<=r&&r<=4)},w=function(){for(var e=8;e>r&1);i[Math.floor(r/3)][r%3+o-8-3]=a}for(r=0;r<18;r+=1)a=!e&&1==(t>>r&1),i[r%3+o-8-3][Math.floor(r/3)]=a},S=function(e,t){for(var n=r<<3|t,a=s.getBCHTypeInfo(n),l=0;l<15;l+=1){var u=!e&&1==(a>>l&1);l<6?i[l][8]=u:l<8?i[l+1][8]=u:i[o-15+l][8]=u}for(l=0;l<15;l+=1)u=!e&&1==(a>>l&1),l<8?i[8][o-l-1]=u:l<9?i[8][15-l-1+1]=u:i[8][15-l-1]=u;i[o-8][8]=!e},k=function(e,t){for(var n=-1,r=o-1,a=7,l=0,u=s.getMaskFunction(t),c=o-1;c>0;c-=2)for(6==c&&(c-=1);;){for(var d=0;d<2;d+=1)if(null==i[r][c-d]){var f=!1;l>>a&1)),u(r,c-d)&&(f=!f),i[r][c-d]=f,-1==(a-=1)&&(l+=1,a=7)}if((r+=n)<0||o<=r){r-=n,n=-n;break}}},M=function(e,t,n){for(var r=c.getRSBlocks(e,t),i=d(),o=0;o8*l)throw"code length overflow. ("+i.getLengthInBits()+">"+8*l+")";for(i.getLengthInBits()+4<=8*l&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(!1);for(;!(i.getLengthInBits()>=8*l||(i.put(236,8),i.getLengthInBits()>=8*l));)i.put(17,8);return function(e,t){for(var n=0,r=0,i=0,o=Array(t.length),a=Array(t.length),l=0;l=0?p.getAt(m):0}}var g=0;for(f=0;fr)&&(e=r,t=n)}return t}())},v.createTableTag=function(e,t){e=e||2;var n="";n+='';for(var r=0;r";for(var i=0;i';n+=""}return(n+="")+"
"},v.createSvgTag=function(e,t,n,r){var i={};"object"==typeof arguments[0]&&(e=(i=arguments[0]).cellSize,t=i.margin,n=i.alt,r=i.title),e=e||2,t=void 0===t?4*e:t,(n="string"==typeof n?{text:n}:n||{}).text=n.text||null,n.id=n.text?n.id||"qrcode-description":null,(r="string"==typeof r?{text:r}:r||{}).text=r.text||null,r.id=r.text?r.id||"qrcode-title":null;var o,a,s,l,u=v.getModuleCount()*e+2*t,c="";for(l="l"+e+",0 0,"+e+" -"+e+",0 0,-"+e+"z ",c+='"+(r.text?''+C(r.text)+"":"")+(n.text?''+C(n.text)+"":"")+'"},v.createDataURL=function(e,t){e=e||2,t=void 0===t?4*e:t;var n=v.getModuleCount()*e+2*t,r=t,i=n-t;return b(n,n,function(t,n){if(r<=t&&t"};var C=function(e){for(var t="",n=0;n":t+=">";break;case"&":t+="&";break;case'"':t+=""";break;default:t+=r}}return t};return v.createASCII=function(e,t){if((e=e||1)<2)return function(e){e=void 0===e?2:e;var t,n,r,i,o,a=1*v.getModuleCount()+2*e,s=e,l=a-e,u={"██":"█","█ ":"▀"," █":"▄"," ":" "},c={"██":"▀","█ ":"▀"," █":" "," ":" "},d="";for(t=0;t=l?c[o]:u[o];d+="\n"}return a%2&&e>0?d.substring(0,d.length-a-1)+Array(a+1).join("▀"):d.substring(0,d.length-1)}(t);e-=1,t=void 0===t?2*e:t;var n,r,i,o,a=v.getModuleCount()*e+2*t,s=t,l=a-t,u=Array(e+1).join("██"),c=Array(e+1).join(" "),d="",f="";for(n=0;n>>8),t.push(255&o)):t.push(63)}}return t}};var r,i,o,a={L:1,M:0,Q:3,H:2},s=(r=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],o=function(e){for(var t=0;0!=e;)t+=1,e>>>=1;return t},(i={}).getBCHTypeInfo=function(e){for(var t=e<<10;o(t)-o(1335)>=0;)t^=1335<=0;)t^=7973<5&&(n+=3+o-5)}for(r=0;r=256;)t-=255;return e[t]}}}();function u(e,t){if(void 0===e.length)throw e.length+"/"+t;var n=function(){for(var n=0;n>>7-t%8&1)},put:function(e,t){for(var r=0;r>>t-r-1&1))},getLengthInBits:function(){return t},putBit:function(n){var r=Math.floor(t/8);e.length<=r&&e.push(0),n&&(e[r]|=128>>>t%8),t+=1}};return n},f=function(e){var t=function(e){for(var t=0,r=0;r>>8&255)+(255&n),e.put(n,13),t+=2}if(t>>8)},writeBytes:function(e,n,r){n=n||0,r=r||e.length;for(var i=0;i0&&(t+=","),t+=e[n];return t+"]"}};return t},v=function(e){var t=0,n=0,r=0,i=function(e){if(65<=e&&e<=90)return e-65;if(97<=e&&e<=122)return e-97+26;if(48<=e&&e<=57)return e-48+52;if(43==e)return 62;if(47==e)return 63;throw"c:"+e};return{read:function(){for(;r<8;){if(t>=e.length){if(0==r)return -1;throw"unexpected end of file./"+r}var o=e.charAt(t);if(t+=1,"="==o)return r=0,-1;o.match(/^\s$/)||(n=n<<6|i(o.charCodeAt(0)),r+=6)}var a=n>>>r-8&255;return r-=8,a}}},b=function(e,t,n){for(var r,i,o,a,s,l,u,c,d,f,h=(r=Array(e*t),i=function(e){for(var t=1<>>t!=0)throw"length over";for(;l+t>=8;)c.writeByte(255&(e<>>=8-l,u=0,l=0;u|=e<0&&c.writeByte(u)}});d.write(t,i);var f=0,h=String.fromCharCode(r[0]);for(f+=1;fa.size()&&(a.size()==1<255;)n.writeByte(255),n.writeBytes(r,o,255),o+=255;n.writeByte(r.length-o),n.writeBytes(r,o,r.length-o),n.writeByte(0),n.writeString(";")}}),p=0;p=6;)d(a>>>s-6),s-=6},c.flush=function(){if(s>0&&(d(a<<6-s),a=0,s=0),l%3!=0)for(var e=3-l%3,t=0;t>6,128|63&r):r<55296||r>=57344?t.push(224|r>>12,128|r>>6&63,128|63&r):(n++,r=65536+((1023&r)<<10|1023&e.charCodeAt(n)),t.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|63&r))}return t}(e)},void 0===(r="function"==typeof(n=function(){return i})?n.apply(t,[]):n)||(e.exports=r)},676:(e,t,n)=>{n.d(t,{default:()=>O});var r=function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n2||o&&a||s&&l)this._basicSquare({x:t,y:n,size:r,rotation:0});else{if(2===u){var c=0;return o&&s?c=Math.PI/2:s&&a?c=Math.PI:a&&l&&(c=-Math.PI/2),void this._basicCornerRounded({x:t,y:n,size:r,rotation:c})}if(1===u)return c=0,s?c=Math.PI/2:a?c=Math.PI:l&&(c=-Math.PI/2),void this._basicSideRounded({x:t,y:n,size:r,rotation:c})}}else this._basicDot({x:t,y:n,size:r,rotation:0})},e.prototype._drawExtraRounded=function(e){var t=e.x,n=e.y,r=e.size,i=e.getNeighbor,o=i?+i(-1,0):0,a=i?+i(1,0):0,s=i?+i(0,-1):0,l=i?+i(0,1):0,u=o+a+s+l;if(0!==u){if(u>2||o&&a||s&&l)this._basicSquare({x:t,y:n,size:r,rotation:0});else{if(2===u){var c=0;return o&&s?c=Math.PI/2:s&&a?c=Math.PI:a&&l&&(c=-Math.PI/2),void this._basicCornerExtraRounded({x:t,y:n,size:r,rotation:c})}if(1===u)return c=0,s?c=Math.PI/2:a?c=Math.PI:l&&(c=-Math.PI/2),void this._basicSideRounded({x:t,y:n,size:r,rotation:c})}}else this._basicDot({x:t,y:n,size:r,rotation:0})},e.prototype._drawClassy=function(e){var t=e.x,n=e.y,r=e.size,i=e.getNeighbor,o=i?+i(-1,0):0,a=i?+i(1,0):0,s=i?+i(0,-1):0,l=i?+i(0,1):0;0!==o+a+s+l?o||s?a||l?this._basicSquare({x:t,y:n,size:r,rotation:0}):this._basicCornerRounded({x:t,y:n,size:r,rotation:Math.PI/2}):this._basicCornerRounded({x:t,y:n,size:r,rotation:-Math.PI/2}):this._basicCornersRounded({x:t,y:n,size:r,rotation:Math.PI/2})},e.prototype._drawClassyRounded=function(e){var t=e.x,n=e.y,r=e.size,i=e.getNeighbor,o=i?+i(-1,0):0,a=i?+i(1,0):0,s=i?+i(0,-1):0,l=i?+i(0,1):0;0!==o+a+s+l?o||s?a||l?this._basicSquare({x:t,y:n,size:r,rotation:0}):this._basicCornerExtraRounded({x:t,y:n,size:r,rotation:Math.PI/2}):this._basicCornerExtraRounded({x:t,y:n,size:r,rotation:-Math.PI/2}):this._basicCornersRounded({x:t,y:n,size:r,rotation:Math.PI/2})},e}();var d=function(){return(d=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]r||i&&i=(t-i.hideXDots)/2&&e<(t+i.hideXDots)/2&&n>=(t-i.hideYDots)/2&&n<(t+i.hideYDots)/2||(null===(r=b[e])||void 0===r?void 0:r[n])||(null===(o=b[e-t+7])||void 0===o?void 0:o[n])||(null===(a=b[e])||void 0===a?void 0:a[n-t+7])||(null===(s=y[e])||void 0===s?void 0:s[n])||(null===(l=y[e-t+7])||void 0===l?void 0:l[n])||(null===(u=y[e])||void 0===u?void 0:u[n-t+7]))}),this.drawCorners(),this._options.image?[4,this.drawImage({width:i.width,height:i.height,count:t,dotSize:r})]:[3,4];case 3:d.sent(),d.label=4;case 4:return[2]}})})},e.prototype.drawBackground=function(){var e,t,n,r=this._element,i=this._options;if(r){var o=null===(e=i.backgroundOptions)||void 0===e?void 0:e.gradient,a=null===(t=i.backgroundOptions)||void 0===t?void 0:t.color;if((o||a)&&this._createColor({options:o,color:a,additionalRotation:0,x:0,y:0,height:i.height,width:i.width,name:"background-color"}),null===(n=i.backgroundOptions)||void 0===n?void 0:n.round){var s=Math.min(i.width,i.height),l=document.createElementNS("http://www.w3.org/2000/svg","rect");this._backgroundClipPath=document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._backgroundClipPath.setAttribute("id","clip-path-background-color"),this._defs.appendChild(this._backgroundClipPath),l.setAttribute("x",String((i.width-s)/2)),l.setAttribute("y",String((i.height-s)/2)),l.setAttribute("width",String(s)),l.setAttribute("height",String(s)),l.setAttribute("rx",String(s/2*i.backgroundOptions.round)),this._backgroundClipPath.appendChild(l)}}},e.prototype.drawDots=function(e){var t,n,r=this;if(!this._qr)throw"QR code is not defined";var i=this._options,o=this._qr.getModuleCount();if(o>i.width||o>i.height)throw"The canvas is too small.";var a=Math.min(i.width,i.height)-2*i.margin,s=Math.floor((i.shape===m?a/Math.sqrt(2):a)/o),l=Math.floor((i.width-o*s)/2),u=Math.floor((i.height-o*s)/2),d=new c({svg:this._element,type:i.dotsOptions.type});this._dotsClipPath=document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._dotsClipPath.setAttribute("id","clip-path-dot-color"),this._defs.appendChild(this._dotsClipPath),this._createColor({options:null===(t=i.dotsOptions)||void 0===t?void 0:t.gradient,color:i.dotsOptions.color,additionalRotation:0,x:0,y:0,height:i.height,width:i.width,name:"dot-color"});for(var f=function(t){for(var i=function(i){return e&&!e(t,i)?"continue":(null===(n=h._qr)||void 0===n?void 0:n.isDark(t,i))?(d.draw(l+t*s,u+i*s,s,function(n,a){return!(t+n<0||i+a<0||t+n>=o||i+a>=o)&&!(e&&!e(t+n,i+a))&&!!r._qr&&r._qr.isDark(t+n,i+a)}),void(d._element&&h._dotsClipPath&&h._dotsClipPath.appendChild(d._element))):"continue"},a=0;a=g-1&&p<=v-g&&_>=g-1&&_<=v-g||Math.sqrt((p-w)*(p-w)+(_-w)*(_-w))>w?A[p][_]=0:A[p][_]=this._qr.isDark(_-2*g<0?_:_>=o?_-2*g:_-g,p-2*g<0?p:p>=o?p-2*g:p-g)?1:0}var E=function(e){for(var t=function(t){if(!A[e][t])return"continue";d.draw(b+e*s,y+t*s,s,function(n,r){var i;return!!(null===(i=A[e+n])||void 0===i?void 0:i[t+r])}),d._element&&S._dotsClipPath&&S._dotsClipPath.appendChild(d._element)},n=0;n0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]s?l:s)/2));else{var d=((n.rotation||0)+i)%(2*Math.PI),f=(d+2*Math.PI)%(2*Math.PI),h=o+l/2,p=a+s/2,m=o+l/2,g=a+s/2;f>=0&&f<=.25*Math.PI||f>1.75*Math.PI&&f<=2*Math.PI?(h-=l/2,p-=s/2*Math.tan(d),m+=l/2,g+=s/2*Math.tan(d)):f>.25*Math.PI&&f<=.75*Math.PI?(p-=s/2,h-=l/2/Math.tan(d),g+=s/2,m+=l/2/Math.tan(d)):f>.75*Math.PI&&f<=1.25*Math.PI?(h+=l/2,p+=s/2*Math.tan(d),m-=l/2,g-=s/2*Math.tan(d)):f>1.25*Math.PI&&f<=1.75*Math.PI&&(p+=s/2,h+=l/2/Math.tan(d),g-=s/2,m-=l/2/Math.tan(d)),(t=document.createElementNS("http://www.w3.org/2000/svg","linearGradient")).setAttribute("id",u),t.setAttribute("gradientUnits","userSpaceOnUse"),t.setAttribute("x1",String(Math.round(h))),t.setAttribute("y1",String(Math.round(p))),t.setAttribute("x2",String(Math.round(m))),t.setAttribute("y2",String(Math.round(g)))}n.colorStops.forEach(function(e){var n=e.offset,r=e.color,i=document.createElementNS("http://www.w3.org/2000/svg","stop");i.setAttribute("offset",100*n+"%"),i.setAttribute("stop-color",r),t.appendChild(i)}),c.setAttribute("fill","url('#"+u+"')"),this._defs.appendChild(t)}else r&&c.setAttribute("fill",r);this._element.appendChild(c)},e}(),w="canvas";for(var _={},E=0;E<=40;E++)_[E]=E;let S={type:w,shape:"square",width:300,height:300,data:"",margin:0,qrOptions:{typeNumber:_[0],mode:void 0,errorCorrectionLevel:"Q"},imageOptions:{hideBackgroundDots:!0,imageSize:.4,crossOrigin:void 0,margin:0},dotsOptions:{type:"square",color:"#000"},backgroundOptions:{round:0,color:"#fff"}};var k=function(){return(k=Object.assign||function(e){for(var t,n=1,r=arguments.length;nMath.min(t.width,t.height)&&(t.margin=Math.min(t.width,t.height)),t.dotsOptions=k({},t.dotsOptions),t.dotsOptions.gradient&&(t.dotsOptions.gradient=M(t.dotsOptions.gradient)),t.cornersSquareOptions&&(t.cornersSquareOptions=k({},t.cornersSquareOptions),t.cornersSquareOptions.gradient&&(t.cornersSquareOptions.gradient=M(t.cornersSquareOptions.gradient))),t.cornersDotOptions&&(t.cornersDotOptions=k({},t.cornersDotOptions),t.cornersDotOptions.gradient&&(t.cornersDotOptions.gradient=M(t.cornersDotOptions.gradient))),t.backgroundOptions&&(t.backgroundOptions=k({},t.backgroundOptions),t.backgroundOptions.gradient&&(t.backgroundOptions.gradient=M(t.backgroundOptions.gradient))),t}var x=n(192),R=n.n(x),I=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(a,s)}l((r=r.apply(e,t||[])).next())})},T=function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]\r\n'+(new XMLSerializer).serializeToString(t)],{type:"image/svg+xml"})]:[2,new Promise(function(n){return t.toBlob(n,"image/"+e,1)})]:[2,null]}})})},e.prototype.download=function(e){return I(this,void 0,void 0,function(){var t,n,r;return T(this,function(i){switch(i.label){case 0:if(!this._qr)throw"QR code is empty";return t="png",n="qr","string"==typeof e?(t=e,console.warn("Extension is deprecated as argument for 'download' method, please pass object { name: '...', extension: '...' } as argument")):"object"==typeof e&&null!==e&&(e.name&&(n=e.name),e.extension&&(t=e.extension)),[4,this._getElement(t)];case 1:return(r=i.sent())&&("svg"===t.toLowerCase()?s("data:image/svg+xml;charset=utf-8,"+encodeURIComponent('\r\n'+(new XMLSerializer).serializeToString(r)),n+".svg"):s(r.toDataURL("image/"+t),n+"."+t)),[2]}})})},e}()}},t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}return n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n(676)})().default),_b.exports}!function(e,t,n){var r="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA2CAYAAACbZ/oUAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAb1SURBVHgB3Vrdcds4EN4FJVo/fnAqOKWCOBVEqcBKBbbeLvLNWFeBnQpiz+SUe4tTwckVWK4gTgVRB9ZD9BNaBG4XJGiIon4oUYrtb0YiCIIEFvuD3QUQLPxslI8cUG98wJvdVv8SnihUc29v5HknVKyAKz8Uz0dd8wxNYfhnoaKE+GG916WHHRDya/HTqAOPHJrI8WgflHOqlKqaekTsFP/pv43uTYG5K0B9CasvENSB4hkK0JVKXTg7qm3P1mPA8K9CVUmnpkAdEjF7XMdEEtE9Ktb0vStfmnEL86KDcGgal1r9Jkj5Vin4Gj6uCMSPyhM/hsfla54cnlH4TeC+h43S6eC49E1JcU01JyGxPVDqb+boL9etR+1/Yc2UNYdtcUbAetHS32GjcETzcmpxO/gIfZxmq70tkWci+96o5qBzaItsBMTvUnlHu637W1PFzOG2tlhrgm1xttkfvUgTIlGcYSgFCaD2eIWuf561yCeJ7DTwQktl4rssAQDE8Rcvznu9gMNmJgAui61BfVbng+NiExSewsyOA5XwSRVc8G591+nBqvDEoQRo4ry+eKKFrM+SsDuSih3P+6HHS6Je+jw8R1ucSWfflT8P2jAH3B4c50uiWG0VeFF082dIXJvXiqT3XLCOh2KN/felGonqfzxbxN2XsCT6jdIZvXMKW8YirsYRF2uRR+zyDenId0iBcmtwhlK+1APYGvCi4Lqv0xjJoK3qUrHHOizcVp+tGokF/gEpUfx3pKWCLPYH2CB4UlHIt2yYFolwHFoFASsk0tp663U4vNm/W3Ft3TC322m5aoNWl319VeqGr5pgsqpanN1fXhVWxAa43XMEvCu1Bu/ScjUG7XQIITv6GtT5mt3E6SqsiSy4zRaV/IHXO5/mrxhLQcArvoxyhQeRdiQFCRrqADIAc3tEYijJyEA6RK5hFg4M6y8qYJG+fRFKiTADDC1Z5S4jH5k72GUjQ8ZmKW6Ta8hcZecAMoIvnKr+NBFs6qLgQSnUSp337muQIdjYKKvDObjO2i3FyDkKaGNEBFM4qAfFCQDICCxS7LZCaDjmQqkmR0CQIcih0rQ45OaaugeCnYBg4kYVMsDPRn6fXNbrNC4o9X3GEzRs8tq5HrxGmXW3Qr+ea0VQEcGhFWPFrqzb4ahRPBGQ/waxkHIZ8ARR3H3t0YTBGvBAGyvjY0SICNahU/jQDpjTIAzMv5B1XtfwVMY0YeuIOAUMmgYV+hgP9RaMA0KEv4KU0Prqed9ILI8gI7CID47LH1dcObT+ksR07MrcZBt2QAR3xLNTX/RFkzjjAF3ODdDXABkzimlrP98XL1wcd2x9nAXW3zEoPRaxIyfao30TBsx3XM7B/eukj3O45fu47whxQP7p/kaInANOLTmUTR1ThsVx/U7SUjZ4T4kKysElhbwTHGY9HjSKXY4uxipXBbi/ZQPmk047JOaUgagpCXsCtahMztaWwBPM42AdJeMGg0ZJp5OlgKtSzu2w343EDB5fUsg7NWZKCFyGuatuWFWBpwQ2vCR5uhymdezHIt5eOPIyLFbgqRHLMMQSkPLo8cdTBDtyjcTb40IvSb+nCDYL9jPAHhvYeOU0h2fnnp8ceLmM100QrFO2vz39miXUFPMmPa0wfnxGmBLrCYKzEmfec9KBP/3SvKcdBcodI8h6VglBKUU11kcA28taA20acN1OupltnGVeXnYjLyW6JcvbijicSaaDkvojGE26mugvlcUM3MAHYsPRdRWsjYot1rmHb6v1CSZHn9y9JkU45O3ADQq/DWPeGlniVVo3ORgZjL2qkHBg3FjIAKFYd7isRTojcX60sPeH9dyvk4B/CmAbYrI4RtgyzVQ+RkhPHPE13FvKLlP5WEErQJAQ4D8J4gqeOUwyPthqYWv63EHZEb5EjgdlDthKbzVdsy3YVjpahykjcoWbjZR64S8JFdgglJSRyj4QjLKDIDZDMG2UFfP56qx9XvscxiaQo2ynKUc+0L1b2Jge0zrYnrepbZ3DyBzssiZutYQ7Dx3YACi/2V3cClMdqkmBjn0z4eWacxBZg1aB7qI2ZEM2kkuTZJvs+4m8NJ+DIF1Ks5+j96N4omjmDmeFcSjFSb9Rqs77EIZbI4nPSPJ0H4hv0mZkvB23Q2uQ3c8kFi5PSAs4bZ5zJFSgHUejm2EAwuc1M3ZTJ89R6ogq8P1rtCHwZl6sHD8rHQw/BnNUz6riA5ltH+RNmQzbohM1GZ7Q41M89UUHW/Q5LAFVBYLPp1TBYlY8oRDUJXxACadJi1dXkjnfXWLzKnkQtBm+4vqqjWfer69yBIKXOJPW4RNFU9+GDWIFbvMpng9ZHmyJY+P7YdqpUOIjrU1z3VbkM58rcjUN/geU/3c0eMPNdAAAAABJRU5ErkJggg==",i=function(){return(i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n",t=er.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}},"undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction?function(e,t,n,r){MSApp.execUnsafeLocalFunction(function(){return ei(e,t)})}:ei);function ea(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&3===n.nodeType)return void(n.nodeValue=t)}e.textContent=t}var es={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},el=["Webkit","ms","Moz","O"];function eu(e,t,n){return null==t||"boolean"==typeof t||""===t?"":n||"number"!=typeof t||0===t||es.hasOwnProperty(e)&&es[e]?(""+t).trim():t+"px"}function ec(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=0===n.indexOf("--"),i=eu(n,t[n],r);"float"===n&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}Object.keys(es).forEach(function(e){el.forEach(function(t){es[t=t+e.charAt(0).toUpperCase()+e.substring(1)]=es[e]})});var ed=L({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ef(e,t){if(t){if(ed[e]&&(null!=t.children||null!=t.dangerouslySetInnerHTML))throw Error(n(137,e));if(null!=t.dangerouslySetInnerHTML){if(null!=t.children)throw Error(n(60));if("object"!=typeof t.dangerouslySetInnerHTML||!("__html"in t.dangerouslySetInnerHTML))throw Error(n(61))}if(null!=t.style&&"object"!=typeof t.style)throw Error(n(62))}}function eh(e,t){if(-1===e.indexOf("-"))return"string"==typeof t.is;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var ep=null;function em(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var eg=null,ev=null,eb=null;function ey(e){if(e=rC(e)){if("function"!=typeof eg)throw Error(n(280));var t=e.stateNode;t&&(t=rR(t),eg(e.stateNode,e.type,t))}}function eA(e){ev?eb?eb.push(e):eb=[e]:ev=e}function ew(){if(ev){var e=ev,t=eb;if(eb=ev=null,ey(e),t)for(e=0;e>>=0)?32:31-(e0(e)/e1|0)|0},e0=Math.log,e1=Math.LN2,e2=64,e3=4194304;function e6(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return 4194240&e;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return 130023424&e;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function e4(e,t){var n=e.pendingLanes;if(0===n)return 0;var r=0,i=e.suspendedLanes,o=e.pingedLanes,a=268435455&n;if(0!==a){var s=a&~i;0!==s?r=e6(s):0!=(o&=a)&&(r=e6(o))}else 0!=(a=n&~i)?r=e6(a):0!==o&&(r=e6(o));if(0===r)return 0;if(0!==t&&t!==r&&0==(t&i)&&((i=r&-r)>=(o=t&-t)||16===i&&0!=(4194240&o)))return t;if(0!=(4&r)&&(r|=16&n),0!==(t=e.entangledLanes))for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function e9(e,t,n){e.pendingLanes|=t,536870912!==t&&(e.suspendedLanes=0,e.pingedLanes=0),(e=e.eventTimes)[t=31-eX(t)]=n}function te(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-eX(n),i=1<=nr),na=!1;function ns(e,t){switch(e){case"keyup":return -1!==nt.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function nl(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var nu=!1,nc={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function nd(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!nc[e.type]:"textarea"===t}function nf(e,t,n,r){eA(r),0<(t=re(t,"onChange")).length&&(n=new tV("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var nh=null,np=null;function nm(e){n2(e,0)}function ng(e){if(U(rx(e)))return e}function nv(e,t){if("change"===e)return t}var nb=!1;if(s){if(s){var ny="oninput"in document;if(!ny){var nA=document.createElement("div");nA.setAttribute("oninput","return;"),ny="function"==typeof nA.oninput}ad=ny}else ad=!1;nb=ad&&(!document.documentMode||9=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=nR(r)}}function nT(){for(var e=window,t=q();t instanceof e.HTMLIFrameElement;){try{var n="string"==typeof t.contentWindow.location.href}catch(e){n=!1}if(!n)break;t=q((e=t.contentWindow).document)}return t}function nO(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}var nP=s&&"documentMode"in document&&11>=document.documentMode,nL=null,nN=null,nD=null,nB=!1;function nj(e,t,n){var r=n.window===n?n.document:9===n.nodeType?n:n.ownerDocument;nB||null==nL||nL!==q(r)||(r="selectionStart"in(r=nL)&&nO(r)?{start:r.selectionStart,end:r.selectionEnd}:{anchorNode:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset},nD&&nx(nD,r)||(nD=r,0<(r=re(nN,"onSelect")).length&&(t=new tV("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=nL)))}function nF(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var nz={animationend:nF("Animation","AnimationEnd"),animationiteration:nF("Animation","AnimationIteration"),animationstart:nF("Animation","AnimationStart"),transitionend:nF("Transition","TransitionEnd")},nU={},nq={};function nK(e){if(nU[e])return nU[e];if(!nz[e])return e;var t,n=nz[e];for(t in n)if(n.hasOwnProperty(t)&&t in nq)return nU[e]=n[t];return e}s&&(nq=document.createElement("div").style,"AnimationEvent"in window||(delete nz.animationend.animation,delete nz.animationiteration.animation,delete nz.animationstart.animation),"TransitionEvent"in window||delete nz.transitionend.transition);var nH=nK("animationend"),nV=nK("animationiteration"),n$=nK("animationstart"),nW=nK("transitionend"),nY=new Map,nG="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function nQ(e,t){nY.set(e,t),o(t,[e])}for(var nZ=0;nZrT||(e.current=rI[rT],rI[rT]=null,rT--)}function rL(e,t){rI[++rT]=e.current,e.current=t}var rN={},rD=rO(rN),rB=rO(!1),rj=rN;function rF(e,t){var n=e.type.contextTypes;if(!n)return rN;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i,o={};for(i in n)o[i]=t[i];return r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function rz(e){return null!=(e=e.childContextTypes)}function rU(){rP(rB),rP(rD)}function rq(e,t,r){if(rD.current!==rN)throw Error(n(168));rL(rD,t),rL(rB,r)}function rK(e,t,r){var i=e.stateNode;if(t=t.childContextTypes,"function"!=typeof i.getChildContext)return r;for(var o in i=i.getChildContext())if(!(o in t))throw Error(n(108,function(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=(e=t.render).displayName||e.name||"",t.displayName||(""!==e?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return function e(t){if(null==t)return null;if("function"==typeof t)return t.displayName||t.name||null;if("string"==typeof t)return t;switch(t){case A:return"Fragment";case y:return"Portal";case _:return"Profiler";case w:return"StrictMode";case M:return"Suspense";case C:return"SuspenseList"}if("object"==typeof t)switch(t.$$typeof){case S:return(t.displayName||"Context")+".Consumer";case E:return(t._context.displayName||"Context")+".Provider";case k:var n=t.render;return(t=t.displayName)||(t=""!==(t=n.displayName||n.name||"")?"ForwardRef("+t+")":"ForwardRef"),t;case x:return null!==(n=t.displayName||null)?n:e(t.type)||"Memo";case R:n=t._payload,t=t._init;try{return e(t(n))}catch(e){}}return null}(t);case 8:return t===w?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if("function"==typeof t)return t.displayName||t.name||null;if("string"==typeof t)return t}return null}(e)||"Unknown",o));return L({},r,i)}function rH(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||rN,rj=rD.current,rL(rD,e),rL(rB,rB.current),!0}function rV(e,t,r){var i=e.stateNode;if(!i)throw Error(n(169));r?(e=rK(e,t,rj),i.__reactInternalMemoizedMergedChildContext=e,rP(rB),rP(rD),rL(rD,e)):rP(rB),rL(rB,r)}var r$=null,rW=!1,rY=!1;function rG(e){null===r$?r$=[e]:r$.push(e)}function rQ(){if(!rY&&null!==r$){rY=!0;var e=0,t=tt;try{var n=r$;for(tt=1;e>=a,i-=a,r6=1<<32-eX(t)+i|n<m?(g=d,d=null):g=d.sibling;var v=h(n,d,s[m],l);if(null===v){null===d&&(d=g);break}e&&d&&null===v.alternate&&t(n,d),o=a(v,o,m),null===c?u=v:c.sibling=v,c=v,d=g}if(m===s.length)return r(n,d),ir&&r8(n,m),u;if(null===d){for(;mg?(v=m,m=null):v=m.sibling;var y=h(o,m,b.value,u);if(null===y){null===m&&(m=v);break}e&&m&&null===y.alternate&&t(o,m),s=a(y,s,g),null===d?c=y:d.sibling=y,d=y,m=v}if(b.done)return r(o,m),ir&&r8(o,g),c;if(null===m){for(;!b.done;g++,b=l.next())null!==(b=f(o,b.value,u))&&(s=a(b,s,g),null===d?c=b:d.sibling=b,d=b);return ir&&r8(o,g),c}for(m=i(o,m);!b.done;g++,b=l.next())null!==(b=p(m,o,g,b.value,u))&&(e&&null!==b.alternate&&m.delete(null===b.key?g:b.key),s=a(b,s,g),null===d?c=b:d.sibling=b,d=b);return e&&m.forEach(function(e){return t(o,e)}),ir&&r8(o,g),c}(u,c,d,m);iW(u,d)}return"string"==typeof d&&""!==d||"number"==typeof d?(d=""+d,null!==c&&6===c.tag?(r(u,c.sibling),(c=o(c,d)).return=u):(r(u,c),(c=sJ(d,u.mode,m)).return=u),s(u=c)):r(u,c)}}var iQ=iG(!0),iZ=iG(!1),iJ={},iX=rO(iJ),i0=rO(iJ),i1=rO(iJ);function i2(e){if(e===iJ)throw Error(n(174));return e}function i3(e,t){switch(rL(i1,t),rL(i0,e),rL(iX,iJ),e=t.nodeType){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:en(null,"");break;default:t=en(t=(e=8===e?t.parentNode:t).namespaceURI||null,e=e.tagName)}rP(iX),rL(iX,t)}function i6(){rP(iX),rP(i0),rP(i1)}function i4(e){i2(i1.current);var t=i2(iX.current),n=en(t,e.type);t!==n&&(rL(i0,e),rL(iX,n))}function i8(e){i0.current===e&&(rP(iX),rP(i0))}var i5=rO(0);function i7(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||"$?"===n.data||"$!"===n.data))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(0!=(128&t.flags))return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var i9=[];function oe(){for(var e=0;en?n:4,e(!0);var r=on.transition;on.transition={};try{e(!1),t()}finally{tt=n,on.transition=r}}function oK(){return og().memoizedState}function oH(e,t,n){var r=sy(e);(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},o$(e))?oW(t,n):null!==(n=ix(e,t,n,r))&&(sA(n,e,r,sb()),oY(n,t,r))}function oV(e,t,n){var r=sy(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(o$(e))oW(t,i);else{var o=e.alternate;if(0===e.lanes&&(null===o||0===o.lanes)&&null!==(o=t.lastRenderedReducer))try{var a=t.lastRenderedState,s=o(a,n);if(i.hasEagerState=!0,i.eagerState=s,nC(s,a)){var l=t.interleaved;return null===l?(i.next=i,iC(t)):(i.next=l.next,l.next=i),void(t.interleaved=i)}}catch(e){}null!==(n=ix(e,t,i,r))&&(sA(n,e,r,i=sb()),oY(n,t,r))}}function o$(e){var t=e.alternate;return e===oi||null!==t&&t===oi}function oW(e,t){ol=os=!0;var n=e.pending;null===n?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function oY(e,t,n){if(0!=(4194240&n)){var r=t.lanes;n|=r&=e.pendingLanes,t.lanes=n,te(e,n)}}var oG={readContext:ik,useCallback:od,useContext:od,useEffect:od,useImperativeHandle:od,useInsertionEffect:od,useLayoutEffect:od,useMemo:od,useReducer:od,useRef:od,useState:od,useDebugValue:od,useDeferredValue:od,useTransition:od,useMutableSource:od,useSyncExternalStore:od,useId:od,unstable_isNewReconciler:!1},oQ={readContext:ik,useCallback:function(e,t){return om().memoizedState=[e,void 0===t?null:t],e},useContext:ik,useEffect:oO,useImperativeHandle:function(e,t,n){return n=null!=n?n.concat([e]):null,oI(4194308,4,oD.bind(null,t,e),n)},useLayoutEffect:function(e,t){return oI(4194308,4,e,t)},useInsertionEffect:function(e,t){return oI(4,2,e,t)},useMemo:function(e,t){var n=om();return t=void 0===t?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=om();return t=void 0!==n?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=oH.bind(null,oi,e),[r.memoizedState,e]},useRef:function(e){return e={current:e},om().memoizedState=e},useState:oC,useDebugValue:oj,useDeferredValue:function(e){return om().memoizedState=e},useTransition:function(){var e=oC(!1),t=e[0];return e=oq.bind(null,e[1]),om().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var i=oi,o=om();if(ir){if(void 0===r)throw Error(n(407));r=r()}else{if(r=t(),null===a3)throw Error(n(349));0!=(30&or)||o_(i,t,r)}o.memoizedState=r;var a={value:r,getSnapshot:t};return o.queue=a,oO(oS.bind(null,i,a,e),[e]),i.flags|=2048,ox(9,oE.bind(null,i,a,r,t),void 0,null),r},useId:function(){var e=om(),t=a3.identifierPrefix;if(ir){var n=r4;t=":"+t+"R"+(n=(r6&~(1<<32-eX(r6)-1)).toString(32)+n),0<(n=ou++)&&(t+="H"+n.toString(32)),t+=":"}else t=":"+t+"r"+(n=oc++).toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},oZ={readContext:ik,useCallback:oF,useContext:ik,useEffect:oP,useImperativeHandle:oB,useInsertionEffect:oL,useLayoutEffect:oN,useMemo:oz,useReducer:ob,useRef:oR,useState:function(){return ob(ov)},useDebugValue:oj,useDeferredValue:function(e){return oU(og(),oo.memoizedState,e)},useTransition:function(){return[ob(ov)[0],og().memoizedState]},useMutableSource:oA,useSyncExternalStore:ow,useId:oK,unstable_isNewReconciler:!1},oJ={readContext:ik,useCallback:oF,useContext:ik,useEffect:oP,useImperativeHandle:oB,useInsertionEffect:oL,useLayoutEffect:oN,useMemo:oz,useReducer:oy,useRef:oR,useState:function(){return oy(ov)},useDebugValue:oj,useDeferredValue:function(e){var t=og();return null===oo?t.memoizedState=e:oU(t,oo.memoizedState,e)},useTransition:function(){return[oy(ov)[0],og().memoizedState]},useMutableSource:oA,useSyncExternalStore:ow,useId:oK,unstable_isNewReconciler:!1};function oX(e,t){try{var n="",r=t;do n+=function(e){switch(e.tag){case 5:return N(e.type);case 16:return N("Lazy");case 13:return N("Suspense");case 19:return N("SuspenseList");case 0:case 2:case 15:return e=B(e.type,!1);case 11:return e=B(e.type.render,!1);case 1:return e=B(e.type,!0);default:return""}}(r),r=r.return;while(r);var i=n}catch(e){i="\nError generating stack: "+e.message+"\n"+e.stack}return{value:e,source:t,stack:i,digest:null}}function o0(e,t,n){return{value:e,source:null,stack:null!=n?n:null,digest:null!=t?t:null}}function o1(e,t){try{console.error(t.value)}catch(e){setTimeout(function(){throw e})}}var o2="function"==typeof WeakMap?WeakMap:Map;function o3(e,t,n){(n=iP(-1,n)).tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){sl||(sl=!0,su=r),o1(0,t)},n}function o6(e,t,n){(n=iP(-1,n)).tag=3;var r=e.type.getDerivedStateFromError;if("function"==typeof r){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){o1(0,t)}}var o=e.stateNode;return null!==o&&"function"==typeof o.componentDidCatch&&(n.callback=function(){o1(0,t),"function"!=typeof r&&(null===sc?sc=new Set([this]):sc.add(this));var e=t.stack;this.componentDidCatch(t.value,{componentStack:null!==e?e:""})}),n}function o4(e,t,n){var r=e.pingCache;if(null===r){r=e.pingCache=new o2;var i=new Set;r.set(t,i)}else void 0===(i=r.get(t))&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=sU.bind(null,e,t,n),t.then(e,e))}function o8(e){do{var t;if((t=13===e.tag)&&(t=null===(t=e.memoizedState)||null!==t.dehydrated),t)return e;e=e.return}while(null!==e);return null}function o5(e,t,n,r,i){return 0==(1&e.mode)?e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,1===n.tag&&(null===n.alternate?n.tag=17:((t=iP(-1,1)).tag=2,iL(n,t,1))),n.lanes|=1):(e.flags|=65536,e.lanes=i),e}var o7=v.ReactCurrentOwner,o9=!1;function ae(e,t,n,r){t.child=null===e?iZ(t,null,n,r):iQ(t,e.child,n,r)}function at(e,t,n,r,i){n=n.render;var o=t.ref;return iS(t,i),r=oh(e,t,n,r,o,i),n=op(),null===e||o9?(ir&&n&&r7(t),t.flags|=1,ae(e,t,r,i),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,ak(e,t,i))}function an(e,t,n,r,i){if(null===e){var o=n.type;return"function"!=typeof o||sW(o)||void 0!==o.defaultProps||null!==n.compare||void 0!==n.defaultProps?((e=sG(n.type,null,r,t,t.mode,i)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=o,ar(e,t,o,r,i))}if(o=e.child,0==(e.lanes&i)){var a=o.memoizedProps;if((n=null!==(n=n.compare)?n:nx)(a,r)&&e.ref===t.ref)return ak(e,t,i)}return t.flags|=1,(e=sY(o,r)).ref=t.ref,e.return=t,t.child=e}function ar(e,t,n,r,i){if(null!==e){var o=e.memoizedProps;if(nx(o,r)&&e.ref===t.ref){if(o9=!1,t.pendingProps=r=o,0==(e.lanes&i))return t.lanes=e.lanes,ak(e,t,i);0!=(131072&e.flags)&&(o9=!0)}}return aa(e,t,n,r,i)}function ai(e,t,n){var r=t.pendingProps,i=r.children,o=null!==e?e.memoizedState:null;if("hidden"===r.mode){if(0==(1&t.mode))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},rL(a5,a8),a8|=n;else{if(0==(1073741824&n))return e=null!==o?o.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,rL(a5,a8),a8|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=null!==o?o.baseLanes:n,rL(a5,a8),a8|=r}}else null!==o?(r=o.baseLanes|n,t.memoizedState=null):r=n,rL(a5,a8),a8|=r;return ae(e,t,i,n),t.child}function ao(e,t){var n=t.ref;(null===e&&null!==n||null!==e&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function aa(e,t,n,r,i){var o=rz(n)?rj:rD.current;return o=rF(t,o),iS(t,i),n=oh(e,t,n,r,o,i),r=op(),null===e||o9?(ir&&r&&r7(t),t.flags|=1,ae(e,t,n,i),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,ak(e,t,i))}function as(e,t,n,r,i){if(rz(n)){var o=!0;rH(t)}else o=!1;if(iS(t,i),null===t.stateNode)aS(e,t),iK(t,n,r),iV(t,n,r,i),r=!0;else if(null===e){var a=t.stateNode,s=t.memoizedProps;a.props=s;var l=a.context,u=n.contextType;u="object"==typeof u&&null!==u?ik(u):rF(t,u=rz(n)?rj:rD.current);var c=n.getDerivedStateFromProps,d="function"==typeof c||"function"==typeof a.getSnapshotBeforeUpdate;d||"function"!=typeof a.UNSAFE_componentWillReceiveProps&&"function"!=typeof a.componentWillReceiveProps||(s!==r||l!==u)&&iH(t,a,r,u),iI=!1;var f=t.memoizedState;a.state=f,iB(t,r,a,i),l=t.memoizedState,s!==r||f!==l||rB.current||iI?("function"==typeof c&&(iz(t,n,c,r),l=t.memoizedState),(s=iI||iq(t,n,s,r,f,l,u))?(d||"function"!=typeof a.UNSAFE_componentWillMount&&"function"!=typeof a.componentWillMount||("function"==typeof a.componentWillMount&&a.componentWillMount(),"function"==typeof a.UNSAFE_componentWillMount&&a.UNSAFE_componentWillMount()),"function"==typeof a.componentDidMount&&(t.flags|=4194308)):("function"==typeof a.componentDidMount&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=u,r=s):("function"==typeof a.componentDidMount&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,iO(e,t),s=t.memoizedProps,u=t.type===t.elementType?s:ig(t.type,s),a.props=u,d=t.pendingProps,f=a.context,l="object"==typeof(l=n.contextType)&&null!==l?ik(l):rF(t,l=rz(n)?rj:rD.current);var h=n.getDerivedStateFromProps;(c="function"==typeof h||"function"==typeof a.getSnapshotBeforeUpdate)||"function"!=typeof a.UNSAFE_componentWillReceiveProps&&"function"!=typeof a.componentWillReceiveProps||(s!==d||f!==l)&&iH(t,a,r,l),iI=!1,f=t.memoizedState,a.state=f,iB(t,r,a,i);var p=t.memoizedState;s!==d||f!==p||rB.current||iI?("function"==typeof h&&(iz(t,n,h,r),p=t.memoizedState),(u=iI||iq(t,n,u,r,f,p,l)||!1)?(c||"function"!=typeof a.UNSAFE_componentWillUpdate&&"function"!=typeof a.componentWillUpdate||("function"==typeof a.componentWillUpdate&&a.componentWillUpdate(r,p,l),"function"==typeof a.UNSAFE_componentWillUpdate&&a.UNSAFE_componentWillUpdate(r,p,l)),"function"==typeof a.componentDidUpdate&&(t.flags|=4),"function"==typeof a.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!=typeof a.componentDidUpdate||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),"function"!=typeof a.getSnapshotBeforeUpdate||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=l,r=u):("function"!=typeof a.componentDidUpdate||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),"function"!=typeof a.getSnapshotBeforeUpdate||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return al(e,t,n,r,o,i)}function al(e,t,n,r,i,o){ao(e,t);var a=0!=(128&t.flags);if(!r&&!a)return i&&rV(t,n,!1),ak(e,t,o);r=t.stateNode,o7.current=t;var s=a&&"function"!=typeof n.getDerivedStateFromError?null:r.render();return t.flags|=1,null!==e&&a?(t.child=iQ(t,e.child,null,o),t.child=iQ(t,null,s,o)):ae(e,t,s,o),t.memoizedState=r.state,i&&rV(t,n,!0),t.child}function au(e){var t=e.stateNode;t.pendingContext?rq(0,t.pendingContext,t.pendingContext!==t.context):t.context&&rq(0,t.context,!1),i3(e,t.containerInfo)}function ac(e,t,n,r,i){return ih(),ip(i),t.flags|=256,ae(e,t,n,r),t.child}var ad,af,ah,ap,am,ag={dehydrated:null,treeContext:null,retryLane:0};function av(e){return{baseLanes:e,cachePool:null,transitions:null}}function ab(e,t,r){var i,o=t.pendingProps,a=i5.current,s=!1,l=0!=(128&t.flags);if((i=l)||(i=(null===e||null!==e.memoizedState)&&0!=(2&a)),i?(s=!0,t.flags&=-129):null!==e&&null===e.memoizedState||(a|=1),rL(i5,1&a),null===e)return il(t),null!==(e=t.memoizedState)&&null!==(e=e.dehydrated)?(0==(1&t.mode)?t.lanes=1:"$!"===e.data?t.lanes=8:t.lanes=1073741824,null):(l=o.children,e=o.fallback,s?(o=t.mode,s=t.child,l={mode:"hidden",children:l},0==(1&o)&&null!==s?(s.childLanes=0,s.pendingProps=l):s=sZ(l,o,0,null),e=sQ(e,o,r,null),s.return=t,e.return=t,s.sibling=e,t.child=s,t.child.memoizedState=av(r),t.memoizedState=ag,e):ay(t,l));if(null!==(a=e.memoizedState)&&null!==(i=a.dehydrated))return function(e,t,r,i,o,a,s){if(r)return 256&t.flags?(t.flags&=-257,aA(e,t,s,i=o0(Error(n(422))))):null!==t.memoizedState?(t.child=e.child,t.flags|=128,null):(a=i.fallback,o=t.mode,i=sZ({mode:"visible",children:i.children},o,0,null),(a=sQ(a,o,s,null)).flags|=2,i.return=t,a.return=t,i.sibling=a,t.child=i,0!=(1&t.mode)&&iQ(t,e.child,null,s),t.child.memoizedState=av(s),t.memoizedState=ag,a);if(0==(1&t.mode))return aA(e,t,s,null);if("$!"===o.data){if(i=o.nextSibling&&o.nextSibling.dataset)var l=i.dgst;return i=l,aA(e,t,s,i=o0(a=Error(n(419)),i,void 0))}if(l=0!=(s&e.childLanes),o9||l){if(null!==(i=a3)){switch(s&-s){case 4:o=2;break;case 16:o=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:o=32;break;case 536870912:o=268435456;break;default:o=0}0!==(o=0!=(o&(i.suspendedLanes|s))?0:o)&&o!==a.retryLane&&(a.retryLane=o,iR(e,o),sA(i,e,o,-1))}return sP(),aA(e,t,s,i=o0(Error(n(421))))}return"$?"===o.data?(t.flags|=128,t.child=e.child,t=sK.bind(null,e),o._reactRetry=t,null):(e=a.treeContext,it=rv(o.nextSibling),ie=t,ir=!0,ii=null,null!==e&&(r1[r2++]=r6,r1[r2++]=r4,r1[r2++]=r3,r6=e.id,r4=e.overflow,r3=t),t=ay(t,i.children),t.flags|=4096,t)}(e,t,l,o,i,a,r);if(s){s=o.fallback,l=t.mode,i=(a=e.child).sibling;var u={mode:"hidden",children:o.children};return 0==(1&l)&&t.child!==a?((o=t.child).childLanes=0,o.pendingProps=u,t.deletions=null):(o=sY(a,u)).subtreeFlags=14680064&a.subtreeFlags,null!==i?s=sY(i,s):(s=sQ(s,l,r,null)).flags|=2,s.return=t,o.return=t,o.sibling=s,t.child=o,o=s,s=t.child,l=null===(l=e.child.memoizedState)?av(r):{baseLanes:l.baseLanes|r,cachePool:null,transitions:l.transitions},s.memoizedState=l,s.childLanes=e.childLanes&~r,t.memoizedState=ag,o}return e=(s=e.child).sibling,o=sY(s,{mode:"visible",children:o.children}),0==(1&t.mode)&&(o.lanes=r),o.return=t,o.sibling=null,null!==e&&(null===(r=t.deletions)?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=o,t.memoizedState=null,o}function ay(e,t){return(t=sZ({mode:"visible",children:t},e.mode,0,null)).return=e,e.child=t}function aA(e,t,n,r){return null!==r&&ip(r),iQ(t,e.child,null,n),(e=ay(t,t.pendingProps.children)).flags|=2,t.memoizedState=null,e}function aw(e,t,n){e.lanes|=t;var r=e.alternate;null!==r&&(r.lanes|=t),iE(e.return,t,n)}function a_(e,t,n,r,i){var o=e.memoizedState;null===o?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i)}function aE(e,t,n){var r=t.pendingProps,i=r.revealOrder,o=r.tail;if(ae(e,t,r.children,n),0!=(2&(r=i5.current)))r=1&r|2,t.flags|=128;else{if(null!==e&&0!=(128&e.flags))e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&aw(e,n,t);else if(19===e.tag)aw(e,n,t);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(rL(i5,r),0==(1&t.mode))t.memoizedState=null;else switch(i){case"forwards":for(n=t.child,i=null;null!==n;)null!==(e=n.alternate)&&null===i7(e)&&(i=n),n=n.sibling;null===(n=i)?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),a_(t,!1,i,n,o);break;case"backwards":for(n=null,i=t.child,t.child=null;null!==i;){if(null!==(e=i.alternate)&&null===i7(e)){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}a_(t,!0,n,null,o);break;case"together":a_(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function aS(e,t){0==(1&t.mode)&&null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2)}function ak(e,t,r){if(null!==e&&(t.dependencies=e.dependencies),se|=t.lanes,0==(r&t.childLanes))return null;if(null!==e&&t.child!==e.child)throw Error(n(153));if(null!==t.child){for(r=sY(e=t.child,e.pendingProps),t.child=r,r.return=t;null!==e.sibling;)e=e.sibling,(r=r.sibling=sY(e,e.pendingProps)).return=t;r.sibling=null}return t.child}function aM(e,t){if(!ir)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;null!==t;)null!==t.alternate&&(n=t),t=t.sibling;null===n?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;null!==n;)null!==n.alternate&&(r=n),n=n.sibling;null===r?t||null===e.tail?e.tail=null:e.tail.sibling=null:r.sibling=null}}function aC(e){var t=null!==e.alternate&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;null!==i;)n|=i.lanes|i.childLanes,r|=14680064&i.subtreeFlags,r|=14680064&i.flags,i.return=e,i=i.sibling;else for(i=e.child;null!==i;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}af=function(e,t){for(var n=t.child;null!==n;){if(5===n.tag||6===n.tag)e.appendChild(n.stateNode);else if(4!==n.tag&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===t)break;for(;null===n.sibling;){if(null===n.return||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},ah=function(){},ap=function(e,t,n,r){var o=e.memoizedProps;if(o!==r){e=t.stateNode,i2(iX.current);var a,s=null;switch(n){case"input":o=K(e,o),r=K(e,r),s=[];break;case"select":o=L({},o,{value:void 0}),r=L({},r,{value:void 0}),s=[];break;case"textarea":o=Z(e,o),r=Z(e,r),s=[];break;default:"function"!=typeof o.onClick&&"function"==typeof r.onClick&&(e.onclick=rs)}for(c in ef(n,r),n=null,o)if(!r.hasOwnProperty(c)&&o.hasOwnProperty(c)&&null!=o[c]){if("style"===c){var l=o[c];for(a in l)l.hasOwnProperty(a)&&(n||(n={}),n[a]="")}else"dangerouslySetInnerHTML"!==c&&"children"!==c&&"suppressContentEditableWarning"!==c&&"suppressHydrationWarning"!==c&&"autoFocus"!==c&&(i.hasOwnProperty(c)?s||(s=[]):(s=s||[]).push(c,null))}for(c in r){var u=r[c];if(l=null!=o?o[c]:void 0,r.hasOwnProperty(c)&&u!==l&&(null!=u||null!=l)){if("style"===c){if(l){for(a in l)!l.hasOwnProperty(a)||u&&u.hasOwnProperty(a)||(n||(n={}),n[a]="");for(a in u)u.hasOwnProperty(a)&&l[a]!==u[a]&&(n||(n={}),n[a]=u[a])}else n||(s||(s=[]),s.push(c,n)),n=u}else"dangerouslySetInnerHTML"===c?(u=u?u.__html:void 0,l=l?l.__html:void 0,null!=u&&l!==u&&(s=s||[]).push(c,u)):"children"===c?"string"!=typeof u&&"number"!=typeof u||(s=s||[]).push(c,""+u):"suppressContentEditableWarning"!==c&&"suppressHydrationWarning"!==c&&(i.hasOwnProperty(c)?(null!=u&&"onScroll"===c&&n3("scroll",e),s||l===u||(s=[])):(s=s||[]).push(c,u))}}n&&(s=s||[]).push("style",n);var c=s;(t.updateQueue=c)&&(t.flags|=4)}},am=function(e,t,n,r){n!==r&&(t.flags|=4)};var ax=!1,aR=!1,aI="function"==typeof WeakSet?WeakSet:Set,aT=null;function aO(e,t){var n=e.ref;if(null!==n){if("function"==typeof n)try{n(null)}catch(n){sz(e,t,n)}else n.current=null}}function aP(e,t,n){try{n()}catch(n){sz(e,t,n)}}var aL=!1;function aN(e,t,n){var r=t.updateQueue;if(null!==(r=null!==r?r.lastEffect:null)){var i=r=r.next;do{if((i.tag&e)===e){var o=i.destroy;i.destroy=void 0,void 0!==o&&aP(t,n,o)}i=i.next}while(i!==r)}}function aD(e,t){if(null!==(t=null!==(t=t.updateQueue)?t.lastEffect:null)){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function aB(e){var t=e.ref;if(null!==t){var n=e.stateNode;e.tag,e=n,"function"==typeof t?t(e):t.current=e}}function aj(e){return 5===e.tag||3===e.tag||4===e.tag}function aF(e){e:for(;;){for(;null===e.sibling;){if(null===e.return||aj(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;5!==e.tag&&6!==e.tag&&18!==e.tag;){if(2&e.flags||null===e.child||4===e.tag)continue e;e.child.return=e,e=e.child}if(!(2&e.flags))return e.stateNode}}var az=null,aU=!1;function aq(e,t,n){for(n=n.child;null!==n;)aK(e,t,n),n=n.sibling}function aK(e,t,n){if(eJ&&"function"==typeof eJ.onCommitFiberUnmount)try{eJ.onCommitFiberUnmount(eZ,n)}catch(e){}switch(n.tag){case 5:aR||aO(n,t);case 6:var r=az,i=aU;az=null,aq(e,t,n),aU=i,null!==(az=r)&&(aU?(e=az,n=n.stateNode,8===e.nodeType?e.parentNode.removeChild(n):e.removeChild(n)):az.removeChild(n.stateNode));break;case 18:null!==az&&(aU?(e=az,n=n.stateNode,8===e.nodeType?rg(e.parentNode,n):1===e.nodeType&&rg(e,n),tS(e)):rg(az,n.stateNode));break;case 4:r=az,i=aU,az=n.stateNode.containerInfo,aU=!0,aq(e,t,n),az=r,aU=i;break;case 0:case 11:case 14:case 15:if(!aR&&null!==(r=n.updateQueue)&&null!==(r=r.lastEffect)){i=r=r.next;do{var o=i,a=o.destroy;o=o.tag,void 0!==a&&(0!=(2&o)||0!=(4&o))&&aP(n,t,a),i=i.next}while(i!==r)}aq(e,t,n);break;case 1:if(!aR&&(aO(n,t),"function"==typeof(r=n.stateNode).componentWillUnmount))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){sz(n,t,e)}aq(e,t,n);break;case 21:default:aq(e,t,n);break;case 22:1&n.mode?(aR=(r=aR)||null!==n.memoizedState,aq(e,t,n),aR=r):aq(e,t,n)}}function aH(e){var t=e.updateQueue;if(null!==t){e.updateQueue=null;var n=e.stateNode;null===n&&(n=e.stateNode=new aI),t.forEach(function(t){var r=sH.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function aV(e,t){var r=t.deletions;if(null!==r)for(var i=0;io&&(o=s),i&=~a}if(i=o,10<(i=(120>(i=eH()-i)?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*aJ(i/1960))-i)){e.timeoutHandle=rd(sB.bind(null,e,si,ss),i);break}sB(e,si,ss);break;default:throw Error(n(329))}}}return sw(e,eH()),e.callbackNode===r?s_.bind(null,e):null}function sE(e,t){var n=sr;return e.current.memoizedState.isDehydrated&&(sI(e,t).flags|=256),2!==(e=sL(e,t))&&(t=si,si=n,null!==t&&sS(t)),e}function sS(e){null===si?si=e:si.push.apply(si,e)}function sk(e,t){for(t&=~sn,t&=~st,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0",e=e.removeChild(e.firstChild)):"string"==typeof o.is?e=l.createElement(r,{is:o.is}):(e=l.createElement(r),"select"===r&&(l=e,o.multiple?l.multiple=!0:o.size&&(l.size=o.size))):e=l.createElementNS(e,r),e[rA]=t,e[rw]=o,af(e,t,!1,!1),t.stateNode=e;e:{switch(l=eh(r,o),r){case"dialog":n3("cancel",e),n3("close",e),a=o;break;case"iframe":case"object":case"embed":n3("load",e),a=o;break;case"video":case"audio":for(a=0;asa&&(t.flags|=128,o=!0,aM(s,!1),t.lanes=4194304)}}else{if(!o){if(null!==(e=i7(l))){if(t.flags|=128,o=!0,null!==(r=e.updateQueue)&&(t.updateQueue=r,t.flags|=4),aM(s,!0),null===s.tail&&"hidden"===s.tailMode&&!l.alternate&&!ir)return aC(t),null}else 2*eH()-s.renderingStartTime>sa&&1073741824!==r&&(t.flags|=128,o=!0,aM(s,!1),t.lanes=4194304)}s.isBackwards?(l.sibling=t.child,t.child=l):(null!==(r=s.last)?r.sibling=l:t.child=l,s.last=l)}return null!==s.tail?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=eH(),t.sibling=null,r=i5.current,rL(i5,o?1&r|2:1&r),t):(aC(t),null);case 22:case 23:return sR(),o=null!==t.memoizedState,null!==e&&null!==e.memoizedState!==o&&(t.flags|=8192),o&&0!=(1&t.mode)?0!=(1073741824&a8)&&(aC(t),6&t.subtreeFlags&&(t.flags|=8192)):aC(t),null;case 24:case 25:return null}throw Error(n(156,t.tag))}(r,t,a8)))return void(a6=r)}else{if(null!==(r=function(e,t){switch(r9(t),t.tag){case 1:return rz(t.type)&&rU(),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return i6(),rP(rB),rP(rD),oe(),0!=(65536&(e=t.flags))&&0==(128&e)?(t.flags=-65537&e|128,t):null;case 5:return i8(t),null;case 13:if(rP(i5),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(n(340));ih()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return rP(i5),null;case 4:return i6(),null;case 10:return i_(t.type._context),null;case 22:case 23:return sR(),null;default:return null}}(r,t)))return r.flags&=32767,void(a6=r);if(null===e)return a7=6,void(a6=null);e.flags|=32768,e.subtreeFlags=0,e.deletions=null}if(null!==(t=t.sibling))return void(a6=t);a6=t=e}while(null!==t);0===a7&&(a7=5)}function sB(e,t,r){var i=tt,o=a1.transition;try{a1.transition=null,tt=1,function(e,t,r,i){do sj();while(null!==sf);if(0!=(6&a2))throw Error(n(327));r=e.finishedWork;var o=e.finishedLanes;if(null!==r){if(e.finishedWork=null,e.finishedLanes=0,r===e.current)throw Error(n(177));e.callbackNode=null,e.callbackPriority=0;var a=r.lanes|r.childLanes;if(function(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0r&&(i=r,r=o,o=i),i=nI(n,o);var a=nI(n,r);i&&a&&(1!==e.rangeCount||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&((t=t.createRange()).setStart(i.node,i.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)1===e.nodeType&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for("function"==typeof n.focus&&n.focus(),n=0;ne?16:e,null===sf)var i=!1;else{if(e=sf,sf=null,sh=0,0!=(6&a2))throw Error(n(331));var o=a2;for(a2|=4,aT=e.current;null!==aT;){var a=aT,s=a.child;if(0!=(16&aT.flags)){var l=a.deletions;if(null!==l){for(var u=0;ueH()-so?sI(e,0):sn|=n),sw(e,t)}function sq(e,t){0===t&&(0==(1&e.mode)?t=1:(t=e3,0==(130023424&(e3<<=1))&&(e3=4194304)));var n=sb();null!==(e=iR(e,t))&&(e9(e,t,n),sw(e,n))}function sK(e){var t=e.memoizedState,n=0;null!==t&&(n=t.retryLane),sq(e,n)}function sH(e,t){var r=0;switch(e.tag){case 13:var i=e.stateNode,o=e.memoizedState;null!==o&&(r=o.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(n(314))}null!==i&&i.delete(t),sq(e,r)}function sV(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function s$(e,t,n,r){return new sV(e,t,n,r)}function sW(e){return!(!(e=e.prototype)||!e.isReactComponent)}function sY(e,t){var n=e.alternate;return null===n?((n=s$(e.tag,t,e.key,e.mode)).elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=14680064&e.flags,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function sG(e,t,r,i,o,a){var s=2;if(i=e,"function"==typeof e)sW(e)&&(s=1);else if("string"==typeof e)s=5;else e:switch(e){case A:return sQ(r.children,o,a,t);case w:s=8,o|=8;break;case _:return(e=s$(12,r,t,2|o)).elementType=_,e.lanes=a,e;case M:return(e=s$(13,r,t,o)).elementType=M,e.lanes=a,e;case C:return(e=s$(19,r,t,o)).elementType=C,e.lanes=a,e;case I:return sZ(r,o,a,t);default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case E:s=10;break e;case S:s=9;break e;case k:s=11;break e;case x:s=14;break e;case R:s=16,i=null;break e}throw Error(n(130,null==e?e:typeof e,""))}return(t=s$(s,r,t,o)).elementType=e,t.type=i,t.lanes=a,t}function sQ(e,t,n,r){return(e=s$(7,e,r,t)).lanes=n,e}function sZ(e,t,n,r){return(e=s$(22,e,r,t)).elementType=I,e.lanes=n,e.stateNode={isHidden:!1},e}function sJ(e,t,n){return(e=s$(6,e,null,t)).lanes=n,e}function sX(e,t,n){return(t=s$(4,null!==e.children?e.children:[],e.key,t)).lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function s0(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=e7(0),this.expirationTimes=e7(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=e7(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function s1(e,t,n,r,i,o,a,s,l){return e=new s0(e,t,n,s,l),1===t?(t=1,!0===o&&(t|=8)):t=0,o=s$(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},iT(o),e}function s2(e){if(!e)return rN;e:{if(eD(e=e._reactInternals)!==e||1!==e.tag)throw Error(n(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(rz(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(null!==t);throw Error(n(171))}if(1===e.tag){var r=e.type;if(rz(r))return rK(e,r,t)}return t}function s3(e,t,n,r,i,o,a,s,l){return(e=s1(n,r,!0,e,0,o,0,s,l)).context=s2(null),n=e.current,(o=iP(r=sb(),i=sy(n))).callback=null!=t?t:null,iL(n,o,i),e.current.lanes=i,e9(e,i,r),sw(e,r),e}function s6(e,t,n,r){var i=t.current,o=sb(),a=sy(i);return n=s2(n),null===t.context?t.context=n:t.pendingContext=n,(t=iP(o,a)).payload={element:e},null!==(r=void 0===r?null:r)&&(t.callback=r),null!==(e=iL(i,t,a))&&(sA(e,i,a,o),iN(e,i,a)),a}function s4(e){return(e=e.current).child?(e.child.tag,e.child.stateNode):null}function s8(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var n=e.retryLane;e.retryLane=0!==n&&n1?t-1:0),r=1;r1?t-1:0),r=1;r2&&("o"===e[0]||"O"===e[0])&&("n"===e[1]||"N"===e[1])}function x(e,t,n,r){if(null!==n&&0===n.type)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":if(r)return!1;if(null!==n)return!n.acceptsBooleans;var i=e.toLowerCase().slice(0,5);return"data-"!==i&&"aria-"!==i;default:return!1}}function R(e,t,n,r){if(null==t||x(e,t,n,r))return!0;if(r)return!1;if(null!==n)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||t<1}return!1}function I(e){return O.hasOwnProperty(e)?O[e]:null}function T(e,t,n,r,i,o,a){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=a}var O={};["children","dangerouslySetInnerHTML","defaultValue","defaultChecked","innerHTML","suppressContentEditableWarning","suppressHydrationWarning","style"].forEach(function(e){O[e]=new T(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0],n=e[1];O[t]=new T(t,1,!1,n,null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){O[e]=new T(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){O[e]=new T(e,2,!1,e,null,!1,!1)}),["allowFullScreen","async","autoFocus","autoPlay","controls","default","defer","disabled","disablePictureInPicture","disableRemotePlayback","formNoValidate","hidden","loop","noModule","noValidate","open","playsInline","readOnly","required","reversed","scoped","seamless","itemScope"].forEach(function(e){O[e]=new T(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){O[e]=new T(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){O[e]=new T(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){O[e]=new T(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){O[e]=new T(e,5,!1,e.toLowerCase(),null,!1,!1)});var P=/[\-\:]([a-z])/g,L=function(e){return e[1].toUpperCase()};["accent-height","alignment-baseline","arabic-form","baseline-shift","cap-height","clip-path","clip-rule","color-interpolation","color-interpolation-filters","color-profile","color-rendering","dominant-baseline","enable-background","fill-opacity","fill-rule","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","glyph-name","glyph-orientation-horizontal","glyph-orientation-vertical","horiz-adv-x","horiz-origin-x","image-rendering","letter-spacing","lighting-color","marker-end","marker-mid","marker-start","overline-position","overline-thickness","paint-order","panose-1","pointer-events","rendering-intent","shape-rendering","stop-color","stop-opacity","strikethrough-position","strikethrough-thickness","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-anchor","text-decoration","text-rendering","underline-position","underline-thickness","unicode-bidi","unicode-range","units-per-em","v-alphabetic","v-hanging","v-ideographic","v-mathematical","vector-effect","vert-adv-y","vert-origin-x","vert-origin-y","word-spacing","writing-mode","xmlns:xlink","x-height"].forEach(function(e){var t=e.replace(P,L);O[t]=new T(t,1,!1,e,null,!1,!1)}),["xlink:actuate","xlink:arcrole","xlink:role","xlink:show","xlink:title","xlink:type"].forEach(function(e){var t=e.replace(P,L);O[t]=new T(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(P,L);O[t]=new T(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){O[e]=new T(e,1,!1,e.toLowerCase(),null,!1,!1)}),O.xlinkHref=new T("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){O[e]=new T(e,1,!1,e.toLowerCase(),null,!0,!0)});var N=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*\:/i,D=!1;function B(e){!D&&N.test(e)&&(D=!0,l("A future version of React will block javascript: URLs as a security precaution. Use event handlers instead if you can. If you need to generate unsafe HTML try using dangerouslySetInnerHTML instead. React was passed %s.",JSON.stringify(e)))}function j(e,t,n,r){if(M(t)){if(!e.hasAttribute(t))return void 0===n?void 0:null;var i=e.getAttribute(t);return y(n,t),i===""+n?n:i}}function F(e,t,n,r){var i=I(t);if(!C(t,i,r)){if(R(t,n,i,r)&&(n=null),r||null===i)M(t)&&(null===n?e.removeAttribute(t):(y(n,t),e.setAttribute(t,""+n)));else if(i.mustUseProperty){var o=i.propertyName;if(null===n){var a=i.type;e[o]=3!==a&&""}else e[o]=n}else{var s=i.attributeName,l=i.attributeNamespace;if(null===n)e.removeAttribute(s);else{var u,c=i.type;3===c||4===c&&!0===n?u="":(y(n,s),u=""+n,i.sanitizeURL&&B(u.toString())),l?e.setAttributeNS(l,s,u):e.setAttribute(s,u)}}}}var z=Symbol.for("react.element"),U=Symbol.for("react.portal"),q=Symbol.for("react.fragment"),K=Symbol.for("react.strict_mode"),H=Symbol.for("react.profiler"),V=Symbol.for("react.provider"),$=Symbol.for("react.context"),W=Symbol.for("react.forward_ref"),Y=Symbol.for("react.suspense"),G=Symbol.for("react.suspense_list"),Q=Symbol.for("react.memo"),Z=Symbol.for("react.lazy"),J=(Symbol.for("react.scope"),Symbol.for("react.debug_trace_mode"),Symbol.for("react.offscreen")),X=(Symbol.for("react.legacy_hidden"),Symbol.for("react.cache"),Symbol.for("react.tracing_marker"),Symbol.iterator);function ee(e){if(null===e||"object"!=typeof e)return null;var t=X&&e[X]||e["@@iterator"];return"function"==typeof t?t:null}var et,en,er,ei,eo,ea,es,el=Object.assign,eu=0;function ec(){}ec.__reactDisabledLog=!0;var ed,ef=o.ReactCurrentDispatcher;function eh(e,t,n){if(void 0===ed)try{throw Error()}catch(e){var r=e.stack.trim().match(/\n( *(at )?)/);ed=r&&r[1]||""}return"\n"+ed+e}var ep,em=!1;function eg(e,t){if(!e||em)return"";var n,r=ep.get(e);if(void 0!==r)return r;em=!0;var i,o=Error.prepareStackTrace;Error.prepareStackTrace=void 0,i=ef.current,ef.current=null,function(){if(0===eu){et=console.log,en=console.info,er=console.warn,ei=console.error,eo=console.group,ea=console.groupCollapsed,es=console.groupEnd;var e={configurable:!0,enumerable:!0,value:ec,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}eu++}();try{if(t){var a=function(){throw Error()};if(Object.defineProperty(a.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(a,[])}catch(e){n=e}Reflect.construct(e,[],a)}else{try{a.call()}catch(e){n=e}e.call(a.prototype)}}else{try{throw Error()}catch(e){n=e}e()}}catch(t){if(t&&n&&"string"==typeof t.stack){for(var s=t.stack.split("\n"),u=n.stack.split("\n"),c=s.length-1,d=u.length-1;c>=1&&d>=0&&s[c]!==u[d];)d--;for(;c>=1&&d>=0;c--,d--)if(s[c]!==u[d]){if(1!==c||1!==d)do if(c--,--d<0||s[c]!==u[d]){var f="\n"+s[c].replace(" at new "," at ");return e.displayName&&f.includes("")&&(f=f.replace("",e.displayName)),"function"==typeof e&&ep.set(e,f),f}while(c>=1&&d>=0);break}}}finally{em=!1,ef.current=i,function(){if(0==--eu){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:el({},e,{value:et}),info:el({},e,{value:en}),warn:el({},e,{value:er}),error:el({},e,{value:ei}),group:el({},e,{value:eo}),groupCollapsed:el({},e,{value:ea}),groupEnd:el({},e,{value:es})})}eu<0&&l("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=o}var h=e?e.displayName||e.name:"",p=h?eh(h):"";return"function"==typeof e&&ep.set(e,p),p}function ev(e){try{var t="",n=e;do t+=function(e){switch(e._debugOwner&&e._debugOwner.type,e._debugSource,e.tag){case 5:return eh(e.type);case 16:return eh("Lazy");case 13:return eh("Suspense");case 19:return eh("SuspenseList");case 0:case 2:case 15:return eg(e.type,!1);case 11:return eg(e.type.render,!1);case 1:return eg(e.type,!0);default:return""}}(n),n=n.return;while(n);return t}catch(e){return"\nError generating stack: "+e.message+"\n"+e.stack}}function eb(e){return e.displayName||"Context"}function ey(e){if(null==e)return null;if("number"==typeof e.tag&&l("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),"function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case q:return"Fragment";case U:return"Portal";case H:return"Profiler";case K:return"StrictMode";case Y:return"Suspense";case G:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case $:return eb(e)+".Consumer";case V:return eb(e._context)+".Provider";case W:return function(e,t,n){var r=e.displayName;if(r)return r;var i=t.displayName||t.name||"";return""!==i?n+"("+i+")":n}(e,e.render,"ForwardRef");case Q:var t=e.displayName||null;return null!==t?t:ey(e.type)||"Memo";case Z:var n=e._payload,r=e._init;try{return ey(r(n))}catch(e){}}return null}function eA(e){return e.displayName||"Context"}function ew(e){var t,n,r,i=e.tag,o=e.type;switch(i){case 24:return"Cache";case 9:return eA(o)+".Consumer";case 10:return eA(o._context)+".Provider";case 18:return"DehydratedFragment";case 11:return t=o.render,n="ForwardRef",r=t.displayName||t.name||"",o.displayName||(""!==r?n+"("+r+")":n);case 7:return"Fragment";case 5:return o;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ey(o);case 8:return o===K?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if("function"==typeof o)return o.displayName||o.name||null;if("string"==typeof o)return o}return null}ep=new("function"==typeof WeakMap?WeakMap:Map);var e_=o.ReactDebugCurrentFrame,eE=null,eS=!1;function ek(){if(null===eE)return null;var e=eE._debugOwner;return null!=e?ew(e):null}function eM(){return null===eE?"":ev(eE)}function eC(){e_.getCurrentStack=null,eE=null,eS=!1}function ex(e){e_.getCurrentStack=null===e?null:eM,eE=e,eS=!1}function eR(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return A(e),e;default:return""}}var eI={button:!0,checkbox:!0,image:!0,hidden:!0,radio:!0,reset:!0,submit:!0};function eT(e,t){eI[t.type]||t.onChange||t.onInput||t.readOnly||t.disabled||null==t.value||l("You provided a `value` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultValue`. Otherwise, set either `onChange` or `readOnly`."),t.onChange||t.readOnly||t.disabled||null==t.checked||l("You provided a `checked` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultChecked`. Otherwise, set either `onChange` or `readOnly`.")}function eO(e){var t=e.type,n=e.nodeName;return n&&"input"===n.toLowerCase()&&("checkbox"===t||"radio"===t)}function eP(e){return e._valueTracker}function eL(e){eP(e)||(e._valueTracker=function(e){var t=eO(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);A(e[t]);var r=""+e[t];if(!e.hasOwnProperty(t)&&void 0!==n&&"function"==typeof n.get&&"function"==typeof n.set){var i=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){A(e),r=""+e,o.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){A(e),r=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e))}function eN(e){if(!e)return!1;var t,n=eP(e);if(!n)return!0;var r=n.getValue(),i=(t="",e?t=eO(e)?e.checked?"true":"false":e.value:t);return i!==r&&(n.setValue(i),!0)}function eD(e){if(void 0===(e=e||("undefined"!=typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}var eB=!1,ej=!1,eF=!1,ez=!1;function eU(e){return"checkbox"===e.type||"radio"===e.type?null!=e.checked:null!=e.value}function eq(e,t){var n=t.checked;return el({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=n?n:e._wrapperState.initialChecked})}function eK(e,t){eT(0,t),void 0===t.checked||void 0===t.defaultChecked||ej||(l("%s contains an input of type %s with both checked and defaultChecked props. Input elements must be either controlled or uncontrolled (specify either the checked prop, or the defaultChecked prop, but not both). Decide between using a controlled or uncontrolled input element and remove one of these props. More info: https://reactjs.org/link/controlled-components",ek()||"A component",t.type),ej=!0),void 0===t.value||void 0===t.defaultValue||eB||(l("%s contains an input of type %s with both value and defaultValue props. Input elements must be either controlled or uncontrolled (specify either the value prop, or the defaultValue prop, but not both). Decide between using a controlled or uncontrolled input element and remove one of these props. More info: https://reactjs.org/link/controlled-components",ek()||"A component",t.type),eB=!0);var n=null==t.defaultValue?"":t.defaultValue;e._wrapperState={initialChecked:null!=t.checked?t.checked:t.defaultChecked,initialValue:eR(null!=t.value?t.value:n),controlled:eU(t)}}function eH(e,t){var n=t.checked;null!=n&&F(e,"checked",n,!1)}function eV(e,t){var n=eU(t);e._wrapperState.controlled||!n||ez||(l("A component is changing an uncontrolled input to be controlled. This is likely caused by the value changing from undefined to a defined value, which should not happen. Decide between using a controlled or uncontrolled input element for the lifetime of the component. More info: https://reactjs.org/link/controlled-components"),ez=!0),!e._wrapperState.controlled||n||eF||(l("A component is changing a controlled input to be uncontrolled. This is likely caused by the value changing from a defined to undefined, which should not happen. Decide between using a controlled or uncontrolled input element for the lifetime of the component. More info: https://reactjs.org/link/controlled-components"),eF=!0),eH(e,t);var r=eR(t.value),i=t.type;if(null!=r)"number"===i?(0===r&&""===e.value||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if("submit"===i||"reset"===i)return void e.removeAttribute("value");t.hasOwnProperty("value")?eW(e,t.type,r):t.hasOwnProperty("defaultValue")&&eW(e,t.type,eR(t.defaultValue)),null==t.checked&&null!=t.defaultChecked&&(e.defaultChecked=!!t.defaultChecked)}function e$(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(("submit"===r||"reset"===r)&&(void 0===t.value||null===t.value))return;var i=""+e._wrapperState.initialValue;n||i!==e.value&&(e.value=i),e.defaultValue=i}var o=e.name;""!==o&&(e.name=""),e.defaultChecked=!e.defaultChecked,e.defaultChecked=!!e._wrapperState.initialChecked,""!==o&&(e.name=o)}function eW(e,t,n){"number"===t&&eD(e.ownerDocument)===e||(null==n?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var eY=!1,eG=!1,eQ=!1;function eZ(e,t){null==t.value&&("object"==typeof t.children&&null!==t.children?r.Children.forEach(t.children,function(e){null!=e&&"string"!=typeof e&&"number"!=typeof e&&(eG||(eG=!0,l("Cannot infer the option value of complex children. Pass a `value` prop or use a plain string as children to