@dodoex/wallet-web3 0.0.3-2 → 0.0.3-4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/controllers/ConnectController.d.ts +6 -5
- package/dist/cjs/core/index.d.ts +1 -1
- package/dist/cjs/{index-a32c3cfa.cjs → index-0eeb697b.cjs} +2 -2
- package/dist/cjs/{index-e0e60b3b.cjs → index-3a14a931.cjs} +2 -2
- package/dist/cjs/index-a26b6945.cjs +1 -0
- package/dist/cjs/index-a9081fe4.cjs +1 -0
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/portis-8c790653.cjs +1 -0
- package/dist/cjs/provider-95f3425c.cjs +1 -0
- package/dist/cjs/state.d.ts +12 -3
- package/dist/cjs/uAuth-692ecdf6.cjs +1 -0
- package/dist/cjs/walletConnect-14d9d490.cjs +1 -0
- package/dist/cjs/walletLink-b99948b8.cjs +1 -0
- package/dist/controllers/ConnectController.d.ts +6 -5
- package/dist/core/index.d.ts +1 -1
- package/dist/{index-6cdefd52.js → index-3a9d1d45.js} +2 -2
- package/dist/{index-83293e8e.js → index-9af08480.js} +1 -1
- package/dist/index-a2c8f38f.js +1 -0
- package/dist/index-afc4ce88.js +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/portis-f89a1cba.js +1 -0
- package/dist/provider-1ecbc0fa.js +1 -0
- package/dist/state.d.ts +12 -3
- package/dist/uAuth-1f7b3a0a.js +1 -0
- package/dist/walletConnect-ac756ff6.js +1 -0
- package/dist/walletLink-c286f908.js +1 -0
- package/package.json +2 -2
- package/dist/cjs/controllers/StateController.d.ts +0 -27
- package/dist/cjs/index-23606273.cjs +0 -1
- package/dist/cjs/index-e948d9e4.cjs +0 -19
- package/dist/cjs/portis-cf05b1f4.cjs +0 -1
- package/dist/cjs/provider-de4ee5b7.cjs +0 -1
- package/dist/cjs/uAuth-075fec28.cjs +0 -1
- package/dist/cjs/walletConnect-58449a61.cjs +0 -1
- package/dist/cjs/walletLink-e3b39e1b.cjs +0 -1
- package/dist/controllers/StateController.d.ts +0 -27
- package/dist/index-822c6d78.js +0 -1
- package/dist/index-ecbe3d8d.js +0 -19
- package/dist/portis-b3fee0d6.js +0 -1
- package/dist/provider-30d55a46.js +0 -1
- package/dist/uAuth-343d653d.js +0 -1
- package/dist/walletConnect-ea07b187.js +0 -1
- package/dist/walletLink-39bc8bdc.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as e,a as t,d as r}from"./index-afc4ce88.js";import{c as n,r as i,s as o,a as s,d as a,b as u}from"./index-9af08480.js";import{g as c,c as l}from"./_commonjsHelpers-70de2c37.js";import{a as h}from"./sha3-a5661517.js";import f from"events";import d from"https";import p from"http";import m from"net";import _ from"tls";import g from"crypto";import v from"url";import y from"zlib";import{c as w,b}from"./bn-16003306.js";import E from"fs";import M from"path";import S from"os";import x from"stream";import k from"buffer";import R from"util";import T from"assert";import{i as C}from"./inherits-e2363129.js";import{e as A}from"./elliptic-1100204f.js";import{l as O,j as L}from"./index-5c16deff.js";import{p as B,s as P,d as I}from"./index-e3ab6de5.js";import"@ethersproject/providers";import"@ethersproject/constants";import"@ethersproject/contracts";import"@ethersproject/address";import"zustand";import"./hash-4b8ad136.js";var N,D,U={},j={},H={},q={},F={},W={},K={},z={};function G(){if(D)return K;D=1,Object.defineProperty(K,"__esModule",{value:!0}),K.getWindowMetadata=void 0;const e=function(){if(N)return z;function e(e){let t;return"undefined"!=typeof window&&void 0!==window[e]&&(t=window[e]),t}function t(t){const r=e(t);if(!r)throw new Error(`${t} is not defined in Window`);return r}return N=1,Object.defineProperty(z,"__esModule",{value:!0}),z.getLocalStorage=z.getLocalStorageOrThrow=z.getCrypto=z.getCryptoOrThrow=z.getLocation=z.getLocationOrThrow=z.getNavigator=z.getNavigatorOrThrow=z.getDocument=z.getDocumentOrThrow=z.getFromWindowOrThrow=z.getFromWindow=void 0,z.getFromWindow=e,z.getFromWindowOrThrow=t,z.getDocumentOrThrow=function(){return t("document")},z.getDocument=function(){return e("document")},z.getNavigatorOrThrow=function(){return t("navigator")},z.getNavigator=function(){return e("navigator")},z.getLocationOrThrow=function(){return t("location")},z.getLocation=function(){return e("location")},z.getCryptoOrThrow=function(){return t("crypto")},z.getCrypto=function(){return e("crypto")},z.getLocalStorageOrThrow=function(){return t("localStorage")},z.getLocalStorage=function(){return e("localStorage")},z}();return K.getWindowMetadata=function(){let t,r;try{t=e.getDocumentOrThrow(),r=e.getLocationOrThrow()}catch(e){return null}function n(...e){const r=t.getElementsByTagName("meta");for(let t=0;t<r.length;t++){const n=r[t],i=["itemprop","property","name"].map((e=>n.getAttribute(e))).filter((t=>!!t&&e.includes(t)));if(i.length&&i){const e=n.getAttribute("content");if(e)return e}}return""}const i=function(){let e=n("name","og:site_name","og:title","twitter:title");return e||(e=t.title),e}();return{description:n("description","og:description","twitter:description","keywords"),url:r.origin,icons:function(){const e=t.getElementsByTagName("link"),n=[];for(let t=0;t<e.length;t++){const i=e[t],o=i.getAttribute("rel");if(o&&o.toLowerCase().indexOf("icon")>-1){const e=i.getAttribute("href");if(e)if(-1===e.toLowerCase().indexOf("https:")&&-1===e.toLowerCase().indexOf("http:")&&0!==e.indexOf("//")){let t=r.protocol+"//"+r.host;if(0===e.indexOf("/"))t+=e;else{const n=r.pathname.split("/");n.pop();t+=n.join("/")+"/"+e}n.push(t)}else if(0===e.indexOf("//")){const t=r.protocol+e;n.push(t)}else n.push(e)}}return n}(),name:i}},K}var V,$={};var Y=function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),i=0;for(t=0;t<r;t++)for(var o=arguments[t],s=0,a=o.length;s<a;s++,i++)n[i]=o[s];return n},Z=function(e,t,r){this.name=e,this.version=t,this.os=r,this.type="browser"},J=function(e){this.version=e,this.type="node",this.name="node",this.os=process.platform},Q=function(e,t,r,n){this.name=e,this.version=t,this.os=r,this.bot=n,this.type="bot-device"},X=function(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null},ee=function(){this.type="react-native",this.name="react-native",this.version=null,this.os=null},te=/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,re=3,ne=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FBAV\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["searchbot",/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/]],ie=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function oe(e){return""!==e&&ne.reduce((function(t,r){var n=r[0],i=r[1];if(t)return t;var o=i.exec(e);return!!o&&[n,o]}),!1)}function se(e){var t=oe(e);if(!t)return null;var r=t[0],n=t[1];if("searchbot"===r)return new X;var i=n[1]&&n[1].split(/[._]/).slice(0,3);i?i.length<re&&(i=Y(i,function(e){for(var t=[],r=0;r<e;r++)t.push("0");return t}(re-i.length))):i=[];var o=i.join("."),s=ae(e),a=te.exec(e);return a&&a[1]?new Q(r,o,s,a[1]):new Z(r,o,s)}function ae(e){for(var t=0,r=ie.length;t<r;t++){var n=ie[t],i=n[0];if(n[1].exec(e))return i}return null}function ue(){return"undefined"!=typeof process&&process.version?new J(process.version.slice(1)):null}var ce,le=c(Object.freeze({__proto__:null,BrowserInfo:Z,NodeInfo:J,SearchBotDeviceInfo:Q,BotInfo:X,ReactNativeInfo:ee,detect:function(e){return e?se(e):"undefined"==typeof document&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product?new ee:"undefined"!=typeof navigator?se(navigator.userAgent):ue()},browserName:function(e){var t=oe(e);return t?t[0]:null},parseUserAgent:se,detectOS:ae,getNodeVersion:ue}));function he(){return ce||(ce=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getClientMeta=e.getLocalStorage=e.getLocalStorageOrThrow=e.getCrypto=e.getCryptoOrThrow=e.getLocation=e.getLocationOrThrow=e.getNavigator=e.getNavigatorOrThrow=e.getDocument=e.getDocumentOrThrow=e.getFromWindowOrThrow=e.getFromWindow=e.isBrowser=e.isNode=e.isMobile=e.isIOS=e.isAndroid=e.detectOS=e.detectEnv=void 0;const t=n,r=t.__importStar(G()),i=t.__importStar(function(){if(V)return $;function e(e){let t;return"undefined"!=typeof window&&void 0!==window[e]&&(t=window[e]),t}function t(t){const r=e(t);if(!r)throw new Error(`${t} is not defined in Window`);return r}return V=1,Object.defineProperty($,"__esModule",{value:!0}),$.getLocalStorage=$.getLocalStorageOrThrow=$.getCrypto=$.getCryptoOrThrow=$.getLocation=$.getLocationOrThrow=$.getNavigator=$.getNavigatorOrThrow=$.getDocument=$.getDocumentOrThrow=$.getFromWindowOrThrow=$.getFromWindow=void 0,$.getFromWindow=e,$.getFromWindowOrThrow=t,$.getDocumentOrThrow=function(){return t("document")},$.getDocument=function(){return e("document")},$.getNavigatorOrThrow=function(){return t("navigator")},$.getNavigator=function(){return e("navigator")},$.getLocationOrThrow=function(){return t("location")},$.getLocation=function(){return e("location")},$.getCryptoOrThrow=function(){return t("crypto")},$.getCrypto=function(){return e("crypto")},$.getLocalStorageOrThrow=function(){return t("localStorage")},$.getLocalStorage=function(){return e("localStorage")},$}()),o=le;function s(e){return(0,o.detect)(e)}function a(){const e=s();return e&&e.os?e.os:void 0}function u(){const e=a();return!!e&&e.toLowerCase().includes("android")}function c(){const e=a();return!!e&&(e.toLowerCase().includes("ios")||e.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1)}function l(){const e=s();return!(!e||!e.name)&&"node"===e.name.toLowerCase()}e.detectEnv=s,e.detectOS=a,e.isAndroid=u,e.isIOS=c,e.isMobile=function(){return!!a()&&(u()||c())},e.isNode=l,e.isBrowser=function(){return!l()&&!!(0,e.getNavigator)()},e.getFromWindow=i.getFromWindow,e.getFromWindowOrThrow=i.getFromWindowOrThrow,e.getDocumentOrThrow=i.getDocumentOrThrow,e.getDocument=i.getDocument,e.getNavigatorOrThrow=i.getNavigatorOrThrow,e.getNavigator=i.getNavigator,e.getLocationOrThrow=i.getLocationOrThrow,e.getLocation=i.getLocation,e.getCryptoOrThrow=i.getCryptoOrThrow,e.getCrypto=i.getCrypto,e.getLocalStorageOrThrow=i.getLocalStorageOrThrow,e.getLocalStorage=i.getLocalStorage,e.getClientMeta=function(){return r.getWindowMetadata()}}(W)),W}var fe={};var de,pe=c(Object.freeze({__proto__:null,safeJsonParse:function(e){if("string"!=typeof e)throw new Error("Cannot safe json parse value of type "+typeof e);try{return JSON.parse(e)}catch(t){return e}},safeJsonStringify:function(e){return"string"==typeof e?e:JSON.stringify(e)}}));function me(){if(de)return fe;de=1,Object.defineProperty(fe,"__esModule",{value:!0}),fe.safeJsonStringify=fe.safeJsonParse=void 0;const e=n.__importStar(pe);return fe.safeJsonParse=e.safeJsonParse,fe.safeJsonStringify=e.safeJsonStringify,fe}var _e,ge={};function ve(){if(_e)return ge;_e=1,Object.defineProperty(ge,"__esModule",{value:!0}),ge.removeLocal=ge.getLocal=ge.setLocal=void 0;const e=me(),t=he();return ge.setLocal=function(r,n){const i=(0,e.safeJsonStringify)(n),o=(0,t.getLocalStorage)();o&&o.setItem(r,i)},ge.getLocal=function(r){let n=null,i=null;const o=(0,t.getLocalStorage)();return o&&(i=o.getItem(r)),n=i?(0,e.safeJsonParse)(i):i,n},ge.removeLocal=function(e){const r=(0,t.getLocalStorage)();r&&r.removeItem(e)},ge}var ye,we={};var be,Ee,Me={};function Se(){return Ee||(Ee=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=n;t.__exportStar(he(),e),t.__exportStar(me(),e),t.__exportStar(ve(),e),t.__exportStar((ye||(ye=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getMobileLinkRegistry=e.getMobileRegistryEntry=e.saveMobileLinkInfo=e.formatIOSMobile=e.mobileLinkChoiceKey=void 0;const t=ve();function r(e,t){return e.filter((e=>e.name.toLowerCase().includes(t.toLowerCase())))[0]}e.mobileLinkChoiceKey="WALLETCONNECT_DEEPLINK_CHOICE",e.formatIOSMobile=function(e,t){const r=encodeURIComponent(e);return t.universalLink?`${t.universalLink}/wc?uri=${r}`:t.deepLink?`${t.deepLink}${t.deepLink.endsWith(":")?"//":"/"}wc?uri=${r}`:""},e.saveMobileLinkInfo=function(r){const n=r.href.split("?")[0];(0,t.setLocal)(e.mobileLinkChoiceKey,Object.assign(Object.assign({},r),{href:n}))},e.getMobileRegistryEntry=r,e.getMobileLinkRegistry=function(e,t){let n=e;return t&&(n=t.map((t=>r(e,t))).filter(Boolean)),n}}(we)),we),e),t.__exportStar(function(){if(be)return Me;be=1,Object.defineProperty(Me,"__esModule",{value:!0}),Me.formatMobileRegistry=Me.formatMobileRegistryEntry=Me.getDappRegistryUrl=Me.getWalletRegistryUrl=void 0;const e="https://registry.walletconnect.com";function t(e,t="mobile"){var r;return{name:e.name||"",shortName:e.metadata.shortName||"",color:e.metadata.colors.primary||"",logo:null!==(r=e.image_url.sm)&&void 0!==r?r:"",universalLink:e[t].universal||"",deepLink:e[t].native||""}}return Me.getWalletRegistryUrl=function(){return e+"/api/v2/wallets"},Me.getDappRegistryUrl=function(){return e+"/api/v2/dapps"},Me.formatMobileRegistryEntry=t,Me.formatMobileRegistry=function(e,r="mobile"){return Object.values(e).filter((e=>!!e[r].universal||!!e[r].native)).map((e=>t(e,r)))},Me}(),e)}(F)),F}var xe,ke={};function Re(){return xe||(xe=1,Object.defineProperty(ke,"__esModule",{value:!0}),ke.infuraNetworks=ke.stateMethods=ke.signingMethods=ke.reservedEvents=void 0,ke.reservedEvents=["session_request","session_update","exchange_key","connect","disconnect","display_uri","modal_closed","transport_open","transport_close","transport_error"],ke.signingMethods=["eth_sendTransaction","eth_signTransaction","eth_sign","eth_signTypedData","eth_signTypedData_v1","eth_signTypedData_v2","eth_signTypedData_v3","eth_signTypedData_v4","personal_sign","wallet_addEthereumChain","wallet_switchEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode"],ke.stateMethods=["eth_accounts","eth_chainId","net_version"],ke.infuraNetworks={1:"mainnet",3:"ropsten",4:"rinkeby",5:"goerli",42:"kovan"}),ke}var Te,Ce={},Ae={exports:{}};function Oe(){return Te||(Te=1,function(e,t){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function n(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function i(e,t,r){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var o;"object"==typeof e?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;try{o=require("buffer").Buffer}catch(e){}function s(e,t,r){for(var n=0,i=Math.min(e.length,r),o=t;o<i;o++){var s=e.charCodeAt(o)-48;n<<=4,n|=s>=49&&s<=54?s-49+10:s>=17&&s<=22?s-17+10:15&s}return n}function a(e,t,r,n){for(var i=0,o=Math.min(e.length,r),s=t;s<o;s++){var a=e.charCodeAt(s)-48;i*=n,i+=a>=49?a-49+10:a>=17?a-17+10:a}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 e.cmp(t)<0?e:t},i.prototype._init=function(e,t,n){if("number"==typeof e)return this._initNumber(e,t,n);if("object"==typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&i++,16===t?this._parseHex(e,i):this._parseBase(e,t,i),"-"===e[0]&&(this.negative=1),this.strip(),"le"===n&&this._initArray(this.toArray(),t,n)},i.prototype._initNumber=function(e,t,n){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),t,n)},i.prototype._initArray=function(e,t,n){if(r("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,s,a=0;if("be"===n)for(i=e.length-1,o=0;i>=0;i-=3)s=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===n)for(i=0,o=0;i<e.length;i+=3)s=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},i.prototype._parseHex=function(e,t){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var n,i,o=0;for(r=e.length-6,n=0;r>=t;r-=6)i=s(e,r,r+6),this.words[n]|=i<<o&67108863,this.words[n+1]|=i>>>26-o&4194303,(o+=24)>=26&&(o-=26,n++);r+6!==t&&(i=s(e,t,r+6),this.words[n]|=i<<o&67108863,this.words[n+1]|=i>>>26-o&4194303),this.strip()},i.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var o=e.length-r,s=o%n,u=Math.min(o,o-s)+r,c=0,l=r;l<u;l+=n)c=a(e,l,l+n,t),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==s){var h=1;for(c=a(e,l,e.length,t),l=0;l<s;l++)h*=t;this.imuln(h),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}},i.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},i.prototype.clone=function(){var e=new i(null);return this.copy(e),e},i.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},i.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var 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],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function h(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var i=0|e.words[0],o=0|t.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var c=1;c<n;c++){for(var l=u>>>26,h=67108863&u,f=Math.min(c,t.length-1),d=Math.max(0,c-e.length+1);d<=f;d++){var p=c-d|0;l+=(s=(i=0|e.words[p])*(o=0|t.words[d])+h)/67108864|0,h=67108863&s}r.words[c]=0|h,u=0|l}return 0!==u?r.words[c]=0|u:r.length--,r.strip()}i.prototype.toString=function(e,t){var n;if(t=0|t||1,16===(e=e||10)||"hex"===e){n="";for(var i=0,o=0,s=0;s<this.length;s++){var a=this.words[s],h=(16777215&(a<<i|o)).toString(16);n=0!=(o=a>>>24-i&16777215)||s!==this.length-1?u[6-h.length]+h+n:h+n,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(n=o.toString(16)+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var f=c[e],d=l[e];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(e);n=(p=p.idivn(d)).isZero()?m+n:u[f-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var 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&&r(!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 r(void 0!==o),this.toArrayLike(o,e,t)},i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},i.prototype.toArrayLike=function(e,t,n){var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var s,a,u="le"===t,c=new e(o),l=this.clone();if(u){for(a=0;!l.isZero();a++)s=l.andln(255),l.iushrn(8),c[a]=s;for(;a<o;a++)c[a]=0}else{for(a=0;a<o-i;a++)c[a]=0;for(a=0;!l.isZero();a++)s=l.andln(255),l.iushrn(8),c[o-a-1]=s}return c},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},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;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},i.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this.strip()},i.prototype.ior=function(e){return r(0==(this.negative|e.negative)),this.iuor(e)},i.prototype.or=function(e){return this.length>e.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 r=0;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this.strip()},i.prototype.iand=function(e){return r(0==(this.negative|e.negative)),this.iuand(e)},i.prototype.and=function(e){return this.length>e.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,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;n<r.length;n++)this.words[n]=t.words[n]^r.words[n];if(this!==t)for(;n<t.length;n++)this.words[n]=t.words[n];return this.length=t.length,this.strip()},i.prototype.ixor=function(e){return r(0==(this.negative|e.negative)),this.iuxor(e)},i.prototype.xor=function(e){return this.length>e.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){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var i=0;i<t;i++)this.words[i]=67108863&~this.words[i];return n>0&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var n=e/26|0,i=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<<i:this.words[n]&~(1<<i),this.strip()},i.prototype.iadd=function(e){var t,r,n;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(r=this,n=e):(r=e,n=this);for(var i=0,o=0;o<n.length;o++)t=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&t,i=t>>>26;for(;0!==i&&o<r.length;o++)t=(0|r.words[o])+i,this.words[o]=67108863&t,i=t>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},i.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},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 r,n,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=e):(r=e,n=this);for(var o=0,s=0;s<n.length;s++)o=(t=(0|r.words[s])-(0|n.words[s])+o)>>26,this.words[s]=67108863&t;for(;0!==o&&s<r.length;s++)o=(t=(0|r.words[s])+o)>>26,this.words[s]=67108863&t;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this.strip()},i.prototype.sub=function(e){return this.clone().isub(e)};var f=function(e,t,r){var n,i,o,s=e.words,a=t.words,u=r.words,c=0,l=0|s[0],h=8191&l,f=l>>>13,d=0|s[1],p=8191&d,m=d>>>13,_=0|s[2],g=8191&_,v=_>>>13,y=0|s[3],w=8191&y,b=y>>>13,E=0|s[4],M=8191&E,S=E>>>13,x=0|s[5],k=8191&x,R=x>>>13,T=0|s[6],C=8191&T,A=T>>>13,O=0|s[7],L=8191&O,B=O>>>13,P=0|s[8],I=8191&P,N=P>>>13,D=0|s[9],U=8191&D,j=D>>>13,H=0|a[0],q=8191&H,F=H>>>13,W=0|a[1],K=8191&W,z=W>>>13,G=0|a[2],V=8191&G,$=G>>>13,Y=0|a[3],Z=8191&Y,J=Y>>>13,Q=0|a[4],X=8191&Q,ee=Q>>>13,te=0|a[5],re=8191&te,ne=te>>>13,ie=0|a[6],oe=8191&ie,se=ie>>>13,ae=0|a[7],ue=8191&ae,ce=ae>>>13,le=0|a[8],he=8191&le,fe=le>>>13,de=0|a[9],pe=8191&de,me=de>>>13;r.negative=e.negative^t.negative,r.length=19;var _e=(c+(n=Math.imul(h,q))|0)+((8191&(i=(i=Math.imul(h,F))+Math.imul(f,q)|0))<<13)|0;c=((o=Math.imul(f,F))+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(p,q),i=(i=Math.imul(p,F))+Math.imul(m,q)|0,o=Math.imul(m,F);var ge=(c+(n=n+Math.imul(h,K)|0)|0)+((8191&(i=(i=i+Math.imul(h,z)|0)+Math.imul(f,K)|0))<<13)|0;c=((o=o+Math.imul(f,z)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(g,q),i=(i=Math.imul(g,F))+Math.imul(v,q)|0,o=Math.imul(v,F),n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,z)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,z)|0;var ve=(c+(n=n+Math.imul(h,V)|0)|0)+((8191&(i=(i=i+Math.imul(h,$)|0)+Math.imul(f,V)|0))<<13)|0;c=((o=o+Math.imul(f,$)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(w,q),i=(i=Math.imul(w,F))+Math.imul(b,q)|0,o=Math.imul(b,F),n=n+Math.imul(g,K)|0,i=(i=i+Math.imul(g,z)|0)+Math.imul(v,K)|0,o=o+Math.imul(v,z)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,$)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,$)|0;var ye=(c+(n=n+Math.imul(h,Z)|0)|0)+((8191&(i=(i=i+Math.imul(h,J)|0)+Math.imul(f,Z)|0))<<13)|0;c=((o=o+Math.imul(f,J)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(M,q),i=(i=Math.imul(M,F))+Math.imul(S,q)|0,o=Math.imul(S,F),n=n+Math.imul(w,K)|0,i=(i=i+Math.imul(w,z)|0)+Math.imul(b,K)|0,o=o+Math.imul(b,z)|0,n=n+Math.imul(g,V)|0,i=(i=i+Math.imul(g,$)|0)+Math.imul(v,V)|0,o=o+Math.imul(v,$)|0,n=n+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,J)|0;var we=(c+(n=n+Math.imul(h,X)|0)|0)+((8191&(i=(i=i+Math.imul(h,ee)|0)+Math.imul(f,X)|0))<<13)|0;c=((o=o+Math.imul(f,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(k,q),i=(i=Math.imul(k,F))+Math.imul(R,q)|0,o=Math.imul(R,F),n=n+Math.imul(M,K)|0,i=(i=i+Math.imul(M,z)|0)+Math.imul(S,K)|0,o=o+Math.imul(S,z)|0,n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,$)|0)+Math.imul(b,V)|0,o=o+Math.imul(b,$)|0,n=n+Math.imul(g,Z)|0,i=(i=i+Math.imul(g,J)|0)+Math.imul(v,Z)|0,o=o+Math.imul(v,J)|0,n=n+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 be=(c+(n=n+Math.imul(h,re)|0)|0)+((8191&(i=(i=i+Math.imul(h,ne)|0)+Math.imul(f,re)|0))<<13)|0;c=((o=o+Math.imul(f,ne)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,n=Math.imul(C,q),i=(i=Math.imul(C,F))+Math.imul(A,q)|0,o=Math.imul(A,F),n=n+Math.imul(k,K)|0,i=(i=i+Math.imul(k,z)|0)+Math.imul(R,K)|0,o=o+Math.imul(R,z)|0,n=n+Math.imul(M,V)|0,i=(i=i+Math.imul(M,$)|0)+Math.imul(S,V)|0,o=o+Math.imul(S,$)|0,n=n+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,J)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,J)|0,n=n+Math.imul(g,X)|0,i=(i=i+Math.imul(g,ee)|0)+Math.imul(v,X)|0,o=o+Math.imul(v,ee)|0,n=n+Math.imul(p,re)|0,i=(i=i+Math.imul(p,ne)|0)+Math.imul(m,re)|0,o=o+Math.imul(m,ne)|0;var Ee=(c+(n=n+Math.imul(h,oe)|0)|0)+((8191&(i=(i=i+Math.imul(h,se)|0)+Math.imul(f,oe)|0))<<13)|0;c=((o=o+Math.imul(f,se)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(L,q),i=(i=Math.imul(L,F))+Math.imul(B,q)|0,o=Math.imul(B,F),n=n+Math.imul(C,K)|0,i=(i=i+Math.imul(C,z)|0)+Math.imul(A,K)|0,o=o+Math.imul(A,z)|0,n=n+Math.imul(k,V)|0,i=(i=i+Math.imul(k,$)|0)+Math.imul(R,V)|0,o=o+Math.imul(R,$)|0,n=n+Math.imul(M,Z)|0,i=(i=i+Math.imul(M,J)|0)+Math.imul(S,Z)|0,o=o+Math.imul(S,J)|0,n=n+Math.imul(w,X)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(b,X)|0,o=o+Math.imul(b,ee)|0,n=n+Math.imul(g,re)|0,i=(i=i+Math.imul(g,ne)|0)+Math.imul(v,re)|0,o=o+Math.imul(v,ne)|0,n=n+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,se)|0)+Math.imul(m,oe)|0,o=o+Math.imul(m,se)|0;var Me=(c+(n=n+Math.imul(h,ue)|0)|0)+((8191&(i=(i=i+Math.imul(h,ce)|0)+Math.imul(f,ue)|0))<<13)|0;c=((o=o+Math.imul(f,ce)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(I,q),i=(i=Math.imul(I,F))+Math.imul(N,q)|0,o=Math.imul(N,F),n=n+Math.imul(L,K)|0,i=(i=i+Math.imul(L,z)|0)+Math.imul(B,K)|0,o=o+Math.imul(B,z)|0,n=n+Math.imul(C,V)|0,i=(i=i+Math.imul(C,$)|0)+Math.imul(A,V)|0,o=o+Math.imul(A,$)|0,n=n+Math.imul(k,Z)|0,i=(i=i+Math.imul(k,J)|0)+Math.imul(R,Z)|0,o=o+Math.imul(R,J)|0,n=n+Math.imul(M,X)|0,i=(i=i+Math.imul(M,ee)|0)+Math.imul(S,X)|0,o=o+Math.imul(S,ee)|0,n=n+Math.imul(w,re)|0,i=(i=i+Math.imul(w,ne)|0)+Math.imul(b,re)|0,o=o+Math.imul(b,ne)|0,n=n+Math.imul(g,oe)|0,i=(i=i+Math.imul(g,se)|0)+Math.imul(v,oe)|0,o=o+Math.imul(v,se)|0,n=n+Math.imul(p,ue)|0,i=(i=i+Math.imul(p,ce)|0)+Math.imul(m,ue)|0,o=o+Math.imul(m,ce)|0;var Se=(c+(n=n+Math.imul(h,he)|0)|0)+((8191&(i=(i=i+Math.imul(h,fe)|0)+Math.imul(f,he)|0))<<13)|0;c=((o=o+Math.imul(f,fe)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(U,q),i=(i=Math.imul(U,F))+Math.imul(j,q)|0,o=Math.imul(j,F),n=n+Math.imul(I,K)|0,i=(i=i+Math.imul(I,z)|0)+Math.imul(N,K)|0,o=o+Math.imul(N,z)|0,n=n+Math.imul(L,V)|0,i=(i=i+Math.imul(L,$)|0)+Math.imul(B,V)|0,o=o+Math.imul(B,$)|0,n=n+Math.imul(C,Z)|0,i=(i=i+Math.imul(C,J)|0)+Math.imul(A,Z)|0,o=o+Math.imul(A,J)|0,n=n+Math.imul(k,X)|0,i=(i=i+Math.imul(k,ee)|0)+Math.imul(R,X)|0,o=o+Math.imul(R,ee)|0,n=n+Math.imul(M,re)|0,i=(i=i+Math.imul(M,ne)|0)+Math.imul(S,re)|0,o=o+Math.imul(S,ne)|0,n=n+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,se)|0)+Math.imul(b,oe)|0,o=o+Math.imul(b,se)|0,n=n+Math.imul(g,ue)|0,i=(i=i+Math.imul(g,ce)|0)+Math.imul(v,ue)|0,o=o+Math.imul(v,ce)|0,n=n+Math.imul(p,he)|0,i=(i=i+Math.imul(p,fe)|0)+Math.imul(m,he)|0,o=o+Math.imul(m,fe)|0;var xe=(c+(n=n+Math.imul(h,pe)|0)|0)+((8191&(i=(i=i+Math.imul(h,me)|0)+Math.imul(f,pe)|0))<<13)|0;c=((o=o+Math.imul(f,me)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(U,K),i=(i=Math.imul(U,z))+Math.imul(j,K)|0,o=Math.imul(j,z),n=n+Math.imul(I,V)|0,i=(i=i+Math.imul(I,$)|0)+Math.imul(N,V)|0,o=o+Math.imul(N,$)|0,n=n+Math.imul(L,Z)|0,i=(i=i+Math.imul(L,J)|0)+Math.imul(B,Z)|0,o=o+Math.imul(B,J)|0,n=n+Math.imul(C,X)|0,i=(i=i+Math.imul(C,ee)|0)+Math.imul(A,X)|0,o=o+Math.imul(A,ee)|0,n=n+Math.imul(k,re)|0,i=(i=i+Math.imul(k,ne)|0)+Math.imul(R,re)|0,o=o+Math.imul(R,ne)|0,n=n+Math.imul(M,oe)|0,i=(i=i+Math.imul(M,se)|0)+Math.imul(S,oe)|0,o=o+Math.imul(S,se)|0,n=n+Math.imul(w,ue)|0,i=(i=i+Math.imul(w,ce)|0)+Math.imul(b,ue)|0,o=o+Math.imul(b,ce)|0,n=n+Math.imul(g,he)|0,i=(i=i+Math.imul(g,fe)|0)+Math.imul(v,he)|0,o=o+Math.imul(v,fe)|0;var ke=(c+(n=n+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;c=((o=o+Math.imul(m,me)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(U,V),i=(i=Math.imul(U,$))+Math.imul(j,V)|0,o=Math.imul(j,$),n=n+Math.imul(I,Z)|0,i=(i=i+Math.imul(I,J)|0)+Math.imul(N,Z)|0,o=o+Math.imul(N,J)|0,n=n+Math.imul(L,X)|0,i=(i=i+Math.imul(L,ee)|0)+Math.imul(B,X)|0,o=o+Math.imul(B,ee)|0,n=n+Math.imul(C,re)|0,i=(i=i+Math.imul(C,ne)|0)+Math.imul(A,re)|0,o=o+Math.imul(A,ne)|0,n=n+Math.imul(k,oe)|0,i=(i=i+Math.imul(k,se)|0)+Math.imul(R,oe)|0,o=o+Math.imul(R,se)|0,n=n+Math.imul(M,ue)|0,i=(i=i+Math.imul(M,ce)|0)+Math.imul(S,ue)|0,o=o+Math.imul(S,ce)|0,n=n+Math.imul(w,he)|0,i=(i=i+Math.imul(w,fe)|0)+Math.imul(b,he)|0,o=o+Math.imul(b,fe)|0;var Re=(c+(n=n+Math.imul(g,pe)|0)|0)+((8191&(i=(i=i+Math.imul(g,me)|0)+Math.imul(v,pe)|0))<<13)|0;c=((o=o+Math.imul(v,me)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,n=Math.imul(U,Z),i=(i=Math.imul(U,J))+Math.imul(j,Z)|0,o=Math.imul(j,J),n=n+Math.imul(I,X)|0,i=(i=i+Math.imul(I,ee)|0)+Math.imul(N,X)|0,o=o+Math.imul(N,ee)|0,n=n+Math.imul(L,re)|0,i=(i=i+Math.imul(L,ne)|0)+Math.imul(B,re)|0,o=o+Math.imul(B,ne)|0,n=n+Math.imul(C,oe)|0,i=(i=i+Math.imul(C,se)|0)+Math.imul(A,oe)|0,o=o+Math.imul(A,se)|0,n=n+Math.imul(k,ue)|0,i=(i=i+Math.imul(k,ce)|0)+Math.imul(R,ue)|0,o=o+Math.imul(R,ce)|0,n=n+Math.imul(M,he)|0,i=(i=i+Math.imul(M,fe)|0)+Math.imul(S,he)|0,o=o+Math.imul(S,fe)|0;var Te=(c+(n=n+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,me)|0)+Math.imul(b,pe)|0))<<13)|0;c=((o=o+Math.imul(b,me)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(U,X),i=(i=Math.imul(U,ee))+Math.imul(j,X)|0,o=Math.imul(j,ee),n=n+Math.imul(I,re)|0,i=(i=i+Math.imul(I,ne)|0)+Math.imul(N,re)|0,o=o+Math.imul(N,ne)|0,n=n+Math.imul(L,oe)|0,i=(i=i+Math.imul(L,se)|0)+Math.imul(B,oe)|0,o=o+Math.imul(B,se)|0,n=n+Math.imul(C,ue)|0,i=(i=i+Math.imul(C,ce)|0)+Math.imul(A,ue)|0,o=o+Math.imul(A,ce)|0,n=n+Math.imul(k,he)|0,i=(i=i+Math.imul(k,fe)|0)+Math.imul(R,he)|0,o=o+Math.imul(R,fe)|0;var Ce=(c+(n=n+Math.imul(M,pe)|0)|0)+((8191&(i=(i=i+Math.imul(M,me)|0)+Math.imul(S,pe)|0))<<13)|0;c=((o=o+Math.imul(S,me)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(U,re),i=(i=Math.imul(U,ne))+Math.imul(j,re)|0,o=Math.imul(j,ne),n=n+Math.imul(I,oe)|0,i=(i=i+Math.imul(I,se)|0)+Math.imul(N,oe)|0,o=o+Math.imul(N,se)|0,n=n+Math.imul(L,ue)|0,i=(i=i+Math.imul(L,ce)|0)+Math.imul(B,ue)|0,o=o+Math.imul(B,ce)|0,n=n+Math.imul(C,he)|0,i=(i=i+Math.imul(C,fe)|0)+Math.imul(A,he)|0,o=o+Math.imul(A,fe)|0;var Ae=(c+(n=n+Math.imul(k,pe)|0)|0)+((8191&(i=(i=i+Math.imul(k,me)|0)+Math.imul(R,pe)|0))<<13)|0;c=((o=o+Math.imul(R,me)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(U,oe),i=(i=Math.imul(U,se))+Math.imul(j,oe)|0,o=Math.imul(j,se),n=n+Math.imul(I,ue)|0,i=(i=i+Math.imul(I,ce)|0)+Math.imul(N,ue)|0,o=o+Math.imul(N,ce)|0,n=n+Math.imul(L,he)|0,i=(i=i+Math.imul(L,fe)|0)+Math.imul(B,he)|0,o=o+Math.imul(B,fe)|0;var Oe=(c+(n=n+Math.imul(C,pe)|0)|0)+((8191&(i=(i=i+Math.imul(C,me)|0)+Math.imul(A,pe)|0))<<13)|0;c=((o=o+Math.imul(A,me)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(U,ue),i=(i=Math.imul(U,ce))+Math.imul(j,ue)|0,o=Math.imul(j,ce),n=n+Math.imul(I,he)|0,i=(i=i+Math.imul(I,fe)|0)+Math.imul(N,he)|0,o=o+Math.imul(N,fe)|0;var Le=(c+(n=n+Math.imul(L,pe)|0)|0)+((8191&(i=(i=i+Math.imul(L,me)|0)+Math.imul(B,pe)|0))<<13)|0;c=((o=o+Math.imul(B,me)|0)+(i>>>13)|0)+(Le>>>26)|0,Le&=67108863,n=Math.imul(U,he),i=(i=Math.imul(U,fe))+Math.imul(j,he)|0,o=Math.imul(j,fe);var Be=(c+(n=n+Math.imul(I,pe)|0)|0)+((8191&(i=(i=i+Math.imul(I,me)|0)+Math.imul(N,pe)|0))<<13)|0;c=((o=o+Math.imul(N,me)|0)+(i>>>13)|0)+(Be>>>26)|0,Be&=67108863;var Pe=(c+(n=Math.imul(U,pe))|0)+((8191&(i=(i=Math.imul(U,me))+Math.imul(j,pe)|0))<<13)|0;return c=((o=Math.imul(j,me))+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,u[0]=_e,u[1]=ge,u[2]=ve,u[3]=ye,u[4]=we,u[5]=be,u[6]=Ee,u[7]=Me,u[8]=Se,u[9]=xe,u[10]=ke,u[11]=Re,u[12]=Te,u[13]=Ce,u[14]=Ae,u[15]=Oe,u[16]=Le,u[17]=Be,u[18]=Pe,0!==c&&(u[19]=c,r.length++),r};function d(e,t,r){return(new p).mulp(e,t,r)}function p(e,t){this.x=e,this.y=t}Math.imul||(f=h),i.prototype.mulTo=function(e,t){var r,n=this.length+e.length;return r=10===this.length&&10===e.length?f(this,e,t):n<63?h(this,e,t):n<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,o=0;o<r.length-1;o++){var s=i;i=0;for(var a=67108863&n,u=Math.min(o,t.length-1),c=Math.max(0,o-e.length+1);c<=u;c++){var l=o-c,h=(0|e.words[l])*(0|t.words[c]),f=67108863&h;a=67108863&(f=f+a|0),i+=(s=(s=s+(h/67108864|0)|0)+(f>>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,e,t):d(this,e,t),r},p.prototype.makeRBT=function(e){for(var t=new Array(e),r=i.prototype._countBits(e)-1,n=0;n<e;n++)t[n]=this.revBin(n,r,e);return t},p.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var n=0,i=0;i<t;i++)n|=(1&e)<<t-i-1,e>>=1;return n},p.prototype.permute=function(e,t,r,n,i,o){for(var s=0;s<o;s++)n[s]=t[e[s]],i[s]=r[e[s]]},p.prototype.transform=function(e,t,r,n,i,o){this.permute(o,e,t,r,n,i);for(var s=1;s<i;s<<=1)for(var a=s<<1,u=Math.cos(2*Math.PI/a),c=Math.sin(2*Math.PI/a),l=0;l<i;l+=a)for(var h=u,f=c,d=0;d<s;d++){var p=r[l+d],m=n[l+d],_=r[l+d+s],g=n[l+d+s],v=h*_-f*g;g=h*g+f*_,_=v,r[l+d]=p+_,n[l+d]=m+g,r[l+d+s]=p-_,n[l+d+s]=m-g,d!==a&&(v=u*h-c*f,f=u*f+c*h,h=v)}},p.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),n=1&r,i=0;for(r=r/2|0;r;r>>>=1)i++;return 1<<i+1+n},p.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var n=0;n<r/2;n++){var i=e[n];e[n]=e[r-n-1],e[r-n-1]=i,i=t[n],t[n]=-t[r-n-1],t[r-n-1]=-i}},p.prototype.normalize13b=function(e,t){for(var r=0,n=0;n<t/2;n++){var i=8192*Math.round(e[2*n+1]/t)+Math.round(e[2*n]/t)+r;e[n]=67108863&i,r=i<67108864?0:i/67108864|0}return e},p.prototype.convert13b=function(e,t,n,i){for(var o=0,s=0;s<t;s++)o+=0|e[s],n[2*s]=8191&o,o>>>=13,n[2*s+1]=8191&o,o>>>=13;for(s=2*t;s<i;++s)n[s]=0;r(0===o),r(0==(-8192&o))},p.prototype.stub=function(e){for(var t=new Array(e),r=0;r<e;r++)t[r]=0;return t},p.prototype.mulp=function(e,t,r){var n=2*this.guessLen13b(e.length,t.length),i=this.makeRBT(n),o=this.stub(n),s=new Array(n),a=new Array(n),u=new Array(n),c=new Array(n),l=new Array(n),h=new Array(n),f=r.words;f.length=n,this.convert13b(e.words,e.length,s,n),this.convert13b(t.words,t.length,c,n),this.transform(s,o,a,u,n,i),this.transform(c,o,l,h,n,i);for(var d=0;d<n;d++){var p=a[d]*l[d]-u[d]*h[d];u[d]=a[d]*h[d]+u[d]*l[d],a[d]=p}return this.conjugate(a,u,n),this.transform(a,u,f,o,n,i),this.conjugate(f,o,n),this.normalize13b(f,n),r.negative=e.negative^t.negative,r.length=e.length+t.length,r.strip()},i.prototype.mul=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},i.prototype.mulf=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),d(this,e,t)},i.prototype.imul=function(e){return this.clone().mulTo(e,this)},i.prototype.imuln=function(e){r("number"==typeof e),r(e<67108864);for(var t=0,n=0;n<this.length;n++){var i=(0|this.words[n])*e,o=(67108863&i)+(67108863&t);t>>=26,t+=i/67108864|0,t+=o>>>26,this.words[n]=67108863&o}return 0!==t&&(this.words[n]=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=new Array(e.bitLength()),r=0;r<t.length;r++){var n=r/26|0,i=r%26;t[r]=(e.words[n]&1<<i)>>>i}return t}(e);if(0===t.length)return new i(1);for(var r=this,n=0;n<t.length&&0===t[n];n++,r=r.sqr());if(++n<t.length)for(var o=r.sqr();n<t.length;n++,o=o.sqr())0!==t[n]&&(r=r.mul(o));return r},i.prototype.iushln=function(e){r("number"==typeof e&&e>=0);var t,n=e%26,i=(e-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(t=0;t<this.length;t++){var a=this.words[t]&o,u=(0|this.words[t])-a<<n;this.words[t]=u|s,s=a>>>26-n}s&&(this.words[t]=s,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this.strip()},i.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},i.prototype.iushrn=function(e,t,n){var i;r("number"==typeof e&&e>=0),i=t?(t-t%26)/26:0;var o=e%26,s=Math.min((e-o)/26,this.length),a=67108863^67108863>>>o<<o,u=n;if(i-=s,i=Math.max(0,i),u){for(var c=0;c<s;c++)u.words[c]=this.words[c];u.length=s}if(0===s);else if(this.length>s)for(this.length-=s,c=0;c<this.length;c++)this.words[c]=this.words[c+s];else this.words[0]=0,this.length=1;var l=0;for(c=this.length-1;c>=0&&(0!==l||c>=i);c--){var h=0|this.words[c];this.words[c]=l<<26-o|h>>>o,l=h&a}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},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){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26,i=1<<t;return!(this.length<=n||!(this.words[n]&i))},i.prototype.imaskn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var i=67108863^67108863>>>t<<t;this.words[this.length-1]&=i}return this.strip()},i.prototype.maskn=function(e){return this.clone().imaskn(e)},i.prototype.iaddn=function(e){return r("number"==typeof e),r(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},i.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[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(r("number"==typeof e),r(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<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this.strip()},i.prototype.addn=function(e){return this.clone().iaddn(e)},i.prototype.subn=function(e){return this.clone().isubn(e)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(e,t,n){var i,o,s=e.length+n;this._expand(s);var a=0;for(i=0;i<e.length;i++){o=(0|this.words[i+n])+a;var u=(0|e.words[i])*t;a=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+n]=67108863&o}for(;i<this.length-n;i++)a=(o=(0|this.words[i+n])+a)>>26,this.words[i+n]=67108863&o;if(0===a)return this.strip();for(r(-1===a),a=0,i=0;i<this.length;i++)a=(o=-(0|this.words[i])+a)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},i.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),o=e,s=0|o.words[o.length-1];0!=(r=26-this._countBits(s))&&(o=o.ushln(r),n.iushln(r),s=0|o.words[o.length-1]);var a,u=n.length-o.length;if("mod"!==t){(a=new i(null)).length=u+1,a.words=new Array(a.length);for(var c=0;c<a.length;c++)a.words[c]=0}var l=n.clone()._ishlnsubmul(o,1,u);0===l.negative&&(n=l,a&&(a.words[u]=1));for(var h=u-1;h>=0;h--){var f=67108864*(0|n.words[o.length+h])+(0|n.words[o.length+h-1]);for(f=Math.min(f/s|0,67108863),n._ishlnsubmul(o,f,h);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(o,1,h),n.isZero()||(n.negative^=1);a&&(a.words[h]=f)}return a&&a.strip(),n.strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},i.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(o=a.div.neg()),"div"!==t&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(e)),{div:o,mod:s}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&e.negative)?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(e)),{div:a.div,mod:s}):e.length>this.length||this.cmp(e)<0?{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);var o,s,a},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 r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),i=e.andln(1),o=r.cmp(n);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){r(e<=67108863);for(var t=(1<<26)%e,n=0,i=this.length-1;i>=0;i--)n=(t*n+(0|this.words[i]))%e;return n},i.prototype.idivn=function(e){r(e<=67108863);for(var t=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*t;this.words[n]=i/e|0,t=i%e}return this.strip()},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o=new i(1),s=new i(0),a=new i(0),u=new i(1),c=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++c;for(var l=n.clone(),h=t.clone();!t.isZero();){for(var f=0,d=1;0==(t.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(t.iushrn(f);f-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(l),s.isub(h)),o.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(l),u.isub(h)),a.iushrn(1),u.iushrn(1);t.cmp(n)>=0?(t.isub(n),o.isub(a),s.isub(u)):(n.isub(t),a.isub(o),u.isub(s))}return{a:a,b:u,gcd:n.iushln(c)}},i.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o,s=new i(1),a=new i(0),u=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var c=0,l=1;0==(t.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(t.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var h=0,f=1;0==(n.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(n.iushrn(h);h-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);t.cmp(n)>=0?(t.isub(n),s.isub(a)):(n.isub(t),a.isub(s))}return(o=0===t.cmpn(1)?s:a).cmpn(0)<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(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=t.cmp(r);if(i<0){var o=t;t=r,r=o}else if(0===i||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},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){r("number"==typeof e);var t=e%26,n=(e-t)/26,i=1<<t;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var o=i,s=n;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(e){var t,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)t=1;else{n&&(e=-e),r(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:i<e?-1:1}return 0!==this.negative?0|-t:t},i.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},i.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|e.words[r];if(n!==i){n<i?t=-1:n>i&&(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 this.cmpn(e)<=0},i.prototype.lte=function(e){return this.cmp(e)<=0},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 b(e)},i.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return r(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 r(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var m={k256:null,p224:null,p192:null,p25519:null};function _(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 g(){_.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){_.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function y(){_.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function w(){_.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function b(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function E(e){b.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)}_.prototype._tmp=function(){var e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},_.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):r.strip(),r},_.prototype.split=function(e,t){e.iushrn(this.n,0,t)},_.prototype.imulK=function(e){return e.imul(this.k)},n(g,_),g.prototype.split=function(e,t){for(var r=4194303,n=Math.min(e.length,9),i=0;i<n;i++)t.words[i]=e.words[i];if(t.length=n,e.length<=9)return e.words[0]=0,void(e.length=1);var o=e.words[9];for(t.words[t.length++]=o&r,i=10;i<e.length;i++){var s=0|e.words[i];e.words[i-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},g.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r<e.length;r++){var n=0|e.words[r];t+=977*n,e.words[r]=67108863&t,t=64*n+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},n(v,_),n(y,_),n(w,_),w.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var n=19*(0|e.words[r])+t,i=67108863&n;n>>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(m[e])return m[e];var t;if("k256"===e)t=new g;else if("p224"===e)t=new v;else if("p192"===e)t=new y;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new w}return m[e]=t,t},b.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},b.prototype._verify2=function(e,t){r(0==(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},b.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},b.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},b.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},b.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},b.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},b.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},b.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},b.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},b.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},b.prototype.isqr=function(e){return this.imul(e,e.clone())},b.prototype.sqr=function(e){return this.mul(e,e)},b.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var n=this.m.add(new i(1)).iushrn(2);return this.pow(e,n)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new i(1).toRed(this),u=a.redNeg(),c=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new i(2*l*l).toRed(this);0!==this.pow(l,c).cmp(u);)l.redIAdd(u);for(var h=this.pow(l,o),f=this.pow(e,o.addn(1).iushrn(1)),d=this.pow(e,o),p=s;0!==d.cmp(a);){for(var m=d,_=0;0!==m.cmp(a);_++)m=m.redSqr();r(_<p);var g=this.pow(h,new i(1).iushln(p-_-1));f=f.redMul(g),h=g.redSqr(),d=d.redMul(h),p=_}return f},b.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},b.prototype.pow=function(e,t){if(t.isZero())return new i(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new i(1).toRed(this),r[1]=e;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],e);var o=r[0],s=0,a=0,u=t.bitLength()%26;for(0===u&&(u=26),n=t.length-1;n>=0;n--){for(var c=t.words[n],l=u-1;l>=0;l--){var h=c>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==h||0!==s?(s<<=1,s|=h,(4==++a||0===n&&0===l)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}u=26}return o},b.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},b.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new E(e)},n(E,b),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 r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},E.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},E.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(Ae,l)),Ae.exports}var Le=Ie;Ie.strict=Ne,Ie.loose=De;var Be=Object.prototype.toString,Pe={"[object Int8Array]":!0,"[object Int16Array]":!0,"[object Int32Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Uint16Array]":!0,"[object Uint32Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0};function Ie(e){return Ne(e)||De(e)}function Ne(e){return e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Uint16Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array}function De(e){return Pe[Be.call(e)]}var Ue=Le.strict,je=function(e){if(Ue(e)){var t=Buffer.from(e.buffer);return e.byteLength!==e.buffer.byteLength&&(t=t.slice(e.byteOffset,e.byteOffset+e.byteLength)),t}return Buffer.from(e)};const He="hex",qe="utf8",Fe="0";function We(e){return new Uint8Array(e)}function Ke(e,t=!1){const r=e.toString(He);return t?vt(r):r}function ze(e){return e.toString(qe)}function Ge(e){return e.readUIntBE(0,e.length)}function Ve(e){return je(e)}function $e(e,t=!1){return Ke(Ve(e),t)}function Ye(e){return ze(Ve(e))}function Ze(e){return Ge(Ve(e))}function Je(e){return Array.from(e).map(nt).join("")}function Qe(e){return Buffer.from(gt(e),He)}function Xe(e){return We(Qe(e))}function et(e){return Je(Xe(e))}function tt(e){return Buffer.from(e,qe)}function rt(e){return We(tt(e))}function nt(e){return mt((e>>>0).toString(2))}function it(e){return Ve(ot(e))}function ot(e){return new Uint8Array(dt(e).map((e=>parseInt(e,2))))}function st(e,t){return $e(ot(e),t)}function at(e){return!("string"!=typeof e||!new RegExp(/^[01]+$/).test(e))&&e.length%8==0}function ut(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}function ct(e){return Buffer.isBuffer(e)}function lt(e){return Le.strict(e)&&!ct(e)}function ht(e){return!lt(e)&&!ct(e)&&void 0!==e.byteLength}function ft(e,t=8){const r=e%t;return r?(e-r)/t*t+t:e}function dt(e,t=8){const r=mt(e).match(new RegExp(`.{${t}}`,"gi"));return Array.from(r||[])}function pt(e){return dt(e).map(yt).join("")}function mt(e,t=8,r=Fe){return _t(e,ft(e.length,t),r)}function _t(e,t,r=Fe){return wt(e,t,!0,r)}function gt(e){return e.replace(/^0x/,"")}function vt(e){return e.startsWith("0x")?e:`0x${e}`}function yt(e){return e.split("").reverse().join("")}function wt(e,t,r,n=Fe){const i=t-e.length;let o=e;if(i>0){const t=n.repeat(i);o=r?t+e:e+t}return o}var bt,Et=Object.freeze({__proto__:null,bufferToArray:We,bufferToHex:Ke,bufferToUtf8:ze,bufferToNumber:Ge,bufferToBinary:function(e){return Je(We(e))},arrayToBuffer:Ve,arrayToHex:$e,arrayToUtf8:Ye,arrayToNumber:Ze,arrayToBinary:Je,hexToBuffer:Qe,hexToArray:Xe,hexToUtf8:function(e){return ze(Qe(e))},hexToNumber:function(e){return Ze(Xe(e))},hexToBinary:et,utf8ToBuffer:tt,utf8ToArray:rt,utf8ToHex:function(e,t=!1){return Ke(tt(e),t)},utf8ToNumber:function(e){const t=parseInt(e,10);return function(e,t){if(!e)throw new Error(t)}(!function(e){return void 0===e}(t),"Number can only safely store up to 53 bits"),t},utf8ToBinary:function(e){return Je(rt(e))},numberToBuffer:function(e){return it(nt(e))},numberToArray:function(e){return ot(nt(e))},numberToHex:function(e,t){return st(nt(e),t)},numberToUtf8:function(e){return`${e}`},numberToBinary:nt,binaryToBuffer:it,binaryToArray:ot,binaryToHex:st,binaryToUtf8:function(e){return Ye(ot(e))},binaryToNumber:function(e){return Ze(ot(e))},isBinaryString:at,isHexString:ut,isBuffer:ct,isTypedArray:lt,isArrayBuffer:ht,getType:function(e){return ct(e)?"buffer":lt(e)?"typed-array":ht(e)?"array-buffer":Array.isArray(e)?"array":typeof e},getEncoding:function(e){return at(e)?"binary":ut(e)?He:qe},concatBuffers:function(...e){return Buffer.concat(e)},concatArrays:function(...e){let t=[];return e.forEach((e=>t=t.concat(Array.from(e)))),new Uint8Array([...t])},trimLeft:function(e,t){const r=e.length-t;return r>0&&(e=e.slice(r)),e},trimRight:function(e,t){return e.slice(0,t)},calcByteLength:ft,splitBytes:dt,swapBytes:pt,swapHex:function(e){return st(pt(et(e)))},sanitizeBytes:mt,padLeft:_t,padRight:function(e,t,r=Fe){return wt(e,t,!1,r)},removeHexPrefix:gt,addHexPrefix:vt,sanitizeHex:function(e){return(e=mt(e=gt(e),2))&&(e=vt(e)),e},removeHexLeadingZeros:function(e){const t=e.startsWith("0x");return e=(e=gt(e)).startsWith(Fe)?e.substring(1):e,t?vt(e):e}}),Mt=c(Et);function St(){if(bt)return Ce;bt=1,Object.defineProperty(Ce,"__esModule",{value:!0}),Ce.convertNumberToHex=Ce.convertNumberToUtf8=Ce.convertNumberToArrayBuffer=Ce.convertNumberToBuffer=Ce.convertHexToNumber=Ce.convertHexToUtf8=Ce.convertHexToArrayBuffer=Ce.convertHexToBuffer=Ce.convertUtf8ToNumber=Ce.convertUtf8ToHex=Ce.convertUtf8ToBuffer=Ce.convertUtf8ToArrayBuffer=Ce.concatBuffers=Ce.convertBufferToNumber=Ce.convertBufferToHex=Ce.convertBufferToUtf8=Ce.convertBufferToArrayBuffer=Ce.concatArrayBuffers=Ce.convertArrayBufferToNumber=Ce.convertArrayBufferToHex=Ce.convertArrayBufferToUtf8=Ce.convertArrayBufferToBuffer=void 0;const e=n,t=e.__importDefault(Oe()),r=e.__importStar(Mt);return Ce.convertArrayBufferToBuffer=function(e){return r.arrayToBuffer(new Uint8Array(e))},Ce.convertArrayBufferToUtf8=function(e){return r.arrayToUtf8(new Uint8Array(e))},Ce.convertArrayBufferToHex=function(e,t){return r.arrayToHex(new Uint8Array(e),!t)},Ce.convertArrayBufferToNumber=function(e){return r.arrayToNumber(new Uint8Array(e))},Ce.concatArrayBuffers=function(...e){return r.hexToArray(e.map((e=>r.arrayToHex(new Uint8Array(e)))).join("")).buffer},Ce.convertBufferToArrayBuffer=function(e){return r.bufferToArray(e).buffer},Ce.convertBufferToUtf8=function(e){return r.bufferToUtf8(e)},Ce.convertBufferToHex=function(e,t){return r.bufferToHex(e,!t)},Ce.convertBufferToNumber=function(e){return r.bufferToNumber(e)},Ce.concatBuffers=function(...e){return r.concatBuffers(...e)},Ce.convertUtf8ToArrayBuffer=function(e){return r.utf8ToArray(e).buffer},Ce.convertUtf8ToBuffer=function(e){return r.utf8ToBuffer(e)},Ce.convertUtf8ToHex=function(e,t){return r.utf8ToHex(e,!t)},Ce.convertUtf8ToNumber=function(e){return new t.default(e,10).toNumber()},Ce.convertHexToBuffer=function(e){return r.hexToBuffer(e)},Ce.convertHexToArrayBuffer=function(e){return r.hexToArray(e).buffer},Ce.convertHexToUtf8=function(e){return r.hexToUtf8(e)},Ce.convertHexToNumber=function(e){return new t.default(r.removeHexPrefix(e),"hex").toNumber()},Ce.convertNumberToBuffer=function(e){return r.numberToBuffer(e)},Ce.convertNumberToArrayBuffer=function(e){return r.numberToArray(e).buffer},Ce.convertNumberToUtf8=function(e){return new t.default(e).toString()},Ce.convertNumberToHex=function(e,n){const i=r.removeHexPrefix(r.sanitizeHex(new t.default(e).toString(16)));return n?i:r.addHexPrefix(i)},Ce}var xt={},kt={};const Rt="PARSE_ERROR",Tt="INVALID_REQUEST",Ct="METHOD_NOT_FOUND",At="INVALID_PARAMS",Ot="INTERNAL_ERROR",Lt="SERVER_ERROR",Bt=[-32700,-32600,-32601,-32602,-32603],Pt=[-32e3,-32099],It={[Rt]:{code:-32700,message:"Parse error"},[Tt]:{code:-32600,message:"Invalid Request"},[Ct]:{code:-32601,message:"Method not found"},[At]:{code:-32602,message:"Invalid params"},[Ot]:{code:-32603,message:"Internal error"},[Lt]:{code:-32e3,message:"Server error"}},Nt=Lt;function Dt(e){return Bt.includes(e)}function Ut(e){return"number"==typeof e}function jt(e){return Object.keys(It).includes(e)?It[e]:It[Nt]}function Ht(e){const t=Object.values(It).find((t=>t.code===e));return t||It[Nt]}var qt,Ft={},Wt={};var Kt,zt={};!function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=n;t.__exportStar(function(){if(qt)return Wt;function e(){return(null==l?void 0:l.crypto)||(null==l?void 0:l.msCrypto)||{}}function t(){const t=e();return t.subtle||t.webkitSubtle}return qt=1,Object.defineProperty(Wt,"__esModule",{value:!0}),Wt.isBrowserCryptoAvailable=Wt.getSubtleCrypto=Wt.getBrowerCrypto=void 0,Wt.getBrowerCrypto=e,Wt.getSubtleCrypto=t,Wt.isBrowserCryptoAvailable=function(){return!!e()&&!!t()},Wt}(),e),t.__exportStar(function(){if(Kt)return zt;function e(){return"undefined"==typeof document&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product}function t(){return"undefined"!=typeof process&&void 0!==process.versions&&void 0!==process.versions.node}return Kt=1,Object.defineProperty(zt,"__esModule",{value:!0}),zt.isBrowser=zt.isNode=zt.isReactNative=void 0,zt.isReactNative=e,zt.isNode=t,zt.isBrowser=function(){return!e()&&!t()},zt}(),e)}(Ft);const Gt=Ft.isNode;function Vt(e=3){return Date.now()*Math.pow(10,e)+Math.floor(Math.random()*Math.pow(10,e))}function $t(e,t){return void 0===e?jt(Ot):("string"==typeof e&&(e=Object.assign(Object.assign({},jt(Lt)),{message:e})),void 0!==t&&(e.data=t),Dt(e.code)&&(e=Ht(e.code)),e)}function Yt(e){return"*"===e}function Zt(e){return!!Yt(e)||!!e.includes("*")&&(2===e.split("*").length&&1===e.split("*").filter((e=>""===e.trim())).length)}class Jt{}class Qt extends Jt{constructor(){super()}}function Xt(e,t){const r=function(e){const t=e.match(new RegExp(/^\w+:/,"gi"));if(t&&t.length)return t[0]}(e);return void 0!==r&&new RegExp(t).test(r)}function er(e){return"object"==typeof e&&"id"in e&&"jsonrpc"in e&&"2.0"===e.jsonrpc}function tr(e){return"result"in e}function rr(e){return"error"in e}var nr,ir=Object.freeze({__proto__:null,PARSE_ERROR:Rt,INVALID_REQUEST:Tt,METHOD_NOT_FOUND:Ct,INVALID_PARAMS:At,INTERNAL_ERROR:Ot,SERVER_ERROR:Lt,RESERVED_ERROR_CODES:Bt,SERVER_ERROR_CODE_RANGE:Pt,STANDARD_ERROR_MAP:It,DEFAULT_ERROR:Nt,isServerErrorCode:function(e){return e<=Pt[0]&&e>=Pt[1]},isReservedErrorCode:Dt,isValidErrorCode:Ut,getError:jt,getErrorByCode:Ht,validateJsonRpcError:function(e){if(void 0===e.error.code)return{valid:!1,error:"Missing code for JSON-RPC error"};if(void 0===e.error.message)return{valid:!1,error:"Missing message for JSON-RPC error"};if(!Ut(e.error.code))return{valid:!1,error:`Invalid error code type for JSON-RPC: ${e.error.code}`};if(Dt(e.error.code)){const t=Ht(e.error.code);if(t.message!==It[Nt].message&&e.error.message===t.message)return{valid:!1,error:`Invalid error code message for JSON-RPC: ${e.error.code}`}}return{valid:!0}},parseConnectionError:function(e,t,r){return e.message.includes("getaddrinfo ENOTFOUND")||e.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${t}`):e},isNodeJs:Gt,payloadId:Vt,getBigIntRpcId:function(e=6){return BigInt(Vt(e))},formatJsonRpcRequest:function(e,t,r){return{id:r||Vt(),jsonrpc:"2.0",method:e,params:t}},formatJsonRpcResult:function(e,t){return{id:e,jsonrpc:"2.0",result:t}},formatJsonRpcError:function(e,t,r){return{id:e,jsonrpc:"2.0",error:$t(t,r)}},formatErrorMessage:$t,isValidRoute:function(e){return e.includes("*")?Zt(e):!/\W/g.test(e)},isValidDefaultRoute:Yt,isValidWildcardRoute:Zt,isValidLeadingWildcardRoute:function(e){return!Yt(e)&&Zt(e)&&!e.split("*")[0].trim()},isValidTrailingWildcardRoute:function(e){return!Yt(e)&&Zt(e)&&!e.split("*")[1].trim()},IEvents:Jt,IJsonRpcConnection:class extends Jt{constructor(e){super()}},IBaseJsonRpcProvider:Qt,IJsonRpcProvider:class extends Qt{constructor(e){super()}},isHttpUrl:function(e){return Xt(e,"^https?:")},isWsUrl:function(e){return Xt(e,"^wss?:")},isLocalhostUrl:function(e){return new RegExp("wss?://localhost(:d{2,5})?").test(e)},isJsonRpcPayload:er,isJsonRpcRequest:function(e){return er(e)&&"method"in e},isJsonRpcResponse:function(e){return er(e)&&(tr(e)||rr(e))},isJsonRpcResult:tr,isJsonRpcError:rr,isJsonRpcValidationInvalid:function(e){return"error"in e&&!1===e.valid}}),or=c(ir);function sr(){if(nr)return kt;nr=1,Object.defineProperty(kt,"__esModule",{value:!0}),kt.getRpcUrl=kt.getInfuraRpcUrl=kt.logDeprecationWarning=kt.uuid=kt.payloadId=kt.removeHexLeadingZeros=kt.removeHexPrefix=kt.addHexPrefix=kt.sanitizeHex=void 0;const e=n,t=e.__importStar(Mt),r=e.__importStar(or),i=Re();function o(e,t){let r;const n=i.infuraNetworks[e];return n&&(r=`https://${n}.infura.io/v3/${t}`),r}return kt.sanitizeHex=function(e){return t.sanitizeHex(e)},kt.addHexPrefix=function(e){return t.addHexPrefix(e)},kt.removeHexPrefix=function(e){return t.removeHexPrefix(e)},kt.removeHexLeadingZeros=function(e){return t.removeHexLeadingZeros(t.addHexPrefix(e))},kt.payloadId=r.payloadId,kt.uuid=function(){return((e,t)=>{for(t=e="";e++<36;t+=51*e&52?(15^e?8^Math.random()*(20^e?16:4):4).toString(16):"-");return t})()},kt.logDeprecationWarning=function(){console.warn("DEPRECATION WARNING: This WalletConnect client library will be deprecated in favor of @walletconnect/client. Please check docs.walletconnect.org to learn more about this migration!")},kt.getInfuraRpcUrl=o,kt.getRpcUrl=function(e,t){let r;const n=o(e,t.infuraId);return t.custom&&t.custom[e]?r=t.custom[e]:n&&(r=n),r},kt}var ar,ur,cr={};function lr(){if(ar)return cr;ar=1,Object.defineProperty(cr,"__esModule",{value:!0}),cr.isSilentPayload=cr.isReservedEvent=cr.isInternalEvent=cr.isJsonRpcResponseError=cr.isJsonRpcResponseSuccess=cr.isJsonRpcRequest=cr.isJsonRpcSubscription=cr.isHexString=cr.getEncoding=cr.getType=cr.isArrayBuffer=cr.isTypedArray=cr.isBuffer=cr.isEmptyArray=cr.isEmptyString=void 0;const e=n.__importStar(Mt),t=Re();return cr.isEmptyString=function(e){return""===e||"string"==typeof e&&""===e.trim()},cr.isEmptyArray=function(e){return!(e&&e.length)},cr.isBuffer=function(t){return e.isBuffer(t)},cr.isTypedArray=function(t){return e.isTypedArray(t)},cr.isArrayBuffer=function(t){return e.isArrayBuffer(t)},cr.getType=function(t){return e.getType(t)},cr.getEncoding=function(t){return e.getEncoding(t)},cr.isHexString=function(t,r){return e.isHexString(t,r)},cr.isJsonRpcSubscription=function(e){return"object"==typeof e.params},cr.isJsonRpcRequest=function(e){return void 0!==e.method},cr.isJsonRpcResponseSuccess=function(e){return void 0!==e.result},cr.isJsonRpcResponseError=function(e){return void 0!==e.error},cr.isInternalEvent=function(e){return void 0!==e.event},cr.isReservedEvent=function(e){return t.reservedEvents.includes(e)||e.startsWith("wc_")},cr.isSilentPayload=function(e){return!!e.method.startsWith("wc_")||!t.signingMethods.includes(e.method)},cr}var hr,fr={};var dr,pr,mr,_r,gr,vr,yr,wr,br,Er,Mr={},Sr={},xr={};function kr(){return pr?dr:(pr=1,dr=e=>encodeURIComponent(e).replace(/[!'()*]/g,(e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)))}function Rr(){if(_r)return mr;_r=1;var e="%[a-f0-9]{2}",t=new RegExp("("+e+")|([^%]+?)","gi"),r=new RegExp("("+e+")+","gi");function n(e,t){try{return[decodeURIComponent(e.join(""))]}catch(e){}if(1===e.length)return e;t=t||1;var r=e.slice(0,t),i=e.slice(t);return Array.prototype.concat.call([],n(r),n(i))}function i(e){try{return decodeURIComponent(e)}catch(o){for(var r=e.match(t)||[],i=1;i<r.length;i++)r=(e=n(r,i).join("")).match(t)||[];return e}}return mr=function(e){if("string"!=typeof e)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return e=e.replace(/\+/g," "),decodeURIComponent(e)}catch(t){return function(e){for(var t={"%FE%FF":"��","%FF%FE":"��"},n=r.exec(e);n;){try{t[n[0]]=decodeURIComponent(n[0])}catch(e){var o=i(n[0]);o!==n[0]&&(t[n[0]]=o)}n=r.exec(e)}t["%C2"]="�";for(var s=Object.keys(t),a=0;a<s.length;a++){var u=s[a];e=e.replace(new RegExp(u,"g"),t[u])}return e}(e)}}}function Tr(){return vr?gr:(vr=1,gr=(e,t)=>{if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Expected the arguments to be of type `string`");if(""===t)return[e];const r=e.indexOf(t);return-1===r?[e]:[e.slice(0,r),e.slice(r+t.length)]})}function Cr(){return yr||(yr=1,function(e){const t=kr(),r=Rr(),n=Tr();function i(e){if("string"!=typeof e||1!==e.length)throw new TypeError("arrayFormatSeparator must be single character string")}function o(e,r){return r.encode?r.strict?t(e):encodeURIComponent(e):e}function s(e,t){return t.decode?r(e):e}function a(e){return Array.isArray(e)?e.sort():"object"==typeof e?a(Object.keys(e)).sort(((e,t)=>Number(e)-Number(t))).map((t=>e[t])):e}function u(e){const t=e.indexOf("#");return-1!==t&&(e=e.slice(0,t)),e}function c(e){const t=(e=u(e)).indexOf("?");return-1===t?"":e.slice(t+1)}function l(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&"string"==typeof e&&""!==e.trim()?e=Number(e):!t.parseBooleans||null===e||"true"!==e.toLowerCase()&&"false"!==e.toLowerCase()||(e="true"===e.toLowerCase()),e}function h(e,t){i((t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t)).arrayFormatSeparator);const r=function(e){let t;switch(e.arrayFormat){case"index":return(e,r,n)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===n[e]&&(n[e]={}),n[e][t[1]]=r):n[e]=r};case"bracket":return(e,r,n)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==n[e]?n[e]=[].concat(n[e],r):n[e]=[r]:n[e]=r};case"comma":case"separator":return(t,r,n)=>{const i="string"==typeof r&&r.split("").indexOf(e.arrayFormatSeparator)>-1?r.split(e.arrayFormatSeparator).map((t=>s(t,e))):null===r?r:s(r,e);n[t]=i};default:return(e,t,r)=>{void 0!==r[e]?r[e]=[].concat(r[e],t):r[e]=t}}}(t),o=Object.create(null);if("string"!=typeof e)return o;if(!(e=e.trim().replace(/^[?#&]/,"")))return o;for(const i of e.split("&")){let[e,a]=n(t.decode?i.replace(/\+/g," "):i,"=");a=void 0===a?null:["comma","separator"].includes(t.arrayFormat)?a:s(a,t),r(s(e,t),a,o)}for(const e of Object.keys(o)){const r=o[e];if("object"==typeof r&&null!==r)for(const e of Object.keys(r))r[e]=l(r[e],t);else o[e]=l(r,t)}return!1===t.sort?o:(!0===t.sort?Object.keys(o).sort():Object.keys(o).sort(t.sort)).reduce(((e,t)=>{const r=o[t];return Boolean(r)&&"object"==typeof r&&!Array.isArray(r)?e[t]=a(r):e[t]=r,e}),Object.create(null))}e.extract=c,e.parse=h,e.stringify=(e,t)=>{if(!e)return"";i((t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t)).arrayFormatSeparator);const r=r=>t.skipNull&&null==e[r]||t.skipEmptyString&&""===e[r],n=function(e){switch(e.arrayFormat){case"index":return t=>(r,n)=>{const i=r.length;return void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[o(t,e),"[",i,"]"].join("")]:[...r,[o(t,e),"[",o(i,e),"]=",o(n,e)].join("")]};case"bracket":return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[o(t,e),"[]"].join("")]:[...r,[o(t,e),"[]=",o(n,e)].join("")];case"comma":case"separator":return t=>(r,n)=>null==n||0===n.length?r:0===r.length?[[o(t,e),"=",o(n,e)].join("")]:[[r,o(n,e)].join(e.arrayFormatSeparator)];default:return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,o(t,e)]:[...r,[o(t,e),"=",o(n,e)].join("")]}}(t),s={};for(const t of Object.keys(e))r(t)||(s[t]=e[t]);const a=Object.keys(s);return!1!==t.sort&&a.sort(t.sort),a.map((r=>{const i=e[r];return void 0===i?"":null===i?o(r,t):Array.isArray(i)?i.reduce(n(r),[]).join("&"):o(r,t)+"="+o(i,t)})).filter((e=>e.length>0)).join("&")},e.parseUrl=(e,t)=>{t=Object.assign({decode:!0},t);const[r,i]=n(e,"#");return Object.assign({url:r.split("?")[0]||"",query:h(c(e),t)},t&&t.parseFragmentIdentifier&&i?{fragmentIdentifier:s(i,t)}:{})},e.stringifyUrl=(t,r)=>{r=Object.assign({encode:!0,strict:!0},r);const n=u(t.url).split("?")[0]||"",i=e.extract(t.url),s=e.parse(i,{sort:!1}),a=Object.assign(s,t.query);let c=e.stringify(a,r);c&&(c=`?${c}`);let l=function(e){let t="";const r=e.indexOf("#");return-1!==r&&(t=e.slice(r)),t}(t.url);return t.fragmentIdentifier&&(l=`#${o(t.fragmentIdentifier,r)}`),`${n}${c}${l}`}}(xr)),xr}function Ar(){if(wr)return Sr;wr=1,Object.defineProperty(Sr,"__esModule",{value:!0}),Sr.formatQueryString=Sr.parseQueryString=Sr.appendToQueryString=Sr.getQueryString=void 0;const e=n.__importStar(Cr());function t(t){return e.parse(t)}function r(t){return e.stringify(t)}return Sr.getQueryString=function(e){const t=-1!==e.indexOf("?")?e.indexOf("?"):void 0;return void 0!==t?e.substr(t):""},Sr.appendToQueryString=function(e,n){let i=t(e);return i=Object.assign(Object.assign({},i),n),e=r(i)},Sr.parseQueryString=t,Sr.formatQueryString=r,Sr}function Or(){return Er||(Er=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=n;t.__exportStar(Se(),e),t.__exportStar(Re(),e),t.__exportStar(St(),e),t.__exportStar((ur||(ur=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.parseTransactionData=e.parsePersonalSign=e.isValidAddress=e.toChecksumAddress=void 0;const t=h.exports,r=Mt,n=St(),i=sr(),o=lr();function s(e){e=(0,r.removeHexPrefix)(e.toLowerCase());const i=(0,r.removeHexPrefix)((0,t.keccak_256)((0,n.convertUtf8ToBuffer)(e)));let o="";for(let t=0;t<e.length;t++)parseInt(i[t],16)>7?o+=e[t].toUpperCase():o+=e[t];return(0,r.addHexPrefix)(o)}e.toChecksumAddress=s,e.isValidAddress=e=>!(!e||"0x"!==e.toLowerCase().substring(0,2)||!/^(0x)?[0-9a-f]{40}$/i.test(e)||!/^(0x)?[0-9a-f]{40}$/.test(e)&&!/^(0x)?[0-9A-F]{40}$/.test(e)&&e!==s(e)),e.parsePersonalSign=function(e){return(0,o.isEmptyArray)(e)||(0,o.isHexString)(e[0])||(e[0]=(0,n.convertUtf8ToHex)(e[0])),e},e.parseTransactionData=function(t){if(void 0!==t.type&&"0"!==t.type)return t;if(void 0===t.from||!(0,e.isValidAddress)(t.from))throw new Error("Transaction object must include a valid 'from' value.");function r(e){let t=e;return("number"==typeof e||"string"==typeof e&&!(0,o.isEmptyString)(e))&&((0,o.isHexString)(e)?"string"==typeof e&&(t=(0,i.sanitizeHex)(e)):t=(0,n.convertNumberToHex)(e)),"string"==typeof t&&(t=(0,i.removeHexLeadingZeros)(t)),t}const s={from:(0,i.sanitizeHex)(t.from),to:void 0===t.to?void 0:(0,i.sanitizeHex)(t.to),gasPrice:void 0===t.gasPrice?"":r(t.gasPrice),gas:void 0===t.gas?void 0===t.gasLimit?"":r(t.gasLimit):r(t.gas),value:void 0===t.value?"":r(t.value),nonce:void 0===t.nonce?"":r(t.nonce),data:void 0===t.data?"":(0,i.sanitizeHex)(t.data)||"0x"},a=["gasPrice","gas","value","nonce"];return Object.keys(s).forEach((e=>{(void 0===s[e]||"string"==typeof s[e]&&!s[e].trim().length)&&a.includes(e)&&delete s[e]})),s}}(xt)),xt),e),t.__exportStar(sr(),e),t.__exportStar(function(){if(hr)return fr;hr=1,Object.defineProperty(fr,"__esModule",{value:!0}),fr.formatRpcError=fr.promisify=void 0;const e=n;return fr.promisify=function(t,r){return(...n)=>e.__awaiter(this,void 0,void 0,(function*(){return new Promise(((e,i)=>{t.apply(r,[...n,(t,r)=>{null==t&&i(t),e(r)}])}))}))},fr.formatRpcError=function(e){const t=e.message||"Failed or Rejected Request";let r=-32e3;if(e&&!e.code)switch(t){case"Parse error":r=-32700;break;case"Invalid request":r=-32600;break;case"Method not found":r=-32601;break;case"Invalid params":r=-32602;break;case"Internal error":r=-32603;break;default:r=-32e3}const n={code:r,message:t};return e.data&&(n.data=e.data),n},fr}(),e),t.__exportStar(function(){if(br)return Mr;br=1,Object.defineProperty(Mr,"__esModule",{value:!0}),Mr.parseWalletConnectUri=Mr.isWalletConnectSession=void 0;const e=Ar();return Mr.isWalletConnectSession=function(e){return void 0!==e.bridge},Mr.parseWalletConnectUri=function(t){const r=t.indexOf(":"),n=-1!==t.indexOf("?")?t.indexOf("?"):void 0,i=t.substring(0,r),o=function(e){const t=e.split("@");return{handshakeTopic:t[0],version:parseInt(t[1],10)}}(t.substring(r+1,n)),s=function(t){const r=(0,e.parseQueryString)(t);return{key:r.key||"",bridge:r.bridge||""}}(void 0!==n?t.substr(n):"");return Object.assign(Object.assign({protocol:i},o),s)},Mr}(),e),t.__exportStar(Ar(),e),t.__exportStar(lr(),e)}(q)),q}var Lr,Br={},Pr={};var Ir,Nr,Dr={exports:{}};function Ur(){return Nr?Ir:(Nr=1,Ir={BINARY_TYPES:["nodebuffer","arraybuffer","fragments"],GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),EMPTY_BUFFER:Buffer.alloc(0),NOOP:()=>{}})}var jr,Hr,qr,Fr,Wr,Kr,zr,Gr,Vr,$r,Yr,Zr={exports:{}},Jr={exports:{}};function Qr(){return qr||(qr=1,e=Jr,"function"==typeof process.addon?e.exports=process.addon.bind(process):e.exports=function(){if(Hr)return jr;Hr=1;var e=E,t=M,r=S,n="function"==typeof __webpack_require__?__non_webpack_require__:w,i=process.config&&process.config.variables||{},o=!!process.env.PREBUILDS_ONLY,s=process.versions.modules,a=process.versions&&process.versions.electron||process.env.ELECTRON_RUN_AS_NODE||"undefined"!=typeof window&&window.process&&"renderer"===window.process.type?"electron":process.versions&&process.versions.nw?"node-webkit":"node",u=process.env.npm_config_arch||r.arch(),c=process.env.npm_config_platform||r.platform(),l=process.env.LIBC||(function(t){return"linux"===t&&e.existsSync("/etc/alpine-release")}(c)?"musl":"glibc"),h=process.env.ARM_VERSION||("arm64"===u?"8":i.arm_version)||"",f=(process.versions.uv||"").split(".")[0];function d(e){return n(d.resolve(e))}function p(t){try{return e.readdirSync(t)}catch(e){return[]}}function m(e,r){var n=p(e).filter(r);return n[0]&&t.join(e,n[0])}function _(e){return/\.node$/.test(e)}function g(e){var t=e.split("-");if(2===t.length){var r=t[0],n=t[1].split("+");if(r&&n.length&&n.every(Boolean))return{name:e,platform:r,architectures:n}}}function v(e,t){return function(r){return null!=r&&r.platform===e&&r.architectures.includes(t)}}function y(e,t){return e.architectures.length-t.architectures.length}function b(e){var t=e.split("."),r={file:e,specificity:0};if("node"===t.pop()){for(var n=0;n<t.length;n++){var i=t[n];if("node"===i||"electron"===i||"node-webkit"===i)r.runtime=i;else if("napi"===i)r.napi=!0;else if("abi"===i.slice(0,3))r.abi=i.slice(3);else if("uv"===i.slice(0,2))r.uv=i.slice(2);else if("armv"===i.slice(0,4))r.armv=i.slice(4);else{if("glibc"!==i&&"musl"!==i)continue;r.libc=i}r.specificity++}return r}}function x(e,t){return function(r){return!(null==r||r.runtime!==e&&!function(e){return"node"===e.runtime&&e.napi}(r)||r.abi!==t&&!r.napi||r.uv&&r.uv!==f||r.armv&&r.armv!==h||r.libc&&r.libc!==l)}}function k(e){return function(t,r){return t.runtime!==r.runtime?t.runtime===e?-1:1:t.abi!==r.abi?t.abi?-1:1:t.specificity!==r.specificity?t.specificity>r.specificity?-1:1:0}}return jr=d,d.resolve=d.path=function(e){e=t.resolve(e||".");try{var r=n(t.join(e,"package.json")).name.toUpperCase().replace(/-/g,"_");process.env[r+"_PREBUILD"]&&(e=process.env[r+"_PREBUILD"])}catch(e){}if(!o){var i=m(t.join(e,"build/Release"),_);if(i)return i;var d=m(t.join(e,"build/Debug"),_);if(d)return d}var w=S(e);if(w)return w;var E=S(t.dirname(process.execPath));if(E)return E;var M=["platform="+c,"arch="+u,"runtime="+a,"abi="+s,"uv="+f,h?"armv="+h:"","libc="+l,"node="+process.versions.node,process.versions.electron?"electron="+process.versions.electron:"","function"==typeof __webpack_require__?"webpack=true":""].filter(Boolean).join(" ");throw new Error("No native build was found for "+M+"\n loaded from: "+e+"\n");function S(e){var r=p(t.join(e,"prebuilds")).map(g).filter(v(c,u)).sort(y)[0];if(r){var n=t.join(e,"prebuilds",r.name),i=p(n).map(b).filter(x(a,s)).sort(k(a))[0];return i?t.join(n,i.file):void 0}}},d.parseTags=b,d.matchTags=x,d.compareTags=k,d.parseTuple=g,d.matchTuple=v,d.compareTuples=y,jr}()),Jr.exports;var e}function Xr(){return Kr||(Kr=1,function(e){try{e.exports=Qr()(__dirname)}catch(t){e.exports=(Wr||(Wr=1,Fr={mask:(e,t,r,n,i)=>{for(var o=0;o<i;o++)r[n+o]=e[o]^t[3&o]},unmask:(e,t)=>{const r=e.length;for(var n=0;n<r;n++)e[n]^=t[3&n]}}),Fr)}}(Zr)),Zr.exports}function en(){if(zr)return Dr.exports;zr=1;const{EMPTY_BUFFER:e}=Ur();function t(t,r){if(0===t.length)return e;if(1===t.length)return t[0];const n=Buffer.allocUnsafe(r);let i=0;for(let e=0;e<t.length;e++){const r=t[e];n.set(r,i),i+=r.length}return i<r?n.slice(0,i):n}function r(e,t,r,n,i){for(let o=0;o<i;o++)r[n+o]=e[o]^t[3&o]}function n(e,t){const r=e.length;for(let n=0;n<r;n++)e[n]^=t[3&n]}function i(e){return e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}function o(e){if(o.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=Buffer.from(e):ArrayBuffer.isView(e)?t=Buffer.from(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),o.readOnly=!1),t}try{const e=Xr(),s=e.BufferUtil||e;Dr.exports={concat:t,mask(e,t,n,i,o){o<48?r(e,t,n,i,o):s.mask(e,t,n,i,o)},toArrayBuffer:i,toBuffer:o,unmask(e,t){e.length<32?n(e,t):s.unmask(e,t)}}}catch(e){Dr.exports={concat:t,mask:r,toArrayBuffer:i,toBuffer:o,unmask:n}}return Dr.exports}function tn(){if(Yr)return $r;Yr=1;const e=y,t=en(),r=function(){if(Vr)return Gr;Vr=1;const e=Symbol("kDone"),t=Symbol("kRun");return Gr=class{constructor(r){this[e]=()=>{this.pending--,this[t]()},this.concurrency=r||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[t]()}[t](){if(this.pending!==this.concurrency&&this.jobs.length){const t=this.jobs.shift();this.pending++,t(this[e])}}}}(),{kStatusCode:n,NOOP:i}=Ur(),o=Buffer.from([0,0,255,255]),s=Symbol("permessage-deflate"),a=Symbol("total-length"),u=Symbol("callback"),c=Symbol("buffers"),l=Symbol("error");let h;function f(e){this[c].push(e),this[a]+=e.length}function d(e){this[a]+=e.length,this[s]._maxPayload<1||this[a]<=this[s]._maxPayload?this[c].push(e):(this[l]=new RangeError("Max payload size exceeded"),this[l].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[l][n]=1009,this.removeListener("data",d),this.reset())}function p(e){this[s]._inflate=null,e[n]=1007,this[u](e)}return $r=class{constructor(e,t,n){if(this._maxPayload=0|n,this._options=e||{},this._threshold=void 0!==this._options.threshold?this._options.threshold:1024,this._isServer=!!t,this._deflate=null,this._inflate=null,this.params=null,!h){const e=void 0!==this._options.concurrencyLimit?this._options.concurrencyLimit:10;h=new r(e)}}static get extensionName(){return"permessage-deflate"}offer(){const e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:null==this._options.clientMaxWindowBits&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){const e=this._deflate[u];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){const t=this._options,r=e.find((e=>!(!1===t.serverNoContextTakeover&&e.server_no_context_takeover||e.server_max_window_bits&&(!1===t.serverMaxWindowBits||"number"==typeof t.serverMaxWindowBits&&t.serverMaxWindowBits>e.server_max_window_bits)||"number"==typeof t.clientMaxWindowBits&&!e.client_max_window_bits)));if(!r)throw new Error("None of the extension offers can be accepted");return t.serverNoContextTakeover&&(r.server_no_context_takeover=!0),t.clientNoContextTakeover&&(r.client_no_context_takeover=!0),"number"==typeof t.serverMaxWindowBits&&(r.server_max_window_bits=t.serverMaxWindowBits),"number"==typeof t.clientMaxWindowBits?r.client_max_window_bits=t.clientMaxWindowBits:!0!==r.client_max_window_bits&&!1!==t.clientMaxWindowBits||delete r.client_max_window_bits,r}acceptAsClient(e){const t=e[0];if(!1===this._options.clientNoContextTakeover&&t.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(t.client_max_window_bits){if(!1===this._options.clientMaxWindowBits||"number"==typeof this._options.clientMaxWindowBits&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"')}else"number"==typeof this._options.clientMaxWindowBits&&(t.client_max_window_bits=this._options.clientMaxWindowBits);return t}normalizeParams(e){return e.forEach((e=>{Object.keys(e).forEach((t=>{let r=e[t];if(r.length>1)throw new Error(`Parameter "${t}" must have only a single value`);if(r=r[0],"client_max_window_bits"===t){if(!0!==r){const e=+r;if(!Number.isInteger(e)||e<8||e>15)throw new TypeError(`Invalid value for parameter "${t}": ${r}`);r=e}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${t}": ${r}`)}else if("server_max_window_bits"===t){const e=+r;if(!Number.isInteger(e)||e<8||e>15)throw new TypeError(`Invalid value for parameter "${t}": ${r}`);r=e}else{if("client_no_context_takeover"!==t&&"server_no_context_takeover"!==t)throw new Error(`Unknown parameter "${t}"`);if(!0!==r)throw new TypeError(`Invalid value for parameter "${t}": ${r}`)}e[t]=r}))})),e}decompress(e,t,r){h.add((n=>{this._decompress(e,t,((e,t)=>{n(),r(e,t)}))}))}compress(e,t,r){h.add((n=>{this._compress(e,t,((e,t)=>{n(),r(e,t)}))}))}_decompress(r,n,i){const h=this._isServer?"client":"server";if(!this._inflate){const t=`${h}_max_window_bits`,r="number"!=typeof this.params[t]?e.Z_DEFAULT_WINDOWBITS:this.params[t];this._inflate=e.createInflateRaw({...this._options.zlibInflateOptions,windowBits:r}),this._inflate[s]=this,this._inflate[a]=0,this._inflate[c]=[],this._inflate.on("error",p),this._inflate.on("data",d)}this._inflate[u]=i,this._inflate.write(r),n&&this._inflate.write(o),this._inflate.flush((()=>{const e=this._inflate[l];if(e)return this._inflate.close(),this._inflate=null,void i(e);const r=t.concat(this._inflate[c],this._inflate[a]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[a]=0,this._inflate[c]=[],n&&this.params[`${h}_no_context_takeover`]&&this._inflate.reset()),i(null,r)}))}_compress(r,n,o){const s=this._isServer?"server":"client";if(!this._deflate){const t=`${s}_max_window_bits`,r="number"!=typeof this.params[t]?e.Z_DEFAULT_WINDOWBITS:this.params[t];this._deflate=e.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:r}),this._deflate[a]=0,this._deflate[c]=[],this._deflate.on("error",i),this._deflate.on("data",f)}this._deflate[u]=o,this._deflate.write(r),this._deflate.flush(e.Z_SYNC_FLUSH,(()=>{if(!this._deflate)return;let e=t.concat(this._deflate[c],this._deflate[a]);n&&(e=e.slice(0,e.length-4)),this._deflate[u]=null,this._deflate[a]=0,this._deflate[c]=[],n&&this.params[`${s}_no_context_takeover`]&&this._deflate.reset(),o(null,e)}))}}}var rn,nn,on,sn,an,un,cn,ln,hn,fn,dn,pn,mn,_n,gn,vn,yn,wn,bn,En,Mn,Sn={exports:{}},xn={exports:{}};function kn(){return on||(on=1,function(e){try{e.exports=Qr()(__dirname)}catch(t){e.exports=nn?rn:(nn=1,rn=function(e){const t=e.length;let r=0;for(;r<t;)if(0==(128&e[r]))r++;else if(192==(224&e[r])){if(r+1===t||128!=(192&e[r+1])||192==(254&e[r]))return!1;r+=2}else if(224==(240&e[r])){if(r+2>=t||128!=(192&e[r+1])||128!=(192&e[r+2])||224===e[r]&&128==(224&e[r+1])||237===e[r]&&160==(224&e[r+1]))return!1;r+=3}else{if(240!=(248&e[r]))return!1;if(r+3>=t||128!=(192&e[r+1])||128!=(192&e[r+2])||128!=(192&e[r+3])||240===e[r]&&128==(240&e[r+1])||244===e[r]&&e[r+1]>143||e[r]>244)return!1;r+=4}return!0})}}(xn)),xn.exports}function Rn(){if(sn)return Sn.exports;function e(e){return e>=1e3&&e<=1014&&1004!==e&&1005!==e&&1006!==e||e>=3e3&&e<=4999}function t(e){const t=e.length;let r=0;for(;r<t;)if(0==(128&e[r]))r++;else if(192==(224&e[r])){if(r+1===t||128!=(192&e[r+1])||192==(254&e[r]))return!1;r+=2}else if(224==(240&e[r])){if(r+2>=t||128!=(192&e[r+1])||128!=(192&e[r+2])||224===e[r]&&128==(224&e[r+1])||237===e[r]&&160==(224&e[r+1]))return!1;r+=3}else{if(240!=(248&e[r]))return!1;if(r+3>=t||128!=(192&e[r+1])||128!=(192&e[r+2])||128!=(192&e[r+3])||240===e[r]&&128==(240&e[r+1])||244===e[r]&&e[r+1]>143||e[r]>244)return!1;r+=4}return!0}sn=1;try{let r=kn();"object"==typeof r&&(r=r.Validation.isValidUTF8),Sn.exports={isValidStatusCode:e,isValidUTF8:e=>e.length<150?t(e):r(e)}}catch(r){Sn.exports={isValidStatusCode:e,isValidUTF8:t}}return Sn.exports}function Tn(){if(un)return an;un=1;const{Writable:e}=x,t=tn(),{BINARY_TYPES:r,EMPTY_BUFFER:n,kStatusCode:i,kWebSocket:o}=Ur(),{concat:s,toArrayBuffer:a,unmask:u}=en(),{isValidStatusCode:c,isValidUTF8:l}=Rn();function h(e,t,r,n,o){const s=new e(r?`Invalid WebSocket frame: ${t}`:t);return Error.captureStackTrace(s,h),s.code=o,s[i]=n,s}return an=class extends e{constructor(e,t,n,i){super(),this._binaryType=e||r[0],this[o]=void 0,this._extensions=t||{},this._isServer=!!n,this._maxPayload=0|i,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._state=0,this._loop=!1}_write(e,t,r){if(8===this._opcode&&0==this._state)return r();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(r)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){const t=this._buffers[0];return this._buffers[0]=t.slice(e),t.slice(0,e)}const t=Buffer.allocUnsafe(e);do{const r=this._buffers[0],n=t.length-e;e>=r.length?t.set(this._buffers.shift(),n):(t.set(new Uint8Array(r.buffer,r.byteOffset,e),n),this._buffers[0]=r.slice(e)),e-=r.length}while(e>0);return t}startLoop(e){let t;this._loop=!0;do{switch(this._state){case 0:t=this.getInfo();break;case 1:t=this.getPayloadLength16();break;case 2:t=this.getPayloadLength64();break;case 3:this.getMask();break;case 4:t=this.getData(e);break;default:return void(this._loop=!1)}}while(this._loop);e(t)}getInfo(){if(this._bufferedBytes<2)return void(this._loop=!1);const e=this.consume(2);if(0!=(48&e[0]))return this._loop=!1,h(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");const r=64==(64&e[0]);if(r&&!this._extensions[t.extensionName])return this._loop=!1,h(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(this._fin=128==(128&e[0]),this._opcode=15&e[0],this._payloadLength=127&e[1],0===this._opcode){if(r)return this._loop=!1,h(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(!this._fragmented)return this._loop=!1,h(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");this._opcode=this._fragmented}else if(1===this._opcode||2===this._opcode){if(this._fragmented)return this._loop=!1,h(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");this._compressed=r}else{if(!(this._opcode>7&&this._opcode<11))return this._loop=!1,h(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");if(!this._fin)return this._loop=!1,h(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");if(r)return this._loop=!1,h(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(this._payloadLength>125)return this._loop=!1,h(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH")}if(this._fin||this._fragmented||(this._fragmented=this._opcode),this._masked=128==(128&e[1]),this._isServer){if(!this._masked)return this._loop=!1,h(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK")}else if(this._masked)return this._loop=!1,h(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");if(126===this._payloadLength)this._state=1;else{if(127!==this._payloadLength)return this.haveLength();this._state=2}}getPayloadLength16(){if(!(this._bufferedBytes<2))return this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength();this._loop=!1}getPayloadLength64(){if(this._bufferedBytes<8)return void(this._loop=!1);const e=this.consume(8),t=e.readUInt32BE(0);return t>Math.pow(2,21)-1?(this._loop=!1,h(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH")):(this._payloadLength=t*Math.pow(2,32)+e.readUInt32BE(4),this.haveLength())}haveLength(){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0))return this._loop=!1,h(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");this._masked?this._state=3:this._state=4}getMask(){this._bufferedBytes<4?this._loop=!1:(this._mask=this.consume(4),this._state=4)}getData(e){let t=n;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength)return void(this._loop=!1);t=this.consume(this._payloadLength),this._masked&&u(t,this._mask)}return this._opcode>7?this.controlMessage(t):this._compressed?(this._state=5,void this.decompress(t,e)):(t.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(t)),this.dataMessage())}decompress(e,r){this._extensions[t.extensionName].decompress(e,this._fin,((e,t)=>{if(e)return r(e);if(t.length){if(this._messageLength+=t.length,this._messageLength>this._maxPayload&&this._maxPayload>0)return r(h(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"));this._fragments.push(t)}const n=this.dataMessage();if(n)return r(n);this.startLoop(r)}))}dataMessage(){if(this._fin){const e=this._messageLength,t=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],2===this._opcode){let r;r="nodebuffer"===this._binaryType?s(t,e):"arraybuffer"===this._binaryType?a(s(t,e)):t,this.emit("message",r)}else{const r=s(t,e);if(!l(r))return this._loop=!1,h(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");this.emit("message",r.toString())}}this._state=0}controlMessage(e){if(8===this._opcode)if(this._loop=!1,0===e.length)this.emit("conclude",1005,""),this.end();else{if(1===e.length)return h(RangeError,"invalid payload length 1",!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");{const t=e.readUInt16BE(0);if(!c(t))return h(RangeError,`invalid status code ${t}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");const r=e.slice(2);if(!l(r))return h(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");this.emit("conclude",t,r.toString()),this.end()}}else 9===this._opcode?this.emit("ping",e):this.emit("pong",e);this._state=0}}}function Cn(){if(ln)return cn;ln=1;const{randomFillSync:e}=g,t=tn(),{EMPTY_BUFFER:r}=Ur(),{isValidStatusCode:n}=Rn(),{mask:i,toBuffer:o}=en(),s=Buffer.alloc(4);class a{constructor(e,t){this._extensions=t||{},this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._deflating=!1,this._queue=[]}static frame(t,r){const n=r.mask&&r.readOnly;let o=r.mask?6:2,a=t.length;t.length>=65536?(o+=8,a=127):t.length>125&&(o+=2,a=126);const u=Buffer.allocUnsafe(n?t.length+o:o);return u[0]=r.fin?128|r.opcode:r.opcode,r.rsv1&&(u[0]|=64),u[1]=a,126===a?u.writeUInt16BE(t.length,2):127===a&&(u.writeUInt32BE(0,2),u.writeUInt32BE(t.length,6)),r.mask?(e(s,0,4),u[1]|=128,u[o-4]=s[0],u[o-3]=s[1],u[o-2]=s[2],u[o-1]=s[3],n?(i(t,s,u,o,t.length),[u]):(i(t,s,t,0,t.length),[u,t])):[u,t]}close(e,t,i,o){let s;if(void 0===e)s=r;else{if("number"!=typeof e||!n(e))throw new TypeError("First argument must be a valid error code number");if(void 0===t||""===t)s=Buffer.allocUnsafe(2),s.writeUInt16BE(e,0);else{const r=Buffer.byteLength(t);if(r>123)throw new RangeError("The message must not be greater than 123 bytes");s=Buffer.allocUnsafe(2+r),s.writeUInt16BE(e,0),s.write(t,2)}}this._deflating?this.enqueue([this.doClose,s,i,o]):this.doClose(s,i,o)}doClose(e,t,r){this.sendFrame(a.frame(e,{fin:!0,rsv1:!1,opcode:8,mask:t,readOnly:!1}),r)}ping(e,t,r){const n=o(e);if(n.length>125)throw new RangeError("The data size must not be greater than 125 bytes");this._deflating?this.enqueue([this.doPing,n,t,o.readOnly,r]):this.doPing(n,t,o.readOnly,r)}doPing(e,t,r,n){this.sendFrame(a.frame(e,{fin:!0,rsv1:!1,opcode:9,mask:t,readOnly:r}),n)}pong(e,t,r){const n=o(e);if(n.length>125)throw new RangeError("The data size must not be greater than 125 bytes");this._deflating?this.enqueue([this.doPong,n,t,o.readOnly,r]):this.doPong(n,t,o.readOnly,r)}doPong(e,t,r,n){this.sendFrame(a.frame(e,{fin:!0,rsv1:!1,opcode:10,mask:t,readOnly:r}),n)}send(e,r,n){const i=o(e),s=this._extensions[t.extensionName];let u=r.binary?2:1,c=r.compress;if(this._firstFragment?(this._firstFragment=!1,c&&s&&(c=i.length>=s._threshold),this._compress=c):(c=!1,u=0),r.fin&&(this._firstFragment=!0),s){const e={fin:r.fin,rsv1:c,opcode:u,mask:r.mask,readOnly:o.readOnly};this._deflating?this.enqueue([this.dispatch,i,this._compress,e,n]):this.dispatch(i,this._compress,e,n)}else this.sendFrame(a.frame(i,{fin:r.fin,rsv1:!1,opcode:u,mask:r.mask,readOnly:o.readOnly}),n)}dispatch(e,r,n,i){if(!r)return void this.sendFrame(a.frame(e,n),i);const o=this._extensions[t.extensionName];this._bufferedBytes+=e.length,this._deflating=!0,o.compress(e,n.fin,((t,r)=>{if(this._socket.destroyed){const e=new Error("The socket was closed while data was being compressed");"function"==typeof i&&i(e);for(let t=0;t<this._queue.length;t++){const r=this._queue[t][4];"function"==typeof r&&r(e)}}else this._bufferedBytes-=e.length,this._deflating=!1,n.readOnly=!1,this.sendFrame(a.frame(r,n),i),this.dequeue()}))}dequeue(){for(;!this._deflating&&this._queue.length;){const e=this._queue.shift();this._bufferedBytes-=e[1].length,Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[1].length,this._queue.push(e)}sendFrame(e,t){2===e.length?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],t),this._socket.uncork()):this._socket.write(e[0],t)}}return cn=a}function An(){if(pn)return dn;pn=1;const e=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function t(e,t,r){void 0===e[t]?e[t]=[r]:e[t].push(r)}return dn={format:function(e){return Object.keys(e).map((t=>{let r=e[t];return Array.isArray(r)||(r=[r]),r.map((e=>[t].concat(Object.keys(e).map((t=>{let r=e[t];return Array.isArray(r)||(r=[r]),r.map((e=>!0===e?t:`${t}=${e}`)).join("; ")}))).join("; "))).join(", ")})).join(", ")},parse:function(r){const n=Object.create(null);if(void 0===r||""===r)return n;let i,o,s=Object.create(null),a=!1,u=!1,c=!1,l=-1,h=-1,f=0;for(;f<r.length;f++){const d=r.charCodeAt(f);if(void 0===i)if(-1===h&&1===e[d])-1===l&&(l=f);else if(32===d||9===d)-1===h&&-1!==l&&(h=f);else{if(59!==d&&44!==d)throw new SyntaxError(`Unexpected character at index ${f}`);{if(-1===l)throw new SyntaxError(`Unexpected character at index ${f}`);-1===h&&(h=f);const e=r.slice(l,h);44===d?(t(n,e,s),s=Object.create(null)):i=e,l=h=-1}}else if(void 0===o)if(-1===h&&1===e[d])-1===l&&(l=f);else if(32===d||9===d)-1===h&&-1!==l&&(h=f);else if(59===d||44===d){if(-1===l)throw new SyntaxError(`Unexpected character at index ${f}`);-1===h&&(h=f),t(s,r.slice(l,h),!0),44===d&&(t(n,i,s),s=Object.create(null),i=void 0),l=h=-1}else{if(61!==d||-1===l||-1!==h)throw new SyntaxError(`Unexpected character at index ${f}`);o=r.slice(l,f),l=h=-1}else if(u){if(1!==e[d])throw new SyntaxError(`Unexpected character at index ${f}`);-1===l?l=f:a||(a=!0),u=!1}else if(c)if(1===e[d])-1===l&&(l=f);else if(34===d&&-1!==l)c=!1,h=f;else{if(92!==d)throw new SyntaxError(`Unexpected character at index ${f}`);u=!0}else if(34===d&&61===r.charCodeAt(f-1))c=!0;else if(-1===h&&1===e[d])-1===l&&(l=f);else if(-1===l||32!==d&&9!==d){if(59!==d&&44!==d)throw new SyntaxError(`Unexpected character at index ${f}`);{if(-1===l)throw new SyntaxError(`Unexpected character at index ${f}`);-1===h&&(h=f);let e=r.slice(l,h);a&&(e=e.replace(/\\/g,""),a=!1),t(s,o,e),44===d&&(t(n,i,s),s=Object.create(null),i=void 0),o=void 0,l=h=-1}}else-1===h&&(h=f)}if(-1===l||c)throw new SyntaxError("Unexpected end of input");-1===h&&(h=f);const d=r.slice(l,h);return void 0===i?t(n,d,s):(void 0===o?t(s,d,!0):t(s,o,a?d.replace(/\\/g,""):d),t(n,i,s)),n}}}function On(){if(_n)return mn;_n=1;const e=f,t=d,r=p,n=m,i=_,{randomBytes:o,createHash:s}=g,{URL:a}=v,u=tn(),c=Tn(),l=Cn(),{BINARY_TYPES:h,EMPTY_BUFFER:y,GUID:w,kStatusCode:b,kWebSocket:E,NOOP:M}=Ur(),{addEventListener:S,removeEventListener:x}=function(){if(fn)return hn;fn=1;class e{constructor(e,t){this.target=t,this.type=e}}class t extends e{constructor(e,t){super("message",t),this.data=e}}class r extends e{constructor(e,t,r){super("close",r),this.wasClean=r._closeFrameReceived&&r._closeFrameSent,this.reason=t,this.code=e}}class n extends e{constructor(e){super("open",e)}}class i extends e{constructor(e,t){super("error",t),this.message=e.message,this.error=e}}const o={addEventListener(e,o,s){if("function"!=typeof o)return;function a(e){o.call(this,new t(e,this))}function u(e,t){o.call(this,new r(e,t,this))}function c(e){o.call(this,new i(e,this))}function l(){o.call(this,new n(this))}const h=s&&s.once?"once":"on";"message"===e?(a._listener=o,this[h](e,a)):"close"===e?(u._listener=o,this[h](e,u)):"error"===e?(c._listener=o,this[h](e,c)):"open"===e?(l._listener=o,this[h](e,l)):this[h](e,o)},removeEventListener(e,t){const r=this.listeners(e);for(let n=0;n<r.length;n++)r[n]!==t&&r[n]._listener!==t||this.removeListener(e,r[n])}};return hn=o}(),{format:k,parse:R}=An(),{toBuffer:T}=en(),C=["CONNECTING","OPEN","CLOSING","CLOSED"],A=[8,13];class O extends e{constructor(e,t,r){super(),this._binaryType=h[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage="",this._closeTimer=null,this._extensions={},this._protocol="",this._readyState=O.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,null!==e?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,Array.isArray(t)?t=t.join(", "):"object"==typeof t&&null!==t&&(r=t,t=void 0),L(this,e,t,r)):this._isServer=!0}get binaryType(){return this._binaryType}set binaryType(e){h.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get onclose(){}set onclose(e){}get onerror(){}set onerror(e){}get onopen(){}set onopen(e){}get onmessage(){}set onmessage(e){}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,t,r){const n=new c(this.binaryType,this._extensions,this._isServer,r);this._sender=new l(e,this._extensions),this._receiver=n,this._socket=e,n[E]=this,e[E]=this,n.on("conclude",D),n.on("drain",U),n.on("error",j),n.on("message",q),n.on("ping",F),n.on("pong",W),e.setTimeout(0),e.setNoDelay(),t.length>0&&e.unshift(t),e.on("close",K),e.on("data",z),e.on("end",G),e.on("error",V),this._readyState=O.OPEN,this.emit("open")}emitClose(){if(!this._socket)return this._readyState=O.CLOSED,void this.emit("close",this._closeCode,this._closeMessage);this._extensions[u.extensionName]&&this._extensions[u.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=O.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,t){if(this.readyState!==O.CLOSED){if(this.readyState===O.CONNECTING){const e="WebSocket was closed before the connection was established";return I(this,this._req,e)}this.readyState!==O.CLOSING?(this._readyState=O.CLOSING,this._sender.close(e,t,!this._isServer,(e=>{e||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())})),this._closeTimer=setTimeout(this._socket.destroy.bind(this._socket),3e4)):this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end()}}ping(e,t,r){if(this.readyState===O.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");"function"==typeof e?(r=e,e=t=void 0):"function"==typeof t&&(r=t,t=void 0),"number"==typeof e&&(e=e.toString()),this.readyState===O.OPEN?(void 0===t&&(t=!this._isServer),this._sender.ping(e||y,t,r)):N(this,e,r)}pong(e,t,r){if(this.readyState===O.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");"function"==typeof e?(r=e,e=t=void 0):"function"==typeof t&&(r=t,t=void 0),"number"==typeof e&&(e=e.toString()),this.readyState===O.OPEN?(void 0===t&&(t=!this._isServer),this._sender.pong(e||y,t,r)):N(this,e,r)}send(e,t,r){if(this.readyState===O.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if("function"==typeof t&&(r=t,t={}),"number"==typeof e&&(e=e.toString()),this.readyState!==O.OPEN)return void N(this,e,r);const n={binary:"string"!=typeof e,mask:!this._isServer,compress:!0,fin:!0,...t};this._extensions[u.extensionName]||(n.compress=!1),this._sender.send(e||y,n,r)}terminate(){if(this.readyState!==O.CLOSED){if(this.readyState===O.CONNECTING){const e="WebSocket was closed before the connection was established";return I(this,this._req,e)}this._socket&&(this._readyState=O.CLOSING,this._socket.destroy())}}}function L(e,n,i,c){const l={protocolVersion:A[1],maxPayload:104857600,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...c,createConnection:void 0,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:void 0,host:void 0,path:void 0,port:void 0};if(!A.includes(l.protocolVersion))throw new RangeError(`Unsupported protocol version: ${l.protocolVersion} (supported versions: ${A.join(", ")})`);let h;n instanceof a?(h=n,e._url=n.href):(h=new a(n),e._url=n);const f="ws+unix:"===h.protocol;if(!(h.host||f&&h.pathname))throw new Error(`Invalid URL: ${e.url}`);const d="wss:"===h.protocol||"https:"===h.protocol,p=d?443:80,m=o(16).toString("base64"),_=d?t.get:r.get;let g;if(l.createConnection=d?P:B,l.defaultPort=l.defaultPort||p,l.port=h.port||p,l.host=h.hostname.startsWith("[")?h.hostname.slice(1,-1):h.hostname,l.headers={"Sec-WebSocket-Version":l.protocolVersion,"Sec-WebSocket-Key":m,Connection:"Upgrade",Upgrade:"websocket",...l.headers},l.path=h.pathname+h.search,l.timeout=l.handshakeTimeout,l.perMessageDeflate&&(g=new u(!0!==l.perMessageDeflate?l.perMessageDeflate:{},!1,l.maxPayload),l.headers["Sec-WebSocket-Extensions"]=k({[u.extensionName]:g.offer()})),i&&(l.headers["Sec-WebSocket-Protocol"]=i),l.origin&&(l.protocolVersion<13?l.headers["Sec-WebSocket-Origin"]=l.origin:l.headers.Origin=l.origin),(h.username||h.password)&&(l.auth=`${h.username}:${h.password}`),f){const e=l.path.split(":");l.socketPath=e[0],l.path=e[1]}let v=e._req=_(l);l.timeout&&v.on("timeout",(()=>{I(e,v,"Opening handshake has timed out")})),v.on("error",(t=>{null===v||v.aborted||(v=e._req=null,e._readyState=O.CLOSING,e.emit("error",t),e.emitClose())})),v.on("response",(t=>{const r=t.headers.location,o=t.statusCode;if(r&&l.followRedirects&&o>=300&&o<400){if(++e._redirects>l.maxRedirects)return void I(e,v,"Maximum redirects exceeded");v.abort();const t=new a(r,n);L(e,t,i,c)}else e.emit("unexpected-response",v,t)||I(e,v,`Unexpected server response: ${t.statusCode}`)})),v.on("upgrade",((t,r,n)=>{if(e.emit("upgrade",t),e.readyState!==O.CONNECTING)return;v=e._req=null;const o=s("sha1").update(m+w).digest("base64");if(t.headers["sec-websocket-accept"]!==o)return void I(e,r,"Invalid Sec-WebSocket-Accept header");const a=t.headers["sec-websocket-protocol"],c=(i||"").split(/, */);let h;if(!i&&a?h="Server sent a subprotocol but none was requested":i&&!a?h="Server sent no subprotocol":a&&!c.includes(a)&&(h="Server sent an invalid subprotocol"),h)return void I(e,r,h);a&&(e._protocol=a);const f=t.headers["sec-websocket-extensions"];if(void 0!==f){if(!g){return void I(e,r,"Server sent a Sec-WebSocket-Extensions header but no extension was requested")}let t;try{t=R(f)}catch(t){return void I(e,r,"Invalid Sec-WebSocket-Extensions header")}const n=Object.keys(t);if(n.length){if(1!==n.length||n[0]!==u.extensionName){return void I(e,r,"Server indicated an extension that was not requested")}try{g.accept(t[u.extensionName])}catch(t){return void I(e,r,"Invalid Sec-WebSocket-Extensions header")}e._extensions[u.extensionName]=g}}e.setSocket(r,n,l.maxPayload)}))}function B(e){return e.path=e.socketPath,n.connect(e)}function P(e){return e.path=void 0,e.servername||""===e.servername||(e.servername=n.isIP(e.host)?"":e.host),i.connect(e)}function I(e,t,r){e._readyState=O.CLOSING;const n=new Error(r);Error.captureStackTrace(n,I),t.setHeader?(t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),t.once("abort",e.emitClose.bind(e)),e.emit("error",n)):(t.destroy(n),t.once("error",e.emit.bind(e,"error")),t.once("close",e.emitClose.bind(e)))}function N(e,t,r){if(t){const r=T(t).length;e._socket?e._sender._bufferedBytes+=r:e._bufferedAmount+=r}if(r){r(new Error(`WebSocket is not open: readyState ${e.readyState} (${C[e.readyState]})`))}}function D(e,t){const r=this[E];r._socket.removeListener("data",z),r._socket.resume(),r._closeFrameReceived=!0,r._closeMessage=t,r._closeCode=e,1005===e?r.close():r.close(e,t)}function U(){this[E]._socket.resume()}function j(e){const t=this[E];t._socket.removeListener("data",z),t._socket.resume(),t.close(e[b]),t.emit("error",e)}function H(){this[E].emitClose()}function q(e){this[E].emit("message",e)}function F(e){const t=this[E];t.pong(e,!t._isServer,M),t.emit("ping",e)}function W(e){this[E].emit("pong",e)}function K(){const e=this[E];this.removeListener("close",K),this.removeListener("end",G),e._readyState=O.CLOSING,e._socket.read(),e._receiver.end(),this.removeListener("data",z),this[E]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on("error",H),e._receiver.on("finish",H))}function z(e){this[E]._receiver.write(e)||this.pause()}function G(){const e=this[E];e._readyState=O.CLOSING,e._receiver.end(),this.end()}function V(){const e=this[E];this.removeListener("error",V),this.on("error",M),e&&(e._readyState=O.CLOSING,this.destroy())}return Object.defineProperty(O,"CONNECTING",{enumerable:!0,value:C.indexOf("CONNECTING")}),Object.defineProperty(O.prototype,"CONNECTING",{enumerable:!0,value:C.indexOf("CONNECTING")}),Object.defineProperty(O,"OPEN",{enumerable:!0,value:C.indexOf("OPEN")}),Object.defineProperty(O.prototype,"OPEN",{enumerable:!0,value:C.indexOf("OPEN")}),Object.defineProperty(O,"CLOSING",{enumerable:!0,value:C.indexOf("CLOSING")}),Object.defineProperty(O.prototype,"CLOSING",{enumerable:!0,value:C.indexOf("CLOSING")}),Object.defineProperty(O,"CLOSED",{enumerable:!0,value:C.indexOf("CLOSED")}),Object.defineProperty(O.prototype,"CLOSED",{enumerable:!0,value:C.indexOf("CLOSED")}),["binaryType","bufferedAmount","extensions","protocol","readyState","url"].forEach((e=>{Object.defineProperty(O.prototype,e,{enumerable:!0})})),["open","error","close","message"].forEach((e=>{Object.defineProperty(O.prototype,`on${e}`,{enumerable:!0,get(){const t=this.listeners(e);for(let e=0;e<t.length;e++)if(t[e]._listener)return t[e]._listener},set(t){const r=this.listeners(e);for(let t=0;t<r.length;t++)r[t]._listener&&this.removeListener(e,r[t]);this.addEventListener(e,t)}})})),O.prototype.addEventListener=S,O.prototype.removeEventListener=x,mn=O}function Ln(){if(wn)return yn;wn=1;const e=f,t=p,{createHash:r}=g,n=tn(),i=On(),{format:o,parse:s}=An(),{GUID:a,kWebSocket:u}=Ur(),c=/^[+/0-9A-Za-z]{22}==$/;function l(e){e._state=2,e.emit("close")}function h(){this.destroy()}function d(e,r,n,i){e.writable&&(n=n||t.STATUS_CODES[r],i={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(n),...i},e.write(`HTTP/1.1 ${r} ${t.STATUS_CODES[r]}\r\n`+Object.keys(i).map((e=>`${e}: ${i[e]}`)).join("\r\n")+"\r\n\r\n"+n)),e.removeListener("error",h),e.destroy()}function m(e){return e.trim()}return yn=class extends e{constructor(e,r){if(super(),null==(e={maxPayload:104857600,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,...e}).port&&!e.server&&!e.noServer||null!=e.port&&(e.server||e.noServer)||e.server&&e.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(null!=e.port?(this._server=t.createServer(((e,r)=>{const n=t.STATUS_CODES[426];r.writeHead(426,{"Content-Length":n.length,"Content-Type":"text/plain"}),r.end(n)})),this._server.listen(e.port,e.host,e.backlog,r)):e.server&&(this._server=e.server),this._server){const e=this.emit.bind(this,"connection");this._removeListeners=function(e,t){for(const r of Object.keys(t))e.on(r,t[r]);return function(){for(const r of Object.keys(t))e.removeListener(r,t[r])}}(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(t,r,n)=>{this.handleUpgrade(t,r,n,e)}})}!0===e.perMessageDeflate&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set),this.options=e,this._state=0}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(e&&this.once("close",e),2===this._state)return void process.nextTick(l,this);if(1===this._state)return;if(this._state=1,this.clients)for(const e of this.clients)e.terminate();const t=this._server;t&&(this._removeListeners(),this._removeListeners=this._server=null,null!=this.options.port)?t.close(l.bind(void 0,this)):process.nextTick(l,this)}shouldHandle(e){if(this.options.path){const t=e.url.indexOf("?");if((-1!==t?e.url.slice(0,t):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,t,r,i){t.on("error",h);const o=void 0!==e.headers["sec-websocket-key"]&&e.headers["sec-websocket-key"].trim(),a=+e.headers["sec-websocket-version"],u={};if("GET"!==e.method||"websocket"!==e.headers.upgrade.toLowerCase()||!o||!c.test(o)||8!==a&&13!==a||!this.shouldHandle(e))return d(t,400);if(this.options.perMessageDeflate){const r=new n(this.options.perMessageDeflate,!0,this.options.maxPayload);try{const t=s(e.headers["sec-websocket-extensions"]);t[n.extensionName]&&(r.accept(t[n.extensionName]),u[n.extensionName]=r)}catch(e){return d(t,400)}}if(this.options.verifyClient){const n={origin:e.headers[""+(8===a?"sec-websocket-origin":"origin")],secure:!(!e.socket.authorized&&!e.socket.encrypted),req:e};if(2===this.options.verifyClient.length)return void this.options.verifyClient(n,((n,s,a,c)=>{if(!n)return d(t,s||401,a,c);this.completeUpgrade(o,u,e,t,r,i)}));if(!this.options.verifyClient(n))return d(t,401)}this.completeUpgrade(o,u,e,t,r,i)}completeUpgrade(e,t,s,c,l,f){if(!c.readable||!c.writable)return c.destroy();if(c[u])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>0)return d(c,503);const p=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${r("sha1").update(e+a).digest("base64")}`],_=new i(null);let g=s.headers["sec-websocket-protocol"];if(g&&(g=g.split(",").map(m),g=this.options.handleProtocols?this.options.handleProtocols(g,s):g[0],g&&(p.push(`Sec-WebSocket-Protocol: ${g}`),_._protocol=g)),t[n.extensionName]){const e=t[n.extensionName].params,r=o({[n.extensionName]:[e]});p.push(`Sec-WebSocket-Extensions: ${r}`),_._extensions=t}this.emit("headers",p,s),c.write(p.concat("\r\n").join("\r\n")),c.removeListener("error",h),_.setSocket(c,l,this.options.maxPayload),this.clients&&(this.clients.add(_),_.on("close",(()=>this.clients.delete(_)))),f(_,s)}},yn}function Bn(){if(En)return bn;En=1;const e=On();return e.createWebSocketStream=function(){if(vn)return gn;vn=1;const{Duplex:e}=x;function t(e){e.emit("close")}function r(){!this.destroyed&&this._writableState.finished&&this.destroy()}function n(e){this.removeListener("error",n),this.destroy(),0===this.listenerCount("error")&&this.emit("error",e)}return gn=function(i,o){let s=!0,a=!0;function u(){s&&i._socket.resume()}i.readyState===i.CONNECTING?i.once("open",(function(){i._receiver.removeAllListeners("drain"),i._receiver.on("drain",u)})):(i._receiver.removeAllListeners("drain"),i._receiver.on("drain",u));const c=new e({...o,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return i.on("message",(function(e){c.push(e)||(s=!1,i._socket.pause())})),i.once("error",(function(e){c.destroyed||(a=!1,c.destroy(e))})),i.once("close",(function(){c.destroyed||c.push(null)})),c._destroy=function(e,r){if(i.readyState===i.CLOSED)return r(e),void process.nextTick(t,c);let n=!1;i.once("error",(function(e){n=!0,r(e)})),i.once("close",(function(){n||r(e),process.nextTick(t,c)})),a&&i.terminate()},c._final=function(e){i.readyState!==i.CONNECTING?null!==i._socket&&(i._socket._writableState.finished?(e(),c._readableState.endEmitted&&c.destroy()):(i._socket.once("finish",(function(){e()})),i.close())):i.once("open",(function(){c._final(e)}))},c._read=function(){i.readyState!==i.OPEN||s||(s=!0,i._receiver._writableState.needDrain||i._socket.resume())},c._write=function(e,t,r){i.readyState!==i.CONNECTING?i.send(e,r):i.once("open",(function(){c._write(e,t,r)}))},c.on("end",r),c.on("error",n),c},gn}(),e.Server=Ln(),e.Receiver=Tn(),e.Sender=Cn(),bn=e}function Pn(){if(Mn)return Br;Mn=1,Object.defineProperty(Br,"__esModule",{value:!0});const e=n,t=Or(),r=e.__importDefault((Lr||(Lr=1,Object.defineProperty(Pr,"__esModule",{value:!0}),Pr.default=class{constructor(){this._eventEmitters=[],"undefined"!=typeof window&&void 0!==window.addEventListener&&(window.addEventListener("online",(()=>this.trigger("online"))),window.addEventListener("offline",(()=>this.trigger("offline"))))}on(e,t){this._eventEmitters.push({event:e,callback:t})}trigger(e){let t=[];e&&(t=this._eventEmitters.filter((t=>t.event===e))),t.forEach((e=>{e.callback()}))}}),Pr)),i=void 0!==l.WebSocket?l.WebSocket:Bn();return Br.default=class{constructor(e){if(this.opts=e,this._queue=[],this._events=[],this._subscriptions=[],this._protocol=e.protocol,this._version=e.version,this._url="",this._netMonitor=null,this._socket=null,this._nextSocket=null,this._subscriptions=e.subscriptions||[],this._netMonitor=e.netMonitor||new r.default,!e.url||"string"!=typeof e.url)throw new Error("Missing or invalid WebSocket url");this._url=e.url,this._netMonitor.on("online",(()=>this._socketCreate()))}set readyState(e){}get readyState(){return this._socket?this._socket.readyState:-1}set connecting(e){}get connecting(){return 0===this.readyState}set connected(e){}get connected(){return 1===this.readyState}set closing(e){}get closing(){return 2===this.readyState}set closed(e){}get closed(){return 3===this.readyState}open(){this._socketCreate()}close(){this._socketClose()}send(e,t,r){if(!t||"string"!=typeof t)throw new Error("Missing or invalid topic field");this._socketSend({topic:t,type:"pub",payload:e,silent:!!r})}subscribe(e){this._socketSend({topic:e,type:"sub",payload:"",silent:!0})}on(e,t){this._events.push({event:e,callback:t})}_socketCreate(){if(this._nextSocket)return;const e=function(e,r,n){var i,o;const s=e.startsWith("https")?e.replace("https","wss"):e.startsWith("http")?e.replace("http","ws"):e,a=s.split("?"),u=(0,t.isBrowser)()?{protocol:r,version:n,env:"browser",host:(null===(i=(0,t.getLocation)())||void 0===i?void 0:i.host)||""}:{protocol:r,version:n,env:(null===(o=(0,t.detectEnv)())||void 0===o?void 0:o.name)||""},c=(0,t.appendToQueryString)((0,t.getQueryString)(a[1]||""),u);return a[0]+"?"+c}(this._url,this._protocol,this._version);if(this._nextSocket=new i(e),!this._nextSocket)throw new Error("Failed to create socket");this._nextSocket.onmessage=e=>this._socketReceive(e),this._nextSocket.onopen=()=>this._socketOpen(),this._nextSocket.onerror=e=>this._socketError(e),this._nextSocket.onclose=()=>{setTimeout((()=>{this._nextSocket=null,this._socketCreate()}),1e3)}}_socketOpen(){this._socketClose(),this._socket=this._nextSocket,this._nextSocket=null,this._queueSubscriptions(),this._pushQueue()}_socketClose(){this._socket&&(this._socket.onclose=()=>{},this._socket.close())}_socketSend(e){const t=JSON.stringify(e);this._socket&&1===this._socket.readyState?this._socket.send(t):(this._setToQueue(e),this._socketCreate())}_socketReceive(t){return e.__awaiter(this,void 0,void 0,(function*(){let e;try{e=JSON.parse(t.data)}catch(e){return}if(this._socketSend({topic:e.topic,type:"ack",payload:"",silent:!0}),this._socket&&1===this._socket.readyState){const t=this._events.filter((e=>"message"===e.event));t&&t.length&&t.forEach((t=>t.callback(e)))}}))}_socketError(e){const t=this._events.filter((e=>"error"===e.event));t&&t.length&&t.forEach((t=>t.callback(e)))}_queueSubscriptions(){this._subscriptions.forEach((e=>this._queue.push({topic:e,type:"sub",payload:"",silent:!0}))),this._subscriptions=this.opts.subscriptions||[]}_setToQueue(e){this._queue.push(e)}_pushQueue(){this._queue.forEach((e=>this._socketSend(e))),this._queue=[]}},Br}var In,Nn={};var Dn,Un={};var jn,Hn={};var qn,Fn,Wn={};function Kn(){if(Fn)return H;Fn=1,Object.defineProperty(H,"__esModule",{value:!0});const e=n,t=Or(),r=e.__importDefault(Pn()),i=(In||(In=1,Object.defineProperty(Nn,"__esModule",{value:!0}),Nn.ERROR_QRCODE_MODAL_USER_CLOSED=Nn.ERROR_QRCODE_MODAL_NOT_PROVIDED=Nn.ERROR_INVALID_URI=Nn.ERROR_INVALID_RESPONSE=Nn.ERROR_MISSING_REQUIRED=Nn.ERROR_MISSING_ID=Nn.ERROR_MISSING_METHOD=Nn.ERROR_MISSING_ERROR=Nn.ERROR_MISSING_RESULT=Nn.ERROR_MISSING_JSON_RPC=Nn.ERROR_SESSION_REJECTED=Nn.ERROR_SESSION_DISCONNECTED=Nn.ERROR_SESSION_CONNECTED=void 0,Nn.ERROR_SESSION_CONNECTED="Session currently connected",Nn.ERROR_SESSION_DISCONNECTED="Session currently disconnected",Nn.ERROR_SESSION_REJECTED="Session Rejected",Nn.ERROR_MISSING_JSON_RPC="Missing JSON RPC response",Nn.ERROR_MISSING_RESULT='JSON-RPC success response must include "result" field',Nn.ERROR_MISSING_ERROR='JSON-RPC error response must include "error" field',Nn.ERROR_MISSING_METHOD='JSON RPC request must have valid "method" value',Nn.ERROR_MISSING_ID='JSON RPC request must have valid "id" value',Nn.ERROR_MISSING_REQUIRED="Missing one of the required parameters: bridge / uri / session",Nn.ERROR_INVALID_RESPONSE="JSON RPC response format is invalid",Nn.ERROR_INVALID_URI="URI format is invalid",Nn.ERROR_QRCODE_MODAL_NOT_PROVIDED="QRCode Modal not provided",Nn.ERROR_QRCODE_MODAL_USER_CLOSED="User close QRCode Modal"),Nn),o=e.__importDefault(function(){if(Dn)return Un;Dn=1,Object.defineProperty(Un,"__esModule",{value:!0});const e=Or();return Un.default=class{constructor(){this._eventEmitters=[]}subscribe(e){this._eventEmitters.push(e)}unsubscribe(e){this._eventEmitters=this._eventEmitters.filter((t=>t.event!==e))}trigger(t){let r,n=[];r=(0,e.isJsonRpcRequest)(t)?t.method:(0,e.isJsonRpcResponseSuccess)(t)||(0,e.isJsonRpcResponseError)(t)?`response:${t.id}`:(0,e.isInternalEvent)(t)?t.event:"",r&&(n=this._eventEmitters.filter((e=>e.event===r))),n&&n.length||(0,e.isReservedEvent)(r)||(0,e.isInternalEvent)(r)||(n=this._eventEmitters.filter((e=>"call_request"===e.event))),n.forEach((r=>{if((0,e.isJsonRpcResponseError)(t)){const e=new Error(t.error.message);r.callback(e,null)}else r.callback(null,t)}))}},Un}()),s=e.__importDefault(function(){if(jn)return Hn;jn=1,Object.defineProperty(Hn,"__esModule",{value:!0});const e=Or();return Hn.default=class{constructor(e="walletconnect"){this.storageId=e}getSession(){let t=null;const r=(0,e.getLocal)(this.storageId);return r&&(0,e.isWalletConnectSession)(r)&&(t=r),t}setSession(t){return(0,e.setLocal)(this.storageId,t),t}removeSession(){(0,e.removeLocal)(this.storageId)}},Hn}()),a=function(){if(qn)return Wn;qn=1,Object.defineProperty(Wn,"__esModule",{value:!0}),Wn.getBridgeUrl=Wn.shouldSelectRandomly=Wn.selectRandomBridgeUrl=Wn.randomBridgeIndex=Wn.extractRootDomain=Wn.extractHostname=void 0;const e="walletconnect.org",t="abcdefghijklmnopqrstuvwxyz0123456789".split("").map((e=>`https://${e}.bridge.walletconnect.org`));function r(e){let t=e.indexOf("//")>-1?e.split("/")[2]:e.split("/")[0];return t=t.split(":")[0],t=t.split("?")[0],t}function n(e){return r(e).split(".").slice(-2).join(".")}function i(){return Math.floor(Math.random()*t.length)}function o(){return t[i()]}function s(t){return n(t)===e}return Wn.extractHostname=r,Wn.extractRootDomain=n,Wn.randomBridgeIndex=i,Wn.selectRandomBridgeUrl=o,Wn.shouldSelectRandomly=s,Wn.getBridgeUrl=function(e){return s(e)?o():e},Wn}();return H.default=class{constructor(e){if(this.protocol="wc",this.version=1,this._bridge="",this._key=null,this._clientId="",this._clientMeta=null,this._peerId="",this._peerMeta=null,this._handshakeId=0,this._handshakeTopic="",this._connected=!1,this._accounts=[],this._chainId=0,this._networkId=0,this._rpcUrl="",this._eventManager=new o.default,this._clientMeta=(0,t.getClientMeta)()||e.connectorOpts.clientMeta||null,this._cryptoLib=e.cryptoLib,this._sessionStorage=e.sessionStorage||new s.default(e.connectorOpts.storageId),this._qrcodeModal=e.connectorOpts.qrcodeModal,this._qrcodeModalOptions=e.connectorOpts.qrcodeModalOptions,this._signingMethods=[...t.signingMethods,...e.connectorOpts.signingMethods||[]],!e.connectorOpts.bridge&&!e.connectorOpts.uri&&!e.connectorOpts.session)throw new Error(i.ERROR_MISSING_REQUIRED);e.connectorOpts.bridge&&(this.bridge=(0,a.getBridgeUrl)(e.connectorOpts.bridge)),e.connectorOpts.uri&&(this.uri=e.connectorOpts.uri);const n=e.connectorOpts.session||this._getStorageSession();n&&(this.session=n),this.handshakeId&&this._subscribeToSessionResponse(this.handshakeId,"Session request rejected"),this._transport=e.transport||new r.default({protocol:this.protocol,version:this.version,url:this.bridge,subscriptions:[this.clientId]}),this._subscribeToInternalEvents(),this._initTransport(),e.connectorOpts.uri&&this._subscribeToSessionRequest(),e.pushServerOpts&&this._registerPushServer(e.pushServerOpts)}set bridge(e){e&&(this._bridge=e)}get bridge(){return this._bridge}set key(e){if(!e)return;const r=(0,t.convertHexToArrayBuffer)(e);this._key=r}get key(){if(this._key){return(0,t.convertArrayBufferToHex)(this._key,!0)}return""}set clientId(e){e&&(this._clientId=e)}get clientId(){let e=this._clientId;return e||(e=this._clientId=(0,t.uuid)()),this._clientId}set peerId(e){e&&(this._peerId=e)}get peerId(){return this._peerId}set clientMeta(e){}get clientMeta(){let e=this._clientMeta;return e||(e=this._clientMeta=(0,t.getClientMeta)()),e}set peerMeta(e){this._peerMeta=e}get peerMeta(){return this._peerMeta}set handshakeTopic(e){e&&(this._handshakeTopic=e)}get handshakeTopic(){return this._handshakeTopic}set handshakeId(e){e&&(this._handshakeId=e)}get handshakeId(){return this._handshakeId}get uri(){return this._formatUri()}set uri(e){if(!e)return;const{handshakeTopic:t,bridge:r,key:n}=this._parseUri(e);this.handshakeTopic=t,this.bridge=r,this.key=n}set chainId(e){this._chainId=e}get chainId(){return this._chainId}set networkId(e){this._networkId=e}get networkId(){return this._networkId}set accounts(e){this._accounts=e}get accounts(){return this._accounts}set rpcUrl(e){this._rpcUrl=e}get rpcUrl(){return this._rpcUrl}set connected(e){}get connected(){return this._connected}set pending(e){}get pending(){return!!this._handshakeTopic}get session(){return{connected:this.connected,accounts:this.accounts,chainId:this.chainId,bridge:this.bridge,key:this.key,clientId:this.clientId,clientMeta:this.clientMeta,peerId:this.peerId,peerMeta:this.peerMeta,handshakeId:this.handshakeId,handshakeTopic:this.handshakeTopic}}set session(e){e&&(this._connected=e.connected,this.accounts=e.accounts,this.chainId=e.chainId,this.bridge=e.bridge,this.key=e.key,this.clientId=e.clientId,this.clientMeta=e.clientMeta,this.peerId=e.peerId,this.peerMeta=e.peerMeta,this.handshakeId=e.handshakeId,this.handshakeTopic=e.handshakeTopic)}on(e,t){const r={event:e,callback:t};this._eventManager.subscribe(r)}off(e){this._eventManager.unsubscribe(e)}createInstantRequest(r){return e.__awaiter(this,void 0,void 0,(function*(){this._key=yield this._generateKey();const e=this._formatRequest({method:"wc_instantRequest",params:[{peerId:this.clientId,peerMeta:this.clientMeta,request:this._formatRequest(r)}]});this.handshakeId=e.id,this.handshakeTopic=(0,t.uuid)(),this._eventManager.trigger({event:"display_uri",params:[this.uri]}),this.on("modal_closed",(()=>{throw new Error(i.ERROR_QRCODE_MODAL_USER_CLOSED)}));const n=()=>{this.killSession()};try{const t=yield this._sendCallRequest(e);return t&&n(),t}catch(e){throw n(),e}}))}connect(t){return e.__awaiter(this,void 0,void 0,(function*(){if(!this._qrcodeModal)throw new Error(i.ERROR_QRCODE_MODAL_NOT_PROVIDED);return this.connected?{chainId:this.chainId,accounts:this.accounts}:(yield this.createSession(t),new Promise(((t,r)=>e.__awaiter(this,void 0,void 0,(function*(){this.on("modal_closed",(()=>r(new Error(i.ERROR_QRCODE_MODAL_USER_CLOSED)))),this.on("connect",((e,n)=>{if(e)return r(e);t(n.params[0])}))})))))}))}createSession(r){return e.__awaiter(this,void 0,void 0,(function*(){if(this._connected)throw new Error(i.ERROR_SESSION_CONNECTED);if(this.pending)return;this._key=yield this._generateKey();const e=this._formatRequest({method:"wc_sessionRequest",params:[{peerId:this.clientId,peerMeta:this.clientMeta,chainId:r&&r.chainId?r.chainId:null}]});this.handshakeId=e.id,this.handshakeTopic=(0,t.uuid)(),this._sendSessionRequest(e,"Session update rejected",{topic:this.handshakeTopic}),this._eventManager.trigger({event:"display_uri",params:[this.uri]})}))}approveSession(e){if(this._connected)throw new Error(i.ERROR_SESSION_CONNECTED);this.chainId=e.chainId,this.accounts=e.accounts,this.networkId=e.networkId||0,this.rpcUrl=e.rpcUrl||"";const t={approved:!0,chainId:this.chainId,networkId:this.networkId,accounts:this.accounts,rpcUrl:this.rpcUrl,peerId:this.clientId,peerMeta:this.clientMeta},r={id:this.handshakeId,jsonrpc:"2.0",result:t};this._sendResponse(r),this._connected=!0,this._setStorageSession(),this._eventManager.trigger({event:"connect",params:[{peerId:this.peerId,peerMeta:this.peerMeta,chainId:this.chainId,accounts:this.accounts}]})}rejectSession(e){if(this._connected)throw new Error(i.ERROR_SESSION_CONNECTED);const t=e&&e.message?e.message:i.ERROR_SESSION_REJECTED,r=this._formatResponse({id:this.handshakeId,error:{message:t}});this._sendResponse(r),this._connected=!1,this._eventManager.trigger({event:"disconnect",params:[{message:t}]}),this._removeStorageSession()}updateSession(e){if(!this._connected)throw new Error(i.ERROR_SESSION_DISCONNECTED);this.chainId=e.chainId,this.accounts=e.accounts,this.networkId=e.networkId||0,this.rpcUrl=e.rpcUrl||"";const t={approved:!0,chainId:this.chainId,networkId:this.networkId,accounts:this.accounts,rpcUrl:this.rpcUrl},r=this._formatRequest({method:"wc_sessionUpdate",params:[t]});this._sendSessionRequest(r,"Session update rejected"),this._eventManager.trigger({event:"session_update",params:[{chainId:this.chainId,accounts:this.accounts}]}),this._manageStorageSession()}killSession(t){return e.__awaiter(this,void 0,void 0,(function*(){const e=t?t.message:"Session Disconnected",r=this._formatRequest({method:"wc_sessionUpdate",params:[{approved:!1,chainId:null,networkId:null,accounts:null}]});yield this._sendRequest(r),this._handleSessionDisconnect(e)}))}sendTransaction(r){return e.__awaiter(this,void 0,void 0,(function*(){if(!this._connected)throw new Error(i.ERROR_SESSION_DISCONNECTED);const e=(0,t.parseTransactionData)(r),n=this._formatRequest({method:"eth_sendTransaction",params:[e]});return yield this._sendCallRequest(n)}))}signTransaction(r){return e.__awaiter(this,void 0,void 0,(function*(){if(!this._connected)throw new Error(i.ERROR_SESSION_DISCONNECTED);const e=(0,t.parseTransactionData)(r),n=this._formatRequest({method:"eth_signTransaction",params:[e]});return yield this._sendCallRequest(n)}))}signMessage(t){return e.__awaiter(this,void 0,void 0,(function*(){if(!this._connected)throw new Error(i.ERROR_SESSION_DISCONNECTED);const e=this._formatRequest({method:"eth_sign",params:t});return yield this._sendCallRequest(e)}))}signPersonalMessage(r){return e.__awaiter(this,void 0,void 0,(function*(){if(!this._connected)throw new Error(i.ERROR_SESSION_DISCONNECTED);r=(0,t.parsePersonalSign)(r);const e=this._formatRequest({method:"personal_sign",params:r});return yield this._sendCallRequest(e)}))}signTypedData(t){return e.__awaiter(this,void 0,void 0,(function*(){if(!this._connected)throw new Error(i.ERROR_SESSION_DISCONNECTED);const e=this._formatRequest({method:"eth_signTypedData",params:t});return yield this._sendCallRequest(e)}))}updateChain(t){return e.__awaiter(this,void 0,void 0,(function*(){if(!this._connected)throw new Error("Session currently disconnected");const e=this._formatRequest({method:"wallet_updateChain",params:[t]});return yield this._sendCallRequest(e)}))}unsafeSend(e,t){return this._sendRequest(e,t),this._eventManager.trigger({event:"call_request_sent",params:[{request:e,options:t}]}),new Promise(((t,r)=>{this._subscribeToResponse(e.id,((e,n)=>{if(e)r(e);else{if(!n)throw new Error(i.ERROR_MISSING_JSON_RPC);t(n)}}))}))}sendCustomRequest(r,n){return e.__awaiter(this,void 0,void 0,(function*(){if(!this._connected)throw new Error(i.ERROR_SESSION_DISCONNECTED);switch(r.method){case"eth_accounts":return this.accounts;case"eth_chainId":return(0,t.convertNumberToHex)(this.chainId);case"eth_sendTransaction":case"eth_signTransaction":r.params&&(r.params[0]=(0,t.parseTransactionData)(r.params[0]));break;case"personal_sign":r.params&&(r.params=(0,t.parsePersonalSign)(r.params))}const e=this._formatRequest(r);return yield this._sendCallRequest(e,n)}))}approveRequest(e){if(!(0,t.isJsonRpcResponseSuccess)(e))throw new Error(i.ERROR_MISSING_RESULT);{const t=this._formatResponse(e);this._sendResponse(t)}}rejectRequest(e){if(!(0,t.isJsonRpcResponseError)(e))throw new Error(i.ERROR_MISSING_ERROR);{const t=this._formatResponse(e);this._sendResponse(t)}}transportClose(){this._transport.close()}_sendRequest(r,n){return e.__awaiter(this,void 0,void 0,(function*(){const e=this._formatRequest(r),i=yield this._encrypt(e),o=void 0!==(null==n?void 0:n.topic)?n.topic:this.peerId,s=JSON.stringify(i),a=void 0!==(null==n?void 0:n.forcePushNotification)?!n.forcePushNotification:(0,t.isSilentPayload)(e);this._transport.send(s,o,a)}))}_sendResponse(t){return e.__awaiter(this,void 0,void 0,(function*(){const e=yield this._encrypt(t),r=this.peerId,n=JSON.stringify(e);this._transport.send(n,r,!0)}))}_sendSessionRequest(t,r,n){return e.__awaiter(this,void 0,void 0,(function*(){this._sendRequest(t,n),this._subscribeToSessionResponse(t.id,r)}))}_sendCallRequest(e,t){return this._sendRequest(e,t),this._eventManager.trigger({event:"call_request_sent",params:[{request:e,options:t}]}),this._subscribeToCallResponse(e.id)}_formatRequest(e){if(void 0===e.method)throw new Error(i.ERROR_MISSING_METHOD);return{id:void 0===e.id?(0,t.payloadId)():e.id,jsonrpc:"2.0",method:e.method,params:void 0===e.params?[]:e.params}}_formatResponse(e){if(void 0===e.id)throw new Error(i.ERROR_MISSING_ID);const r={id:e.id,jsonrpc:"2.0"};if((0,t.isJsonRpcResponseError)(e)){const n=(0,t.formatRpcError)(e.error);return Object.assign(Object.assign(Object.assign({},r),e),{error:n})}if((0,t.isJsonRpcResponseSuccess)(e)){return Object.assign(Object.assign({},r),e)}throw new Error(i.ERROR_INVALID_RESPONSE)}_handleSessionDisconnect(e){const r=e||"Session Disconnected";this._connected||(this._qrcodeModal&&this._qrcodeModal.close(),(0,t.removeLocal)(t.mobileLinkChoiceKey)),this._connected&&(this._connected=!1),this._handshakeId&&(this._handshakeId=0),this._handshakeTopic&&(this._handshakeTopic=""),this._peerId&&(this._peerId=""),this._eventManager.trigger({event:"disconnect",params:[{message:r}]}),this._removeStorageSession(),this.transportClose()}_handleSessionResponse(e,t){t&&t.approved?(this._connected?(t.chainId&&(this.chainId=t.chainId),t.accounts&&(this.accounts=t.accounts),this._eventManager.trigger({event:"session_update",params:[{chainId:this.chainId,accounts:this.accounts}]})):(this._connected=!0,t.chainId&&(this.chainId=t.chainId),t.accounts&&(this.accounts=t.accounts),t.peerId&&!this.peerId&&(this.peerId=t.peerId),t.peerMeta&&!this.peerMeta&&(this.peerMeta=t.peerMeta),this._eventManager.trigger({event:"connect",params:[{peerId:this.peerId,peerMeta:this.peerMeta,chainId:this.chainId,accounts:this.accounts}]})),this._manageStorageSession()):this._handleSessionDisconnect(e)}_handleIncomingMessages(t){return e.__awaiter(this,void 0,void 0,(function*(){if(![this.clientId,this.handshakeTopic].includes(t.topic))return;let e;try{e=JSON.parse(t.payload)}catch(e){return}const r=yield this._decrypt(e);r&&this._eventManager.trigger(r)}))}_subscribeToSessionRequest(){this._transport.subscribe(this.handshakeTopic)}_subscribeToResponse(e,t){this.on(`response:${e}`,t)}_subscribeToSessionResponse(e,r){this._subscribeToResponse(e,((e,n)=>{e?this._handleSessionResponse(e.message):(0,t.isJsonRpcResponseSuccess)(n)?this._handleSessionResponse(r,n.result):n.error&&n.error.message?this._handleSessionResponse(n.error.message):this._handleSessionResponse(r)}))}_subscribeToCallResponse(e){return new Promise(((r,n)=>{this._subscribeToResponse(e,((e,o)=>{e?n(e):(0,t.isJsonRpcResponseSuccess)(o)?r(o.result):o.error&&o.error.message?n(o.error):n(new Error(i.ERROR_INVALID_RESPONSE))}))}))}_subscribeToInternalEvents(){this.on("display_uri",(()=>{this._qrcodeModal&&this._qrcodeModal.open(this.uri,(()=>{this._eventManager.trigger({event:"modal_closed",params:[]})}),this._qrcodeModalOptions)})),this.on("connect",(()=>{this._qrcodeModal&&this._qrcodeModal.close()})),this.on("call_request_sent",((e,r)=>{const{request:n}=r.params[0];if((0,t.isMobile)()&&this._signingMethods.includes(n.method)){const e=(0,t.getLocal)(t.mobileLinkChoiceKey);e&&(window.location.href=e.href)}})),this.on("wc_sessionRequest",((e,t)=>{e&&this._eventManager.trigger({event:"error",params:[{code:"SESSION_REQUEST_ERROR",message:e.toString()}]}),this.handshakeId=t.id,this.peerId=t.params[0].peerId,this.peerMeta=t.params[0].peerMeta;const r=Object.assign(Object.assign({},t),{method:"session_request"});this._eventManager.trigger(r)})),this.on("wc_sessionUpdate",((e,t)=>{e&&this._handleSessionResponse(e.message),this._handleSessionResponse("Session disconnected",t.params[0])}))}_initTransport(){this._transport.on("message",(e=>this._handleIncomingMessages(e))),this._transport.on("open",(()=>this._eventManager.trigger({event:"transport_open",params:[]}))),this._transport.on("close",(()=>this._eventManager.trigger({event:"transport_close",params:[]}))),this._transport.on("error",(()=>this._eventManager.trigger({event:"transport_error",params:["Websocket connection failed"]}))),this._transport.open()}_formatUri(){return`${this.protocol}:${this.handshakeTopic}@${this.version}?bridge=${encodeURIComponent(this.bridge)}&key=${this.key}`}_parseUri(e){const r=(0,t.parseWalletConnectUri)(e);if(r.protocol===this.protocol){if(!r.handshakeTopic)throw Error("Invalid or missing handshakeTopic parameter value");const e=r.handshakeTopic;if(!r.bridge)throw Error("Invalid or missing bridge url parameter value");const t=decodeURIComponent(r.bridge);if(!r.key)throw Error("Invalid or missing key parameter value");return{handshakeTopic:e,bridge:t,key:r.key}}throw new Error(i.ERROR_INVALID_URI)}_generateKey(){return e.__awaiter(this,void 0,void 0,(function*(){if(this._cryptoLib){return yield this._cryptoLib.generateKey()}return null}))}_encrypt(t){return e.__awaiter(this,void 0,void 0,(function*(){const e=this._key;if(this._cryptoLib&&e){return yield this._cryptoLib.encrypt(t,e)}return null}))}_decrypt(t){return e.__awaiter(this,void 0,void 0,(function*(){const e=this._key;if(this._cryptoLib&&e){return yield this._cryptoLib.decrypt(t,e)}return null}))}_getStorageSession(){let e=null;return this._sessionStorage&&(e=this._sessionStorage.getSession()),e}_setStorageSession(){this._sessionStorage&&this._sessionStorage.setSession(this.session)}_removeStorageSession(){this._sessionStorage&&this._sessionStorage.removeSession()}_manageStorageSession(){this._connected?this._setStorageSession():this._removeStorageSession()}_registerPushServer(t){if(!t.url||"string"!=typeof t.url)throw Error("Invalid or missing pushServerOpts.url parameter value");if(!t.type||"string"!=typeof t.type)throw Error("Invalid or missing pushServerOpts.type parameter value");if(!t.token||"string"!=typeof t.token)throw Error("Invalid or missing pushServerOpts.token parameter value");const r={bridge:this.bridge,topic:this.clientId,type:t.type,token:t.token,peerName:"",language:t.language||""};this.on("connect",((n,i)=>e.__awaiter(this,void 0,void 0,(function*(){if(n)throw n;if(t.peerMeta){const e=i.params[0].peerMeta.name;r.peerName=e}try{const e=yield fetch(`${t.url}/new`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(r)});if(!(yield e.json()).success)throw Error("Failed to register in Push Server")}catch(e){throw Error("Failed to register in Push Server")}}))))}},H}var zn,Gn={},Vn={},$n={};var Yn,Zn,Jn={},Qn={},Xn={},ei={},ti={};function ri(){return Yn||(Yn=1,Object.defineProperty(ti,"__esModule",{value:!0}),ti.LENGTH_1024=ti.LENGTH_512=ti.LENGTH_256=ti.LENGTH_128=ti.LENGTH_64=ti.LENGTH_32=ti.LENGTH_16=ti.LENGTH_1=ti.LENGTH_0=void 0,ti.LENGTH_0=0,ti.LENGTH_1=1,ti.LENGTH_16=16,ti.LENGTH_32=32,ti.LENGTH_64=64,ti.LENGTH_128=128,ti.LENGTH_256=256,ti.LENGTH_512=512,ti.LENGTH_1024=1024),ti}var ni,ii={};var oi,si={};var ai,ui,ci,li,hi={};function fi(){return ui||(ui=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=n;t.__exportStar((Zn||(Zn=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.MAC_LENGTH=e.IV_LENGTH=e.KEY_LENGTH=e.PREFIX_LENGTH=e.RIPEMD160_NODE_ALGO=e.SHA512_NODE_ALGO=e.SHA256_NODE_ALGO=e.HMAC_NODE_ALGO=e.AES_NODE_ALGO=e.SHA512_BROWSER_ALGO=e.SHA256_BROWSER_ALGO=e.HMAC_BROWSER=e.HMAC_BROWSER_ALGO=e.AES_BROWSER_ALGO=e.HMAC_LENGTH=e.AES_LENGTH=void 0;const t=ri();e.AES_LENGTH=t.LENGTH_256,e.HMAC_LENGTH=t.LENGTH_256,e.AES_BROWSER_ALGO="AES-CBC",e.HMAC_BROWSER_ALGO=`SHA-${e.AES_LENGTH}`,e.HMAC_BROWSER="HMAC",e.SHA256_BROWSER_ALGO="SHA-256",e.SHA512_BROWSER_ALGO="SHA-512",e.AES_NODE_ALGO=`aes-${e.AES_LENGTH}-cbc`,e.HMAC_NODE_ALGO=`sha${e.HMAC_LENGTH}`,e.SHA256_NODE_ALGO="sha256",e.SHA512_NODE_ALGO="sha512",e.RIPEMD160_NODE_ALGO="ripemd160",e.PREFIX_LENGTH=t.LENGTH_1,e.KEY_LENGTH=t.LENGTH_32,e.IV_LENGTH=t.LENGTH_16,e.MAC_LENGTH=t.LENGTH_32}(ei)),ei),e),t.__exportStar((ni||(ni=1,Object.defineProperty(ii,"__esModule",{value:!0}),ii.UTF8_ENC=ii.HEX_ENC=void 0,ii.HEX_ENC="hex",ii.UTF8_ENC="utf8"),ii),e),t.__exportStar((oi||(oi=1,Object.defineProperty(si,"__esModule",{value:!0}),si.ERROR_BAD_MAC=void 0,si.ERROR_BAD_MAC="Bad MAC"),si),e),t.__exportStar(ri(),e),t.__exportStar((ai||(ai=1,Object.defineProperty(hi,"__esModule",{value:!0}),hi.VERIFY_OP=hi.SIGN_OP=hi.DECRYPT_OP=hi.ENCRYPT_OP=void 0,hi.ENCRYPT_OP="encrypt",hi.DECRYPT_OP="decrypt",hi.SIGN_OP="sign",hi.VERIFY_OP="verify"),hi),e)}(Xn)),Xn}function di(){if(ci)return Qn;ci=1,Object.defineProperty(Qn,"__esModule",{value:!0}),Qn.nodeRipemd160=Qn.nodeSha512=Qn.nodeSha256=Qn.nodeHmacSha512Sign=Qn.nodeHmacSha256Sign=Qn.nodeAesDecrypt=Qn.nodeAesEncrypt=void 0;const e=n.__importDefault(g),t=Mt,r=fi();return Qn.nodeAesEncrypt=function(n,i,o){const s=e.default.createCipheriv(r.AES_NODE_ALGO,Buffer.from(i),Buffer.from(n));return t.bufferToArray(t.concatBuffers(s.update(Buffer.from(o)),s.final()))},Qn.nodeAesDecrypt=function(n,i,o){const s=e.default.createDecipheriv(r.AES_NODE_ALGO,Buffer.from(i),Buffer.from(n));return t.bufferToArray(t.concatBuffers(s.update(Buffer.from(o)),s.final()))},Qn.nodeHmacSha256Sign=function(n,i){const o=e.default.createHmac(r.HMAC_NODE_ALGO,Buffer.from(n)).update(Buffer.from(i)).digest();return t.bufferToArray(o)},Qn.nodeHmacSha512Sign=function(n,i){const o=e.default.createHmac(r.SHA512_NODE_ALGO,Buffer.from(n)).update(Buffer.from(i)).digest();return t.bufferToArray(o)},Qn.nodeSha256=function(n){const i=e.default.createHash(r.SHA256_NODE_ALGO).update(Buffer.from(n)).digest();return t.bufferToArray(i)},Qn.nodeSha512=function(n){const i=e.default.createHash(r.SHA512_NODE_ALGO).update(Buffer.from(n)).digest();return t.bufferToArray(i)},Qn.nodeRipemd160=function(n){const i=e.default.createHash(r.RIPEMD160_NODE_ALGO).update(Buffer.from(n)).digest();return t.bufferToArray(i)},Qn}var pi,mi={},_i={},gi={};var vi,yi={};var wi,bi={};var Ei,Mi,Si,xi={};function ki(){return Mi||(Mi=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=n;t.__exportStar((pi||(pi=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),n.__exportStar(Ft,e)}(gi)),gi),e),t.__exportStar(function(){if(vi)return yi;vi=1,Object.defineProperty(yi,"__esModule",{value:!0}),yi.pkcs7=void 0;const e=[[16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16],[15,15,15,15,15,15,15,15,15,15,15,15,15,15,15],[14,14,14,14,14,14,14,14,14,14,14,14,14,14],[13,13,13,13,13,13,13,13,13,13,13,13,13],[12,12,12,12,12,12,12,12,12,12,12,12],[11,11,11,11,11,11,11,11,11,11,11],[10,10,10,10,10,10,10,10,10,10],[9,9,9,9,9,9,9,9,9],[8,8,8,8,8,8,8,8],[7,7,7,7,7,7,7],[6,6,6,6,6,6],[5,5,5,5,5],[4,4,4,4],[3,3,3],[2,2],[1]];return yi.pkcs7={pad(t){const r=e[t.byteLength%16||0],n=new Uint8Array(t.byteLength+r.length);return n.set(t),n.set(r,t.byteLength),n},unpad:e=>e.subarray(0,e.byteLength-e[e.byteLength-1])},yi}(),e),t.__exportStar((wi||(wi=1,Object.defineProperty(bi,"__esModule",{value:!0})),bi),e),t.__exportStar((Ei||(Ei=1,Object.defineProperty(xi,"__esModule",{value:!0}),xi.isConstantTime=xi.assert=void 0,xi.assert=function(e,t){if(!e)throw new Error(t||"Assertion failed")},xi.isConstantTime=function(e,t){if(e.length!==t.length)return!1;let r=0;for(let n=0;n<e.length;n++)r|=e[n]^t[n];return 0===r}),xi),e)}(_i)),_i}var Ri,Ti,Ci,Ai,Oi={};function Li(){return Ti||(Ti=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=n;t.__exportStar(function(){if(zn)return $n;zn=1,Object.defineProperty($n,"__esModule",{value:!0}),$n.randomBytes=void 0;const e=n.__importDefault(g),t=Mt;return $n.randomBytes=function(r){const n=e.default.randomBytes(r);return t.bufferToArray(n)},$n}(),e),t.__exportStar(function(){if(li)return Jn;li=1,Object.defineProperty(Jn,"__esModule",{value:!0}),Jn.aesCbcDecrypt=Jn.aesCbcEncrypt=void 0;const e=n,t=di();return Jn.aesCbcEncrypt=function(r,n,i){return e.__awaiter(this,void 0,void 0,(function*(){return t.nodeAesEncrypt(r,n,i)}))},Jn.aesCbcDecrypt=function(r,n,i){return e.__awaiter(this,void 0,void 0,(function*(){return t.nodeAesDecrypt(r,n,i)}))},Jn}(),e),t.__exportStar(function(){if(Si)return mi;Si=1,Object.defineProperty(mi,"__esModule",{value:!0}),mi.hmacSha512Verify=mi.hmacSha512Sign=mi.hmacSha256Verify=mi.hmacSha256Sign=void 0;const e=n,t=ki(),r=di();return mi.hmacSha256Sign=function(t,n){return e.__awaiter(this,void 0,void 0,(function*(){return r.nodeHmacSha256Sign(t,n)}))},mi.hmacSha256Verify=function(n,i,o){return e.__awaiter(this,void 0,void 0,(function*(){const e=r.nodeHmacSha256Sign(n,i);return t.isConstantTime(e,o)}))},mi.hmacSha512Sign=function(t,n){return e.__awaiter(this,void 0,void 0,(function*(){return r.nodeHmacSha512Sign(t,n)}))},mi.hmacSha512Verify=function(n,i,o){return e.__awaiter(this,void 0,void 0,(function*(){const e=r.nodeHmacSha512Sign(n,i);return t.isConstantTime(e,o)}))},mi}(),e),t.__exportStar(function(){if(Ri)return Oi;Ri=1,Object.defineProperty(Oi,"__esModule",{value:!0}),Oi.ripemd160=Oi.sha512=Oi.sha256=void 0;const e=n,t=di();return Oi.sha256=function(r){return e.__awaiter(this,void 0,void 0,(function*(){return t.nodeSha256(r)}))},Oi.sha512=function(r){return e.__awaiter(this,void 0,void 0,(function*(){return t.nodeSha512(r)}))},Oi.ripemd160=function(r){return e.__awaiter(this,void 0,void 0,(function*(){return t.nodeRipemd160(r)}))},Oi}(),e),t.__exportStar(ki(),e),t.__exportStar(fi(),e)}(Vn)),Vn}var Bi,Pi,Ii={exports:{}},Ni={};function Di(){return Pi?Bi:(Pi=1,Bi=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then})}var Ui,ji,Hi,qi,Fi,Wi,Ki,zi,Gi,Vi={},$i={};function Yi(){if(ji)return Ui;ji=1;var e=function(){try{if(!Buffer.isEncoding("latin1"))return!1;var e=Buffer.alloc?Buffer.alloc(4):new Buffer(4);return e.fill("ab","ucs2"),"61006200"===e.toString("hex")}catch(e){return!1}}();function t(e,t,r,n){if(r<0||n>e.length)throw new RangeError("Out of range index");return r>>>=0,(n=void 0===n?e.length:n>>>0)>r&&e.fill(t,r,n),e}return Ui=function(r,n,i,o,s){if(e)return r.fill(n,i,o,s);if("number"==typeof n)return t(r,n,i,o);if("string"==typeof n){if("string"==typeof i?(s=i,i=0,o=r.length):"string"==typeof o&&(s=o,o=r.length),void 0!==s&&"string"!=typeof s)throw new TypeError("encoding must be a string");if("latin1"===s&&(s="binary"),"string"==typeof s&&!Buffer.isEncoding(s))throw new TypeError("Unknown encoding: "+s);if(""===n)return t(r,0,i,o);if(function(e){return 1===e.length&&e.charCodeAt(0)<256}(n))return t(r,n.charCodeAt(0),i,o);n=new Buffer(n,s)}return Buffer.isBuffer(n)?function(e,t,r,n){if(r<0||n>e.length)throw new RangeError("Out of range index");if(n<=r)return e;r>>>=0,n=void 0===n?e.length:n>>>0;for(var i=r,o=t.length;i<=n-o;)t.copy(e,i),i+=o;return i!==n&&t.copy(e,i,0,n-i),e}(r,n,i,o):t(r,0,i,o)},Ui}function Zi(){if(Wi)return Fi;Wi=1;var e=Yi(),t=qi?Hi:(qi=1,Hi=function(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative');return Buffer.allocUnsafe?Buffer.allocUnsafe(e):new Buffer(e)});return Fi=function(r,n,i){if("number"!=typeof r)throw new TypeError('"size" argument must be a number');if(r<0)throw new RangeError('"size" argument must not be negative');if(Buffer.alloc)return Buffer.alloc(r,n,i);var o=t(r);return 0===r?o:void 0===n?e(o,0):("string"!=typeof i&&(i=void 0),e(o,n,i))},Fi}function Ji(){if(zi)return Ki;zi=1;var e=Object.prototype.toString,t="undefined"!=typeof Buffer&&"function"==typeof Buffer.alloc&&"function"==typeof Buffer.allocUnsafe&&"function"==typeof Buffer.from;return Ki=function(r,n,i){if("number"==typeof r)throw new TypeError('"value" argument must not be a number');return o=r,"ArrayBuffer"===e.call(o).slice(8,-1)?function(e,r,n){r>>>=0;var i=e.byteLength-r;if(i<0)throw new RangeError("'offset' is out of bounds");if(void 0===n)n=i;else if((n>>>=0)>i)throw new RangeError("'length' is out of bounds");return t?Buffer.from(e.slice(r,r+n)):new Buffer(new Uint8Array(e.slice(r,r+n)))}(r,n,i):"string"==typeof r?function(e,r){if("string"==typeof r&&""!==r||(r="utf8"),!Buffer.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');return t?Buffer.from(e,r):new Buffer(e,r)}(r,n):t?Buffer.from(r):new Buffer(r);var o},Ki}function Qi(){return Gi||(Gi=1,$i.alloc=Zi(),$i.from=Ji()),$i}var Xi,eo={};function to(){if(Xi)return eo;var e;Xi=1;var t=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return eo.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return 4*e+17},eo.getSymbolTotalCodewords=function(e){return t[e]},eo.getBCHDigit=function(e){for(var t=0;0!==e;)t++,e>>>=1;return t},eo.setToSJISFunction=function(t){if("function"!=typeof t)throw new Error('"toSJISFunc" is not a valid function.');e=t},eo.isKanjiModeEnabled=function(){return void 0!==e},eo.toSJIS=function(t){return e(t)},eo}var ro,no,io,oo,so,ao={};function uo(){return ro||(ro=1,(e=ao).L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2},e.isValid=function(e){return e&&void 0!==e.bit&&e.bit>=0&&e.bit<4},e.from=function(t,r){if(e.isValid(t))return t;try{return function(t){if("string"!=typeof t)throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+t)}}(t)}catch(e){return r}}),ao;var e}var co,lo={};var ho,fo={};var po,mo={};var _o,go={};function vo(){if(_o)return go;_o=1;var e=uo(),t=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return go.getBlocksCount=function(r,n){switch(n){case e.L:return t[4*(r-1)+0];case e.M:return t[4*(r-1)+1];case e.Q:return t[4*(r-1)+2];case e.H:return t[4*(r-1)+3];default:return}},go.getTotalCodewordsCount=function(t,n){switch(n){case e.L:return r[4*(t-1)+0];case e.M:return r[4*(t-1)+1];case e.Q:return r[4*(t-1)+2];case e.H:return r[4*(t-1)+3];default:return}},go}var yo,wo,bo,Eo,Mo={},So={};function xo(){return wo||(wo=1,e=Mo,t=Qi(),r=function(){if(yo)return So;yo=1;var e=Qi(),t=e.alloc(512),r=e.alloc(256);return function(){for(var e=1,n=0;n<255;n++)t[n]=e,r[e]=n,256&(e<<=1)&&(e^=285);for(n=255;n<512;n++)t[n]=t[n-255]}(),So.log=function(e){if(e<1)throw new Error("log("+e+")");return r[e]},So.exp=function(e){return t[e]},So.mul=function(e,n){return 0===e||0===n?0:t[r[e]+r[n]]},So}(),e.mul=function(e,n){for(var i=t.alloc(e.length+n.length-1),o=0;o<e.length;o++)for(var s=0;s<n.length;s++)i[o+s]^=r.mul(e[o],n[s]);return i},e.mod=function(e,n){for(var i=t.from(e);i.length-n.length>=0;){for(var o=i[0],s=0;s<n.length;s++)i[s]^=r.mul(n[s],o);for(var a=0;a<i.length&&0===i[a];)a++;i=i.slice(a)}return i},e.generateECPolynomial=function(n){for(var i=t.from([1]),o=0;o<n;o++)i=e.mul(i,[1,r.exp(o)]);return i}),Mo;var e,t,r}var ko,Ro={},To={},Co={};function Ao(){return ko||(ko=1,Co.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}),Co}var Oo,Lo,Bo,Po,Io,No={};function Do(){if(Oo)return No;Oo=1;var e="[0-9]+",t="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+",r="(?:(?![A-Z0-9 $%*+\\-./:]|"+(t=t.replace(/u/g,"\\u"))+")(?:.|[\r\n]))+";No.KANJI=new RegExp(t,"g"),No.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),No.BYTE=new RegExp(r,"g"),No.NUMERIC=new RegExp(e,"g"),No.ALPHANUMERIC=new RegExp("[A-Z $%*+\\-./:]+","g");var n=new RegExp("^"+t+"$"),i=new RegExp("^"+e+"$"),o=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return No.testKanji=function(e){return n.test(e)},No.testNumeric=function(e){return i.test(e)},No.testAlphanumeric=function(e){return o.test(e)},No}function Uo(){return Lo||(Lo=1,e=To,t=Ao(),r=Do(),e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,r){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!t.isValid(r))throw new Error("Invalid version: "+r);return r>=1&&r<10?e.ccBits[0]:r<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return r.testNumeric(t)?e.NUMERIC:r.testAlphanumeric(t)?e.ALPHANUMERIC:r.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")},e.isValid=function(e){return e&&e.bit&&e.ccBits},e.from=function(t,r){if(e.isValid(t))return t;try{return function(t){if("string"!=typeof t)throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+t)}}(t)}catch(e){return r}}),To;var e,t,r}function jo(){if(Po)return Bo;Po=1;var e={}.toString;return Bo=Array.isArray||function(t){return"[object Array]"==e.call(t)}}function Ho(){return Io||(Io=1,function(e){var t=to(),r=vo(),n=uo(),i=Uo(),o=Ao(),s=jo(),a=t.getBCHDigit(7973);function u(e,t){return i.getCharCountIndicator(e,t)+4}function c(e,t){var r=0;return e.forEach((function(e){var n=u(e.mode,t);r+=n+e.getBitsLength()})),r}e.from=function(e,t){return o.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,n,s){if(!o.isValid(e))throw new Error("Invalid QR Code version");void 0===s&&(s=i.BYTE);var a=8*(t.getSymbolTotalCodewords(e)-r.getTotalCodewordsCount(e,n));if(s===i.MIXED)return a;var c=a-u(s,e);switch(s){case i.NUMERIC:return Math.floor(c/10*3);case i.ALPHANUMERIC:return Math.floor(c/11*2);case i.KANJI:return Math.floor(c/13);case i.BYTE:default:return Math.floor(c/8)}},e.getBestVersionForData=function(t,r){var o,a=n.from(r,n.M);if(s(t)){if(t.length>1)return function(t,r){for(var n=1;n<=40;n++)if(c(t,n)<=e.getCapacity(n,r,i.MIXED))return n}(t,a);if(0===t.length)return 1;o=t[0]}else o=t;return function(t,r,n){for(var i=1;i<=40;i++)if(r<=e.getCapacity(i,n,t))return i}(o.mode,o.getLength(),a)},e.getEncodedBits=function(e){if(!o.isValid(e)||e<7)throw new Error("Invalid QR Code version");for(var r=e<<12;t.getBCHDigit(r)-a>=0;)r^=7973<<t.getBCHDigit(r)-a;return e<<12|r}}(Ro)),Ro}var qo,Fo={};var Wo,Ko,zo,Go,Vo,$o,Yo,Zo,Jo={};var Qo,Xo,es,ts={exports:{}};function rs(){return Qo||(Qo=1,function(e){var t={single_source_shortest_paths:function(e,r,n){var i={},o={};o[r]=0;var s,a,u,c,l,h,f,d=t.PriorityQueue.make();for(d.push(r,0);!d.empty();)for(u in a=(s=d.pop()).value,c=s.cost,l=e[a]||{})l.hasOwnProperty(u)&&(h=c+l[u],f=o[u],(void 0===o[u]||f>h)&&(o[u]=h,d.push(u,h),i[u]=a));if(void 0!==n&&void 0===o[n]){var p=["Could not find a path from ",r," to ",n,"."].join("");throw new Error(p)}return i},extract_shortest_path_from_predecessor_list:function(e,t){for(var r=[],n=t;n;)r.push(n),e[n],n=e[n];return r.reverse(),r},find_path:function(e,r,n){var i=t.single_source_shortest_paths(e,r,n);return t.extract_shortest_path_from_predecessor_list(i,n)},PriorityQueue:{make:function(e){var r,n=t.PriorityQueue,i={};for(r in e=e||{},n)n.hasOwnProperty(r)&&(i[r]=n[r]);return i.queue=[],i.sorter=e.sorter||n.default_sorter,i},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var r={value:e,cost:t};this.queue.push(r),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};e.exports=t}(ts)),ts.exports}function ns(){return Xo||(Xo=1,function(e){var t=Uo(),r=function(){if(Ko)return Wo;Ko=1;var e=Uo();function t(t){this.mode=e.NUMERIC,this.data=t.toString()}return t.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(e){var t,r,n;for(t=0;t+3<=this.data.length;t+=3)r=this.data.substr(t,3),n=parseInt(r,10),e.put(n,10);var i=this.data.length-t;i>0&&(r=this.data.substr(t),n=parseInt(r,10),e.put(n,3*i+1))},Wo=t}(),n=function(){if(Go)return zo;Go=1;var e=Uo(),t=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function r(t){this.mode=e.ALPHANUMERIC,this.data=t}return r.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){var r;for(r=0;r+2<=this.data.length;r+=2){var n=45*t.indexOf(this.data[r]);n+=t.indexOf(this.data[r+1]),e.put(n,11)}this.data.length%2&&e.put(t.indexOf(this.data[r]),6)},zo=r}(),i=function(){if($o)return Vo;$o=1;var e=Qi(),t=Uo();function r(r){this.mode=t.BYTE,this.data=e.from(r)}return r.getBitsLength=function(e){return 8*e},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){for(var t=0,r=this.data.length;t<r;t++)e.put(this.data[t],8)},Vo=r}(),o=function(){if(Zo)return Yo;Zo=1;var e=Uo(),t=to();function r(t){this.mode=e.KANJI,this.data=t}return r.getBitsLength=function(e){return 13*e},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){var r;for(r=0;r<this.data.length;r++){var n=t.toSJIS(this.data[r]);if(n>=33088&&n<=40956)n-=33088;else{if(!(n>=57408&&n<=60351))throw new Error("Invalid SJIS character: "+this.data[r]+"\nMake sure your charset is UTF-8");n-=49472}n=192*(n>>>8&255)+(255&n),e.put(n,13)}},Yo=r}(),s=Do(),a=to(),u=rs();function c(e){return unescape(encodeURIComponent(e)).length}function l(e,t,r){for(var n,i=[];null!==(n=e.exec(r));)i.push({data:n[0],index:n.index,mode:t,length:n[0].length});return i}function h(e){var r,n,i=l(s.NUMERIC,t.NUMERIC,e),o=l(s.ALPHANUMERIC,t.ALPHANUMERIC,e);return a.isKanjiModeEnabled()?(r=l(s.BYTE,t.BYTE,e),n=l(s.KANJI,t.KANJI,e)):(r=l(s.BYTE_KANJI,t.BYTE,e),n=[]),i.concat(o,r,n).sort((function(e,t){return e.index-t.index})).map((function(e){return{data:e.data,mode:e.mode,length:e.length}}))}function f(e,s){switch(s){case t.NUMERIC:return r.getBitsLength(e);case t.ALPHANUMERIC:return n.getBitsLength(e);case t.KANJI:return o.getBitsLength(e);case t.BYTE:return i.getBitsLength(e)}}function d(e,s){var u,c=t.getBestModeForData(e);if((u=t.from(s,c))!==t.BYTE&&u.bit<c.bit)throw new Error('"'+e+'" cannot be encoded with mode '+t.toString(u)+".\n Suggested mode is: "+t.toString(c));switch(u!==t.KANJI||a.isKanjiModeEnabled()||(u=t.BYTE),u){case t.NUMERIC:return new r(e);case t.ALPHANUMERIC:return new n(e);case t.KANJI:return new o(e);case t.BYTE:return new i(e)}}e.fromArray=function(e){return e.reduce((function(e,t){return"string"==typeof t?e.push(d(t,null)):t.data&&e.push(d(t.data,t.mode)),e}),[])},e.fromString=function(r,n){for(var i=function(e){for(var r=[],n=0;n<e.length;n++){var i=e[n];switch(i.mode){case t.NUMERIC:r.push([i,{data:i.data,mode:t.ALPHANUMERIC,length:i.length},{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.ALPHANUMERIC:r.push([i,{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.KANJI:r.push([i,{data:i.data,mode:t.BYTE,length:c(i.data)}]);break;case t.BYTE:r.push([{data:i.data,mode:t.BYTE,length:c(i.data)}])}}return r}(h(r,a.isKanjiModeEnabled())),o=function(e,r){for(var n={},i={start:{}},o=["start"],s=0;s<e.length;s++){for(var a=e[s],u=[],c=0;c<a.length;c++){var l=a[c],h=""+s+c;u.push(h),n[h]={node:l,lastCount:0},i[h]={};for(var d=0;d<o.length;d++){var p=o[d];n[p]&&n[p].node.mode===l.mode?(i[p][h]=f(n[p].lastCount+l.length,l.mode)-f(n[p].lastCount,l.mode),n[p].lastCount+=l.length):(n[p]&&(n[p].lastCount=l.length),i[p][h]=f(l.length,l.mode)+4+t.getCharCountIndicator(l.mode,r))}}o=u}for(d=0;d<o.length;d++)i[o[d]].end=0;return{map:i,table:n}}(i,n),s=u.find_path(o.map,"start","end"),l=[],d=1;d<s.length-1;d++)l.push(o.table[s[d]].node);return e.fromArray(function(e){return e.reduce((function(e,t){var r=e.length-1>=0?e[e.length-1]:null;return r&&r.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)}),[])}(l))},e.rawSplit=function(t){return e.fromArray(h(t,a.isKanjiModeEnabled()))}}(Jo)),Jo}function is(){if(es)return Vi;es=1;var e,t,r=Qi(),n=to(),i=uo(),o=function(){if(io)return no;function e(){this.buffer=[],this.length=0}return io=1,e.prototype={get:function(e){var t=Math.floor(e/8);return 1==(this.buffer[t]>>>7-e%8&1)},put:function(e,t){for(var r=0;r<t;r++)this.putBit(1==(e>>>t-r-1&1))},getLengthInBits:function(){return this.length},putBit:function(e){var t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},no=e}(),s=function(){if(so)return oo;so=1;var e=Qi();function t(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=e.alloc(t*t),this.reservedBit=e.alloc(t*t)}return t.prototype.set=function(e,t,r,n){var i=e*this.size+t;this.data[i]=r,n&&(this.reservedBit[i]=!0)},t.prototype.get=function(e,t){return this.data[e*this.size+t]},t.prototype.xor=function(e,t,r){this.data[e*this.size+t]^=r},t.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},oo=t}(),a=(co||(co=1,e=lo,t=to().getSymbolSize,e.getRowColCoords=function(e){if(1===e)return[];for(var r=Math.floor(e/7)+2,n=t(e),i=145===n?26:2*Math.ceil((n-13)/(2*r-2)),o=[n-7],s=1;s<r-1;s++)o[s]=o[s-1]-i;return o.push(6),o.reverse()},e.getPositions=function(t){for(var r=[],n=e.getRowColCoords(t),i=n.length,o=0;o<i;o++)for(var s=0;s<i;s++)0===o&&0===s||0===o&&s===i-1||o===i-1&&0===s||r.push([n[o],n[s]]);return r}),lo),u=function(){if(ho)return fo;ho=1;var e=to().getSymbolSize;return fo.getPositions=function(t){var r=e(t);return[[0,0],[r-7,0],[0,r-7]]},fo}(),c=(po||(po=1,function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t=3,r=3,n=40,i=10;function o(t,r,n){switch(t){case e.Patterns.PATTERN000:return(r+n)%2==0;case e.Patterns.PATTERN001:return r%2==0;case e.Patterns.PATTERN010:return n%3==0;case e.Patterns.PATTERN011:return(r+n)%3==0;case e.Patterns.PATTERN100:return(Math.floor(r/2)+Math.floor(n/3))%2==0;case e.Patterns.PATTERN101:return r*n%2+r*n%3==0;case e.Patterns.PATTERN110:return(r*n%2+r*n%3)%2==0;case e.Patterns.PATTERN111:return(r*n%3+(r+n)%2)%2==0;default:throw new Error("bad maskPattern:"+t)}}e.isValid=function(e){return null!=e&&""!==e&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){for(var r=e.size,n=0,i=0,o=0,s=null,a=null,u=0;u<r;u++){i=o=0,s=a=null;for(var c=0;c<r;c++){var l=e.get(u,c);l===s?i++:(i>=5&&(n+=t+(i-5)),s=l,i=1),(l=e.get(c,u))===a?o++:(o>=5&&(n+=t+(o-5)),a=l,o=1)}i>=5&&(n+=t+(i-5)),o>=5&&(n+=t+(o-5))}return n},e.getPenaltyN2=function(e){for(var t=e.size,n=0,i=0;i<t-1;i++)for(var o=0;o<t-1;o++){var s=e.get(i,o)+e.get(i,o+1)+e.get(i+1,o)+e.get(i+1,o+1);4!==s&&0!==s||n++}return n*r},e.getPenaltyN3=function(e){for(var t=e.size,r=0,i=0,o=0,s=0;s<t;s++){i=o=0;for(var a=0;a<t;a++)i=i<<1&2047|e.get(s,a),a>=10&&(1488===i||93===i)&&r++,o=o<<1&2047|e.get(a,s),a>=10&&(1488===o||93===o)&&r++}return r*n},e.getPenaltyN4=function(e){for(var t=0,r=e.data.length,n=0;n<r;n++)t+=e.data[n];return Math.abs(Math.ceil(100*t/r/5)-10)*i},e.applyMask=function(e,t){for(var r=t.size,n=0;n<r;n++)for(var i=0;i<r;i++)t.isReserved(i,n)||t.xor(i,n,o(e,i,n))},e.getBestMask=function(t,r){for(var n=Object.keys(e.Patterns).length,i=0,o=1/0,s=0;s<n;s++){r(s),e.applyMask(s,t);var a=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(s,t),a<o&&(o=a,i=s)}return i}}(mo)),mo),l=vo(),h=function(){if(Eo)return bo;Eo=1;var e=Qi(),t=xo(),r=k.Buffer;function n(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}return n.prototype.initialize=function(e){this.degree=e,this.genPoly=t.generateECPolynomial(this.degree)},n.prototype.encode=function(n){if(!this.genPoly)throw new Error("Encoder not initialized");var i=e.alloc(this.degree),o=r.concat([n,i],n.length+this.degree),s=t.mod(o,this.genPoly),a=this.degree-s.length;if(a>0){var u=e.alloc(this.degree);return s.copy(u,a),u}return s},bo=n}(),f=Ho(),d=function(){if(qo)return Fo;qo=1;var e=to(),t=e.getBCHDigit(1335);return Fo.getEncodedBits=function(r,n){for(var i=r.bit<<3|n,o=i<<10;e.getBCHDigit(o)-t>=0;)o^=1335<<e.getBCHDigit(o)-t;return 21522^(i<<10|o)},Fo}(),p=Uo(),m=ns(),_=jo();function g(e,t,r){var n,i,o=e.size,s=d.getEncodedBits(t,r);for(n=0;n<15;n++)i=1==(s>>n&1),n<6?e.set(n,8,i,!0):n<8?e.set(n+1,8,i,!0):e.set(o-15+n,8,i,!0),n<8?e.set(8,o-n-1,i,!0):n<9?e.set(8,15-n-1+1,i,!0):e.set(8,15-n-1,i,!0);e.set(o-8,8,1,!0)}function v(e,t,i){var s=new o;i.forEach((function(t){s.put(t.mode.bit,4),s.put(t.getLength(),p.getCharCountIndicator(t.mode,e)),t.write(s)}));var a=8*(n.getSymbolTotalCodewords(e)-l.getTotalCodewordsCount(e,t));for(s.getLengthInBits()+4<=a&&s.put(0,4);s.getLengthInBits()%8!=0;)s.putBit(0);for(var u=(a-s.getLengthInBits())/8,c=0;c<u;c++)s.put(c%2?17:236,8);return function(e,t,i){for(var o=n.getSymbolTotalCodewords(t),s=l.getTotalCodewordsCount(t,i),a=o-s,u=l.getBlocksCount(t,i),c=u-o%u,f=Math.floor(o/u),d=Math.floor(a/u),p=d+1,m=f-d,_=new h(m),g=0,v=new Array(u),y=new Array(u),w=0,b=r.from(e.buffer),E=0;E<u;E++){var M=E<c?d:p;v[E]=b.slice(g,g+M),y[E]=_.encode(v[E]),g+=M,w=Math.max(w,M)}var S,x,k=r.alloc(o),R=0;for(S=0;S<w;S++)for(x=0;x<u;x++)S<v[x].length&&(k[R++]=v[x][S]);for(S=0;S<m;S++)for(x=0;x<u;x++)k[R++]=y[x][S];return k}(s,e,t)}function y(e,t,r,i){var o;if(_(e))o=m.fromArray(e);else{if("string"!=typeof e)throw new Error("Invalid data");var l=t;if(!l){var h=m.rawSplit(e);l=f.getBestVersionForData(h,r)}o=m.fromString(e,l||40)}var d=f.getBestVersionForData(o,r);if(!d)throw new Error("The amount of data is too big to be stored in a QR Code");if(t){if(t<d)throw new Error("\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: "+d+".\n")}else t=d;var p=v(t,r,o),y=n.getSymbolSize(t),w=new s(y);return function(e,t){for(var r=e.size,n=u.getPositions(t),i=0;i<n.length;i++)for(var o=n[i][0],s=n[i][1],a=-1;a<=7;a++)if(!(o+a<=-1||r<=o+a))for(var c=-1;c<=7;c++)s+c<=-1||r<=s+c||(a>=0&&a<=6&&(0===c||6===c)||c>=0&&c<=6&&(0===a||6===a)||a>=2&&a<=4&&c>=2&&c<=4?e.set(o+a,s+c,!0,!0):e.set(o+a,s+c,!1,!0))}(w,t),function(e){for(var t=e.size,r=8;r<t-8;r++){var n=r%2==0;e.set(r,6,n,!0),e.set(6,r,n,!0)}}(w),function(e,t){for(var r=a.getPositions(t),n=0;n<r.length;n++)for(var i=r[n][0],o=r[n][1],s=-2;s<=2;s++)for(var u=-2;u<=2;u++)-2===s||2===s||-2===u||2===u||0===s&&0===u?e.set(i+s,o+u,!0,!0):e.set(i+s,o+u,!1,!0)}(w,t),g(w,r,0),t>=7&&function(e,t){for(var r,n,i,o=e.size,s=f.getEncodedBits(t),a=0;a<18;a++)r=Math.floor(a/3),n=a%3+o-8-3,i=1==(s>>a&1),e.set(r,n,i,!0),e.set(n,r,i,!0)}(w,t),function(e,t){for(var r=e.size,n=-1,i=r-1,o=7,s=0,a=r-1;a>0;a-=2)for(6===a&&a--;;){for(var u=0;u<2;u++)if(!e.isReserved(i,a-u)){var c=!1;s<t.length&&(c=1==(t[s]>>>o&1)),e.set(i,a-u,c),-1==--o&&(s++,o=7)}if((i+=n)<0||r<=i){i-=n,n=-n;break}}}(w,p),isNaN(i)&&(i=c.getBestMask(w,g.bind(null,w,r))),c.applyMask(i,w),g(w,r,i),{modules:w,version:t,errorCorrectionLevel:r,maskPattern:i,segments:o}}return Vi.create=function(e,t){if(void 0===e||""===e)throw new Error("No input text");var r,o,s=i.M;return void 0!==t&&(s=i.from(t.errorCorrectionLevel,i.M),r=f.from(t.version),o=c.from(t.maskPattern),t.toSJISFunc&&n.setToSJISFunction(t.toSJISFunc)),y(e,r,s,o)},Vi}var os,ss={},as={},us={exports:{}},cs={exports:{}};function ls(){if(os)return cs.exports;os=1;var e=R,t=x,r=cs.exports=function(){t.call(this),this._buffers=[],this._buffered=0,this._reads=[],this._paused=!1,this._encoding="utf8",this.writable=!0};return e.inherits(r,t),r.prototype.read=function(e,t){this._reads.push({length:Math.abs(e),allowLess:e<0,func:t}),process.nextTick(function(){this._process(),this._paused&&this._reads.length>0&&(this._paused=!1,this.emit("drain"))}.bind(this))},r.prototype.write=function(e,t){return this.writable?(r=Buffer.isBuffer(e)?e:new Buffer(e,t||this._encoding),this._buffers.push(r),this._buffered+=r.length,this._process(),this._reads&&0===this._reads.length&&(this._paused=!0),this.writable&&!this._paused):(this.emit("error",new Error("Stream not writable")),!1);var r},r.prototype.end=function(e,t){e&&this.write(e,t),this.writable=!1,this._buffers&&(0===this._buffers.length?this._end():(this._buffers.push(null),this._process()))},r.prototype.destroySoon=r.prototype.end,r.prototype._end=function(){this._reads.length>0&&this.emit("error",new Error("Unexpected end of input")),this.destroy()},r.prototype.destroy=function(){this._buffers&&(this.writable=!1,this._reads=null,this._buffers=null,this.emit("close"))},r.prototype._processReadAllowingLess=function(e){this._reads.shift();var t=this._buffers[0];t.length>e.length?(this._buffered-=e.length,this._buffers[0]=t.slice(e.length),e.func.call(this,t.slice(0,e.length))):(this._buffered-=t.length,this._buffers.shift(),e.func.call(this,t))},r.prototype._processRead=function(e){this._reads.shift();for(var t=0,r=0,n=new Buffer(e.length);t<e.length;){var i=this._buffers[r++],o=Math.min(i.length,e.length-t);i.copy(n,t,0,o),t+=o,o!==i.length&&(this._buffers[--r]=i.slice(o))}r>0&&this._buffers.splice(0,r),this._buffered-=e.length,e.func.call(this,n)},r.prototype._process=function(){try{for(;this._buffered>0&&this._reads&&this._reads.length>0;){var e=this._reads[0];if(e.allowLess)this._processReadAllowingLess(e);else{if(!(this._buffered>=e.length))break;this._processRead(e)}}this._buffers&&!this.writable&&this._end()}catch(e){this.emit("error",e)}},cs.exports}var hs,fs,ds,ps,ms,_s={exports:{}},gs={exports:{}},vs={};function ys(){if(hs)return vs;hs=1;var e=[{x:[0],y:[0]},{x:[4],y:[0]},{x:[0,4],y:[4]},{x:[2,6],y:[0,4]},{x:[0,2,4,6],y:[2,6]},{x:[1,3,5,7],y:[0,2,4,6]},{x:[0,1,2,3,4,5,6,7],y:[1,3,5,7]}];return vs.getImagePasses=function(t,r){for(var n=[],i=t%8,o=r%8,s=(t-i)/8,a=(r-o)/8,u=0;u<e.length;u++){for(var c=e[u],l=s*c.x.length,h=a*c.y.length,f=0;f<c.x.length&&c.x[f]<i;f++)l++;for(f=0;f<c.y.length&&c.y[f]<o;f++)h++;l>0&&h>0&&n.push({width:l,height:h,index:u})}return n},vs.getInterlaceIterator=function(t){return function(r,n,i){var o=r%e[i].x.length,s=(r-o)/e[i].x.length*8+e[i].x[o],a=n%e[i].y.length;return 4*s+((n-a)/e[i].y.length*8+e[i].y[a])*t*4}},vs}function ws(){return ds?fs:(ds=1,fs=function(e,t,r){var n=e+t-r,i=Math.abs(n-e),o=Math.abs(n-t),s=Math.abs(n-r);return i<=o&&i<=s?e:o<=s?t:r})}function bs(){if(ps)return gs.exports;ps=1;var e=ys(),t=ws();function r(e,t,r){var n=e*t;return 8!==r&&(n=Math.ceil(n/(8/r))),n}var n=gs.exports=function(t,n){var i=t.width,o=t.height,s=t.interlace,a=t.bpp,u=t.depth;if(this.read=n.read,this.write=n.write,this.complete=n.complete,this._imageIndex=0,this._images=[],s)for(var c=e.getImagePasses(i,o),l=0;l<c.length;l++)this._images.push({byteWidth:r(c[l].width,a,u),height:c[l].height,lineIndex:0});else this._images.push({byteWidth:r(i,a,u),height:o,lineIndex:0});this._xComparison=8===u?a:16===u?2*a:1};return n.prototype.start=function(){this.read(this._images[this._imageIndex].byteWidth+1,this._reverseFilterLine.bind(this))},n.prototype._unFilterType1=function(e,t,r){for(var n=this._xComparison,i=n-1,o=0;o<r;o++){var s=e[1+o],a=o>i?t[o-n]:0;t[o]=s+a}},n.prototype._unFilterType2=function(e,t,r){for(var n=this._lastLine,i=0;i<r;i++){var o=e[1+i],s=n?n[i]:0;t[i]=o+s}},n.prototype._unFilterType3=function(e,t,r){for(var n=this._xComparison,i=n-1,o=this._lastLine,s=0;s<r;s++){var a=e[1+s],u=o?o[s]:0,c=s>i?t[s-n]:0,l=Math.floor((c+u)/2);t[s]=a+l}},n.prototype._unFilterType4=function(e,r,n){for(var i=this._xComparison,o=i-1,s=this._lastLine,a=0;a<n;a++){var u=e[1+a],c=s?s[a]:0,l=a>o?r[a-i]:0,h=a>o&&s?s[a-i]:0,f=t(l,c,h);r[a]=u+f}},n.prototype._reverseFilterLine=function(e){var t,r=e[0],n=this._images[this._imageIndex],i=n.byteWidth;if(0===r)t=e.slice(1,i+1);else switch(t=new Buffer(i),r){case 1:this._unFilterType1(e,t,i);break;case 2:this._unFilterType2(e,t,i);break;case 3:this._unFilterType3(e,t,i);break;case 4:this._unFilterType4(e,t,i);break;default:throw new Error("Unrecognised filter type - "+r)}this.write(t),n.lineIndex++,n.lineIndex>=n.height?(this._lastLine=null,this._imageIndex++,n=this._images[this._imageIndex]):this._lastLine=t,n?this.read(n.byteWidth+1,this._reverseFilterLine.bind(this)):(this._lastLine=null,this.complete())},gs.exports}var Es,Ms,Ss={exports:{}};function xs(){return Ms?Es:(Ms=1,Es={PNG_SIGNATURE:[137,80,78,71,13,10,26,10],TYPE_IHDR:1229472850,TYPE_IEND:1229278788,TYPE_IDAT:1229209940,TYPE_PLTE:1347179589,TYPE_tRNS:1951551059,TYPE_gAMA:1732332865,COLORTYPE_GRAYSCALE:0,COLORTYPE_PALETTE:1,COLORTYPE_COLOR:2,COLORTYPE_ALPHA:4,COLORTYPE_PALETTE_COLOR:3,COLORTYPE_COLOR_ALPHA:6,COLORTYPE_TO_BPP_MAP:{0:1,2:3,3:1,4:2,6:4},GAMMA_DIVISION:1e5})}var ks,Rs,Ts={exports:{}};function Cs(){if(ks)return Ts.exports;ks=1;var e=[];!function(){for(var t=0;t<256;t++){for(var r=t,n=0;n<8;n++)1&r?r=3988292384^r>>>1:r>>>=1;e[t]=r}}();var t=Ts.exports=function(){this._crc=-1};return t.prototype.write=function(t){for(var r=0;r<t.length;r++)this._crc=e[255&(this._crc^t[r])]^this._crc>>>8;return!0},t.prototype.crc32=function(){return-1^this._crc},t.crc32=function(t){for(var r=-1,n=0;n<t.length;n++)r=e[255&(r^t[n])]^r>>>8;return-1^r},Ts.exports}function As(){if(Rs)return Ss.exports;Rs=1;var e=xs(),t=Cs(),r=Ss.exports=function(t,r){this._options=t,t.checkCRC=!1!==t.checkCRC,this._hasIHDR=!1,this._hasIEND=!1,this._emittedHeadersFinished=!1,this._palette=[],this._colorType=0,this._chunks={},this._chunks[e.TYPE_IHDR]=this._handleIHDR.bind(this),this._chunks[e.TYPE_IEND]=this._handleIEND.bind(this),this._chunks[e.TYPE_IDAT]=this._handleIDAT.bind(this),this._chunks[e.TYPE_PLTE]=this._handlePLTE.bind(this),this._chunks[e.TYPE_tRNS]=this._handleTRNS.bind(this),this._chunks[e.TYPE_gAMA]=this._handleGAMA.bind(this),this.read=r.read,this.error=r.error,this.metadata=r.metadata,this.gamma=r.gamma,this.transColor=r.transColor,this.palette=r.palette,this.parsed=r.parsed,this.inflateData=r.inflateData,this.finished=r.finished,this.simpleTransparency=r.simpleTransparency,this.headersFinished=r.headersFinished||function(){}};return r.prototype.start=function(){this.read(e.PNG_SIGNATURE.length,this._parseSignature.bind(this))},r.prototype._parseSignature=function(t){for(var r=e.PNG_SIGNATURE,n=0;n<r.length;n++)if(t[n]!==r[n])return void this.error(new Error("Invalid file signature"));this.read(8,this._parseChunkBegin.bind(this))},r.prototype._parseChunkBegin=function(r){for(var n=r.readUInt32BE(0),i=r.readUInt32BE(4),o="",s=4;s<8;s++)o+=String.fromCharCode(r[s]);var a=Boolean(32&r[4]);if(this._hasIHDR||i===e.TYPE_IHDR){if(this._crc=new t,this._crc.write(new Buffer(o)),this._chunks[i])return this._chunks[i](n);a?this.read(n+4,this._skipChunk.bind(this)):this.error(new Error("Unsupported critical chunk type "+o))}else this.error(new Error("Expected IHDR on beggining"))},r.prototype._skipChunk=function(){this.read(8,this._parseChunkBegin.bind(this))},r.prototype._handleChunkEnd=function(){this.read(4,this._parseChunkEnd.bind(this))},r.prototype._parseChunkEnd=function(e){var t=e.readInt32BE(0),r=this._crc.crc32();this._options.checkCRC&&r!==t?this.error(new Error("Crc error - "+t+" - "+r)):this._hasIEND||this.read(8,this._parseChunkBegin.bind(this))},r.prototype._handleIHDR=function(e){this.read(e,this._parseIHDR.bind(this))},r.prototype._parseIHDR=function(t){this._crc.write(t);var r=t.readUInt32BE(0),n=t.readUInt32BE(4),i=t[8],o=t[9],s=t[10],a=t[11],u=t[12];if(8===i||4===i||2===i||1===i||16===i)if(o in e.COLORTYPE_TO_BPP_MAP)if(0===s)if(0===a)if(0===u||1===u){this._colorType=o;var c=e.COLORTYPE_TO_BPP_MAP[this._colorType];this._hasIHDR=!0,this.metadata({width:r,height:n,depth:i,interlace:Boolean(u),palette:Boolean(o&e.COLORTYPE_PALETTE),color:Boolean(o&e.COLORTYPE_COLOR),alpha:Boolean(o&e.COLORTYPE_ALPHA),bpp:c,colorType:o}),this._handleChunkEnd()}else this.error(new Error("Unsupported interlace method"));else this.error(new Error("Unsupported filter method"));else this.error(new Error("Unsupported compression method"));else this.error(new Error("Unsupported color type"));else this.error(new Error("Unsupported bit depth "+i))},r.prototype._handlePLTE=function(e){this.read(e,this._parsePLTE.bind(this))},r.prototype._parsePLTE=function(e){this._crc.write(e);for(var t=Math.floor(e.length/3),r=0;r<t;r++)this._palette.push([e[3*r],e[3*r+1],e[3*r+2],255]);this.palette(this._palette),this._handleChunkEnd()},r.prototype._handleTRNS=function(e){this.simpleTransparency(),this.read(e,this._parseTRNS.bind(this))},r.prototype._parseTRNS=function(t){if(this._crc.write(t),this._colorType===e.COLORTYPE_PALETTE_COLOR){if(0===this._palette.length)return void this.error(new Error("Transparency chunk must be after palette"));if(t.length>this._palette.length)return void this.error(new Error("More transparent colors than palette size"));for(var r=0;r<t.length;r++)this._palette[r][3]=t[r];this.palette(this._palette)}this._colorType===e.COLORTYPE_GRAYSCALE&&this.transColor([t.readUInt16BE(0)]),this._colorType===e.COLORTYPE_COLOR&&this.transColor([t.readUInt16BE(0),t.readUInt16BE(2),t.readUInt16BE(4)]),this._handleChunkEnd()},r.prototype._handleGAMA=function(e){this.read(e,this._parseGAMA.bind(this))},r.prototype._parseGAMA=function(t){this._crc.write(t),this.gamma(t.readUInt32BE(0)/e.GAMMA_DIVISION),this._handleChunkEnd()},r.prototype._handleIDAT=function(e){this._emittedHeadersFinished||(this._emittedHeadersFinished=!0,this.headersFinished()),this.read(-e,this._parseIDAT.bind(this,e))},r.prototype._parseIDAT=function(t,r){if(this._crc.write(r),this._colorType===e.COLORTYPE_PALETTE_COLOR&&0===this._palette.length)throw new Error("Expected palette not found");this.inflateData(r);var n=t-r.length;n>0?this._handleIDAT(n):this._handleChunkEnd()},r.prototype._handleIEND=function(e){this.read(e,this._parseIEND.bind(this))},r.prototype._parseIEND=function(e){this._crc.write(e),this._hasIEND=!0,this._handleChunkEnd(),this.finished&&this.finished()},Ss.exports}var Os,Ls,Bs,Ps,Is={};function Ns(){if(Os)return Is;Os=1;var e=ys(),t=[function(){},function(e,t,r,n){if(n===t.length)throw new Error("Ran out of data");var i=t[n];e[r]=i,e[r+1]=i,e[r+2]=i,e[r+3]=255},function(e,t,r,n){if(n+1>=t.length)throw new Error("Ran out of data");var i=t[n];e[r]=i,e[r+1]=i,e[r+2]=i,e[r+3]=t[n+1]},function(e,t,r,n){if(n+2>=t.length)throw new Error("Ran out of data");e[r]=t[n],e[r+1]=t[n+1],e[r+2]=t[n+2],e[r+3]=255},function(e,t,r,n){if(n+3>=t.length)throw new Error("Ran out of data");e[r]=t[n],e[r+1]=t[n+1],e[r+2]=t[n+2],e[r+3]=t[n+3]}],r=[function(){},function(e,t,r,n){var i=t[0];e[r]=i,e[r+1]=i,e[r+2]=i,e[r+3]=n},function(e,t,r){var n=t[0];e[r]=n,e[r+1]=n,e[r+2]=n,e[r+3]=t[1]},function(e,t,r,n){e[r]=t[0],e[r+1]=t[1],e[r+2]=t[2],e[r+3]=n},function(e,t,r){e[r]=t[0],e[r+1]=t[1],e[r+2]=t[2],e[r+3]=t[3]}];function n(e,r,n,i,o,s){for(var a=e.width,u=e.height,c=e.index,l=0;l<u;l++)for(var h=0;h<a;h++){var f=n(h,l,c);t[i](r,o,f,s),s+=i}return s}function i(e,t,n,i,o,s){for(var a=e.width,u=e.height,c=e.index,l=0;l<u;l++){for(var h=0;h<a;h++){var f=o.get(i),d=n(h,l,c);r[i](t,f,d,s)}o.resetAfterLine()}}return Is.dataToBitMap=function(t,r){var o,s=r.width,a=r.height,u=r.depth,c=r.bpp,l=r.interlace;if(8!==u)var h=function(e,t){var r=[],n=0;function i(){if(n===e.length)throw new Error("Ran out of data");var i,o,s,a,u,c,l,h,f=e[n];switch(n++,t){default:throw new Error("unrecognised depth");case 16:l=e[n],n++,r.push((f<<8)+l);break;case 4:l=15&f,h=f>>4,r.push(h,l);break;case 2:u=3&f,c=f>>2&3,l=f>>4&3,h=f>>6&3,r.push(h,l,c,u);break;case 1:i=1&f,o=f>>1&1,s=f>>2&1,a=f>>3&1,u=f>>4&1,c=f>>5&1,l=f>>6&1,h=f>>7&1,r.push(h,l,c,u,a,s,o,i)}}return{get:function(e){for(;r.length<e;)i();var t=r.slice(0,e);return r=r.slice(e),t},resetAfterLine:function(){r.length=0},end:function(){if(n!==e.length)throw new Error("extra data found")}}}(t,u);o=u<=8?new Buffer(s*a*4):new Uint16Array(s*a*4);var f,d,p=Math.pow(2,u)-1,m=0;if(l)f=e.getImagePasses(s,a),d=e.getInterlaceIterator(s,a);else{var _=0;d=function(){var e=_;return _+=4,e},f=[{width:s,height:a}]}for(var g=0;g<f.length;g++)8===u?m=n(f[g],o,d,c,t,m):i(f[g],o,d,c,h,p);if(8===u){if(m!==t.length)throw new Error("extra data found")}else h.end();return o},Is}function Ds(){if(Bs)return Ls;return Bs=1,Ls=function(e,t){var r=t.depth,n=t.width,i=t.height,o=t.colorType,s=t.transColor,a=t.palette,u=e;return 3===o?function(e,t,r,n,i){for(var o=0,s=0;s<n;s++)for(var a=0;a<r;a++){var u=i[e[o]];if(!u)throw new Error("index "+e[o]+" not in palette");for(var c=0;c<4;c++)t[o+c]=u[c];o+=4}}(e,u,n,i,a):(s&&function(e,t,r,n,i){for(var o=0,s=0;s<n;s++)for(var a=0;a<r;a++){var u=!1;if(1===i.length?i[0]===e[o]&&(u=!0):i[0]===e[o]&&i[1]===e[o+1]&&i[2]===e[o+2]&&(u=!0),u)for(var c=0;c<4;c++)t[o+c]=0;o+=4}}(e,u,n,i,s),8!==r&&(16===r&&(u=new Buffer(n*i*4)),function(e,t,r,n,i){for(var o=Math.pow(2,i)-1,s=0,a=0;a<n;a++)for(var u=0;u<r;u++){for(var c=0;c<4;c++)t[s+c]=Math.floor(255*e[s+c]/o+.5);s+=4}}(e,u,n,i,r))),u}}function Us(){if(Ps)return us.exports;Ps=1;var e=R,t=y,r=ls(),n=function(){if(ms)return _s.exports;ms=1;var e=R,t=ls(),r=bs(),n=_s.exports=function(e){t.call(this);var n=[],i=this;this._filter=new r(e,{read:this.read.bind(this),write:function(e){n.push(e)},complete:function(){i.emit("complete",Buffer.concat(n))}}),this._filter.start()};return e.inherits(n,t),_s.exports}(),i=As(),o=Ns(),s=Ds(),a=us.exports=function(e){r.call(this),this._parser=new i(e,{read:this.read.bind(this),error:this._handleError.bind(this),metadata:this._handleMetaData.bind(this),gamma:this.emit.bind(this,"gamma"),palette:this._handlePalette.bind(this),transColor:this._handleTransColor.bind(this),finished:this._finished.bind(this),inflateData:this._inflateData.bind(this),simpleTransparency:this._simpleTransparency.bind(this),headersFinished:this._headersFinished.bind(this)}),this._options=e,this.writable=!0,this._parser.start()};return e.inherits(a,r),a.prototype._handleError=function(e){this.emit("error",e),this.writable=!1,this.destroy(),this._inflate&&this._inflate.destroy&&this._inflate.destroy(),this._filter&&(this._filter.destroy(),this._filter.on("error",(function(){}))),this.errord=!0},a.prototype._inflateData=function(e){if(!this._inflate)if(this._bitmapInfo.interlace)this._inflate=t.createInflate(),this._inflate.on("error",this.emit.bind(this,"error")),this._filter.on("complete",this._complete.bind(this)),this._inflate.pipe(this._filter);else{var r=(1+(this._bitmapInfo.width*this._bitmapInfo.bpp*this._bitmapInfo.depth+7>>3))*this._bitmapInfo.height,n=Math.max(r,t.Z_MIN_CHUNK);this._inflate=t.createInflate({chunkSize:n});var i=r,o=this.emit.bind(this,"error");this._inflate.on("error",(function(e){i&&o(e)})),this._filter.on("complete",this._complete.bind(this));var s=this._filter.write.bind(this._filter);this._inflate.on("data",(function(e){i&&(e.length>i&&(e=e.slice(0,i)),i-=e.length,s(e))})),this._inflate.on("end",this._filter.end.bind(this._filter))}this._inflate.write(e)},a.prototype._handleMetaData=function(e){this._metaData=e,this._bitmapInfo=Object.create(e),this._filter=new n(this._bitmapInfo)},a.prototype._handleTransColor=function(e){this._bitmapInfo.transColor=e},a.prototype._handlePalette=function(e){this._bitmapInfo.palette=e},a.prototype._simpleTransparency=function(){this._metaData.alpha=!0},a.prototype._headersFinished=function(){this.emit("metadata",this._metaData)},a.prototype._finished=function(){this.errord||(this._inflate?this._inflate.end():this.emit("error","No Inflate block"),this.destroySoon())},a.prototype._complete=function(e){if(!this.errord){try{var t=o.dataToBitMap(e,this._bitmapInfo),r=s(t,this._bitmapInfo);t=null}catch(e){return void this._handleError(e)}this.emit("parsed",r)}},us.exports}var js,Hs,qs,Fs,Ws,Ks,zs={exports:{}},Gs={exports:{}};function Vs(){if(Ws)return Gs.exports;Ws=1;var e=xs(),t=Cs(),r=function(){if(Hs)return js;Hs=1;var e=xs();return js=function(t,r,n,i){var o=-1!==[e.COLORTYPE_COLOR_ALPHA,e.COLORTYPE_ALPHA].indexOf(i.colorType);if(i.colorType===i.inputColorType){var s=function(){var e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),256!==new Int16Array(e)[0]}();if(8===i.bitDepth||16===i.bitDepth&&s)return t}var a=16!==i.bitDepth?t:new Uint16Array(t.buffer),u=255,c=e.COLORTYPE_TO_BPP_MAP[i.inputColorType];4!==c||i.inputHasAlpha||(c=3);var l=e.COLORTYPE_TO_BPP_MAP[i.colorType];16===i.bitDepth&&(u=65535,l*=2);var h=new Buffer(r*n*l),f=0,d=0,p=i.bgColor||{};function m(){var t,r,n,s=u;switch(i.inputColorType){case e.COLORTYPE_COLOR_ALPHA:s=a[f+3],t=a[f],r=a[f+1],n=a[f+2];break;case e.COLORTYPE_COLOR:t=a[f],r=a[f+1],n=a[f+2];break;case e.COLORTYPE_ALPHA:s=a[f+1],r=t=a[f],n=t;break;case e.COLORTYPE_GRAYSCALE:r=t=a[f],n=t;break;default:throw new Error("input color type:"+i.inputColorType+" is not supported at present")}return i.inputHasAlpha&&(o||(s/=u,t=Math.min(Math.max(Math.round((1-s)*p.red+s*t),0),u),r=Math.min(Math.max(Math.round((1-s)*p.green+s*r),0),u),n=Math.min(Math.max(Math.round((1-s)*p.blue+s*n),0),u))),{red:t,green:r,blue:n,alpha:s}}void 0===p.red&&(p.red=u),void 0===p.green&&(p.green=u),void 0===p.blue&&(p.blue=u);for(var _=0;_<n;_++)for(var g=0;g<r;g++){var v=m();switch(i.colorType){case e.COLORTYPE_COLOR_ALPHA:case e.COLORTYPE_COLOR:8===i.bitDepth?(h[d]=v.red,h[d+1]=v.green,h[d+2]=v.blue,o&&(h[d+3]=v.alpha)):(h.writeUInt16BE(v.red,d),h.writeUInt16BE(v.green,d+2),h.writeUInt16BE(v.blue,d+4),o&&h.writeUInt16BE(v.alpha,d+6));break;case e.COLORTYPE_ALPHA:case e.COLORTYPE_GRAYSCALE:var y=(v.red+v.green+v.blue)/3;8===i.bitDepth?(h[d]=y,o&&(h[d+1]=v.alpha)):(h.writeUInt16BE(y,d),o&&h.writeUInt16BE(v.alpha,d+2));break;default:throw new Error("unrecognised color Type "+i.colorType)}f+=c,d+=l}return h},js}(),n=function(){if(Fs)return qs;Fs=1;var e=ws(),t={0:function(e,t,r,n,i){for(var o=0;o<r;o++)n[i+o]=e[t+o]},1:function(e,t,r,n,i,o){for(var s=0;s<r;s++){var a=s>=o?e[t+s-o]:0,u=e[t+s]-a;n[i+s]=u}},2:function(e,t,r,n,i){for(var o=0;o<r;o++){var s=t>0?e[t+o-r]:0,a=e[t+o]-s;n[i+o]=a}},3:function(e,t,r,n,i,o){for(var s=0;s<r;s++){var a=s>=o?e[t+s-o]:0,u=t>0?e[t+s-r]:0,c=e[t+s]-(a+u>>1);n[i+s]=c}},4:function(t,r,n,i,o,s){for(var a=0;a<n;a++){var u=a>=s?t[r+a-s]:0,c=r>0?t[r+a-n]:0,l=r>0&&a>=s?t[r+a-(n+s)]:0,h=t[r+a]-e(u,c,l);i[o+a]=h}}},r={0:function(e,t,r){for(var n=0,i=t+r,o=t;o<i;o++)n+=Math.abs(e[o]);return n},1:function(e,t,r,n){for(var i=0,o=0;o<r;o++){var s=o>=n?e[t+o-n]:0,a=e[t+o]-s;i+=Math.abs(a)}return i},2:function(e,t,r){for(var n=0,i=t+r,o=t;o<i;o++){var s=t>0?e[o-r]:0,a=e[o]-s;n+=Math.abs(a)}return n},3:function(e,t,r,n){for(var i=0,o=0;o<r;o++){var s=o>=n?e[t+o-n]:0,a=t>0?e[t+o-r]:0,u=e[t+o]-(s+a>>1);i+=Math.abs(u)}return i},4:function(t,r,n,i){for(var o=0,s=0;s<n;s++){var a=s>=i?t[r+s-i]:0,u=r>0?t[r+s-n]:0,c=r>0&&s>=i?t[r+s-(n+i)]:0,l=t[r+s]-e(a,u,c);o+=Math.abs(l)}return o}};return qs=function(e,n,i,o,s){var a;if("filterType"in o&&-1!==o.filterType){if("number"!=typeof o.filterType)throw new Error("unrecognised filter types");a=[o.filterType]}else a=[0,1,2,3,4];16===o.bitDepth&&(s*=2);for(var u=n*s,c=0,l=0,h=new Buffer((u+1)*i),f=a[0],d=0;d<i;d++){if(a.length>1)for(var p=1/0,m=0;m<a.length;m++){var _=r[a[m]](e,l,u,s);_<p&&(f=a[m],p=_)}h[c]=f,c++,t[f](e,l,u,h,c,s),c+=u,l+=u}return h}}(),i=y,o=Gs.exports=function(t){if(this._options=t,t.deflateChunkSize=t.deflateChunkSize||32768,t.deflateLevel=null!=t.deflateLevel?t.deflateLevel:9,t.deflateStrategy=null!=t.deflateStrategy?t.deflateStrategy:3,t.inputHasAlpha=null==t.inputHasAlpha||t.inputHasAlpha,t.deflateFactory=t.deflateFactory||i.createDeflate,t.bitDepth=t.bitDepth||8,t.colorType="number"==typeof t.colorType?t.colorType:e.COLORTYPE_COLOR_ALPHA,t.inputColorType="number"==typeof t.inputColorType?t.inputColorType:e.COLORTYPE_COLOR_ALPHA,-1===[e.COLORTYPE_GRAYSCALE,e.COLORTYPE_COLOR,e.COLORTYPE_COLOR_ALPHA,e.COLORTYPE_ALPHA].indexOf(t.colorType))throw new Error("option color type:"+t.colorType+" is not supported at present");if(-1===[e.COLORTYPE_GRAYSCALE,e.COLORTYPE_COLOR,e.COLORTYPE_COLOR_ALPHA,e.COLORTYPE_ALPHA].indexOf(t.inputColorType))throw new Error("option input color type:"+t.inputColorType+" is not supported at present");if(8!==t.bitDepth&&16!==t.bitDepth)throw new Error("option bit depth:"+t.bitDepth+" is not supported at present")};return o.prototype.getDeflateOptions=function(){return{chunkSize:this._options.deflateChunkSize,level:this._options.deflateLevel,strategy:this._options.deflateStrategy}},o.prototype.createDeflate=function(){return this._options.deflateFactory(this.getDeflateOptions())},o.prototype.filterData=function(t,i,o){var s=r(t,i,o,this._options),a=e.COLORTYPE_TO_BPP_MAP[this._options.colorType];return n(s,i,o,this._options,a)},o.prototype._packChunk=function(e,r){var n=r?r.length:0,i=new Buffer(n+12);return i.writeUInt32BE(n,0),i.writeUInt32BE(e,4),r&&r.copy(i,8),i.writeInt32BE(t.crc32(i.slice(4,i.length-4)),i.length-4),i},o.prototype.packGAMA=function(t){var r=new Buffer(4);return r.writeUInt32BE(Math.floor(t*e.GAMMA_DIVISION),0),this._packChunk(e.TYPE_gAMA,r)},o.prototype.packIHDR=function(t,r){var n=new Buffer(13);return n.writeUInt32BE(t,0),n.writeUInt32BE(r,4),n[8]=this._options.bitDepth,n[9]=this._options.colorType,n[10]=0,n[11]=0,n[12]=0,this._packChunk(e.TYPE_IHDR,n)},o.prototype.packIDAT=function(t){return this._packChunk(e.TYPE_IDAT,t)},o.prototype.packIEND=function(){return this._packChunk(e.TYPE_IEND,null)},Gs.exports}var $s,Ys={},Zs={exports:{}};function Js(){return $s||($s=1,function(e,t){var r=T.ok,n=y,i=R,o=k.kMaxLength;function s(e){if(!(this instanceof s))return new s(e);e&&e.chunkSize<n.Z_MIN_CHUNK&&(e.chunkSize=n.Z_MIN_CHUNK),n.Inflate.call(this,e),this._offset=void 0===this._offset?this._outOffset:this._offset,this._buffer=this._buffer||this._outBuffer,e&&null!=e.maxLength&&(this._maxLength=e.maxLength)}function a(e,t){t&&process.nextTick(t),e._handle&&(e._handle.close(),e._handle=null)}function u(e,t){return function(e,t){if("string"==typeof t&&(t=Buffer.from(t)),!(t instanceof Buffer))throw new TypeError("Not a string or buffer");var r=e._finishFlushFlag;return null==r&&(r=n.Z_FINISH),e._processChunk(t,r)}(new s(t),e)}s.prototype._processChunk=function(e,t,i){if("function"==typeof i)return n.Inflate._processChunk.call(this,e,t,i);var s,u=this,c=e&&e.length,l=this._chunkSize-this._offset,h=this._maxLength,f=0,d=[],p=0;function m(e,t){if(!u._hadError){var n=l-t;if(r(n>=0,"have should not go down"),n>0){var i=u._buffer.slice(u._offset,u._offset+n);if(u._offset+=n,i.length>h&&(i=i.slice(0,h)),d.push(i),p+=i.length,0===(h-=i.length))return!1}return(0===t||u._offset>=u._chunkSize)&&(l=u._chunkSize,u._offset=0,u._buffer=Buffer.allocUnsafe(u._chunkSize)),0===t&&(f+=c-e,c=e,!0)}}this.on("error",(function(e){s=e})),r(this._handle,"zlib binding closed");do{var _=this._handle.writeSync(t,e,f,c,this._buffer,this._offset,l);_=_||this._writeState}while(!this._hadError&&m(_[0],_[1]));if(this._hadError)throw s;if(p>=o)throw a(this),new RangeError("Cannot create final Buffer. It would be larger than 0x"+o.toString(16)+" bytes");var g=Buffer.concat(d,p);return a(this),g},i.inherits(s,n.Inflate),e.exports=t=u,t.Inflate=s,t.createInflate=function(e){return new s(e)},t.inflateSync=u}(Zs,Zs.exports)),Zs.exports}var Qs,Xs={exports:{}};function ea(){if(Qs)return Xs.exports;Qs=1;var e=Xs.exports=function(e){this._buffer=e,this._reads=[]};return e.prototype.read=function(e,t){this._reads.push({length:Math.abs(e),allowLess:e<0,func:t})},e.prototype.process=function(){for(;this._reads.length>0&&this._buffer.length;){var e=this._reads[0];if(!this._buffer.length||!(this._buffer.length>=e.length||e.allowLess))break;this._reads.shift();var t=this._buffer;this._buffer=t.slice(e.length),e.func.call(this,t.slice(0,e.length))}return this._reads.length>0?new Error("There are some read requests waitng on finished stream"):this._buffer.length>0?new Error("unrecognised content at end of stream"):void 0},Xs.exports}var ta,ra,na,ia,oa,sa,aa,ua={};function ca(){if(na)return ra;na=1;var e=!0,t=y,r=Js();t.deflateSync||(e=!1);var n=ea(),i=function(){if(ta)return ua;ta=1;var e=ea(),t=bs();return ua.process=function(r,n){var i=[],o=new e(r);return new t(n,{read:o.read.bind(o),write:function(e){i.push(e)},complete:function(){}}).start(),o.process(),Buffer.concat(i)},ua}(),o=As(),s=Ns(),a=Ds();return ra=function(u,c){if(!e)throw new Error("To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0");var l,h,f;var d=[];var p=new n(u),m=new o(c,{read:p.read.bind(p),error:function(e){l=e},metadata:function(e){h=e},gamma:function(e){f=e},palette:function(e){h.palette=e},transColor:function(e){h.transColor=e},inflateData:function(e){d.push(e)},simpleTransparency:function(){h.alpha=!0}});if(m.start(),p.process(),l)throw l;var _,g=Buffer.concat(d);if(d.length=0,h.interlace)_=t.inflateSync(g);else{var v=(1+(h.width*h.bpp*h.depth+7>>3))*h.height;_=r(g,{chunkSize:v,maxLength:v})}if(g=null,!_||!_.length)throw new Error("bad png - invalid inflate data response");var y=i.process(_,h);g=null;var w=s.dataToBitMap(y,h);y=null;var b=a(w,h);return h.data=b,h.gamma=f||0,h},ra}function la(){if(sa)return Ys;sa=1;var e=ca(),t=function(){if(oa)return ia;oa=1;var e=!0,t=y;t.deflateSync||(e=!1);var r=xs(),n=Vs();return ia=function(i,o){if(!e)throw new Error("To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0");var s=new n(o||{}),a=[];a.push(new Buffer(r.PNG_SIGNATURE)),a.push(s.packIHDR(i.width,i.height)),i.gamma&&a.push(s.packGAMA(i.gamma));var u=s.filterData(i.data,i.width,i.height),c=t.deflateSync(u,s.getDeflateOptions());if(u=null,!c||!c.length)throw new Error("bad png - invalid compressed data response");return a.push(s.packIDAT(c)),a.push(s.packIEND()),Buffer.concat(a)},ia}();return Ys.read=function(t,r){return e(t,r||{})},Ys.write=function(e,r){return t(e,r)},Ys}function ha(){if(aa)return as;aa=1;var e=R,t=x,r=Us(),n=function(){if(Ks)return zs.exports;Ks=1;var e=R,t=x,r=xs(),n=Vs(),i=zs.exports=function(e){t.call(this);var r=e||{};this._packer=new n(r),this._deflate=this._packer.createDeflate(),this.readable=!0};return e.inherits(i,t),i.prototype.pack=function(e,t,n,i){this.emit("data",new Buffer(r.PNG_SIGNATURE)),this.emit("data",this._packer.packIHDR(t,n)),i&&this.emit("data",this._packer.packGAMA(i));var o=this._packer.filterData(e,t,n);this._deflate.on("error",this.emit.bind(this,"error")),this._deflate.on("data",function(e){this.emit("data",this._packer.packIDAT(e))}.bind(this)),this._deflate.on("end",function(){this.emit("data",this._packer.packIEND()),this.emit("end")}.bind(this)),this._deflate.end(o)},zs.exports}(),i=la(),o=as.PNG=function(e){t.call(this),e=e||{},this.width=0|e.width,this.height=0|e.height,this.data=this.width>0&&this.height>0?new Buffer(4*this.width*this.height):null,e.fill&&this.data&&this.data.fill(0),this.gamma=0,this.readable=this.writable=!0,this._parser=new r(e),this._parser.on("error",this.emit.bind(this,"error")),this._parser.on("close",this._handleClose.bind(this)),this._parser.on("metadata",this._metadata.bind(this)),this._parser.on("gamma",this._gamma.bind(this)),this._parser.on("parsed",function(e){this.data=e,this.emit("parsed",e)}.bind(this)),this._packer=new n(e),this._packer.on("data",this.emit.bind(this,"data")),this._packer.on("end",this.emit.bind(this,"end")),this._parser.on("close",this._handleClose.bind(this)),this._packer.on("error",this.emit.bind(this,"error"))};return e.inherits(o,t),o.sync=i,o.prototype.pack=function(){return this.data&&this.data.length?(process.nextTick(function(){this._packer.pack(this.data,this.width,this.height,this.gamma)}.bind(this)),this):(this.emit("error","No data provided"),this)},o.prototype.parse=function(e,t){var r,n;t&&(r=function(e){this.removeListener("error",n),this.data=e,t(null,this)}.bind(this),n=function(e){this.removeListener("parsed",r),t(e,null)}.bind(this),this.once("parsed",r),this.once("error",n));return this.end(e),this},o.prototype.write=function(e){return this._parser.write(e),!0},o.prototype.end=function(e){this._parser.end(e)},o.prototype._metadata=function(e){this.width=e.width,this.height=e.height,this.emit("metadata",e)},o.prototype._gamma=function(e){this.gamma=e},o.prototype._handleClose=function(){this._parser.writable||this._packer.readable||this.emit("close")},o.bitblt=function(e,t,r,n,i,o,s,a){if(n|=0,i|=0,o|=0,s|=0,a|=0,(r|=0)>e.width||n>e.height||r+i>e.width||n+o>e.height)throw new Error("bitblt reading outside image");if(s>t.width||a>t.height||s+i>t.width||a+o>t.height)throw new Error("bitblt writing outside image");for(var u=0;u<o;u++)e.data.copy(t.data,(a+u)*t.width+s<<2,(n+u)*e.width+r<<2,(n+u)*e.width+r+i<<2)},o.prototype.bitblt=function(e,t,r,n,i,s,a){return o.bitblt(this,e,t,r,n,i,s,a),this},o.adjustGamma=function(e){if(e.gamma){for(var t=0;t<e.height;t++)for(var r=0;r<e.width;r++)for(var n=e.width*t+r<<2,i=0;i<3;i++){var o=e.data[n+i]/255;o=Math.pow(o,1/2.2/e.gamma),e.data[n+i]=Math.round(255*o)}e.gamma=0}},o.prototype.adjustGamma=function(){o.adjustGamma(this)},as}var fa,da,pa={};function ma(){return fa||(fa=1,function(e){function t(e){if("number"==typeof e&&(e=e.toString()),"string"!=typeof e)throw new Error("Color should be defined as hex string");var t=e.slice().replace("#","").split("");if(t.length<3||5===t.length||t.length>8)throw new Error("Invalid hex color: "+e);3!==t.length&&4!==t.length||(t=Array.prototype.concat.apply([],t.map((function(e){return[e,e]})))),6===t.length&&t.push("F","F");var r=parseInt(t.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:255&r,hex:"#"+t.slice(0,6).join("")}}e.getOptions=function(e){e||(e={}),e.color||(e.color={});var r=void 0===e.margin||null===e.margin||e.margin<0?4:e.margin,n=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:n,scale:n?4:i,margin:r,color:{dark:t(e.color.dark||"#000000ff"),light:t(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}},e.getScale=function(e,t){return t.width&&t.width>=e+2*t.margin?t.width/(e+2*t.margin):t.scale},e.getImageWidth=function(t,r){var n=e.getScale(t,r);return Math.floor((t+2*r.margin)*n)},e.qrToImageData=function(t,r,n){for(var i=r.modules.size,o=r.modules.data,s=e.getScale(i,n),a=Math.floor((i+2*n.margin)*s),u=n.margin*s,c=[n.color.light,n.color.dark],l=0;l<a;l++)for(var h=0;h<a;h++){var f=4*(l*a+h),d=n.color.light;if(l>=u&&h>=u&&l<a-u&&h<a-u)d=c[o[Math.floor((l-u)/s)*i+Math.floor((h-u)/s)]?1:0];t[f++]=d.r,t[f++]=d.g,t[f++]=d.b,t[f]=d.a}}}(pa)),pa}var _a,ga={};var va,ya={};var wa,ba,Ea={},Ma={};function Sa(){if(wa)return Ma;wa=1;var e=ma();function t(e,t){var r=e.a/255,n=t+'="'+e.hex+'"';return r<1?n+" "+t+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function r(e,t,r){var n=e+t;return void 0!==r&&(n+=" "+r),n}return Ma.render=function(n,i,o){var s=e.getOptions(i),a=n.modules.size,u=n.modules.data,c=a+2*s.margin,l=s.color.light.a?"<path "+t(s.color.light,"fill")+' d="M0 0h'+c+"v"+c+'H0z"/>':"",h="<path "+t(s.color.dark,"stroke")+' d="'+function(e,t,n){for(var i="",o=0,s=!1,a=0,u=0;u<e.length;u++){var c=Math.floor(u%t),l=Math.floor(u/t);c||s||(s=!0),e[u]?(a++,u>0&&c>0&&e[u-1]||(i+=s?r("M",c+n,.5+l+n):r("m",o,0),o=0,s=!1),c+1<t&&e[u+1]||(i+=r("h",a),a=0)):o++}return i}(u,a,s.margin)+'"/>',f='viewBox="0 0 '+c+" "+c+'"',d='<svg xmlns="http://www.w3.org/2000/svg" '+(s.width?'width="'+s.width+'" height="'+s.width+'" ':"")+f+' shape-rendering="crispEdges">'+l+h+"</svg>\n";return"function"==typeof o&&o(null,d),d},Ma}var xa,ka,Ra,Ta,Ca,Aa,Oa,La,Ba={},Pa={};function Ia(){return xa||(xa=1,e=Pa,t=ma(),e.render=function(e,r,n){var i=n,o=r;void 0!==i||r&&r.getContext||(i=r,r=void 0),r||(o=function(){try{return document.createElement("canvas")}catch(e){throw new Error("You need to specify a canvas element")}}()),i=t.getOptions(i);var s=t.getImageWidth(e.modules.size,i),a=o.getContext("2d"),u=a.createImageData(s,s);return t.qrToImageData(u.data,e,i),function(e,t,r){e.clearRect(0,0,t.width,t.height),t.style||(t.style={}),t.height=r,t.width=r,t.style.height=r+"px",t.style.width=r+"px"}(a,o,s),a.putImageData(u,0,0),o},e.renderToDataURL=function(t,r,n){var i=n;void 0!==i||r&&r.getContext||(i=r,r=void 0),i||(i={});var o=e.render(t,r,i),s=i.type||"image/png",a=i.rendererOpts||{};return o.toDataURL(s,a.quality)}),Pa;var e,t}function Na(){if(Ra)return Ni;Ra=1;var e,t,r,n,i=Di(),o=is(),s=(da||(da=1,e=ss,t=E,r=ha().PNG,n=ma(),e.render=function(e,t){var i=n.getOptions(t),o=i.rendererOpts,s=n.getImageWidth(e.modules.size,i);o.width=s,o.height=s;var a=new r(o);return n.qrToImageData(a.data,e,i),a},e.renderToDataURL=function(t,r,n){void 0===n&&(n=r,r=void 0),e.renderToBuffer(t,r,(function(e,t){e&&n(e);var r="data:image/png;base64,";r+=t.toString("base64"),n(null,r)}))},e.renderToBuffer=function(t,r,n){void 0===n&&(n=r,r=void 0);var i=e.render(t,r),o=[];i.on("error",n),i.on("data",(function(e){o.push(e)})),i.on("end",(function(){n(null,Buffer.concat(o))})),i.pack()},e.renderToFile=function(r,n,i,o){void 0===o&&(o=i,i=void 0);var s=t.createWriteStream(r);s.on("error",o),s.on("close",o),e.renderToFileStream(s,n,i)},e.renderToFileStream=function(t,r,n){e.render(r,n).pack().pipe(t)}),ss),a=(_a||(_a=1,function(e){var t=ma(),r={WW:" ",WB:"▄",BB:"█",BW:"▀"},n={BB:" ",BW:"▄",WW:"█",WB:"▀"};function i(e,t,r){return e&&t?r.BB:e&&!t?r.BW:!e&&t?r.WB:r.WW}e.render=function(e,o,s){var a=t.getOptions(o),u=r;"#ffffff"!==a.color.dark.hex&&"#000000"!==a.color.light.hex||(u=n);var c=e.modules.size,l=e.modules.data,h="",f=Array(c+2*a.margin+1).join(u.WW);f=Array(a.margin/2+1).join(f+"\n");var d=Array(a.margin+1).join(u.WW);h+=f;for(var p=0;p<c;p+=2){h+=d;for(var m=0;m<c;m++)h+=i(l[p*c+m],l[(p+1)*c+m],u);h+=d+"\n"}return h+=f.slice(0,-1),"function"==typeof s&&s(null,h),h},e.renderToFile=function(t,r,n,i){void 0===i&&(i=n,n=void 0);var o=E,s=e.render(r,n);o.writeFile(t,s,i)}}(ga)),ga),u=(va||(va=1,ya.render=function(e,t,r){var n=e.modules.size,i=e.modules.data,o="[47m [0m",s="",a=Array(n+3).join(o),u=Array(2).join(o);s+=a+"\n";for(var c=0;c<n;++c){s+=o;for(var l=0;l<n;l++)s+=i[c*n+l]?"[40m [0m":o;s+=u+"\n"}return s+=a+"\n","function"==typeof r&&r(null,s),s}),ya),c=function(){return ba||(ba=1,e=Ea,t=Sa(),e.render=t.render,e.renderToFile=function(t,r,n,i){void 0===i&&(i=n,n=void 0);var o=E,s='<?xml version="1.0" encoding="utf-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">'+e.render(r,n);o.writeFile(t,s,i)}),Ea;var e,t}();function l(e,t,r){if(void 0===e)throw new Error("String required as first argument");if(void 0===r&&(r=t,t={}),"function"!=typeof r){if(!i())throw new Error("Callback required as last argument");t=r||{},r=null}return{opts:t,cb:r}}function h(e){switch(e){case"svg":return c;case"txt":case"utf8":return a;default:return s}}function f(e,t,r){if(!r.cb)return new Promise((function(n,i){try{var s=o.create(t,r.opts);return e(s,r.opts,(function(e,t){return e?i(e):n(t)}))}catch(e){i(e)}}));try{var n=o.create(t,r.opts);return e(n,r.opts,r.cb)}catch(e){r.cb(e)}}return Ni.create=o.create,Ni.toCanvas=function(){if(ka)return Ba;ka=1;var e=Di(),t=is(),r=Ia(),n=Sa();function i(r,n,i,o,s){var a=[].slice.call(arguments,1),u=a.length,c="function"==typeof a[u-1];if(!c&&!e())throw new Error("Callback required as last argument");if(!c){if(u<1)throw new Error("Too few arguments provided");return 1===u?(i=n,n=o=void 0):2!==u||n.getContext||(o=i,i=n,n=void 0),new Promise((function(e,s){try{var a=t.create(i,o);e(r(a,n,o))}catch(e){s(e)}}))}if(u<2)throw new Error("Too few arguments provided");2===u?(s=i,i=n,n=o=void 0):3===u&&(n.getContext&&void 0===s?(s=o,o=void 0):(s=o,o=i,i=n,n=void 0));try{var l=t.create(i,o);s(null,r(l,n,o))}catch(e){s(e)}}return Ba.create=t.create,Ba.toCanvas=i.bind(null,r.render),Ba.toDataURL=i.bind(null,r.renderToDataURL),Ba.toString=i.bind(null,(function(e,t,r){return n.render(e,r)})),Ba}().toCanvas,Ni.toString=function(e,t,r){var n=l(e,t,r);return f(function(e){switch(e){case"svg":return c;case"terminal":return u;default:return a}}(n.opts.type).render,e,n)},Ni.toDataURL=function(e,t,r){var n=l(e,t,r);return f(h(n.opts.type).renderToDataURL,e,n)},Ni.toBuffer=function(e,t,r){var n=l(e,t,r);return f(h(n.opts.type).renderToBuffer,e,n)},Ni.toFile=function(e,t,r,n){if("string"!=typeof e||"string"!=typeof t&&"object"!=typeof t)throw new Error("Invalid argument");if(arguments.length<3&&!i())throw new Error("Too few arguments provided");var o=l(t,r,n),s=o.opts.type||function(e){return e.slice(2+(e.lastIndexOf(".")-1>>>0)).toLowerCase()}(e);return f(h(s).renderToFile.bind(null,e),t,o)},Ni.toFileStream=function(e,t,r){if(arguments.length<2)throw new Error("Too few arguments provided");var n=l(t,r,e.emit.bind(e,"error"));f(h("png").renderToFileStream.bind(null,e),t,n)},Ni}function Da(){if(La)return Oa;La=1;var e=Aa?Ca:(Aa=1,Ca=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,r=[],n=0;n<e.rangeCount;n++)r.push(e.getRangeAt(n));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null}return e.removeAllRanges(),function(){"Caret"===e.type&&e.removeAllRanges(),e.rangeCount||r.forEach((function(t){e.addRange(t)})),t&&t.focus()}}),t={"text/plain":"Text","text/html":"Url",default:"Text"};return Oa=function(r,n){var i,o,s,a,u,c,l=!1;n||(n={}),i=n.debug||!1;try{if(s=e(),a=document.createRange(),u=document.getSelection(),(c=document.createElement("span")).textContent=r,c.ariaHidden="true",c.style.all="unset",c.style.position="fixed",c.style.top=0,c.style.clip="rect(0, 0, 0, 0)",c.style.whiteSpace="pre",c.style.webkitUserSelect="text",c.style.MozUserSelect="text",c.style.msUserSelect="text",c.style.userSelect="text",c.addEventListener("copy",(function(e){if(e.stopPropagation(),n.format)if(e.preventDefault(),void 0===e.clipboardData){i&&console.warn("unable to use e.clipboardData"),i&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var o=t[n.format]||t.default;window.clipboardData.setData(o,r)}else e.clipboardData.clearData(),e.clipboardData.setData(n.format,r);n.onCopy&&(e.preventDefault(),n.onCopy(e.clipboardData))})),document.body.appendChild(c),a.selectNodeContents(c),u.addRange(a),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");l=!0}catch(e){i&&console.error("unable to copy using execCommand: ",e),i&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(n.format||"text",r),n.onCopy&&n.onCopy(window.clipboardData),l=!0}catch(e){i&&console.error("unable to copy using clipboardData: ",e),i&&console.error("falling back to prompt"),o=function(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}("message"in n?n.message:"Copy to clipboard: #{key}, Enter"),window.prompt(o,r)}}finally{u&&("function"==typeof u.removeRange?u.removeRange(a):u.removeAllRanges()),c&&document.body.removeChild(c),s()}return l},Oa}var Ua,ja,Ha,qa,Fa,Wa={},Ka={},za={};function Ga(){if(Ua)return za;Ua=1;var e,t,r,n,i,o,s,a,u={},c=[],l=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord/i;function h(e,t){for(var r in t)e[r]=t[r];return e}function f(e){var t=e.parentNode;t&&t.removeChild(e)}function d(e,t,r){var n,i=arguments,o={};for(n in t)"key"!==n&&"ref"!==n&&(o[n]=t[n]);if(arguments.length>3)for(r=[r],n=3;n<arguments.length;n++)r.push(i[n]);if(null!=r&&(o.children=r),"function"==typeof e&&null!=e.defaultProps)for(n in e.defaultProps)void 0===o[n]&&(o[n]=e.defaultProps[n]);return p(e,o,t&&t.key,t&&t.ref,null)}function p(t,r,n,i,o){var s={type:t,props:r,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:o};return null==o&&(s.__v=s),e.vnode&&e.vnode(s),s}function m(e){return e.children}function _(e,t){this.props=e,this.context=t}function g(e,t){if(null==t)return e.__?g(e.__,e.__.__k.indexOf(e)+1):null;for(var r;t<e.__k.length;t++)if(null!=(r=e.__k[t])&&null!=r.__e)return r.__e;return"function"==typeof e.type?g(e):null}function v(e){var t,r;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(r=e.__k[t])&&null!=r.__e){e.__e=e.__c.base=r.__e;break}return v(e)}}function y(t){(!t.__d&&(t.__d=!0)&&r.push(t)&&!n++||o!==e.debounceRendering)&&((o=e.debounceRendering)||i)(w)}function w(){for(var e;n=r.length;)e=r.sort((function(e,t){return e.__v.__b-t.__v.__b})),r=[],e.some((function(e){var t,r,n,i,o,s,a;e.__d&&(s=(o=(t=e).__v).__e,(a=t.__P)&&(r=[],(n=h({},o)).__v=n,i=k(a,o,n,t.__n,void 0!==a.ownerSVGElement,null,r,null==s?g(o):s),R(r,o),i!=s&&v(o)))}))}function b(e,t,r,n,i,o,s,a,l){var h,d,p,m,_,v,y,w=r&&r.__k||c,b=w.length;if(a==u&&(a=null!=o?o[0]:b?g(r,0):null),h=0,t.__k=E(t.__k,(function(r){if(null!=r){if(r.__=t,r.__b=t.__b+1,null===(p=w[h])||p&&r.key==p.key&&r.type===p.type)w[h]=void 0;else for(d=0;d<b;d++){if((p=w[d])&&r.key==p.key&&r.type===p.type){w[d]=void 0;break}p=null}if(m=k(e,r,p=p||u,n,i,o,s,a,l),(d=r.ref)&&p.ref!=d&&(y||(y=[]),p.ref&&y.push(p.ref,null,r),y.push(d,r.__c||m,r)),null!=m){var c;if(null==v&&(v=m),void 0!==r.__d)c=r.__d,r.__d=void 0;else if(o==p||m!=a||null==m.parentNode){e:if(null==a||a.parentNode!==e)e.appendChild(m),c=null;else{for(_=a,d=0;(_=_.nextSibling)&&d<b;d+=2)if(_==m)break e;e.insertBefore(m,a),c=a}"option"==t.type&&(e.value="")}a=void 0!==c?c:m.nextSibling,"function"==typeof t.type&&(t.__d=a)}else a&&p.__e==a&&a.parentNode!=e&&(a=g(p))}return h++,r})),t.__e=v,null!=o&&"function"!=typeof t.type)for(h=o.length;h--;)null!=o[h]&&f(o[h]);for(h=b;h--;)null!=w[h]&&A(w[h],w[h]);if(y)for(h=0;h<y.length;h++)C(y[h],y[++h],y[++h])}function E(e,t,r){if(null==r&&(r=[]),null==e||"boolean"==typeof e)t&&r.push(t(null));else if(Array.isArray(e))for(var n=0;n<e.length;n++)E(e[n],t,r);else r.push(t?t("string"==typeof e||"number"==typeof e?p(null,e,null,null,e):null!=e.__e||null!=e.__c?p(e.type,e.props,e.key,null,e.__v):e):e);return r}function M(e,t,r){"-"===t[0]?e.setProperty(t,r):e[t]="number"==typeof r&&!1===l.test(t)?r+"px":null==r?"":r}function S(e,t,r,n,i){var o,s,a,u,c;if(i?"className"===t&&(t="class"):"class"===t&&(t="className"),"style"===t)if(o=e.style,"string"==typeof r)o.cssText=r;else{if("string"==typeof n&&(o.cssText="",n=null),n)for(u in n)r&&u in r||M(o,u,"");if(r)for(c in r)n&&r[c]===n[c]||M(o,c,r[c])}else"o"===t[0]&&"n"===t[1]?(s=t!==(t=t.replace(/Capture$/,"")),a=t.toLowerCase(),t=(a in e?a:t).slice(2),r?(n||e.addEventListener(t,x,s),(e.l||(e.l={}))[t]=r):e.removeEventListener(t,x,s)):"list"!==t&&"tagName"!==t&&"form"!==t&&"type"!==t&&"size"!==t&&!i&&t in e?e[t]=null==r?"":r:"function"!=typeof r&&"dangerouslySetInnerHTML"!==t&&(t!==(t=t.replace(/^xlink:?/,""))?null==r||!1===r?e.removeAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase()):e.setAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase(),r):null==r||!1===r&&!/^ar/.test(t)?e.removeAttribute(t):e.setAttribute(t,r))}function x(t){this.l[t.type](e.event?e.event(t):t)}function k(t,r,n,i,o,s,a,u,c){var l,f,d,p,g,v,y,w,E,M,S=r.type;if(void 0!==r.constructor)return null;(l=e.__b)&&l(r);try{e:if("function"==typeof S){if(w=r.props,E=(l=S.contextType)&&i[l.__c],M=l?E?E.props.value:l.__:i,n.__c?y=(f=r.__c=n.__c).__=f.__E:("prototype"in S&&S.prototype.render?r.__c=f=new S(w,M):(r.__c=f=new _(w,M),f.constructor=S,f.render=O),E&&E.sub(f),f.props=w,f.state||(f.state={}),f.context=M,f.__n=i,d=f.__d=!0,f.__h=[]),null==f.__s&&(f.__s=f.state),null!=S.getDerivedStateFromProps&&(f.__s==f.state&&(f.__s=h({},f.__s)),h(f.__s,S.getDerivedStateFromProps(w,f.__s))),p=f.props,g=f.state,d)null==S.getDerivedStateFromProps&&null!=f.componentWillMount&&f.componentWillMount(),null!=f.componentDidMount&&f.__h.push(f.componentDidMount);else{if(null==S.getDerivedStateFromProps&&w!==p&&null!=f.componentWillReceiveProps&&f.componentWillReceiveProps(w,M),!f.__e&&null!=f.shouldComponentUpdate&&!1===f.shouldComponentUpdate(w,f.__s,M)||r.__v===n.__v&&!f.__){for(f.props=w,f.state=f.__s,r.__v!==n.__v&&(f.__d=!1),f.__v=r,r.__e=n.__e,r.__k=n.__k,f.__h.length&&a.push(f),l=0;l<r.__k.length;l++)r.__k[l]&&(r.__k[l].__=r);break e}null!=f.componentWillUpdate&&f.componentWillUpdate(w,f.__s,M),null!=f.componentDidUpdate&&f.__h.push((function(){f.componentDidUpdate(p,g,v)}))}f.context=M,f.props=w,f.state=f.__s,(l=e.__r)&&l(r),f.__d=!1,f.__v=r,f.__P=t,l=f.render(f.props,f.state,f.context),r.__k=null!=l&&l.type==m&&null==l.key?l.props.children:Array.isArray(l)?l:[l],null!=f.getChildContext&&(i=h(h({},i),f.getChildContext())),d||null==f.getSnapshotBeforeUpdate||(v=f.getSnapshotBeforeUpdate(p,g)),b(t,r,n,i,o,s,a,u,c),f.base=r.__e,f.__h.length&&a.push(f),y&&(f.__E=f.__=null),f.__e=!1}else null==s&&r.__v===n.__v?(r.__k=n.__k,r.__e=n.__e):r.__e=T(n.__e,r,n,i,o,s,a,c);(l=e.diffed)&&l(r)}catch(t){r.__v=null,e.__e(t,r,n)}return r.__e}function R(t,r){e.__c&&e.__c(r,t),t.some((function(r){try{t=r.__h,r.__h=[],t.some((function(e){e.call(r)}))}catch(t){e.__e(t,r.__v)}}))}function T(e,t,r,n,i,o,s,a){var l,h,f,d,p,m=r.props,_=t.props;if(i="svg"===t.type||i,null!=o)for(l=0;l<o.length;l++)if(null!=(h=o[l])&&((null===t.type?3===h.nodeType:h.localName===t.type)||e==h)){e=h,o[l]=null;break}if(null==e){if(null===t.type)return document.createTextNode(_);e=i?document.createElementNS("http://www.w3.org/2000/svg",t.type):document.createElement(t.type,_.is&&{is:_.is}),o=null,a=!1}if(null===t.type)m!==_&&e.data!=_&&(e.data=_);else{if(null!=o&&(o=c.slice.call(e.childNodes)),f=(m=r.props||u).dangerouslySetInnerHTML,d=_.dangerouslySetInnerHTML,!a){if(m===u)for(m={},p=0;p<e.attributes.length;p++)m[e.attributes[p].name]=e.attributes[p].value;(d||f)&&(d&&f&&d.__html==f.__html||(e.innerHTML=d&&d.__html||""))}(function(e,t,r,n,i){var o;for(o in r)"children"===o||"key"===o||o in t||S(e,o,null,r[o],n);for(o in t)i&&"function"!=typeof t[o]||"children"===o||"key"===o||"value"===o||"checked"===o||r[o]===t[o]||S(e,o,t[o],r[o],n)})(e,_,m,i,a),d?t.__k=[]:(t.__k=t.props.children,b(e,t,r,n,"foreignObject"!==t.type&&i,o,s,u,a)),a||("value"in _&&void 0!==(l=_.value)&&l!==e.value&&S(e,"value",l,m.value,!1),"checked"in _&&void 0!==(l=_.checked)&&l!==e.checked&&S(e,"checked",l,m.checked,!1))}return e}function C(t,r,n){try{"function"==typeof t?t(r):t.current=r}catch(t){e.__e(t,n)}}function A(t,r,n){var i,o,s;if(e.unmount&&e.unmount(t),(i=t.ref)&&(i.current&&i.current!==t.__e||C(i,null,r)),n||"function"==typeof t.type||(n=null!=(o=t.__e)),t.__e=t.__d=void 0,null!=(i=t.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(t){e.__e(t,r)}i.base=i.__P=null}if(i=t.__k)for(s=0;s<i.length;s++)i[s]&&A(i[s],r,n);null!=o&&f(o)}function O(e,t,r){return this.constructor(e,r)}function L(t,r,n){var i,o,a;e.__&&e.__(t,r),o=(i=n===s)?null:n&&n.__k||r.__k,t=d(m,null,[t]),a=[],k(r,(i?r:n||r).__k=t,o||u,u,void 0!==r.ownerSVGElement,n&&!i?[n]:o?null:c.slice.call(r.childNodes),a,n||u,i),R(a,t)}return e={__e:function(e,t){for(var r,n;t=t.__;)if((r=t.__c)&&!r.__)try{if(r.constructor&&null!=r.constructor.getDerivedStateFromError&&(n=!0,r.setState(r.constructor.getDerivedStateFromError(e))),null!=r.componentDidCatch&&(n=!0,r.componentDidCatch(e)),n)return y(r.__E=r)}catch(t){e=t}throw e}},t=function(e){return null!=e&&void 0===e.constructor},_.prototype.setState=function(e,t){var r;r=this.__s!==this.state?this.__s:this.__s=h({},this.state),"function"==typeof e&&(e=e(r,this.props)),e&&h(r,e),null!=e&&this.__v&&(t&&this.__h.push(t),y(this))},_.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),y(this))},_.prototype.render=m,r=[],n=0,i="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,s=u,a=0,za.render=L,za.hydrate=function(e,t){L(e,t,s)},za.createElement=d,za.h=d,za.Fragment=m,za.createRef=function(){return{}},za.isValidElement=t,za.Component=_,za.cloneElement=function(e,t){var r,n;for(n in t=h(h({},e.props),t),arguments.length>2&&(t.children=c.slice.call(arguments,2)),r={},t)"key"!==n&&"ref"!==n&&(r[n]=t[n]);return p(e.type,r,t.key||e.key,t.ref||e.ref,null)},za.createContext=function(e){var t={},r={__c:"__cC"+a++,__:e,Consumer:function(e,t){return e.children(t)},Provider:function(e){var n,i=this;return this.getChildContext||(n=[],this.getChildContext=function(){return t[r.__c]=i,t},this.shouldComponentUpdate=function(e){i.props.value!==e.value&&n.some((function(t){t.context=e.value,y(t)}))},this.sub=function(e){n.push(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n.splice(n.indexOf(e),1),t&&t.call(e)}}),e.children}};return r.Consumer.contextType=r,r.Provider.__=r,r},za.toChildArray=E,za._e=A,za.options=e,za}function Va(){return Ha||(Ha=1,function(e){var t=function(){if(ja)return Ka;ja=1;var e,t,r,n=Ga(),i=0,o=[],s=n.options.__r,a=n.options.diffed,u=n.options.__c,c=n.options.unmount;function l(e,r){n.options.__h&&n.options.__h(t,e,i||r),i=0;var o=t.__H||(t.__H={__:[],__h:[]});return e>=o.__.length&&o.__.push({}),o.__[e]}function h(e){return i=1,f(y,e)}function f(r,n,i){var o=l(e++,2);return o.__c||(o.__c=t,o.__=[i?i(n):y(void 0,n),function(e){var t=r(o.__[0],e);o.__[0]!==t&&(o.__[0]=t,o.__c.setState({}))}]),o.__}function d(r,i){var o=l(e++,4);!n.options.__s&&v(o.__H,i)&&(o.__=r,o.__H=i,t.__h.push(o))}function p(t,r){var n=l(e++,7);return v(n.__H,r)?(n.__H=r,n.__h=t,n.__=t()):n.__}function m(){o.some((function(e){if(e.__P)try{e.__H.__h.forEach(_),e.__H.__h.forEach(g),e.__H.__h=[]}catch(t){return e.__H.__h=[],n.options.__e(t,e.__v),!0}})),o=[]}function _(e){e.t&&e.t()}function g(e){var t=e.__();"function"==typeof t&&(e.t=t)}function v(e,t){return!e||t.some((function(t,r){return t!==e[r]}))}function y(e,t){return"function"==typeof t?t(e):t}return n.options.__r=function(r){s&&s(r),e=0,(t=r.__c).__H&&(t.__H.__h.forEach(_),t.__H.__h.forEach(g),t.__H.__h=[])},n.options.diffed=function(e){a&&a(e);var t=e.__c;if(t){var i=t.__H;i&&i.__h.length&&(1!==o.push(t)&&r===n.options.requestAnimationFrame||((r=n.options.requestAnimationFrame)||function(e){var t,r=function(){clearTimeout(n),cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,100);"undefined"!=typeof window&&(t=requestAnimationFrame(r))})(m))}},n.options.__c=function(e,t){t.some((function(e){try{e.__h.forEach(_),e.__h=e.__h.filter((function(e){return!e.__||g(e)}))}catch(r){t.some((function(e){e.__h&&(e.__h=[])})),t=[],n.options.__e(r,e.__v)}})),u&&u(e,t)},n.options.unmount=function(e){c&&c(e);var t=e.__c;if(t){var r=t.__H;if(r)try{r.__.forEach((function(e){return e.t&&e.t()}))}catch(e){n.options.__e(e,t.__v)}}},Ka.useState=h,Ka.useReducer=f,Ka.useEffect=function(r,i){var o=l(e++,3);!n.options.__s&&v(o.__H,i)&&(o.__=r,o.__H=i,t.__H.__h.push(o))},Ka.useLayoutEffect=d,Ka.useRef=function(e){return i=5,p((function(){return{current:e}}),[])},Ka.useImperativeHandle=function(e,t,r){i=6,d((function(){"function"==typeof e?e(t()):e&&(e.current=t())}),null==r?r:r.concat(e))},Ka.useMemo=p,Ka.useCallback=function(e,t){return i=8,p((function(){return e}),t)},Ka.useContext=function(r){var n=t.context[r.__c],i=l(e++,9);return i.__c=r,n?(null==i.__&&(i.__=!0,n.sub(t)),n.props.value):r.__},Ka.useDebugValue=function(e,t){n.options.useDebugValue&&n.options.useDebugValue(t?t(e):e)},Ka.useErrorBoundary=function(r){var n=l(e++,10),i=h();return n.__=r,t.componentDidCatch||(t.componentDidCatch=function(e){n.__&&n.__(e),i[1](e)}),[i[0],function(){i[1](void 0)}]},Ka}(),r=Ga();function n(e,t){for(var r in t)e[r]=t[r];return e}function i(e,t){for(var r in e)if("__source"!==r&&!(r in t))return!0;for(var n in t)if("__source"!==n&&e[n]!==t[n])return!0;return!1}var o=function(e){var t,r;function n(t){var r;return(r=e.call(this,t)||this).isPureReactComponent=!0,r}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n.prototype.shouldComponentUpdate=function(e,t){return i(this.props,e)||i(this.state,t)},n}(r.Component);function s(e,t){function o(e){var r=this.props.ref,n=r==e.ref;return!n&&r&&(r.call?r(null):r.current=null),t?!t(this.props,e)||!n:i(this.props,e)}function s(t){return this.shouldComponentUpdate=o,r.createElement(e,n({},t))}return s.prototype.isReactComponent=!0,s.displayName="Memo("+(e.displayName||e.name)+")",s.t=!0,s}var a=r.options.__b;function u(e){function t(t){var r=n({},t);return delete r.ref,e(r,t.ref)}return t.prototype.isReactComponent=t.t=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}r.options.__b=function(e){e.type&&e.type.t&&e.ref&&(e.props.ref=e.ref,e.ref=null),a&&a(e)};var c=function(e,t){return e?r.toChildArray(e).reduce((function(e,r,n){return e.concat(t(r,n))}),[]):null},l={map:c,forEach:c,count:function(e){return e?r.toChildArray(e).length:0},only:function(e){if(1!==(e=r.toChildArray(e)).length)throw new Error("Children.only() expects only one child.");return e[0]},toArray:r.toChildArray},h=r.options.__e;function f(e){return e&&((e=n({},e)).__c=null,e.__k=e.__k&&e.__k.map(f)),e}function d(){this.__u=0,this.o=null,this.__b=null}function p(e){var t=e.__.__c;return t&&t.u&&t.u(e)}function m(e){var t,n,i;function o(o){if(t||(t=e()).then((function(e){n=e.default||e}),(function(e){i=e})),i)throw i;if(!n)throw t;return r.createElement(n,o)}return o.displayName="Lazy",o.t=!0,o}function _(){this.i=null,this.l=null}r.options.__e=function(e,t,r){if(e.then)for(var n,i=t;i=i.__;)if((n=i.__c)&&n.__c)return n.__c(e,t.__c);h(e,t,r)},(d.prototype=new r.Component).__c=function(e,t){var r=this;null==r.o&&(r.o=[]),r.o.push(t);var n=p(r.__v),i=!1,o=function(){i||(i=!0,n?n(s):s())};t.__c=t.componentWillUnmount,t.componentWillUnmount=function(){o(),t.__c&&t.__c()};var s=function(){var e;if(!--r.__u)for(r.__v.__k[0]=r.state.u,r.setState({u:r.__b=null});e=r.o.pop();)e.forceUpdate()};r.__u++||r.setState({u:r.__b=r.__v.__k[0]}),e.then(o,o)},d.prototype.render=function(e,t){return this.__b&&(this.__v.__k[0]=f(this.__b),this.__b=null),[r.createElement(r.Component,null,t.u?null:e.children),t.u&&e.fallback]};var g=function(e,t,r){if(++r[1]===r[0]&&e.l.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.l.size))for(r=e.i;r;){for(;r.length>3;)r.pop()();if(r[1]<r[0])break;e.i=r=r[2]}};(_.prototype=new r.Component).u=function(e){var t=this,r=p(t.__v),n=t.l.get(e);return n[0]++,function(i){var o=function(){t.props.revealOrder?(n.push(i),g(t,e,n)):i()};r?r(o):o()}},_.prototype.render=function(e){this.i=null,this.l=new Map;var t=r.toChildArray(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},_.prototype.componentDidUpdate=_.prototype.componentDidMount=function(){var e=this;e.l.forEach((function(t,r){g(e,r,t)}))};var v=function(){function e(){}var t=e.prototype;return t.getChildContext=function(){return this.props.context},t.render=function(e){return e.children},e}();function y(e){var t=this,n=e.container,i=r.createElement(v,{context:t.context},e.vnode);return t.s&&t.s!==n&&(t.p.parentNode&&t.s.removeChild(t.p),r._e(t.v),t.h=!1),e.vnode?t.h?(n.__k=t.__k,r.render(i,n),t.__k=n.__k):(t.p=document.createTextNode(""),r.hydrate("",n),n.appendChild(t.p),t.h=!0,t.s=n,r.render(i,n,t.p),t.__k=t.p.__k):t.h&&(t.p.parentNode&&t.s.removeChild(t.p),r._e(t.v)),t.v=i,t.componentWillUnmount=function(){t.p.parentNode&&t.s.removeChild(t.p),r._e(t.v)},null}function w(e,t){return r.createElement(y,{vnode:e,container:t})}var b=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|fill|flood|font|glyph(?!R)|horiz|marker(?!H|W|U)|overline|paint|stop|strikethrough|stroke|text(?!L)|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/;r.Component.prototype.isReactComponent={};var E="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103;function M(e,t,n){if(null==t.__k)for(;t.firstChild;)t.removeChild(t.firstChild);return r.render(e,t),"function"==typeof n&&n(),e?e.__c:null}var S=r.options.event;function x(e,t){e["UNSAFE_"+t]&&!e[t]&&Object.defineProperty(e,t,{configurable:!1,get:function(){return this["UNSAFE_"+t]},set:function(e){this["UNSAFE_"+t]=e}})}r.options.event=function(e){S&&(e=S(e)),e.persist=function(){};var t=!1,r=!1,n=e.stopPropagation;e.stopPropagation=function(){n.call(e),t=!0};var i=e.preventDefault;return e.preventDefault=function(){i.call(e),r=!0},e.isPropagationStopped=function(){return t},e.isDefaultPrevented=function(){return r},e.nativeEvent=e};var k={configurable:!0,get:function(){return this.class}},R=r.options.vnode;function T(e){return r.createElement.bind(null,e)}function C(e){return!!e&&e.$$typeof===E}function A(e){return C(e)?r.cloneElement.apply(null,arguments):e}function O(e){return!!e.__k&&(r.render(null,e),!0)}function L(e){return e&&(e.base||1===e.nodeType&&e)||null}r.options.vnode=function(e){e.$$typeof=E;var t=e.type,n=e.props;if(t){if(n.class!=n.className&&(k.enumerable="className"in n,null!=n.className&&(n.class=n.className),Object.defineProperty(n,"className",k)),"function"!=typeof t){var i,o,s;for(s in n.defaultValue&&void 0!==n.value&&(n.value||0===n.value||(n.value=n.defaultValue),delete n.defaultValue),Array.isArray(n.value)&&n.multiple&&"select"===t&&(r.toChildArray(n.children).forEach((function(e){-1!=n.value.indexOf(e.props.value)&&(e.props.selected=!0)})),delete n.value),n)if(i=b.test(s))break;if(i)for(s in o=e.props={},n)o[b.test(s)?s.replace(/[A-Z0-9]/,"-$&").toLowerCase():s]=n[s]}!function(t){var r=e.type,n=e.props;if(n&&"string"==typeof r){var i={};for(var o in n)/^on(Ani|Tra|Tou)/.test(o)&&(n[o.toLowerCase()]=n[o],delete n[o]),i[o.toLowerCase()]=o;if(i.ondoubleclick&&(n.ondblclick=n[i.ondoubleclick],delete n[i.ondoubleclick]),i.onbeforeinput&&(n.onbeforeinput=n[i.onbeforeinput],delete n[i.onbeforeinput]),i.onchange&&("textarea"===r||"input"===r.toLowerCase()&&!/^fil|che|ra/i.test(n.type))){var s=i.oninput||"oninput";n[s]||(n[s]=n[i.onchange],delete n[i.onchange])}}}(),"function"==typeof t&&!t.m&&t.prototype&&(x(t.prototype,"componentWillMount"),x(t.prototype,"componentWillReceiveProps"),x(t.prototype,"componentWillUpdate"),t.m=!0)}R&&R(e)};var B=function(e,t){return e(t)},P={useState:t.useState,useReducer:t.useReducer,useEffect:t.useEffect,useLayoutEffect:t.useLayoutEffect,useRef:t.useRef,useImperativeHandle:t.useImperativeHandle,useMemo:t.useMemo,useCallback:t.useCallback,useContext:t.useContext,useDebugValue:t.useDebugValue,version:"16.8.0",Children:l,render:M,hydrate:M,unmountComponentAtNode:O,createPortal:w,createElement:r.createElement,createContext:r.createContext,createFactory:T,cloneElement:A,createRef:r.createRef,Fragment:r.Fragment,isValidElement:C,findDOMNode:L,Component:r.Component,PureComponent:o,memo:s,forwardRef:u,unstable_batchedUpdates:B,Suspense:d,SuspenseList:_,lazy:m};Object.keys(t).forEach((function(r){e[r]=t[r]})),e.createElement=r.createElement,e.createContext=r.createContext,e.createRef=r.createRef,e.Fragment=r.Fragment,e.Component=r.Component,e.version="16.8.0",e.Children=l,e.render=M,e.hydrate=function(e,t,n){return r.hydrate(e,t),"function"==typeof n&&n(),e?e.__c:null},e.unmountComponentAtNode=O,e.createPortal=w,e.createFactory=T,e.cloneElement=A,e.isValidElement=C,e.findDOMNode=L,e.PureComponent=o,e.memo=s,e.forwardRef=u,e.unstable_batchedUpdates=B,e.Suspense=d,e.SuspenseList=_,e.lazy=m,e.default=P}(Wa)),Wa}var $a,Ya={},Za={exports:{}};var Ja,Qa={},Xa={},eu={};var tu,ru={};var nu,iu={};function ou(){if(nu)return iu;nu=1,Object.defineProperty(iu,"__esModule",{value:!0});var e=function(){function e(){this.listeners={}}return e.prototype.addEventListener=function(e,t){e=e.toLowerCase(),this.listeners[e]=this.listeners[e]||[],this.listeners[e].push(t.handleEvent||t)},e.prototype.removeEventListener=function(e,t){if(e=e.toLowerCase(),this.listeners[e]){var r=this.listeners[e].indexOf(t.handleEvent||t);r<0||this.listeners[e].splice(r,1)}},e.prototype.dispatchEvent=function(e){var t=e.type.toLowerCase();if(e.target=this,this.listeners[t])for(var r=0,n=this.listeners[t];r<n.length;r++){n[r].call(this,e)}var i=this["on"+t];return i&&i.call(this,e),!0},e}();return iu.XMLHttpRequestEventTarget=e,iu}var su,au={};var uu,cu,lu,hu,fu={};function du(){if(cu)return Xa;cu=1;var e,t=l&&l.__extends||(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}),r=l&&l.__assign||Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e};Object.defineProperty(Xa,"__esModule",{value:!0});var n=p,i=d,o=S,s=v,a=function(){if(Ja)return eu;Ja=1,Object.defineProperty(eu,"__esModule",{value:!0});var e=function(e){this.type=e,this.bubbles=!1,this.cancelable=!1,this.loaded=0,this.lengthComputable=!1,this.total=0};return eu.ProgressEvent=e,eu}(),u=function(){if(tu)return ru;tu=1;var e,t=l&&l.__extends||(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)});Object.defineProperty(ru,"__esModule",{value:!0});var r=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return t(r,e),r}(Error);ru.SecurityError=r;var n=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return t(r,e),r}(Error);ru.InvalidStateError=n;var i=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return t(r,e),r}(Error);ru.NetworkError=i;var o=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return t(r,e),r}(Error);return ru.SyntaxError=o,ru}(),c=ou(),h=function(){if(su)return au;su=1;var e,t=l&&l.__extends||(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)});Object.defineProperty(au,"__esModule",{value:!0});var r=function(e){function r(){var t=e.call(this)||this;return t._contentType=null,t._body=null,t._reset(),t}return t(r,e),r.prototype._reset=function(){this._contentType=null,this._body=null},r.prototype._setData=function(e){if(null!=e)if("string"==typeof e)0!==e.length&&(this._contentType="text/plain;charset=UTF-8"),this._body=new Buffer(e,"utf-8");else if(Buffer.isBuffer(e))this._body=e;else if(e instanceof ArrayBuffer){for(var t=new Buffer(e.byteLength),r=new Uint8Array(e),n=0;n<e.byteLength;n++)t[n]=r[n];this._body=t}else{if(!(e.buffer&&e.buffer instanceof ArrayBuffer))throw new Error("Unsupported send() data "+e);t=new Buffer(e.byteLength);var i=e.byteOffset;for(r=new Uint8Array(e.buffer),n=0;n<e.byteLength;n++)t[n]=r[n+i];this._body=t}},r.prototype._finalizeHeaders=function(e,t){this._contentType&&!t["content-type"]&&(e["Content-Type"]=this._contentType),this._body&&(e["Content-Length"]=this._body.length.toString())},r.prototype._startUpload=function(e){this._body&&e.write(this._body),e.end()},r}(ou().XMLHttpRequestEventTarget);return au.XMLHttpRequestUpload=r,au}(),f=(uu||(uu=1,function(){function e(t,r,n,i){return this instanceof e?(this.domain=t||void 0,this.path=r||"/",this.secure=!!n,this.script=!!i,this):new e(t,r,n,i)}function t(e,r,n){return e instanceof t?e:this instanceof t?(this.name=null,this.value=null,this.expiration_date=1/0,this.path=String(n||"/"),this.explicit_path=!1,this.domain=r||null,this.explicit_domain=!1,this.secure=!1,this.noscript=!1,e&&this.parse(e,r,n),this):new t(e,r,n)}e.All=Object.freeze(Object.create(null)),fu.CookieAccessInfo=e,fu.Cookie=t,t.prototype.toString=function(){var e=[this.name+"="+this.value];return this.expiration_date!==1/0&&e.push("expires="+new Date(this.expiration_date).toGMTString()),this.domain&&e.push("domain="+this.domain),this.path&&e.push("path="+this.path),this.secure&&e.push("secure"),this.noscript&&e.push("httponly"),e.join("; ")},t.prototype.toValueString=function(){return this.name+"="+this.value};var r=/[:](?=\s*[a-zA-Z0-9_\-]+\s*[=])/g;function n(){var e,r;return this instanceof n?(e=Object.create(null),this.setCookie=function(n,i,o){var s,a;if(s=(n=new t(n,i,o)).expiration_date<=Date.now(),void 0!==e[n.name]){for(r=e[n.name],a=0;a<r.length;a+=1)if(r[a].collidesWith(n))return s?(r.splice(a,1),0===r.length&&delete e[n.name],!1):(r[a]=n,n);return!s&&(r.push(n),n)}return!s&&(e[n.name]=[n],e[n.name])},this.getCookie=function(t,n){var i,o;if(r=e[t])for(o=0;o<r.length;o+=1)if((i=r[o]).expiration_date<=Date.now())0===r.length&&delete e[i.name];else if(i.matches(n))return i},this.getCookies=function(t){var r,n,i=[];for(r in e)(n=this.getCookie(r,t))&&i.push(n);return i.toString=function(){return i.join(":")},i.toValueString=function(){return i.map((function(e){return e.toValueString()})).join("; ")},i},this):new n}t.prototype.parse=function(e,r,n){if(this instanceof t){if(e.length>32768)return void console.warn("Cookie too long for parsing (>32768 characters)");var i,o=e.split(";").filter((function(e){return!!e})),s=o[0].match(/([^=]+)=([\s\S]*)/);if(!s)return void console.warn("Invalid cookie header encountered. Header: '"+e+"'");var a=s[1],u=s[2];if("string"!=typeof a||0===a.length||"string"!=typeof u)return void console.warn("Unable to extract values from cookie header. Cookie: '"+e+"'");for(this.name=a,this.value=u,i=1;i<o.length;i+=1)switch(a=(s=o[i].match(/([^=]+)(?:=([\s\S]*))?/))[1].trim().toLowerCase(),u=s[2],a){case"httponly":this.noscript=!0;break;case"expires":this.expiration_date=u?Number(Date.parse(u)):1/0;break;case"path":this.path=u?u.trim():"",this.explicit_path=!0;break;case"domain":this.domain=u?u.trim():"",this.explicit_domain=!!this.domain;break;case"secure":this.secure=!0}return this.explicit_path||(this.path=n||"/"),this.explicit_domain||(this.domain=r),this}return(new t).parse(e,r,n)},t.prototype.matches=function(t){return t===e.All||!(this.noscript&&t.script||this.secure&&!t.secure||!this.collidesWith(t))},t.prototype.collidesWith=function(e){if(this.path&&!e.path||this.domain&&!e.domain)return!1;if(this.path&&0!==e.path.indexOf(this.path))return!1;if(this.explicit_path&&0!==e.path.indexOf(this.path))return!1;var t=e.domain&&e.domain.replace(/^[\.]/,""),r=this.domain&&this.domain.replace(/^[\.]/,"");if(r===t)return!0;if(r){if(!this.explicit_domain)return!1;var n=t.indexOf(r);return-1!==n&&n===t.length-r.length}return!0},fu.CookieJar=n,n.prototype.setCookies=function(e,n,i){var o,s,a=[];for(e=(e=Array.isArray(e)?e:e.split(r)).map((function(e){return new t(e,n,i)})),o=0;o<e.length;o+=1)s=e[o],this.setCookie(s,n,i)&&a.push(s);return a}}()),fu),m=function(e){function c(t){void 0===t&&(t={});var r=e.call(this)||this;return r.UNSENT=c.UNSENT,r.OPENED=c.OPENED,r.HEADERS_RECEIVED=c.HEADERS_RECEIVED,r.LOADING=c.LOADING,r.DONE=c.DONE,r.onreadystatechange=null,r.readyState=c.UNSENT,r.response=null,r.responseText="",r.responseType="",r.status=0,r.statusText="",r.timeout=0,r.upload=new h.XMLHttpRequestUpload,r.responseUrl="",r.withCredentials=!1,r._method=null,r._url=null,r._sync=!1,r._headers={},r._loweredHeaders={},r._mimeOverride=null,r._request=null,r._response=null,r._responseParts=null,r._responseHeaders=null,r._aborting=null,r._error=null,r._loadedBytes=0,r._totalBytes=0,r._lengthComputable=!1,r._restrictedMethods={CONNECT:!0,TRACE:!0,TRACK:!0},r._restrictedHeaders={"accept-charset":!0,"accept-encoding":!0,"access-control-request-headers":!0,"access-control-request-method":!0,connection:!0,"content-length":!0,cookie:!0,cookie2:!0,date:!0,dnt:!0,expect:!0,host:!0,"keep-alive":!0,origin:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,via:!0},r._privateHeaders={"set-cookie":!0,"set-cookie2":!0},r._userAgent="Mozilla/5.0 ("+o.type()+" "+o.arch()+") node.js/"+process.versions.node+" v8/"+process.versions.v8,r._anonymous=t.anon||!1,r}return t(c,e),c.prototype.open=function(e,t,r,n,i){if(void 0===r&&(r=!0),e=e.toUpperCase(),this._restrictedMethods[e])throw new c.SecurityError("HTTP method "+e+" is not allowed in XHR");var o=this._parseUrl(t,n,i);this.readyState===c.HEADERS_RECEIVED||(this.readyState,c.LOADING),this._method=e,this._url=o,this._sync=!r,this._headers={},this._loweredHeaders={},this._mimeOverride=null,this._setReadyState(c.OPENED),this._request=null,this._response=null,this.status=0,this.statusText="",this._responseParts=[],this._responseHeaders=null,this._loadedBytes=0,this._totalBytes=0,this._lengthComputable=!1},c.prototype.setRequestHeader=function(e,t){if(this.readyState!==c.OPENED)throw new c.InvalidStateError("XHR readyState must be OPENED");var r=e.toLowerCase();this._restrictedHeaders[r]||/^sec-/.test(r)||/^proxy-/.test(r)?console.warn('Refused to set unsafe header "'+e+'"'):(t=t.toString(),null!=this._loweredHeaders[r]?(e=this._loweredHeaders[r],this._headers[e]=this._headers[e]+", "+t):(this._loweredHeaders[r]=e,this._headers[e]=t))},c.prototype.send=function(e){if(this.readyState!==c.OPENED)throw new c.InvalidStateError("XHR readyState must be OPENED");if(this._request)throw new c.InvalidStateError("send() already called");switch(this._url.protocol){case"file:":return this._sendFile(e);case"http:":case"https:":return this._sendHttp(e);default:throw new c.NetworkError("Unsupported protocol "+this._url.protocol)}},c.prototype.abort=function(){null!=this._request&&(this._request.abort(),this._setError(),this._dispatchProgress("abort"),this._dispatchProgress("loadend"))},c.prototype.getResponseHeader=function(e){if(null==this._responseHeaders||null==e)return null;var t=e.toLowerCase();return this._responseHeaders.hasOwnProperty(t)?this._responseHeaders[e.toLowerCase()]:null},c.prototype.getAllResponseHeaders=function(){var e=this;return null==this._responseHeaders?"":Object.keys(this._responseHeaders).map((function(t){return t+": "+e._responseHeaders[t]})).join("\r\n")},c.prototype.overrideMimeType=function(e){if(this.readyState===c.LOADING||this.readyState===c.DONE)throw new c.InvalidStateError("overrideMimeType() not allowed in LOADING or DONE");this._mimeOverride=e.toLowerCase()},c.prototype.nodejsSet=function(e){if(this.nodejsHttpAgent=e.httpAgent||this.nodejsHttpAgent,this.nodejsHttpsAgent=e.httpsAgent||this.nodejsHttpsAgent,e.hasOwnProperty("baseUrl")){if(null!=e.baseUrl)if(!s.parse(e.baseUrl,!1,!0).protocol)throw new c.SyntaxError("baseUrl must be an absolute URL");this.nodejsBaseUrl=e.baseUrl}},c.nodejsSet=function(e){c.prototype.nodejsSet(e)},c.prototype._setReadyState=function(e){this.readyState=e,this.dispatchEvent(new a.ProgressEvent("readystatechange"))},c.prototype._sendFile=function(e){throw new Error("Protocol file: not implemented")},c.prototype._sendHttp=function(e){if(this._sync)throw new Error("Synchronous XHR processing not implemented");!e||"GET"!==this._method&&"HEAD"!==this._method?e=e||"":(console.warn("Discarding entity body for "+this._method+" requests"),e=null),this.upload._setData(e),this._finalizeHeaders(),this._sendHxxpRequest()},c.prototype._sendHxxpRequest=function(){var e=this;if(this.withCredentials){var t=c.cookieJar.getCookies(f.CookieAccessInfo(this._url.hostname,this._url.pathname,"https:"===this._url.protocol)).toValueString();this._headers.cookie=this._headers.cookie2=t}var r="http:"===this._url.protocol?[n,this.nodejsHttpAgent]:[i,this.nodejsHttpsAgent],o=r[0],s=r[1],a=o.request.bind(o)({hostname:this._url.hostname,port:+this._url.port,path:this._url.path,auth:this._url.auth,method:this._method,headers:this._headers,agent:s});this._request=a,this.timeout&&a.setTimeout(this.timeout,(function(){return e._onHttpTimeout(a)})),a.on("response",(function(t){return e._onHttpResponse(a,t)})),a.on("error",(function(t){return e._onHttpRequestError(a,t)})),this.upload._startUpload(a),this._request===a&&this._dispatchProgress("loadstart")},c.prototype._finalizeHeaders=function(){this._headers=r({},this._headers,{Connection:"keep-alive",Host:this._url.host,"User-Agent":this._userAgent},this._anonymous?{Referer:"about:blank"}:{}),this.upload._finalizeHeaders(this._headers,this._loweredHeaders)},c.prototype._onHttpResponse=function(e,t){var r=this;if(this._request===e){if(this.withCredentials&&(t.headers["set-cookie"]||t.headers["set-cookie2"])&&c.cookieJar.setCookies(t.headers["set-cookie"]||t.headers["set-cookie2"]),[301,302,303,307,308].indexOf(t.statusCode)>=0)return this._url=this._parseUrl(t.headers.location),this._method="GET",this._loweredHeaders["content-type"]&&(delete this._headers[this._loweredHeaders["content-type"]],delete this._loweredHeaders["content-type"]),null!=this._headers["Content-Type"]&&delete this._headers["Content-Type"],delete this._headers["Content-Length"],this.upload._reset(),this._finalizeHeaders(),void this._sendHxxpRequest();this._response=t,this._response.on("data",(function(e){return r._onHttpResponseData(t,e)})),this._response.on("end",(function(){return r._onHttpResponseEnd(t)})),this._response.on("close",(function(){return r._onHttpResponseClose(t)})),this.responseUrl=this._url.href.split("#")[0],this.status=t.statusCode,this.statusText=n.STATUS_CODES[this.status],this._parseResponseHeaders(t);var i=this._responseHeaders["content-length"]||"";this._totalBytes=+i,this._lengthComputable=!!i,this._setReadyState(c.HEADERS_RECEIVED)}},c.prototype._onHttpResponseData=function(e,t){this._response===e&&(this._responseParts.push(new Buffer(t)),this._loadedBytes+=t.length,this.readyState!==c.LOADING&&this._setReadyState(c.LOADING),this._dispatchProgress("progress"))},c.prototype._onHttpResponseEnd=function(e){this._response===e&&(this._parseResponse(),this._request=null,this._response=null,this._setReadyState(c.DONE),this._dispatchProgress("load"),this._dispatchProgress("loadend"))},c.prototype._onHttpResponseClose=function(e){if(this._response===e){var t=this._request;this._setError(),t.abort(),this._setReadyState(c.DONE),this._dispatchProgress("error"),this._dispatchProgress("loadend")}},c.prototype._onHttpTimeout=function(e){this._request===e&&(this._setError(),e.abort(),this._setReadyState(c.DONE),this._dispatchProgress("timeout"),this._dispatchProgress("loadend"))},c.prototype._onHttpRequestError=function(e,t){this._request===e&&(this._setError(),e.abort(),this._setReadyState(c.DONE),this._dispatchProgress("error"),this._dispatchProgress("loadend"))},c.prototype._dispatchProgress=function(e){var t=new c.ProgressEvent(e);t.lengthComputable=this._lengthComputable,t.loaded=this._loadedBytes,t.total=this._totalBytes,this.dispatchEvent(t)},c.prototype._setError=function(){this._request=null,this._response=null,this._responseHeaders=null,this._responseParts=null},c.prototype._parseUrl=function(e,t,r){var n=null==this.nodejsBaseUrl?e:s.resolve(this.nodejsBaseUrl,e),i=s.parse(n,!1,!0);i.hash=null;var o=(i.auth||"").split(":"),a=o[0],u=o[1];return(a||u||t||r)&&(i.auth=(t||a||"")+":"+(r||u||"")),i},c.prototype._parseResponseHeaders=function(e){for(var t in this._responseHeaders={},e.headers){var r=t.toLowerCase();this._privateHeaders[r]||(this._responseHeaders[r]=e.headers[t])}null!=this._mimeOverride&&(this._responseHeaders["content-type"]=this._mimeOverride)},c.prototype._parseResponse=function(){var e=Buffer.concat(this._responseParts);switch(this._responseParts=null,this.responseType){case"json":this.responseText=null;try{this.response=JSON.parse(e.toString("utf-8"))}catch(e){this.response=null}return;case"buffer":return this.responseText=null,void(this.response=e);case"arraybuffer":this.responseText=null;for(var t=new ArrayBuffer(e.length),r=new Uint8Array(t),n=0;n<e.length;n++)r[n]=e[n];return void(this.response=t);default:try{this.responseText=e.toString(this._parseResponseEncoding())}catch(t){this.responseText=e.toString("binary")}this.response=this.responseText}},c.prototype._parseResponseEncoding=function(){return/;\s*charset=(.*)$/.exec(this._responseHeaders["content-type"]||"")[1]||"utf-8"},c.ProgressEvent=a.ProgressEvent,c.InvalidStateError=u.InvalidStateError,c.NetworkError=u.NetworkError,c.SecurityError=u.SecurityError,c.SyntaxError=u.SyntaxError,c.XMLHttpRequestUpload=h.XMLHttpRequestUpload,c.UNSENT=0,c.OPENED=1,c.HEADERS_RECEIVED=2,c.LOADING=3,c.DONE=4,c.cookieJar=f.CookieJar(),c}(c.XMLHttpRequestEventTarget);return Xa.XMLHttpRequest=m,m.prototype.nodejsHttpAgent=n.globalAgent,m.prototype.nodejsHttpsAgent=i.globalAgent,m.prototype.nodejsBaseUrl=null,Xa}var pu,mu={},_u={},gu={};var vu,yu,wu,bu,Eu,Mu={exports:{}},Su={exports:{}},xu={exports:{}};function ku(){return vu||(vu=1,xu.exports=x),xu.exports}function Ru(){if(wu)return yu;function e(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function t(t){for(var n=1;n<arguments.length;n++){var i=null!=arguments[n]?arguments[n]:{};n%2?e(Object(i),!0).forEach((function(e){r(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):e(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function r(e,t,r){return(t=i(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,i(n.key),n)}}function i(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}wu=1;var o=k.Buffer,s=R.inspect,a=s&&s.custom||"inspect";return yu=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}var r,i,u;return r=e,(i=[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?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,r=""+t.data;t=t.next;)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return o.alloc(0);for(var t,r,n,i=o.allocUnsafe(e>>>0),s=this.head,a=0;s;)t=s.data,r=i,n=a,o.prototype.copy.call(t,r,n),a+=s.data.length,s=s.next;return i}},{key:"consume",value:function(e,t){var r;return e<this.head.data.length?(r=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):r=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,r=1,n=t.data;for(e-=n.length;t=t.next;){var i=t.data,o=e>i.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0==(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=o.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,s=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,s),0==(e-=s)){s===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(s));break}++n}return this.length-=n,t}},{key:a,value:function(e,r){return s(this,t(t({},r),{},{depth:0,customInspect:!1}))}}])&&n(r.prototype,i),u&&n(r,u),Object.defineProperty(r,"prototype",{writable:!1}),e}()}function Tu(){if(Eu)return bu;function e(e,n){r(e,n),t(e)}function t(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function r(e,t){e.emit("error",t)}return Eu=1,bu={destroy:function(n,i){var o=this,s=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return s||a?(i?i(n):n&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(r,this,n)):process.nextTick(r,this,n)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(n||null,(function(r){!i&&r?o._writableState?o._writableState.errorEmitted?process.nextTick(t,o):(o._writableState.errorEmitted=!0,process.nextTick(e,o,r)):process.nextTick(e,o,r):i?(process.nextTick(t,o),i(r)):process.nextTick(t,o)})),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 r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}},bu}var Cu,Au,Ou,Lu,Bu,Pu,Iu,Nu={};function Du(){if(Cu)return Nu;Cu=1;const e={};function t(t,r,n){n||(n=Error);class i extends n{constructor(e,t,n){super(function(e,t,n){return"string"==typeof r?r:r(e,t,n)}(e,t,n))}}i.prototype.name=n.name,i.prototype.code=t,e[t]=i}function r(e,t){if(Array.isArray(e)){const r=e.length;return e=e.map((e=>String(e))),r>2?`one of ${t} ${e.slice(0,r-1).join(", ")}, or `+e[r-1]:2===r?`one of ${t} ${e[0]} or ${e[1]}`:`of ${t} ${e[0]}`}return`of ${t} ${String(e)}`}return t("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),t("ERR_INVALID_ARG_TYPE",(function(e,t,n){let i;var o,s;let a;if("string"==typeof t&&(o="not ",t.substr(!s||s<0?0:+s,o.length)===o)?(i="must not be",t=t.replace(/^not /,"")):i="must be",function(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}(e," argument"))a=`The ${e} ${i} ${r(t,"type")}`;else{const n=function(e,t,r){return"number"!=typeof r&&(r=0),!(r+t.length>e.length)&&-1!==e.indexOf(t,r)}(e,".")?"property":"argument";a=`The "${e}" ${n} ${i} ${r(t,"type")}`}return a+=". Received type "+typeof n,a}),TypeError),t("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),t("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),t("ERR_STREAM_PREMATURE_CLOSE","Premature close"),t("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),t("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),t("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),t("ERR_STREAM_WRITE_AFTER_END","write after end"),t("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),t("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),t("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),Nu.codes=e,Nu}function Uu(){if(Ou)return Au;Ou=1;var e=Du().codes.ERR_INVALID_OPT_VALUE;return Au={getHighWaterMark:function(t,r,n,i){var o=function(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(r,i,n);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new e(i?n:"highWaterMark",o);return Math.floor(o)}return t.objectMode?16:16384}}}function ju(){if(Bu)return Lu;function e(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,r){var n=e.entry;e.entry=null;for(;n;){var i=n.callback;t.pendingcb--,i(r),n=n.next}t.corkedRequestsFree.next=e}(t,e)}}var t;Bu=1,Lu=M,M.WritableState=E;var r={deprecate:i()},n=ku(),o=k.Buffer,s=(void 0!==l?l:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var a,u=Tu(),c=Uu().getHighWaterMark,h=Du().codes,f=h.ERR_INVALID_ARG_TYPE,d=h.ERR_METHOD_NOT_IMPLEMENTED,p=h.ERR_MULTIPLE_CALLBACK,m=h.ERR_STREAM_CANNOT_PIPE,_=h.ERR_STREAM_DESTROYED,g=h.ERR_STREAM_NULL_VALUES,v=h.ERR_STREAM_WRITE_AFTER_END,y=h.ERR_UNKNOWN_ENCODING,w=u.errorOrDestroy;function b(){}function E(r,n,i){t=t||Hu(),r=r||{},"boolean"!=typeof i&&(i=n instanceof t),this.objectMode=!!r.objectMode,i&&(this.objectMode=this.objectMode||!!r.writableObjectMode),this.highWaterMark=c(this,r,"writableHighWaterMark",i),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var o=!1===r.decodeStrings;this.decodeStrings=!o,this.defaultEncoding=r.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 r=e._writableState,n=r.sync,i=r.writecb;if("function"!=typeof i)throw new p;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function(e,t,r,n,i){--t.pendingcb,r?(process.nextTick(i,n),process.nextTick(O,e,t),e._writableState.errorEmitted=!0,w(e,n)):(i(n),e._writableState.errorEmitted=!0,w(e,n),O(e,t))}(e,r,n,t,i);else{var o=T(r)||e.destroyed;o||r.corked||r.bufferProcessing||!r.bufferedRequest||R(e,r),n?process.nextTick(x,e,r,o,i):x(e,r,o,i)}}(n,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!==r.emitClose,this.autoDestroy=!!r.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}function M(e){var r=this instanceof(t=t||Hu());if(!r&&!a.call(M,this))return new M(e);this._writableState=new E(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)),n.call(this)}function S(e,t,r,n,i,o,s){t.writelen=n,t.writecb=s,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new _("write")):r?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function x(e,t,r,n){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),O(e,t)}function R(t,r){r.bufferProcessing=!0;var n=r.bufferedRequest;if(t._writev&&n&&n.next){var i=r.bufferedRequestCount,o=new Array(i),s=r.corkedRequestsFree;s.entry=n;for(var a=0,u=!0;n;)o[a]=n,n.isBuf||(u=!1),n=n.next,a+=1;o.allBuffers=u,S(t,r,!0,r.length,o,"",s.finish),r.pendingcb++,r.lastBufferedRequest=null,s.next?(r.corkedRequestsFree=s.next,s.next=null):r.corkedRequestsFree=new e(r),r.bufferedRequestCount=0}else{for(;n;){var c=n.chunk,l=n.encoding,h=n.callback;if(S(t,r,!1,r.objectMode?1:c.length,c,l,h),n=n.next,r.bufferedRequestCount--,r.writing)break}null===n&&(r.lastBufferedRequest=null)}r.bufferedRequest=n,r.bufferProcessing=!1}function T(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function A(e,t){e._final((function(r){t.pendingcb--,r&&w(e,r),t.prefinished=!0,e.emit("prefinish"),O(e,t)}))}function O(e,t){var r=T(t);if(r&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,process.nextTick(A,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var n=e._readableState;(!n||n.autoDestroy&&n.endEmitted)&&e.destroy()}return r}return C.exports(M,n),E.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(E.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]?(a=Function.prototype[Symbol.hasInstance],Object.defineProperty(M,Symbol.hasInstance,{value:function(e){return!!a.call(this,e)||this===M&&(e&&e._writableState instanceof E)}})):a=function(e){return e instanceof this},M.prototype.pipe=function(){w(this,new m)},M.prototype.write=function(e,t,r){var n,i=this._writableState,a=!1,u=!i.objectMode&&(n=e,o.isBuffer(n)||n instanceof s);return u&&!o.isBuffer(e)&&(e=function(e){return o.from(e)}(e)),"function"==typeof t&&(r=t,t=null),u?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof r&&(r=b),i.ending?function(e,t){var r=new v;w(e,r),process.nextTick(t,r)}(this,r):(u||function(e,t,r,n){var i;return null===r?i=new g:"string"==typeof r||t.objectMode||(i=new f("chunk",["string","Buffer"],r)),!i||(w(e,i),process.nextTick(n,i),!1)}(this,i,e,r))&&(i.pendingcb++,a=function(e,t,r,n,i,s){if(!r){var a=function(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=o.from(t,r));return t}(t,n,i);n!==a&&(r=!0,i="buffer",n=a)}var u=t.objectMode?1:n.length;t.length+=u;var c=t.length<t.highWaterMark;c||(t.needDrain=!0);if(t.writing||t.corked){var l=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:s,next:null},l?l.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else S(e,t,!1,u,n,i,s);return c}(this,i,u,e,t,r)),a},M.prototype.cork=function(){this._writableState.corked++},M.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||R(this,e))},M.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new y(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(M.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(M.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),M.prototype._write=function(e,t,r){r(new d("_write()"))},M.prototype._writev=null,M.prototype.end=function(e,t,r){var n=this._writableState;return"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||function(e,t,r){t.ending=!0,O(e,t),r&&(t.finished?process.nextTick(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,n,r),this},Object.defineProperty(M.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(M.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),M.prototype.destroy=u.destroy,M.prototype._undestroy=u.undestroy,M.prototype._destroy=function(e,t){t(e)},Lu}function Hu(){if(Iu)return Pu;Iu=1;var e=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};Pu=s;var t=_c(),r=ju();C.exports(s,t);for(var n=e(r.prototype),i=0;i<n.length;i++){var o=n[i];s.prototype[o]||(s.prototype[o]=r.prototype[o])}function s(e){if(!(this instanceof s))return new s(e);t.call(this,e),r.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",a)))}function a(){this._writableState.ended||process.nextTick(u,this)}function u(e){e.end()}return Object.defineProperty(s.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(s.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(s.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(s.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}),Pu}var qu,Fu,Wu,Ku,zu,Gu,Vu,$u,Yu,Zu,Ju,Qu,Xu,ec,tc,rc,nc,ic,oc,sc,ac,uc,cc,lc,hc={};function fc(){if(qu)return hc;qu=1;var e=o.exports.Buffer,t=e.isEncoding||function(e){switch((e=""+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 r(r){var n;switch(this.encoding=function(r){var n=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(r);if("string"!=typeof n&&(e.isEncoding===t||!t(r)))throw new Error("Unknown encoding: "+r);return n||r}(r),this.encoding){case"utf16le":this.text=s,this.end=a,n=4;break;case"utf8":this.fillLast=i,n=4;break;case"base64":this.text=u,this.end=c,n=3;break;default:return this.write=l,void(this.end=h)}this.lastNeed=0,this.lastTotal=0,this.lastChar=e.allocUnsafe(n)}function n(e){return e<=127?0:e>>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,r=function(e,t,r){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!==r?r: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 s(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}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 r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function u(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?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-r))}function c(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function l(e){return e.toString(this.encoding)}function h(e){return e&&e.length?this.write(e):""}return hc.StringDecoder=r,r.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""},r.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},r.prototype.text=function(e,t){var r=function(e,t,r){var i=t.length-1;if(i<r)return 0;var o=n(t[i]);if(o>=0)return o>0&&(e.lastNeed=o-1),o;if(--i<r||-2===o)return 0;if(o=n(t[i]),o>=0)return o>0&&(e.lastNeed=o-2),o;if(--i<r||-2===o)return 0;if(o=n(t[i]),o>=0)return o>0&&(2===o?o=0:e.lastNeed=o-3),o;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var i=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,i),e.toString("utf8",t,i)},r.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},hc}function dc(){if(Wu)return Fu;Wu=1;var e=Du().codes.ERR_STREAM_PREMATURE_CLOSE;function t(){}return Fu=function r(n,i,o){if("function"==typeof i)return r(n,null,i);i||(i={}),o=function(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];e.apply(this,n)}}}(o||t);var s=i.readable||!1!==i.readable&&n.readable,a=i.writable||!1!==i.writable&&n.writable,u=function(){n.writable||l()},c=n._writableState&&n._writableState.finished,l=function(){a=!1,c=!0,s||o.call(n)},h=n._readableState&&n._readableState.endEmitted,f=function(){s=!1,h=!0,a||o.call(n)},d=function(e){o.call(n,e)},p=function(){var t;return s&&!h?(n._readableState&&n._readableState.ended||(t=new e),o.call(n,t)):a&&!c?(n._writableState&&n._writableState.ended||(t=new e),o.call(n,t)):void 0},m=function(){n.req.on("finish",l)};return!function(e){return e.setHeader&&"function"==typeof e.abort}(n)?a&&!n._writableState&&(n.on("end",u),n.on("close",u)):(n.on("complete",l),n.on("abort",p),n.req?m():n.on("request",m)),n.on("end",f),n.on("finish",l),!1!==i.error&&n.on("error",d),n.on("close",p),function(){n.removeListener("complete",l),n.removeListener("abort",p),n.removeListener("request",m),n.req&&n.req.removeListener("finish",l),n.removeListener("end",u),n.removeListener("close",u),n.removeListener("finish",l),n.removeListener("end",f),n.removeListener("error",d),n.removeListener("close",p)}},Fu}function pc(){if(zu)return Ku;var e;function t(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}zu=1;var r=dc(),n=Symbol("lastResolve"),i=Symbol("lastReject"),o=Symbol("error"),s=Symbol("ended"),a=Symbol("lastPromise"),u=Symbol("handlePromise"),c=Symbol("stream");function l(e,t){return{value:e,done:t}}function h(e){var t=e[n];if(null!==t){var r=e[c].read();null!==r&&(e[a]=null,e[n]=null,e[i]=null,t(l(r,!1)))}}function f(e){process.nextTick(h,e)}var d=Object.getPrototypeOf((function(){})),p=Object.setPrototypeOf((e={get stream(){return this[c]},next:function(){var e=this,t=this[o];if(null!==t)return Promise.reject(t);if(this[s])return Promise.resolve(l(void 0,!0));if(this[c].destroyed)return new Promise((function(t,r){process.nextTick((function(){e[o]?r(e[o]):t(l(void 0,!0))}))}));var r,n=this[a];if(n)r=new Promise(function(e,t){return function(r,n){e.then((function(){t[s]?r(l(void 0,!0)):t[u](r,n)}),n)}}(n,this));else{var i=this[c].read();if(null!==i)return Promise.resolve(l(i,!1));r=new Promise(this[u])}return this[a]=r,r}},t(e,Symbol.asyncIterator,(function(){return this})),t(e,"return",(function(){var e=this;return new Promise((function(t,r){e[c].destroy(null,(function(e){e?r(e):t(l(void 0,!0))}))}))})),e),d);return Ku=function(e){var h,d=Object.create(p,(t(h={},c,{value:e,writable:!0}),t(h,n,{value:null,writable:!0}),t(h,i,{value:null,writable:!0}),t(h,o,{value:null,writable:!0}),t(h,s,{value:e._readableState.endEmitted,writable:!0}),t(h,u,{value:function(e,t){var r=d[c].read();r?(d[a]=null,d[n]=null,d[i]=null,e(l(r,!1))):(d[n]=e,d[i]=t)},writable:!0}),h));return d[a]=null,r(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=d[i];return null!==t&&(d[a]=null,d[n]=null,d[i]=null,t(e)),void(d[o]=e)}var r=d[n];null!==r&&(d[a]=null,d[n]=null,d[i]=null,r(l(void 0,!0))),d[s]=!0})),e.on("readable",f.bind(null,d)),d},Ku}function mc(){if(Vu)return Gu;function e(e,t,r,n,i,o,s){try{var a=e[o](s),u=a.value}catch(e){return void r(e)}a.done?t(u):Promise.resolve(u).then(n,i)}function t(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function r(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Vu=1;var n=Du().codes.ERR_INVALID_ARG_TYPE;return Gu=function(i,o,s){var a;if(o&&"function"==typeof o.next)a=o;else if(o&&o[Symbol.asyncIterator])a=o[Symbol.asyncIterator]();else{if(!o||!o[Symbol.iterator])throw new n("iterable",["Iterable"],o);a=o[Symbol.iterator]()}var u=new i(function(e){for(var n=1;n<arguments.length;n++){var i=null!=arguments[n]?arguments[n]:{};n%2?t(Object(i),!0).forEach((function(t){r(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):t(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}({objectMode:!0},s)),c=!1;function l(){return h.apply(this,arguments)}function h(){var t;return t=function*(){try{var e=yield a.next(),t=e.value;e.done?u.push(null):u.push(yield t)?l():c=!1}catch(e){u.destroy(e)}},h=function(){var r=this,n=arguments;return new Promise((function(i,o){var s=t.apply(r,n);function a(t){e(s,i,o,a,u,"next",t)}function u(t){e(s,i,o,a,u,"throw",t)}a(void 0)}))},h.apply(this,arguments)}return u._read=function(){c||(c=!0,l())},u},Gu}function _c(){if(Yu)return $u;var e;Yu=1,$u=M,M.ReadableState=E,f.EventEmitter;var t=function(e,t){return e.listeners(t).length},r=ku(),n=k.Buffer,i=(void 0!==l?l:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var o,s=R;o=s&&s.debuglog?s.debuglog("stream"):function(){};var a,u,c,h=Ru(),d=Tu(),p=Uu().getHighWaterMark,m=Du().codes,_=m.ERR_INVALID_ARG_TYPE,g=m.ERR_STREAM_PUSH_AFTER_EOF,v=m.ERR_METHOD_NOT_IMPLEMENTED,y=m.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;C.exports(M,r);var w=d.errorOrDestroy,b=["error","close","destroy","pause","resume"];function E(t,r,n){e=e||Hu(),t=t||{},"boolean"!=typeof n&&(n=r instanceof e),this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=p(this,t,"readableHighWaterMark",n),this.buffer=new h,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(a||(a=fc().StringDecoder),this.decoder=new a(t.encoding),this.encoding=t.encoding)}function M(t){if(e=e||Hu(),!(this instanceof M))return new M(t);var n=this instanceof e;this._readableState=new E(t,this,n),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),r.call(this)}function S(e,t,r,s,a){o("readableAddChunk",t);var u,c=e._readableState;if(null===t)c.reading=!1,function(e,t){if(o("onEofChunk"),t.ended)return;if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?O(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,L(e)))}(e,c);else if(a||(u=function(e,t){var r;o=t,n.isBuffer(o)||o instanceof i||"string"==typeof t||void 0===t||e.objectMode||(r=new _("chunk",["string","Buffer","Uint8Array"],t));var o;return r}(c,t)),u)w(e,u);else if(c.objectMode||t&&t.length>0)if("string"==typeof t||c.objectMode||Object.getPrototypeOf(t)===n.prototype||(t=function(e){return n.from(e)}(t)),s)c.endEmitted?w(e,new y):x(e,c,t,!0);else if(c.ended)w(e,new g);else{if(c.destroyed)return!1;c.reading=!1,c.decoder&&!r?(t=c.decoder.write(t),c.objectMode||0!==t.length?x(e,c,t,!1):B(e,c)):x(e,c,t,!1)}else s||(c.reading=!1,B(e,c));return!c.ended&&(c.length<c.highWaterMark||0===c.length)}function x(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&O(e)),B(e,t)}Object.defineProperty(M.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),M.prototype.destroy=d.destroy,M.prototype._undestroy=d.undestroy,M.prototype._destroy=function(e,t){t(e)},M.prototype.push=function(e,t){var r,i=this._readableState;return i.objectMode?r=!0:"string"==typeof e&&((t=t||i.defaultEncoding)!==i.encoding&&(e=n.from(e,t),t=""),r=!0),S(this,e,t,!1,r)},M.prototype.unshift=function(e){return S(this,e,null,!0,!1)},M.prototype.isPaused=function(){return!1===this._readableState.flowing},M.prototype.setEncoding=function(e){a||(a=fc().StringDecoder);var t=new a(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,n="";null!==r;)n+=t.write(r.data),r=r.next;return this._readableState.buffer.clear(),""!==n&&this._readableState.buffer.push(n),this._readableState.length=n.length,this};var T=1073741824;function A(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=T?e=T:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function O(e){var t=e._readableState;o("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(o("emitReadable",t.flowing),t.emittedReadable=!0,process.nextTick(L,e))}function L(e){var t=e._readableState;o("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,U(e)}function B(e,t){t.readingMore||(t.readingMore=!0,process.nextTick(P,e,t))}function P(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var r=t.length;if(o("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}function I(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function N(e){o("readable nexttick read 0"),e.read(0)}function D(e,t){o("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),U(e),t.flowing&&!t.reading&&e.read(0)}function U(e){var t=e._readableState;for(o("flow",t.flowing);t.flowing&&null!==e.read(););}function j(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function H(e){var t=e._readableState;o("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,process.nextTick(q,t,e))}function q(e,t){if(o("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function F(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}return M.prototype.read=function(e){o("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return o("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?H(this):O(this),null;if(0===(e=A(e,t))&&t.ended)return 0===t.length&&H(this),null;var n,i=t.needReadable;return o("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&o("length less than watermark",i=!0),t.ended||t.reading?o("reading or ended",i=!1):i&&(o("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=A(r,t))),null===(n=e>0?j(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),r!==e&&t.ended&&H(this)),null!==n&&this.emit("data",n),n},M.prototype._read=function(e){w(this,new v("_read()"))},M.prototype.pipe=function(e,r){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e)}i.pipesCount+=1,o("pipe count=%d opts=%j",i.pipesCount,r);var s=(!r||!1!==r.end)&&e!==process.stdout&&e!==process.stderr?u:m;function a(t,r){o("onunpipe"),t===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,o("cleanup"),e.removeListener("close",d),e.removeListener("finish",p),e.removeListener("drain",c),e.removeListener("error",f),e.removeListener("unpipe",a),n.removeListener("end",u),n.removeListener("end",m),n.removeListener("data",h),l=!0,!i.awaitDrain||e._writableState&&!e._writableState.needDrain||c())}function u(){o("onend"),e.end()}i.endEmitted?process.nextTick(s):n.once("end",s),e.on("unpipe",a);var c=function(e){return function(){var r=e._readableState;o("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,0===r.awaitDrain&&t(e,"data")&&(r.flowing=!0,U(e))}}(n);e.on("drain",c);var l=!1;function h(t){o("ondata");var r=e.write(t);o("dest.write",r),!1===r&&((1===i.pipesCount&&i.pipes===e||i.pipesCount>1&&-1!==F(i.pipes,e))&&!l&&(o("false write response, pause",i.awaitDrain),i.awaitDrain++),n.pause())}function f(r){o("onerror",r),m(),e.removeListener("error",f),0===t(e,"error")&&w(e,r)}function d(){e.removeListener("finish",p),m()}function p(){o("onfinish"),e.removeListener("close",d),m()}function m(){o("unpipe"),n.unpipe(e)}return n.on("data",h),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",f),e.once("close",d),e.once("finish",p),e.emit("pipe",n),i.flowing||(o("pipe resume"),n.resume()),e},M.prototype.unpipe=function(e){var t=this._readableState,r={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,r)),this;if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<i;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}var s=F(t.pipes,e);return-1===s||(t.pipes.splice(s,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r)),this},M.prototype.on=function(e,t){var n=r.prototype.on.call(this,e,t),i=this._readableState;return"data"===e?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"===e&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,o("on readable",i.length,i.reading),i.length?O(this):i.reading||process.nextTick(N,this))),n},M.prototype.addListener=M.prototype.on,M.prototype.removeListener=function(e,t){var n=r.prototype.removeListener.call(this,e,t);return"readable"===e&&process.nextTick(I,this),n},M.prototype.removeAllListeners=function(e){var t=r.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||process.nextTick(I,this),t},M.prototype.resume=function(){var e=this._readableState;return e.flowing||(o("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,process.nextTick(D,e,t))}(this,e)),e.paused=!1,this},M.prototype.pause=function(){return o("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(o("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},M.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var i in e.on("end",(function(){if(o("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(i){(o("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i)||(r.objectMode||i&&i.length)&&(t.push(i)||(n=!0,e.pause()))})),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var s=0;s<b.length;s++)e.on(b[s],this.emit.bind(this,b[s]));return this._read=function(t){o("wrapped _read",t),n&&(n=!1,e.resume())},this},"function"==typeof Symbol&&(M.prototype[Symbol.asyncIterator]=function(){return void 0===u&&(u=pc()),u(this)}),Object.defineProperty(M.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(M.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(M.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),M._fromList=j,Object.defineProperty(M.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(M.from=function(e,t){return void 0===c&&(c=mc()),c(M,e,t)}),$u}function gc(){if(Ju)return Zu;Ju=1,Zu=a;var e=Du().codes,t=e.ERR_METHOD_NOT_IMPLEMENTED,r=e.ERR_MULTIPLE_CALLBACK,n=e.ERR_TRANSFORM_ALREADY_TRANSFORMING,i=e.ERR_TRANSFORM_WITH_LENGTH_0,o=Hu();function s(e,t){var n=this._transformState;n.transforming=!1;var i=n.writecb;if(null===i)return this.emit("error",new r);n.writechunk=null,n.writecb=null,null!=t&&this.push(t),i(e);var o=this._readableState;o.reading=!1,(o.needReadable||o.length<o.highWaterMark)&&this._read(o.highWaterMark)}function a(e){if(!(this instanceof a))return new a(e);o.call(this,e),this._transformState={afterTransform:s.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",u)}function u(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?c(this,null,null):this._flush((function(t,r){c(e,t,r)}))}function c(e,t,r){if(t)return e.emit("error",t);if(null!=r&&e.push(r),e._writableState.length)throw new i;if(e._transformState.transforming)throw new n;return e.push(null)}return C.exports(a,o),a.prototype.push=function(e,t){return this._transformState.needTransform=!1,o.prototype.push.call(this,e,t)},a.prototype._transform=function(e,r,n){n(new t("_transform()"))},a.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},a.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},a.prototype._destroy=function(e,t){o.prototype._destroy.call(this,e,(function(e){t(e)}))},Zu}function vc(){if(tc)return ec;var e;tc=1;var t=Du().codes,r=t.ERR_MISSING_ARGS,n=t.ERR_STREAM_DESTROYED;function i(e){if(e)throw e}function o(e){e()}function s(e,t){return e.pipe(t)}return ec=function(){for(var t=arguments.length,a=new Array(t),u=0;u<t;u++)a[u]=arguments[u];var c,l=function(e){return e.length?"function"!=typeof e[e.length-1]?i:e.pop():i}(a);if(Array.isArray(a[0])&&(a=a[0]),a.length<2)throw new r("streams");var h=a.map((function(t,r){var i=r<a.length-1;return function(t,r,i,o){o=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(o);var s=!1;t.on("close",(function(){s=!0})),void 0===e&&(e=dc()),e(t,{readable:r,writable:i},(function(e){if(e)return o(e);s=!0,o()}));var a=!1;return function(e){if(!s&&!a)return a=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(t)?t.abort():"function"==typeof t.destroy?t.destroy():void o(e||new n("pipe"))}}(t,i,r>0,(function(e){c||(c=e),e&&h.forEach(o),i||(h.forEach(o),l(c))}))}));return a.reduce(s)},ec}function yc(){return rc||(rc=1,e=Su,t=Su.exports,r=x,"disable"===process.env.READABLE_STREAM&&r?(e.exports=r.Readable,Object.assign(e.exports,r),e.exports.Stream=r):((t=e.exports=_c()).Stream=r||t,t.Readable=t,t.Writable=ju(),t.Duplex=Hu(),t.Transform=gc(),t.PassThrough=function(){if(Xu)return Qu;Xu=1,Qu=t;var e=gc();function t(r){if(!(this instanceof t))return new t(r);e.call(this,r)}return C.exports(t,e),t.prototype._transform=function(e,t,r){r(null,e)},Qu}(),t.finished=dc(),t.pipeline=vc())),Su.exports;var e,t,r}function wc(){if(uc)return ac;uc=1;const e=function(){if(ic)return nc;ic=1;const{Transform:e}=yc();return nc=t=>class r extends e{constructor(e,r,n,i,o){super(o),this._rate=e,this._capacity=r,this._delimitedSuffix=n,this._hashBitLength=i,this._options=o,this._state=new t,this._state.initialize(e,r),this._finalized=!1}_transform(e,t,r){let n=null;try{this.update(e,t)}catch(e){n=e}r(n)}_flush(e){let t=null;try{this.push(this.digest())}catch(e){t=e}e(t)}update(e,t){if(!Buffer.isBuffer(e)&&"string"!=typeof e)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return Buffer.isBuffer(e)||(e=Buffer.from(e,t)),this._state.absorb(e),this}digest(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);let t=this._state.squeeze(this._hashBitLength/8);return void 0!==e&&(t=t.toString(e)),this._resetState(),t}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const e=new r(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(e._state),e._finalized=this._finalized,e}},nc}(),t=function(){if(sc)return oc;sc=1;const{Transform:e}=yc();return oc=t=>class r extends e{constructor(e,r,n,i){super(i),this._rate=e,this._capacity=r,this._delimitedSuffix=n,this._options=i,this._state=new t,this._state.initialize(e,r),this._finalized=!1}_transform(e,t,r){let n=null;try{this.update(e,t)}catch(e){n=e}r(n)}_flush(){}_read(e){this.push(this.squeeze(e))}update(e,t){if(!Buffer.isBuffer(e)&&"string"!=typeof e)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Squeeze already called");return Buffer.isBuffer(e)||(e=Buffer.from(e,t)),this._state.absorb(e),this}squeeze(e,t){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));let r=this._state.squeeze(e);return void 0!==t&&(r=r.toString(t)),r}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const e=new r(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(e._state),e._finalized=this._finalized,e}},oc}();return ac=function(r){const n=e(r),i=t(r);return function(e,t){switch("string"==typeof e?e.toLowerCase():e){case"keccak224":return new n(1152,448,null,224,t);case"keccak256":return new n(1088,512,null,256,t);case"keccak384":return new n(832,768,null,384,t);case"keccak512":return new n(576,1024,null,512,t);case"sha3-224":return new n(1152,448,6,224,t);case"sha3-256":return new n(1088,512,6,256,t);case"sha3-384":return new n(832,768,6,384,t);case"sha3-512":return new n(576,1024,6,512,t);case"shake128":return new i(1344,256,31,t);case"shake256":return new i(1088,512,31,t);default:throw new Error("Invald algorithm: "+e)}}}}var bc,Ec,Mc,Sc,xc,kc,Rc,Tc={};function Cc(){if(Mc)return Ec;Mc=1;const e=function(){if(bc)return Tc;bc=1;const e=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648];return Tc.p1600=function(t){for(let r=0;r<24;++r){const n=t[0]^t[10]^t[20]^t[30]^t[40],i=t[1]^t[11]^t[21]^t[31]^t[41],o=t[2]^t[12]^t[22]^t[32]^t[42],s=t[3]^t[13]^t[23]^t[33]^t[43],a=t[4]^t[14]^t[24]^t[34]^t[44],u=t[5]^t[15]^t[25]^t[35]^t[45],c=t[6]^t[16]^t[26]^t[36]^t[46],l=t[7]^t[17]^t[27]^t[37]^t[47],h=t[8]^t[18]^t[28]^t[38]^t[48],f=t[9]^t[19]^t[29]^t[39]^t[49];let d=h^(o<<1|s>>>31),p=f^(s<<1|o>>>31);const m=t[0]^d,_=t[1]^p,g=t[10]^d,v=t[11]^p,y=t[20]^d,w=t[21]^p,b=t[30]^d,E=t[31]^p,M=t[40]^d,S=t[41]^p;d=n^(a<<1|u>>>31),p=i^(u<<1|a>>>31);const x=t[2]^d,k=t[3]^p,R=t[12]^d,T=t[13]^p,C=t[22]^d,A=t[23]^p,O=t[32]^d,L=t[33]^p,B=t[42]^d,P=t[43]^p;d=o^(c<<1|l>>>31),p=s^(l<<1|c>>>31);const I=t[4]^d,N=t[5]^p,D=t[14]^d,U=t[15]^p,j=t[24]^d,H=t[25]^p,q=t[34]^d,F=t[35]^p,W=t[44]^d,K=t[45]^p;d=a^(h<<1|f>>>31),p=u^(f<<1|h>>>31);const z=t[6]^d,G=t[7]^p,V=t[16]^d,$=t[17]^p,Y=t[26]^d,Z=t[27]^p,J=t[36]^d,Q=t[37]^p,X=t[46]^d,ee=t[47]^p;d=c^(n<<1|i>>>31),p=l^(i<<1|n>>>31);const te=t[8]^d,re=t[9]^p,ne=t[18]^d,ie=t[19]^p,oe=t[28]^d,se=t[29]^p,ae=t[38]^d,ue=t[39]^p,ce=t[48]^d,le=t[49]^p,he=m,fe=_,de=v<<4|g>>>28,pe=g<<4|v>>>28,me=y<<3|w>>>29,_e=w<<3|y>>>29,ge=E<<9|b>>>23,ve=b<<9|E>>>23,ye=M<<18|S>>>14,we=S<<18|M>>>14,be=x<<1|k>>>31,Ee=k<<1|x>>>31,Me=T<<12|R>>>20,Se=R<<12|T>>>20,xe=C<<10|A>>>22,ke=A<<10|C>>>22,Re=L<<13|O>>>19,Te=O<<13|L>>>19,Ce=B<<2|P>>>30,Ae=P<<2|B>>>30,Oe=N<<30|I>>>2,Le=I<<30|N>>>2,Be=D<<6|U>>>26,Pe=U<<6|D>>>26,Ie=H<<11|j>>>21,Ne=j<<11|H>>>21,De=q<<15|F>>>17,Ue=F<<15|q>>>17,je=K<<29|W>>>3,He=W<<29|K>>>3,qe=z<<28|G>>>4,Fe=G<<28|z>>>4,We=$<<23|V>>>9,Ke=V<<23|$>>>9,ze=Y<<25|Z>>>7,Ge=Z<<25|Y>>>7,Ve=J<<21|Q>>>11,$e=Q<<21|J>>>11,Ye=ee<<24|X>>>8,Ze=X<<24|ee>>>8,Je=te<<27|re>>>5,Qe=re<<27|te>>>5,Xe=ne<<20|ie>>>12,et=ie<<20|ne>>>12,tt=se<<7|oe>>>25,rt=oe<<7|se>>>25,nt=ae<<8|ue>>>24,it=ue<<8|ae>>>24,ot=ce<<14|le>>>18,st=le<<14|ce>>>18;t[0]=he^~Me&Ie,t[1]=fe^~Se&Ne,t[10]=qe^~Xe&me,t[11]=Fe^~et&_e,t[20]=be^~Be&ze,t[21]=Ee^~Pe&Ge,t[30]=Je^~de&xe,t[31]=Qe^~pe&ke,t[40]=Oe^~We&tt,t[41]=Le^~Ke&rt,t[2]=Me^~Ie&Ve,t[3]=Se^~Ne&$e,t[12]=Xe^~me&Re,t[13]=et^~_e&Te,t[22]=Be^~ze&nt,t[23]=Pe^~Ge&it,t[32]=de^~xe&De,t[33]=pe^~ke&Ue,t[42]=We^~tt&ge,t[43]=Ke^~rt&ve,t[4]=Ie^~Ve&ot,t[5]=Ne^~$e&st,t[14]=me^~Re&je,t[15]=_e^~Te&He,t[24]=ze^~nt&ye,t[25]=Ge^~it&we,t[34]=xe^~De&Ye,t[35]=ke^~Ue&Ze,t[44]=tt^~ge&Ce,t[45]=rt^~ve&Ae,t[6]=Ve^~ot&he,t[7]=$e^~st&fe,t[16]=Re^~je&qe,t[17]=Te^~He&Fe,t[26]=nt^~ye&be,t[27]=it^~we&Ee,t[36]=De^~Ye&Je,t[37]=Ue^~Ze&Qe,t[46]=ge^~Ce&Oe,t[47]=ve^~Ae&Le,t[8]=ot^~he&Me,t[9]=st^~fe&Se,t[18]=je^~qe&Xe,t[19]=He^~Fe&et,t[28]=ye^~be&Be,t[29]=we^~Ee&Pe,t[38]=Ye^~Je&de,t[39]=Ze^~Qe&pe,t[48]=Ce^~Oe&We,t[49]=Ae^~Le&Ke,t[0]^=e[2*r],t[1]^=e[2*r+1]}},Tc}();function t(){this.state=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.blockSize=null,this.count=0,this.squeezing=!1}return t.prototype.initialize=function(e,t){for(let e=0;e<50;++e)this.state[e]=0;this.blockSize=e/8,this.count=0,this.squeezing=!1},t.prototype.absorb=function(t){for(let r=0;r<t.length;++r)this.state[~~(this.count/4)]^=t[r]<<this.count%4*8,this.count+=1,this.count===this.blockSize&&(e.p1600(this.state),this.count=0)},t.prototype.absorbLastFewBits=function(t){this.state[~~(this.count/4)]^=t<<this.count%4*8,0!=(128&t)&&this.count===this.blockSize-1&&e.p1600(this.state),this.state[~~((this.blockSize-1)/4)]^=128<<(this.blockSize-1)%4*8,e.p1600(this.state),this.count=0,this.squeezing=!0},t.prototype.squeeze=function(t){this.squeezing||this.absorbLastFewBits(1);const r=Buffer.alloc(t);for(let n=0;n<t;++n)r[n]=this.state[~~(this.count/4)]>>>this.count%4*8&255,this.count+=1,this.count===this.blockSize&&(e.p1600(this.state),this.count=0);return r},t.prototype.copy=function(e){for(let t=0;t<50;++t)e.state[t]=this.state[t];e.blockSize=this.blockSize,e.count=this.count,e.squeezing=this.squeezing},Ec=t}function Ac(){return kc||(kc=1,function(e){try{e.exports=lc?cc:(lc=1,cc=wc()(Qr()(__dirname)))}catch(t){e.exports=xc?Sc:(xc=1,Sc=wc()(Cc()))}}(Mu)),Mu.exports}function Oc(){if(Rc)return _u;Rc=1,Object.defineProperty(_u,"__esModule",{value:!0});var e=(pu||(pu=1,Object.defineProperty(gu,"__esModule",{value:!0}),gu.createHashFunction=function(e){return function(t){var r=e();return r.update(t),Buffer.from(r.digest())}}),gu),t=Ac();return _u.keccak224=e.createHashFunction((function(){return t("keccak224")})),_u.keccak256=e.createHashFunction((function(){return t("keccak256")})),_u.keccak384=e.createHashFunction((function(){return t("keccak384")})),_u.keccak512=e.createHashFunction((function(){return t("keccak512")})),_u}var Lc,Bc,Pc,Ic,Nc,Dc,Uc,jc,Hc,qc={},Fc={exports:{}};function Wc(){if(Bc)return Lc;Bc=1;const e="Impossible case. Please create issue.",t="The tweak was out of range or the resulted private key is invalid",r="The tweak was out of range or equal to zero",n="Unknow error on context randomization",i="Private Key is invalid",o="Public Key could not be parsed",s="Public Key serialization error",a="The sum of the public keys is not valid",u="Signature could not be parsed",c="The nonce generation function failed, or the private key was invalid",l="Public key could not be recover",h="Scalar was invalid (zero or overflow)";function f(e,t){if(!e)throw new Error(t)}function d(e,t,r){if(f(t instanceof Uint8Array,`Expected ${e} to be an Uint8Array`),void 0!==r)if(Array.isArray(r)){const n=`Expected ${e} to be an Uint8Array with length [${r.join(", ")}]`;f(r.includes(t.length),n)}else{const n=`Expected ${e} to be an Uint8Array with length ${r}`;f(t.length===r,n)}}function p(e){f("Boolean"===_(e),"Expected compressed to be a Boolean")}function m(e=(e=>new Uint8Array(e)),t){return"function"==typeof e&&(e=e(t)),d("output",e,t),e}function _(e){return Object.prototype.toString.call(e).slice(8,-1)}return Lc=g=>({contextRandomize(e){if(f(null===e||e instanceof Uint8Array,"Expected seed to be an Uint8Array or null"),null!==e&&d("seed",e,32),1===g.contextRandomize(e))throw new Error(n)},privateKeyVerify:e=>(d("private key",e,32),0===g.privateKeyVerify(e)),privateKeyNegate(t){switch(d("private key",t,32),g.privateKeyNegate(t)){case 0:return t;case 1:throw new Error(e)}},privateKeyTweakAdd(e,r){switch(d("private key",e,32),d("tweak",r,32),g.privateKeyTweakAdd(e,r)){case 0:return e;case 1:throw new Error(t)}},privateKeyTweakMul(e,t){switch(d("private key",e,32),d("tweak",t,32),g.privateKeyTweakMul(e,t)){case 0:return e;case 1:throw new Error(r)}},publicKeyVerify:e=>(d("public key",e,[33,65]),0===g.publicKeyVerify(e)),publicKeyCreate(e,t=!0,r){switch(d("private key",e,32),p(t),r=m(r,t?33:65),g.publicKeyCreate(r,e)){case 0:return r;case 1:throw new Error(i);case 2:throw new Error(s)}},publicKeyConvert(e,t=!0,r){switch(d("public key",e,[33,65]),p(t),r=m(r,t?33:65),g.publicKeyConvert(r,e)){case 0:return r;case 1:throw new Error(o);case 2:throw new Error(s)}},publicKeyNegate(t,r=!0,n){switch(d("public key",t,[33,65]),p(r),n=m(n,r?33:65),g.publicKeyNegate(n,t)){case 0:return n;case 1:throw new Error(o);case 2:throw new Error(e);case 3:throw new Error(s)}},publicKeyCombine(e,t=!0,r){f(Array.isArray(e),"Expected public keys to be an Array"),f(e.length>0,"Expected public keys array will have more than zero items");for(const t of e)d("public key",t,[33,65]);switch(p(t),r=m(r,t?33:65),g.publicKeyCombine(r,e)){case 0:return r;case 1:throw new Error(o);case 2:throw new Error(a);case 3:throw new Error(s)}},publicKeyTweakAdd(e,r,n=!0,i){switch(d("public key",e,[33,65]),d("tweak",r,32),p(n),i=m(i,n?33:65),g.publicKeyTweakAdd(i,e,r)){case 0:return i;case 1:throw new Error(o);case 2:throw new Error(t)}},publicKeyTweakMul(e,t,n=!0,i){switch(d("public key",e,[33,65]),d("tweak",t,32),p(n),i=m(i,n?33:65),g.publicKeyTweakMul(i,e,t)){case 0:return i;case 1:throw new Error(o);case 2:throw new Error(r)}},signatureNormalize(e){switch(d("signature",e,64),g.signatureNormalize(e)){case 0:return e;case 1:throw new Error(u)}},signatureExport(t,r){d("signature",t,64);const n={output:r=m(r,72),outputlen:72};switch(g.signatureExport(n,t)){case 0:return r.slice(0,n.outputlen);case 1:throw new Error(u);case 2:throw new Error(e)}},signatureImport(t,r){switch(d("signature",t),r=m(r,64),g.signatureImport(r,t)){case 0:return r;case 1:throw new Error(u);case 2:throw new Error(e)}},ecdsaSign(t,r,n={},i){d("message",t,32),d("private key",r,32),f("Object"===_(n),"Expected options to be an Object"),void 0!==n.data&&d("options.data",n.data),void 0!==n.noncefn&&f("Function"===_(n.noncefn),"Expected options.noncefn to be a Function");const o={signature:i=m(i,64),recid:null};switch(g.ecdsaSign(o,t,r,n.data,n.noncefn)){case 0:return o;case 1:throw new Error(c);case 2:throw new Error(e)}},ecdsaVerify(e,t,r){switch(d("signature",e,64),d("message",t,32),d("public key",r,[33,65]),g.ecdsaVerify(e,t,r)){case 0:return!0;case 3:return!1;case 1:throw new Error(u);case 2:throw new Error(o)}},ecdsaRecover(t,r,n,i=!0,o){switch(d("signature",t,64),f("Number"===_(r)&&r>=0&&r<=3,"Expected recovery id to be a Number within interval [0, 3]"),d("message",n,32),p(i),o=m(o,i?33:65),g.ecdsaRecover(o,t,r,n)){case 0:return o;case 1:throw new Error(u);case 2:throw new Error(l);case 3:throw new Error(e)}},ecdh(e,t,r={},n){switch(d("public key",e,[33,65]),d("private key",t,32),f("Object"===_(r),"Expected options to be an Object"),void 0!==r.data&&d("options.data",r.data),void 0!==r.hashfn?(f("Function"===_(r.hashfn),"Expected options.hashfn to be a Function"),void 0!==r.xbuf&&d("options.xbuf",r.xbuf,32),void 0!==r.ybuf&&d("options.ybuf",r.ybuf,32),d("output",n)):n=m(n,32),g.ecdh(n,e,t,r.data,r.hashfn,r.xbuf,r.ybuf)){case 0:return n;case 1:throw new Error(o);case 2:throw new Error(h)}}}),Lc}function Kc(){if(Dc)return Nc;Dc=1;const e=new(0,A.ec)("secp256k1"),t=e.curve,r=t.n.constructor;function n(n){const i=n[0];switch(i){case 2:case 3:return 33!==n.length?null:function(n,i){let o=new r(i);if(o.cmp(t.p)>=0)return null;o=o.toRed(t.red);let s=o.redSqr().redIMul(o).redIAdd(t.b).redSqrt();return 3===n!==s.isOdd()&&(s=s.redNeg()),e.keyPair({pub:{x:o,y:s}})}(i,n.subarray(1,33));case 4:case 6:case 7:return 65!==n.length?null:function(n,i,o){let s=new r(i),a=new r(o);if(s.cmp(t.p)>=0||a.cmp(t.p)>=0)return null;if(s=s.toRed(t.red),a=a.toRed(t.red),(6===n||7===n)&&a.isOdd()!==(7===n))return null;const u=s.redSqr().redIMul(s);return a.redSqr().redISub(u.redIAdd(t.b)).isZero()?e.keyPair({pub:{x:s,y:a}}):null}(i,n.subarray(1,33),n.subarray(33,65));default:return null}}function i(e,t){const r=t.encode(null,33===e.length);for(let t=0;t<e.length;++t)e[t]=r[t]}return Nc={contextRandomize:()=>0,privateKeyVerify(e){const n=new r(e);return n.cmp(t.n)<0&&!n.isZero()?0:1},privateKeyNegate(e){const n=new r(e),i=t.n.sub(n).umod(t.n).toArrayLike(Uint8Array,"be",32);return e.set(i),0},privateKeyTweakAdd(e,n){const i=new r(n);if(i.cmp(t.n)>=0)return 1;if(i.iadd(new r(e)),i.cmp(t.n)>=0&&i.isub(t.n),i.isZero())return 1;const o=i.toArrayLike(Uint8Array,"be",32);return e.set(o),0},privateKeyTweakMul(e,n){let i=new r(n);if(i.cmp(t.n)>=0||i.isZero())return 1;i.imul(new r(e)),i.cmp(t.n)>=0&&(i=i.umod(t.n));const o=i.toArrayLike(Uint8Array,"be",32);return e.set(o),0},publicKeyVerify:e=>null===n(e)?1:0,publicKeyCreate(n,o){const s=new r(o);if(s.cmp(t.n)>=0||s.isZero())return 1;return i(n,e.keyFromPrivate(o).getPublic()),0},publicKeyConvert(e,t){const r=n(t);if(null===r)return 1;return i(e,r.getPublic()),0},publicKeyNegate(e,t){const r=n(t);if(null===r)return 1;const o=r.getPublic();return o.y=o.y.redNeg(),i(e,o),0},publicKeyCombine(e,t){const r=new Array(t.length);for(let e=0;e<t.length;++e)if(r[e]=n(t[e]),null===r[e])return 1;let o=r[0].getPublic();for(let e=1;e<r.length;++e)o=o.add(r[e].pub);return o.isInfinity()?2:(i(e,o),0)},publicKeyTweakAdd(e,o,s){const a=n(o);if(null===a)return 1;if((s=new r(s)).cmp(t.n)>=0)return 2;const u=a.getPublic().add(t.g.mul(s));return u.isInfinity()?2:(i(e,u),0)},publicKeyTweakMul(e,o,s){const a=n(o);if(null===a)return 1;if((s=new r(s)).cmp(t.n)>=0||s.isZero())return 2;return i(e,a.getPublic().mul(s)),0},signatureNormalize(n){const i=new r(n.subarray(0,32)),o=new r(n.subarray(32,64));return i.cmp(t.n)>=0||o.cmp(t.n)>=0?1:(1===o.cmp(e.nh)&&n.set(t.n.sub(o).toArrayLike(Uint8Array,"be",32),32),0)},signatureExport(e,n){const i=n.subarray(0,32),o=n.subarray(32,64);if(new r(i).cmp(t.n)>=0)return 1;if(new r(o).cmp(t.n)>=0)return 1;const{output:s}=e;let a=s.subarray(4,37);a[0]=0,a.set(i,1);let u=33,c=0;for(;u>1&&0===a[c]&&!(128&a[c+1]);--u,++c);if(a=a.subarray(c),128&a[0])return 1;if(u>1&&0===a[0]&&!(128&a[1]))return 1;let l=s.subarray(39,72);l[0]=0,l.set(o,1);let h=33,f=0;for(;h>1&&0===l[f]&&!(128&l[f+1]);--h,++f);return l=l.subarray(f),128&l[0]||h>1&&0===l[0]&&!(128&l[1])?1:(e.outputlen=6+u+h,s[0]=48,s[1]=e.outputlen-2,s[2]=2,s[3]=a.length,s.set(a,4),s[4+u]=2,s[5+u]=l.length,s.set(l,6+u),0)},signatureImport(e,n){if(n.length<8)return 1;if(n.length>72)return 1;if(48!==n[0])return 1;if(n[1]!==n.length-2)return 1;if(2!==n[2])return 1;const i=n[3];if(0===i)return 1;if(5+i>=n.length)return 1;if(2!==n[4+i])return 1;const o=n[5+i];if(0===o)return 1;if(6+i+o!==n.length)return 1;if(128&n[4])return 1;if(i>1&&0===n[4]&&!(128&n[5]))return 1;if(128&n[i+6])return 1;if(o>1&&0===n[i+6]&&!(128&n[i+7]))return 1;let s=n.subarray(4,4+i);if(33===s.length&&0===s[0]&&(s=s.subarray(1)),s.length>32)return 1;let a=n.subarray(6+i);if(33===a.length&&0===a[0]&&(a=a.slice(1)),a.length>32)throw new Error("S length is too long");let u=new r(s);u.cmp(t.n)>=0&&(u=new r(0));let c=new r(n.subarray(6+i));return c.cmp(t.n)>=0&&(c=new r(0)),e.set(u.toArrayLike(Uint8Array,"be",32),0),e.set(c.toArrayLike(Uint8Array,"be",32),32),0},ecdsaSign(n,i,o,s,a){if(a){const e=a;a=t=>{const n=e(i,o,null,s,t);if(!(n instanceof Uint8Array&&32===n.length))throw new Error("This is the way");return new r(n)}}const u=new r(o);if(u.cmp(t.n)>=0||u.isZero())return 1;let c;try{c=e.sign(i,o,{canonical:!0,k:a,pers:s})}catch(e){return 1}return n.signature.set(c.r.toArrayLike(Uint8Array,"be",32),0),n.signature.set(c.s.toArrayLike(Uint8Array,"be",32),32),n.recid=c.recoveryParam,0},ecdsaVerify(i,o,s){const a={r:i.subarray(0,32),s:i.subarray(32,64)},u=new r(a.r),c=new r(a.s);if(u.cmp(t.n)>=0||c.cmp(t.n)>=0)return 1;if(1===c.cmp(e.nh)||u.isZero()||c.isZero())return 3;const l=n(s);if(null===l)return 2;const h=l.getPublic();return e.verify(o,a,h)?0:3},ecdsaRecover(n,o,s,a){const u={r:o.slice(0,32),s:o.slice(32,64)},c=new r(u.r),l=new r(u.s);if(c.cmp(t.n)>=0||l.cmp(t.n)>=0)return 1;if(c.isZero()||l.isZero())return 2;let h;try{h=e.recoverPubKey(a,u,s)}catch(e){return 2}return i(n,h),0},ecdh(i,o,s,a,u,c,l){const h=n(o);if(null===h)return 1;const f=new r(s);if(f.cmp(t.n)>=0||f.isZero())return 2;const d=h.getPublic().mul(f);if(void 0===u){const t=d.encode(null,!0),r=e.hash().update(t).digest();for(let e=0;e<32;++e)i[e]=r[e]}else{c||(c=new Uint8Array(32));const e=d.getX().toArray("be",32);for(let t=0;t<32;++t)c[t]=e[t];l||(l=new Uint8Array(32));const t=d.getY().toArray("be",32);for(let e=0;e<32;++e)l[e]=t[e];const r=u(c,l,a);if(!(r instanceof Uint8Array&&r.length===i.length))return 2;i.set(r)}return 0}},Nc}function zc(){return Hc||(Hc=1,function(e){try{e.exports=function(){if(Ic)return Pc;Ic=1;const e=Qr()(__dirname);return Pc=Wc()(new e.Secp256k1)}()}catch(t){e.exports=jc?Uc:(jc=1,Uc=Wc()(Kc()))}}(Fc)),Fc.exports}var Gc,Vc,$c,Yc,Zc={};function Jc(){return Vc?Gc:(Vc=1,Gc=g.randomBytes)}function Qc(){return Yc||(Yc=1,function(e){var t=l&&l.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{u(n.next(e))}catch(e){o(e)}}function a(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))},r=l&&l.__generator||function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};Object.defineProperty(e,"__esModule",{value:!0});var n=zc(),i=function(){if($c)return Zc;$c=1,Object.defineProperty(Zc,"__esModule",{value:!0});var e=Jc();return Zc.getRandomBytes=function(t){return new Promise((function(r,n){e(t,(function(e,t){e?n(e):r(t)}))}))},Zc.getRandomBytesSync=function(t){return e(t)},Zc}(),o=32;e.createPrivateKey=function(){return t(this,void 0,void 0,(function(){var e;return r(this,(function(t){switch(t.label){case 0:return[4,i.getRandomBytes(o)];case 1:return e=t.sent(),n.privateKeyVerify(e)?[2,e]:[3,0];case 2:return[2]}}))}))},e.createPrivateKeySync=function(){for(;;){var e=i.getRandomBytesSync(o);if(n.privateKeyVerify(e))return e}},function(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}(zc())}(qc)),qc}var Xc,el={};var tl,rl,nl,il={};function ol(){if(nl)return rl;nl=1;var e=Qc(),t=function(){if(Xc)return el;Xc=1;var e=b.exports,t=new(0,A.ec)("secp256k1"),r=t.curve;el.privateKeyExport=function(i,o){var s=new e(i);if(s.ucmp(r.n)>=0)throw new Error("couldn't export to DER format");var a=t.g.mul(s);return n(a.getX(),a.getY(),o)},el.privateKeyModInverse=function(t){var n=new e(t);if(n.ucmp(r.n)>=0||n.isZero())throw new Error("private key range is invalid");return n.invm(r.n).toArrayLike(Buffer,"be",32)},el.signatureImport=function(t){var n=new e(t.r);n.ucmp(r.n)>=0&&(n=new e(0));var i=new e(t.s);return i.ucmp(r.n)>=0&&(i=new e(0)),Buffer.concat([n.toArrayLike(Buffer,"be",32),i.toArrayLike(Buffer,"be",32)])},el.ecdhUnsafe=function(i,o,s){var a=t.keyFromPublic(i),u=new e(o);if(u.ucmp(r.n)>=0||u.isZero())throw new Error("scalar was invalid (zero or overflow)");var c=a.pub.mul(u);return n(c.getX(),c.getY(),s)};var n=function(e,t,r){var n=void 0;return r?((n=Buffer.alloc(33))[0]=t.isOdd()?3:2,e.toArrayLike(Buffer,"be",32).copy(n,1)):((n=Buffer.alloc(65))[0]=4,e.toArrayLike(Buffer,"be",32).copy(n,1),t.toArrayLike(Buffer,"be",32).copy(n,33)),n};return el}(),r=function(){if(tl)return il;tl=1;var e=Buffer.from([48,129,211,2,1,1,4,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,129,133,48,129,130,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,33,2,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,36,3,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),t=Buffer.from([48,130,1,19,2,1,1,4,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,129,165,48,129,162,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,65,4,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,72,58,218,119,38,163,196,101,93,164,251,252,14,17,8,168,253,23,180,72,166,133,84,25,156,71,208,143,251,16,212,184,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,68,3,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);return il.privateKeyExport=function(r,n,i){var o=Buffer.from(i?e:t);return r.copy(o,i?8:9),n.copy(o,i?181:214),o},il.privateKeyImport=function(e){var t=e.length,r=0;if(t<r+1||48!==e[r])return null;if(t<(r+=1)+1||!(128&e[r]))return null;var n=127&e[r];if(n<1||n>2)return null;if(t<(r+=1)+n)return null;var i=e[r+n-1]|(n>1?e[r+n-2]<<8:0);return t<(r+=n)+i||t<r+3||2!==e[r]||1!==e[r+1]||1!==e[r+2]||t<(r+=3)+2||4!==e[r]||e[r+1]>32||t<r+2+e[r+1]?null:e.slice(r+2,r+2+e[r+1])},il.signatureImportLax=function(e){var t=Buffer.alloc(32,0),r=Buffer.alloc(32,0),n=e.length,i=0;if(48!==e[i++])return null;var o=e[i++];if(128&o&&(i+=o-128)>n)return null;if(2!==e[i++])return null;var s=e[i++];if(128&s){if(i+(o=s-128)>n)return null;for(;o>0&&0===e[i];i+=1,o-=1);for(s=0;o>0;i+=1,o-=1)s=(s<<8)+e[i]}if(s>n-i)return null;var a=i;if(i+=s,2!==e[i++])return null;var u=e[i++];if(128&u){if(i+(o=u-128)>n)return null;for(;o>0&&0===e[i];i+=1,o-=1);for(u=0;o>0;i+=1,o-=1)u=(u<<8)+e[i]}if(u>n-i)return null;var c=i;for(i+=u;s>0&&0===e[a];s-=1,a+=1);if(s>32)return null;var l=e.slice(a,a+s);for(l.copy(t,32-l.length);u>0&&0===e[c];u-=1,c+=1);if(u>32)return null;var h=e.slice(c,c+u);return h.copy(r,32-h.length),{r:t,s:r}},il}(),n=function(t){return 32===t.length&&e.privateKeyVerify(Uint8Array.from(t))};return rl={privateKeyVerify:n,privateKeyExport:function(e,n){if(32!==e.length)throw new RangeError("private key length is invalid");var i=t.privateKeyExport(e,n);return r.privateKeyExport(e,i,n)},privateKeyImport:function(e){if(null!==(e=r.privateKeyImport(e))&&32===e.length&&n(e))return e;throw new Error("couldn't import from DER format")},privateKeyNegate:function(t){return Buffer.from(e.privateKeyNegate(Uint8Array.from(t)))},privateKeyModInverse:function(e){if(32!==e.length)throw new Error("private key length is invalid");return Buffer.from(t.privateKeyModInverse(Uint8Array.from(e)))},privateKeyTweakAdd:function(t,r){return Buffer.from(e.privateKeyTweakAdd(Uint8Array.from(t),r))},privateKeyTweakMul:function(t,r){return Buffer.from(e.privateKeyTweakMul(Uint8Array.from(t),Uint8Array.from(r)))},publicKeyCreate:function(t,r){return Buffer.from(e.publicKeyCreate(Uint8Array.from(t),r))},publicKeyConvert:function(t,r){return Buffer.from(e.publicKeyConvert(Uint8Array.from(t),r))},publicKeyVerify:function(t){return(33===t.length||65===t.length)&&e.publicKeyVerify(Uint8Array.from(t))},publicKeyTweakAdd:function(t,r,n){return Buffer.from(e.publicKeyTweakAdd(Uint8Array.from(t),Uint8Array.from(r),n))},publicKeyTweakMul:function(t,r,n){return Buffer.from(e.publicKeyTweakMul(Uint8Array.from(t),Uint8Array.from(r),n))},publicKeyCombine:function(t,r){var n=[];return t.forEach((function(e){n.push(Uint8Array.from(e))})),Buffer.from(e.publicKeyCombine(n,r))},signatureNormalize:function(t){return Buffer.from(e.signatureNormalize(Uint8Array.from(t)))},signatureExport:function(t){return Buffer.from(e.signatureExport(Uint8Array.from(t)))},signatureImport:function(t){return Buffer.from(e.signatureImport(Uint8Array.from(t)))},signatureImportLax:function(e){if(0===e.length)throw new RangeError("signature length is invalid");var n=r.signatureImportLax(e);if(null===n)throw new Error("couldn't parse DER signature");return t.signatureImport(n)},sign:function(t,r,n){if(null===n)throw new TypeError("options should be an Object");var i=void 0;if(n){if(i={},null===n.data)throw new TypeError("options.data should be a Buffer");if(n.data){if(32!==n.data.length)throw new RangeError("options.data length is invalid");i.data=new Uint8Array(n.data)}if(null===n.noncefn)throw new TypeError("options.noncefn should be a Function");n.noncefn&&(i.noncefn=function(e,t,r,i,o){var s=null!=r?Buffer.from(r):null,a=null!=i?Buffer.from(i):null,u=Buffer.from("");return n.noncefn&&(u=n.noncefn(Buffer.from(e),Buffer.from(t),s,a,o)),Uint8Array.from(u)})}var o=e.ecdsaSign(Uint8Array.from(t),Uint8Array.from(r),i);return{signature:Buffer.from(o.signature),recovery:o.recid}},verify:function(t,r,n){return e.ecdsaVerify(Uint8Array.from(r),Uint8Array.from(t),n)},recover:function(t,r,n,i){return Buffer.from(e.ecdsaRecover(Uint8Array.from(r),n,Uint8Array.from(t),i))},ecdh:function(t,r){return Buffer.from(e.ecdh(Uint8Array.from(t),Uint8Array.from(r),{}))},ecdhUnsafe:function(e,r,n){if(33!==e.length&&65!==e.length)throw new RangeError("public key length is invalid");if(32!==r.length)throw new RangeError("private key length is invalid");return Buffer.from(t.ecdhUnsafe(Uint8Array.from(e),Uint8Array.from(r),n))}},rl}var sl,al,ul,cl,ll,hl={},fl={exports:{}};function dl(){return sl||(sl=1,function(e,t){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function n(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function i(e,t,r){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var o;"object"==typeof e?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:require("buffer").Buffer}catch(e){}function s(e,t){var n=e.charCodeAt(t);return n>=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void r(!1,"Invalid character in "+e)}function a(e,t,r){var n=s(e,r);return r-1>=t&&(n|=s(e,r-1)<<4),n}function u(e,t,n,i){for(var o=0,s=0,a=Math.min(e.length,n),u=t;u<a;u++){var c=e.charCodeAt(u)-48;o*=i,s=c>=49?c-49+10:c>=17?c-17+10:c,r(c>=0&&s<i,"Invalid character"),o+=s}return o}function c(e,t){e.words=t.words,e.length=t.length,e.negative=t.negative,e.red=t.red}if(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 e.cmp(t)<0?e:t},i.prototype._init=function(e,t,n){if("number"==typeof e)return this._initNumber(e,t,n);if("object"==typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<e.length&&(16===t?this._parseHex(e,i,n):(this._parseBase(e,t,i),"le"===n&&this._initArray(this.toArray(),t,n)))},i.prototype._initNumber=function(e,t,n){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),t,n)},i.prototype._initArray=function(e,t,n){if(r("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,s,a=0;if("be"===n)for(i=e.length-1,o=0;i>=0;i-=3)s=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===n)for(i=0,o=0;i<e.length;i+=3)s=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},i.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,o=0,s=0;if("be"===r)for(n=e.length-1;n>=t;n-=2)i=a(e,t,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(e.length-t)%2==0?t+1:t;n<e.length;n+=2)i=a(e,t,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var o=e.length-r,s=o%n,a=Math.min(o,o-s)+r,c=0,l=r;l<a;l+=n)c=u(e,l,l+n,t),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==s){var h=1;for(c=u(e,l,e.length,t),l=0;l<s;l++)h*=t;this.imuln(h),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this._strip()},i.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},i.prototype._move=function(e){c(e,this)},i.prototype.clone=function(){var e=new i(null);return this.copy(e),e},i.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(e){i.prototype.inspect=l}else i.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var h=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function p(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var i=0|e.words[0],o=0|t.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var c=1;c<n;c++){for(var l=u>>>26,h=67108863&u,f=Math.min(c,t.length-1),d=Math.max(0,c-e.length+1);d<=f;d++){var p=c-d|0;l+=(s=(i=0|e.words[p])*(o=0|t.words[d])+h)/67108864|0,h=67108863&s}r.words[c]=0|h,u=0|l}return 0!==u?r.words[c]=0|u:r.length--,r._strip()}i.prototype.toString=function(e,t){var n;if(t=0|t||1,16===(e=e||10)||"hex"===e){n="";for(var i=0,o=0,s=0;s<this.length;s++){var a=this.words[s],u=(16777215&(a<<i|o)).toString(16);o=a>>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),n=0!==o||s!==this.length-1?h[6-u.length]+u+n:u+n}for(0!==o&&(n=o.toString(16)+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var c=f[e],l=d[e];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modrn(l).toString(e);n=(p=p.idivn(l)).isZero()?m+n:h[c-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var 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&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(e,t){return this.toArrayLike(o,e,t)}),i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},i.prototype.toArrayLike=function(e,t,n){this._strip();var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0");var s=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,o);return this["_toArrayLike"+("le"===t?"LE":"BE")](s,i),s},i.prototype._toArrayLikeLE=function(e,t){for(var r=0,n=0,i=0,o=0;i<this.length;i++){var s=this.words[i]<<o|n;e[r++]=255&s,r<e.length&&(e[r++]=s>>8&255),r<e.length&&(e[r++]=s>>16&255),6===o?(r<e.length&&(e[r++]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r<e.length)for(e[r++]=n;r<e.length;)e[r++]=0},i.prototype._toArrayLikeBE=function(e,t){for(var r=e.length-1,n=0,i=0,o=0;i<this.length;i++){var s=this.words[i]<<o|n;e[r--]=255&s,r>=0&&(e[r--]=s>>8&255),r>=0&&(e[r--]=s>>16&255),6===o?(r>=0&&(e[r--]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r>=0)for(e[r--]=n;r>=0;)e[r--]=0},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},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;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},i.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this._strip()},i.prototype.ior=function(e){return r(0==(this.negative|e.negative)),this.iuor(e)},i.prototype.or=function(e){return this.length>e.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 r=0;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this._strip()},i.prototype.iand=function(e){return r(0==(this.negative|e.negative)),this.iuand(e)},i.prototype.and=function(e){return this.length>e.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,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;n<r.length;n++)this.words[n]=t.words[n]^r.words[n];if(this!==t)for(;n<t.length;n++)this.words[n]=t.words[n];return this.length=t.length,this._strip()},i.prototype.ixor=function(e){return r(0==(this.negative|e.negative)),this.iuxor(e)},i.prototype.xor=function(e){return this.length>e.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){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var i=0;i<t;i++)this.words[i]=67108863&~this.words[i];return n>0&&(this.words[i]=~this.words[i]&67108863>>26-n),this._strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var n=e/26|0,i=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<<i:this.words[n]&~(1<<i),this._strip()},i.prototype.iadd=function(e){var t,r,n;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(r=this,n=e):(r=e,n=this);for(var i=0,o=0;o<n.length;o++)t=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&t,i=t>>>26;for(;0!==i&&o<r.length;o++)t=(0|r.words[o])+i,this.words[o]=67108863&t,i=t>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},i.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},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 r,n,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=e):(r=e,n=this);for(var o=0,s=0;s<n.length;s++)o=(t=(0|r.words[s])-(0|n.words[s])+o)>>26,this.words[s]=67108863&t;for(;0!==o&&s<r.length;s++)o=(t=(0|r.words[s])+o)>>26,this.words[s]=67108863&t;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(e){return this.clone().isub(e)};var m=function(e,t,r){var n,i,o,s=e.words,a=t.words,u=r.words,c=0,l=0|s[0],h=8191&l,f=l>>>13,d=0|s[1],p=8191&d,m=d>>>13,_=0|s[2],g=8191&_,v=_>>>13,y=0|s[3],w=8191&y,b=y>>>13,E=0|s[4],M=8191&E,S=E>>>13,x=0|s[5],k=8191&x,R=x>>>13,T=0|s[6],C=8191&T,A=T>>>13,O=0|s[7],L=8191&O,B=O>>>13,P=0|s[8],I=8191&P,N=P>>>13,D=0|s[9],U=8191&D,j=D>>>13,H=0|a[0],q=8191&H,F=H>>>13,W=0|a[1],K=8191&W,z=W>>>13,G=0|a[2],V=8191&G,$=G>>>13,Y=0|a[3],Z=8191&Y,J=Y>>>13,Q=0|a[4],X=8191&Q,ee=Q>>>13,te=0|a[5],re=8191&te,ne=te>>>13,ie=0|a[6],oe=8191&ie,se=ie>>>13,ae=0|a[7],ue=8191&ae,ce=ae>>>13,le=0|a[8],he=8191&le,fe=le>>>13,de=0|a[9],pe=8191&de,me=de>>>13;r.negative=e.negative^t.negative,r.length=19;var _e=(c+(n=Math.imul(h,q))|0)+((8191&(i=(i=Math.imul(h,F))+Math.imul(f,q)|0))<<13)|0;c=((o=Math.imul(f,F))+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(p,q),i=(i=Math.imul(p,F))+Math.imul(m,q)|0,o=Math.imul(m,F);var ge=(c+(n=n+Math.imul(h,K)|0)|0)+((8191&(i=(i=i+Math.imul(h,z)|0)+Math.imul(f,K)|0))<<13)|0;c=((o=o+Math.imul(f,z)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(g,q),i=(i=Math.imul(g,F))+Math.imul(v,q)|0,o=Math.imul(v,F),n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,z)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,z)|0;var ve=(c+(n=n+Math.imul(h,V)|0)|0)+((8191&(i=(i=i+Math.imul(h,$)|0)+Math.imul(f,V)|0))<<13)|0;c=((o=o+Math.imul(f,$)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(w,q),i=(i=Math.imul(w,F))+Math.imul(b,q)|0,o=Math.imul(b,F),n=n+Math.imul(g,K)|0,i=(i=i+Math.imul(g,z)|0)+Math.imul(v,K)|0,o=o+Math.imul(v,z)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,$)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,$)|0;var ye=(c+(n=n+Math.imul(h,Z)|0)|0)+((8191&(i=(i=i+Math.imul(h,J)|0)+Math.imul(f,Z)|0))<<13)|0;c=((o=o+Math.imul(f,J)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(M,q),i=(i=Math.imul(M,F))+Math.imul(S,q)|0,o=Math.imul(S,F),n=n+Math.imul(w,K)|0,i=(i=i+Math.imul(w,z)|0)+Math.imul(b,K)|0,o=o+Math.imul(b,z)|0,n=n+Math.imul(g,V)|0,i=(i=i+Math.imul(g,$)|0)+Math.imul(v,V)|0,o=o+Math.imul(v,$)|0,n=n+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,J)|0;var we=(c+(n=n+Math.imul(h,X)|0)|0)+((8191&(i=(i=i+Math.imul(h,ee)|0)+Math.imul(f,X)|0))<<13)|0;c=((o=o+Math.imul(f,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(k,q),i=(i=Math.imul(k,F))+Math.imul(R,q)|0,o=Math.imul(R,F),n=n+Math.imul(M,K)|0,i=(i=i+Math.imul(M,z)|0)+Math.imul(S,K)|0,o=o+Math.imul(S,z)|0,n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,$)|0)+Math.imul(b,V)|0,o=o+Math.imul(b,$)|0,n=n+Math.imul(g,Z)|0,i=(i=i+Math.imul(g,J)|0)+Math.imul(v,Z)|0,o=o+Math.imul(v,J)|0,n=n+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 be=(c+(n=n+Math.imul(h,re)|0)|0)+((8191&(i=(i=i+Math.imul(h,ne)|0)+Math.imul(f,re)|0))<<13)|0;c=((o=o+Math.imul(f,ne)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,n=Math.imul(C,q),i=(i=Math.imul(C,F))+Math.imul(A,q)|0,o=Math.imul(A,F),n=n+Math.imul(k,K)|0,i=(i=i+Math.imul(k,z)|0)+Math.imul(R,K)|0,o=o+Math.imul(R,z)|0,n=n+Math.imul(M,V)|0,i=(i=i+Math.imul(M,$)|0)+Math.imul(S,V)|0,o=o+Math.imul(S,$)|0,n=n+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,J)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,J)|0,n=n+Math.imul(g,X)|0,i=(i=i+Math.imul(g,ee)|0)+Math.imul(v,X)|0,o=o+Math.imul(v,ee)|0,n=n+Math.imul(p,re)|0,i=(i=i+Math.imul(p,ne)|0)+Math.imul(m,re)|0,o=o+Math.imul(m,ne)|0;var Ee=(c+(n=n+Math.imul(h,oe)|0)|0)+((8191&(i=(i=i+Math.imul(h,se)|0)+Math.imul(f,oe)|0))<<13)|0;c=((o=o+Math.imul(f,se)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(L,q),i=(i=Math.imul(L,F))+Math.imul(B,q)|0,o=Math.imul(B,F),n=n+Math.imul(C,K)|0,i=(i=i+Math.imul(C,z)|0)+Math.imul(A,K)|0,o=o+Math.imul(A,z)|0,n=n+Math.imul(k,V)|0,i=(i=i+Math.imul(k,$)|0)+Math.imul(R,V)|0,o=o+Math.imul(R,$)|0,n=n+Math.imul(M,Z)|0,i=(i=i+Math.imul(M,J)|0)+Math.imul(S,Z)|0,o=o+Math.imul(S,J)|0,n=n+Math.imul(w,X)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(b,X)|0,o=o+Math.imul(b,ee)|0,n=n+Math.imul(g,re)|0,i=(i=i+Math.imul(g,ne)|0)+Math.imul(v,re)|0,o=o+Math.imul(v,ne)|0,n=n+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,se)|0)+Math.imul(m,oe)|0,o=o+Math.imul(m,se)|0;var Me=(c+(n=n+Math.imul(h,ue)|0)|0)+((8191&(i=(i=i+Math.imul(h,ce)|0)+Math.imul(f,ue)|0))<<13)|0;c=((o=o+Math.imul(f,ce)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(I,q),i=(i=Math.imul(I,F))+Math.imul(N,q)|0,o=Math.imul(N,F),n=n+Math.imul(L,K)|0,i=(i=i+Math.imul(L,z)|0)+Math.imul(B,K)|0,o=o+Math.imul(B,z)|0,n=n+Math.imul(C,V)|0,i=(i=i+Math.imul(C,$)|0)+Math.imul(A,V)|0,o=o+Math.imul(A,$)|0,n=n+Math.imul(k,Z)|0,i=(i=i+Math.imul(k,J)|0)+Math.imul(R,Z)|0,o=o+Math.imul(R,J)|0,n=n+Math.imul(M,X)|0,i=(i=i+Math.imul(M,ee)|0)+Math.imul(S,X)|0,o=o+Math.imul(S,ee)|0,n=n+Math.imul(w,re)|0,i=(i=i+Math.imul(w,ne)|0)+Math.imul(b,re)|0,o=o+Math.imul(b,ne)|0,n=n+Math.imul(g,oe)|0,i=(i=i+Math.imul(g,se)|0)+Math.imul(v,oe)|0,o=o+Math.imul(v,se)|0,n=n+Math.imul(p,ue)|0,i=(i=i+Math.imul(p,ce)|0)+Math.imul(m,ue)|0,o=o+Math.imul(m,ce)|0;var Se=(c+(n=n+Math.imul(h,he)|0)|0)+((8191&(i=(i=i+Math.imul(h,fe)|0)+Math.imul(f,he)|0))<<13)|0;c=((o=o+Math.imul(f,fe)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(U,q),i=(i=Math.imul(U,F))+Math.imul(j,q)|0,o=Math.imul(j,F),n=n+Math.imul(I,K)|0,i=(i=i+Math.imul(I,z)|0)+Math.imul(N,K)|0,o=o+Math.imul(N,z)|0,n=n+Math.imul(L,V)|0,i=(i=i+Math.imul(L,$)|0)+Math.imul(B,V)|0,o=o+Math.imul(B,$)|0,n=n+Math.imul(C,Z)|0,i=(i=i+Math.imul(C,J)|0)+Math.imul(A,Z)|0,o=o+Math.imul(A,J)|0,n=n+Math.imul(k,X)|0,i=(i=i+Math.imul(k,ee)|0)+Math.imul(R,X)|0,o=o+Math.imul(R,ee)|0,n=n+Math.imul(M,re)|0,i=(i=i+Math.imul(M,ne)|0)+Math.imul(S,re)|0,o=o+Math.imul(S,ne)|0,n=n+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,se)|0)+Math.imul(b,oe)|0,o=o+Math.imul(b,se)|0,n=n+Math.imul(g,ue)|0,i=(i=i+Math.imul(g,ce)|0)+Math.imul(v,ue)|0,o=o+Math.imul(v,ce)|0,n=n+Math.imul(p,he)|0,i=(i=i+Math.imul(p,fe)|0)+Math.imul(m,he)|0,o=o+Math.imul(m,fe)|0;var xe=(c+(n=n+Math.imul(h,pe)|0)|0)+((8191&(i=(i=i+Math.imul(h,me)|0)+Math.imul(f,pe)|0))<<13)|0;c=((o=o+Math.imul(f,me)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(U,K),i=(i=Math.imul(U,z))+Math.imul(j,K)|0,o=Math.imul(j,z),n=n+Math.imul(I,V)|0,i=(i=i+Math.imul(I,$)|0)+Math.imul(N,V)|0,o=o+Math.imul(N,$)|0,n=n+Math.imul(L,Z)|0,i=(i=i+Math.imul(L,J)|0)+Math.imul(B,Z)|0,o=o+Math.imul(B,J)|0,n=n+Math.imul(C,X)|0,i=(i=i+Math.imul(C,ee)|0)+Math.imul(A,X)|0,o=o+Math.imul(A,ee)|0,n=n+Math.imul(k,re)|0,i=(i=i+Math.imul(k,ne)|0)+Math.imul(R,re)|0,o=o+Math.imul(R,ne)|0,n=n+Math.imul(M,oe)|0,i=(i=i+Math.imul(M,se)|0)+Math.imul(S,oe)|0,o=o+Math.imul(S,se)|0,n=n+Math.imul(w,ue)|0,i=(i=i+Math.imul(w,ce)|0)+Math.imul(b,ue)|0,o=o+Math.imul(b,ce)|0,n=n+Math.imul(g,he)|0,i=(i=i+Math.imul(g,fe)|0)+Math.imul(v,he)|0,o=o+Math.imul(v,fe)|0;var ke=(c+(n=n+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;c=((o=o+Math.imul(m,me)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(U,V),i=(i=Math.imul(U,$))+Math.imul(j,V)|0,o=Math.imul(j,$),n=n+Math.imul(I,Z)|0,i=(i=i+Math.imul(I,J)|0)+Math.imul(N,Z)|0,o=o+Math.imul(N,J)|0,n=n+Math.imul(L,X)|0,i=(i=i+Math.imul(L,ee)|0)+Math.imul(B,X)|0,o=o+Math.imul(B,ee)|0,n=n+Math.imul(C,re)|0,i=(i=i+Math.imul(C,ne)|0)+Math.imul(A,re)|0,o=o+Math.imul(A,ne)|0,n=n+Math.imul(k,oe)|0,i=(i=i+Math.imul(k,se)|0)+Math.imul(R,oe)|0,o=o+Math.imul(R,se)|0,n=n+Math.imul(M,ue)|0,i=(i=i+Math.imul(M,ce)|0)+Math.imul(S,ue)|0,o=o+Math.imul(S,ce)|0,n=n+Math.imul(w,he)|0,i=(i=i+Math.imul(w,fe)|0)+Math.imul(b,he)|0,o=o+Math.imul(b,fe)|0;var Re=(c+(n=n+Math.imul(g,pe)|0)|0)+((8191&(i=(i=i+Math.imul(g,me)|0)+Math.imul(v,pe)|0))<<13)|0;c=((o=o+Math.imul(v,me)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,n=Math.imul(U,Z),i=(i=Math.imul(U,J))+Math.imul(j,Z)|0,o=Math.imul(j,J),n=n+Math.imul(I,X)|0,i=(i=i+Math.imul(I,ee)|0)+Math.imul(N,X)|0,o=o+Math.imul(N,ee)|0,n=n+Math.imul(L,re)|0,i=(i=i+Math.imul(L,ne)|0)+Math.imul(B,re)|0,o=o+Math.imul(B,ne)|0,n=n+Math.imul(C,oe)|0,i=(i=i+Math.imul(C,se)|0)+Math.imul(A,oe)|0,o=o+Math.imul(A,se)|0,n=n+Math.imul(k,ue)|0,i=(i=i+Math.imul(k,ce)|0)+Math.imul(R,ue)|0,o=o+Math.imul(R,ce)|0,n=n+Math.imul(M,he)|0,i=(i=i+Math.imul(M,fe)|0)+Math.imul(S,he)|0,o=o+Math.imul(S,fe)|0;var Te=(c+(n=n+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,me)|0)+Math.imul(b,pe)|0))<<13)|0;c=((o=o+Math.imul(b,me)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(U,X),i=(i=Math.imul(U,ee))+Math.imul(j,X)|0,o=Math.imul(j,ee),n=n+Math.imul(I,re)|0,i=(i=i+Math.imul(I,ne)|0)+Math.imul(N,re)|0,o=o+Math.imul(N,ne)|0,n=n+Math.imul(L,oe)|0,i=(i=i+Math.imul(L,se)|0)+Math.imul(B,oe)|0,o=o+Math.imul(B,se)|0,n=n+Math.imul(C,ue)|0,i=(i=i+Math.imul(C,ce)|0)+Math.imul(A,ue)|0,o=o+Math.imul(A,ce)|0,n=n+Math.imul(k,he)|0,i=(i=i+Math.imul(k,fe)|0)+Math.imul(R,he)|0,o=o+Math.imul(R,fe)|0;var Ce=(c+(n=n+Math.imul(M,pe)|0)|0)+((8191&(i=(i=i+Math.imul(M,me)|0)+Math.imul(S,pe)|0))<<13)|0;c=((o=o+Math.imul(S,me)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(U,re),i=(i=Math.imul(U,ne))+Math.imul(j,re)|0,o=Math.imul(j,ne),n=n+Math.imul(I,oe)|0,i=(i=i+Math.imul(I,se)|0)+Math.imul(N,oe)|0,o=o+Math.imul(N,se)|0,n=n+Math.imul(L,ue)|0,i=(i=i+Math.imul(L,ce)|0)+Math.imul(B,ue)|0,o=o+Math.imul(B,ce)|0,n=n+Math.imul(C,he)|0,i=(i=i+Math.imul(C,fe)|0)+Math.imul(A,he)|0,o=o+Math.imul(A,fe)|0;var Ae=(c+(n=n+Math.imul(k,pe)|0)|0)+((8191&(i=(i=i+Math.imul(k,me)|0)+Math.imul(R,pe)|0))<<13)|0;c=((o=o+Math.imul(R,me)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(U,oe),i=(i=Math.imul(U,se))+Math.imul(j,oe)|0,o=Math.imul(j,se),n=n+Math.imul(I,ue)|0,i=(i=i+Math.imul(I,ce)|0)+Math.imul(N,ue)|0,o=o+Math.imul(N,ce)|0,n=n+Math.imul(L,he)|0,i=(i=i+Math.imul(L,fe)|0)+Math.imul(B,he)|0,o=o+Math.imul(B,fe)|0;var Oe=(c+(n=n+Math.imul(C,pe)|0)|0)+((8191&(i=(i=i+Math.imul(C,me)|0)+Math.imul(A,pe)|0))<<13)|0;c=((o=o+Math.imul(A,me)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(U,ue),i=(i=Math.imul(U,ce))+Math.imul(j,ue)|0,o=Math.imul(j,ce),n=n+Math.imul(I,he)|0,i=(i=i+Math.imul(I,fe)|0)+Math.imul(N,he)|0,o=o+Math.imul(N,fe)|0;var Le=(c+(n=n+Math.imul(L,pe)|0)|0)+((8191&(i=(i=i+Math.imul(L,me)|0)+Math.imul(B,pe)|0))<<13)|0;c=((o=o+Math.imul(B,me)|0)+(i>>>13)|0)+(Le>>>26)|0,Le&=67108863,n=Math.imul(U,he),i=(i=Math.imul(U,fe))+Math.imul(j,he)|0,o=Math.imul(j,fe);var Be=(c+(n=n+Math.imul(I,pe)|0)|0)+((8191&(i=(i=i+Math.imul(I,me)|0)+Math.imul(N,pe)|0))<<13)|0;c=((o=o+Math.imul(N,me)|0)+(i>>>13)|0)+(Be>>>26)|0,Be&=67108863;var Pe=(c+(n=Math.imul(U,pe))|0)+((8191&(i=(i=Math.imul(U,me))+Math.imul(j,pe)|0))<<13)|0;return c=((o=Math.imul(j,me))+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,u[0]=_e,u[1]=ge,u[2]=ve,u[3]=ye,u[4]=we,u[5]=be,u[6]=Ee,u[7]=Me,u[8]=Se,u[9]=xe,u[10]=ke,u[11]=Re,u[12]=Te,u[13]=Ce,u[14]=Ae,u[15]=Oe,u[16]=Le,u[17]=Be,u[18]=Pe,0!==c&&(u[19]=c,r.length++),r};function _(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,o=0;o<r.length-1;o++){var s=i;i=0;for(var a=67108863&n,u=Math.min(o,t.length-1),c=Math.max(0,o-e.length+1);c<=u;c++){var l=o-c,h=(0|e.words[l])*(0|t.words[c]),f=67108863&h;a=67108863&(f=f+a|0),i+=(s=(s=s+(h/67108864|0)|0)+(f>>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function g(e,t,r){return _(e,t,r)}Math.imul||(m=p),i.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?m(this,e,t):r<63?p(this,e,t):r<1024?_(this,e,t):g(this,e,t)},i.prototype.mul=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},i.prototype.mulf=function(e){var t=new i(null);return t.words=new 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),r("number"==typeof e),r(e<67108864);for(var n=0,i=0;i<this.length;i++){var o=(0|this.words[i])*e,s=(67108863&o)+(67108863&n);n>>=26,n+=o/67108864|0,n+=s>>>26,this.words[i]=67108863&s}return 0!==n&&(this.words[i]=n,this.length++),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=new Array(e.bitLength()),r=0;r<t.length;r++){var n=r/26|0,i=r%26;t[r]=e.words[n]>>>i&1}return t}(e);if(0===t.length)return new i(1);for(var r=this,n=0;n<t.length&&0===t[n];n++,r=r.sqr());if(++n<t.length)for(var o=r.sqr();n<t.length;n++,o=o.sqr())0!==t[n]&&(r=r.mul(o));return r},i.prototype.iushln=function(e){r("number"==typeof e&&e>=0);var t,n=e%26,i=(e-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(t=0;t<this.length;t++){var a=this.words[t]&o,u=(0|this.words[t])-a<<n;this.words[t]=u|s,s=a>>>26-n}s&&(this.words[t]=s,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this._strip()},i.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},i.prototype.iushrn=function(e,t,n){var i;r("number"==typeof e&&e>=0),i=t?(t-t%26)/26:0;var o=e%26,s=Math.min((e-o)/26,this.length),a=67108863^67108863>>>o<<o,u=n;if(i-=s,i=Math.max(0,i),u){for(var c=0;c<s;c++)u.words[c]=this.words[c];u.length=s}if(0===s);else if(this.length>s)for(this.length-=s,c=0;c<this.length;c++)this.words[c]=this.words[c+s];else this.words[0]=0,this.length=1;var l=0;for(c=this.length-1;c>=0&&(0!==l||c>=i);c--){var h=0|this.words[c];this.words[c]=l<<26-o|h>>>o,l=h&a}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},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){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26,i=1<<t;return!(this.length<=n||!(this.words[n]&i))},i.prototype.imaskn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var i=67108863^67108863>>>t<<t;this.words[this.length-1]&=i}return this._strip()},i.prototype.maskn=function(e){return this.clone().imaskn(e)},i.prototype.iaddn=function(e){return r("number"==typeof e),r(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<=e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},i.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[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(r("number"==typeof e),r(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<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this._strip()},i.prototype.addn=function(e){return this.clone().iaddn(e)},i.prototype.subn=function(e){return this.clone().isubn(e)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(e,t,n){var i,o,s=e.length+n;this._expand(s);var a=0;for(i=0;i<e.length;i++){o=(0|this.words[i+n])+a;var u=(0|e.words[i])*t;a=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+n]=67108863&o}for(;i<this.length-n;i++)a=(o=(0|this.words[i+n])+a)>>26,this.words[i+n]=67108863&o;if(0===a)return this._strip();for(r(-1===a),a=0,i=0;i<this.length;i++)a=(o=-(0|this.words[i])+a)>>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),o=e,s=0|o.words[o.length-1];0!=(r=26-this._countBits(s))&&(o=o.ushln(r),n.iushln(r),s=0|o.words[o.length-1]);var a,u=n.length-o.length;if("mod"!==t){(a=new i(null)).length=u+1,a.words=new Array(a.length);for(var c=0;c<a.length;c++)a.words[c]=0}var l=n.clone()._ishlnsubmul(o,1,u);0===l.negative&&(n=l,a&&(a.words[u]=1));for(var h=u-1;h>=0;h--){var f=67108864*(0|n.words[o.length+h])+(0|n.words[o.length+h-1]);for(f=Math.min(f/s|0,67108863),n._ishlnsubmul(o,f,h);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(o,1,h),n.isZero()||(n.negative^=1);a&&(a.words[h]=f)}return a&&a._strip(),n._strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},i.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(o=a.div.neg()),"div"!==t&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(e)),{div:o,mod:s}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&e.negative)?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(e)),{div:a.div,mod:s}):e.length>this.length||this.cmp(e)<0?{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);var o,s,a},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 r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),i=e.andln(1),o=r.cmp(n);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),r(e<=67108863);for(var n=(1<<26)%e,i=0,o=this.length-1;o>=0;o--)i=(n*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),r(e<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*n;this.words[i]=o/e|0,n=o%e}return this._strip(),t?this.ineg():this},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o=new i(1),s=new i(0),a=new i(0),u=new i(1),c=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++c;for(var l=n.clone(),h=t.clone();!t.isZero();){for(var f=0,d=1;0==(t.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(t.iushrn(f);f-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(l),s.isub(h)),o.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(l),u.isub(h)),a.iushrn(1),u.iushrn(1);t.cmp(n)>=0?(t.isub(n),o.isub(a),s.isub(u)):(n.isub(t),a.isub(o),u.isub(s))}return{a:a,b:u,gcd:n.iushln(c)}},i.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o,s=new i(1),a=new i(0),u=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var c=0,l=1;0==(t.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(t.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var h=0,f=1;0==(n.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(n.iushrn(h);h-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);t.cmp(n)>=0?(t.isub(n),s.isub(a)):(n.isub(t),a.isub(s))}return(o=0===t.cmpn(1)?s:a).cmpn(0)<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(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=t.cmp(r);if(i<0){var o=t;t=r,r=o}else if(0===i||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},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){r("number"==typeof e);var t=e%26,n=(e-t)/26,i=1<<t;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var o=i,s=n;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(e){var t,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)t=1;else{n&&(e=-e),r(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:i<e?-1:1}return 0!==this.negative?0|-t:t},i.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},i.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|e.words[r];if(n!==i){n<i?t=-1:n>i&&(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 this.cmpn(e)<=0},i.prototype.lte=function(e){return this.cmp(e)<=0},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 S(e)},i.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return r(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 r(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return r(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 y(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 w(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function M(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function x(e){S.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)}y.prototype._tmp=function(){var e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},y.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},y.prototype.split=function(e,t){e.iushrn(this.n,0,t)},y.prototype.imulK=function(e){return e.imul(this.k)},n(w,y),w.prototype.split=function(e,t){for(var r=4194303,n=Math.min(e.length,9),i=0;i<n;i++)t.words[i]=e.words[i];if(t.length=n,e.length<=9)return e.words[0]=0,void(e.length=1);var o=e.words[9];for(t.words[t.length++]=o&r,i=10;i<e.length;i++){var s=0|e.words[i];e.words[i-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},w.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r<e.length;r++){var n=0|e.words[r];t+=977*n,e.words[r]=67108863&t,t=64*n+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},n(b,y),n(E,y),n(M,y),M.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var n=19*(0|e.words[r])+t,i=67108863&n;n>>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(v[e])return v[e];var t;if("k256"===e)t=new w;else if("p224"===e)t=new b;else if("p192"===e)t=new E;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new M}return v[e]=t,t},S.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},S.prototype._verify2=function(e,t){r(0==(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},S.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(c(e,e.umod(this.m)._forceRed(this)),e)},S.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},S.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},S.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},S.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},S.prototype.isqr=function(e){return this.imul(e,e.clone())},S.prototype.sqr=function(e){return this.mul(e,e)},S.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var n=this.m.add(new i(1)).iushrn(2);return this.pow(e,n)}for(var o=this.m.subn(1),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new i(1).toRed(this),u=a.redNeg(),c=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new i(2*l*l).toRed(this);0!==this.pow(l,c).cmp(u);)l.redIAdd(u);for(var h=this.pow(l,o),f=this.pow(e,o.addn(1).iushrn(1)),d=this.pow(e,o),p=s;0!==d.cmp(a);){for(var m=d,_=0;0!==m.cmp(a);_++)m=m.redSqr();r(_<p);var g=this.pow(h,new i(1).iushln(p-_-1));f=f.redMul(g),h=g.redSqr(),d=d.redMul(h),p=_}return f},S.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},S.prototype.pow=function(e,t){if(t.isZero())return new i(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new i(1).toRed(this),r[1]=e;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],e);var o=r[0],s=0,a=0,u=t.bitLength()%26;for(0===u&&(u=26),n=t.length-1;n>=0;n--){for(var c=t.words[n],l=u-1;l>=0;l--){var h=c>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==h||0!==s?(s<<=1,s|=h,(4==++a||0===n&&0===l)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}u=26}return o},S.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},S.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new x(e)},n(x,S),x.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},x.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},x.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},x.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).iushrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},x.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(fl,l)),fl.exports}function pl(){if(al)return hl;al=1;var e=l&&l.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(hl,"__esModule",{value:!0}),hl.getLength=hl.decode=hl.encode=void 0;const t=e(dl());function r(e,t){if("0"===e[0]&&"0"===e[1])throw new Error("invalid RLP: extra zeros");return parseInt(e,t)}function n(e,t){if(e<56)return Buffer.from([e+t]);{const r=s(e),n=s(t+55+r.length/2);return Buffer.from(n+r,"hex")}}function i(e){let t,n,o,s,a;const u=[],c=e[0];if(c<=127)return{data:e.slice(0,1),remainder:e.slice(1)};if(c<=183){if(t=c-127,o=128===c?Buffer.from([]):e.slice(1,t),2===t&&o[0]<128)throw new Error("invalid rlp encoding: byte must be less 0x80");return{data:o,remainder:e.slice(t)}}if(c<=191){if(n=c-182,e.length-1<n)throw new Error("invalid RLP: not enough bytes for string length");if(t=r(e.slice(1,n).toString("hex"),16),t<=55)throw new Error("invalid RLP: expected string length to be greater than 55");if(o=e.slice(n,t+n),o.length<t)throw new Error("invalid RLP: not enough bytes for string");return{data:o,remainder:e.slice(t+n)}}if(c<=247){for(t=c-191,s=e.slice(1,t);s.length;)a=i(s),u.push(a.data),s=a.remainder;return{data:u,remainder:e.slice(t)}}{n=c-246,t=r(e.slice(1,n).toString("hex"),16);const o=n+t;if(o>e.length)throw new Error("invalid rlp: total length is larger than the data");if(s=e.slice(n,o),0===s.length)throw new Error("invalid rlp, List has a invalid length");for(;s.length;)a=i(s),u.push(a.data),s=a.remainder;return{data:u,remainder:e.slice(o)}}}function o(e){return"0x"===e.slice(0,2)}function s(e){if(e<0)throw new Error("Invalid integer as argument, must be unsigned!");const t=e.toString(16);return t.length%2?`0${t}`:t}function a(e){if(!Buffer.isBuffer(e)){if("string"==typeof e)return o(e)?Buffer.from((r="string"!=typeof(n=e)?n:o(n)?n.slice(2):n).length%2?`0${r}`:r,"hex"):Buffer.from(e);if("number"==typeof e||"bigint"==typeof e)return e?function(e){const t=s(e);return Buffer.from(t,"hex")}(e):Buffer.from([]);if(null==e)return Buffer.from([]);if(e instanceof Uint8Array)return Buffer.from(e);if(t.default.isBN(e))return Buffer.from(e.toArray());throw new Error("invalid type")}var r,n;return e}return hl.encode=function e(t){if(Array.isArray(t)){const r=[];for(let n=0;n<t.length;n++)r.push(e(t[n]));const i=Buffer.concat(r);return Buffer.concat([n(i.length,192),i])}{const e=a(t);return 1===e.length&&e[0]<128?e:Buffer.concat([n(e.length,128),e])}},hl.decode=function(e,t=!1){if(!e||0===e.length)return Buffer.from([]);const r=i(a(e));if(t)return r;if(0!==r.remainder.length)throw new Error("invalid remainder");return r.data},hl.getLength=function(e){if(!e||0===e.length)return Buffer.from([]);const t=a(e),n=t[0];if(n<=127)return t.length;if(n<=183)return n-127;if(n<=191)return n-182;if(n<=247)return n-191;{const e=n-246;return e+r(t.slice(1,e).toString("hex"),16)}},hl}function ml(){return cl?ul:(cl=1,ul=g.createHash)}function _l(){return ll||(ll=1,function(e){var t="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},r=Oc(),n=r.keccak224,i=r.keccak384,s=r.keccak256,a=r.keccak512,u=ol(),c=T,l=pl(),h=b.exports,f=ml(),d=o.exports.Buffer;Object.assign(e,O),e.MAX_INTEGER=new h("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16),e.TWO_POW256=new h("10000000000000000000000000000000000000000000000000000000000000000",16),e.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",e.SHA3_NULL_S=e.KECCAK256_NULL_S,e.KECCAK256_NULL=d.from(e.KECCAK256_NULL_S,"hex"),e.SHA3_NULL=e.KECCAK256_NULL,e.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",e.SHA3_RLP_ARRAY_S=e.KECCAK256_RLP_ARRAY_S,e.KECCAK256_RLP_ARRAY=d.from(e.KECCAK256_RLP_ARRAY_S,"hex"),e.SHA3_RLP_ARRAY=e.KECCAK256_RLP_ARRAY,e.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",e.SHA3_RLP_S=e.KECCAK256_RLP_S,e.KECCAK256_RLP=d.from(e.KECCAK256_RLP_S,"hex"),e.SHA3_RLP=e.KECCAK256_RLP,e.BN=h,e.rlp=l,e.secp256k1=u,e.zeros=function(e){return d.allocUnsafe(e).fill(0)},e.zeroAddress=function(){var t=e.zeros(20);return e.bufferToHex(t)},e.setLengthLeft=e.setLength=function(t,r,n){var i=e.zeros(r);return t=e.toBuffer(t),n?t.length<r?(t.copy(i),i):t.slice(0,r):t.length<r?(t.copy(i,r-t.length),i):t.slice(-r)},e.setLengthRight=function(t,r){return e.setLength(t,r,!0)},e.unpad=e.stripZeros=function(t){for(var r=(t=e.stripHexPrefix(t))[0];t.length>0&&"0"===r.toString();)r=(t=t.slice(1))[0];return t},e.toBuffer=function(t){if(!d.isBuffer(t))if(Array.isArray(t))t=d.from(t);else if("string"==typeof t)t=e.isHexString(t)?d.from(e.padToEven(e.stripHexPrefix(t)),"hex"):d.from(t);else if("number"==typeof t)t=e.intToBuffer(t);else if(null==t)t=d.allocUnsafe(0);else if(h.isBN(t))t=t.toArrayLike(d);else{if(!t.toArray)throw new Error("invalid type");t=d.from(t.toArray())}return t},e.bufferToInt=function(t){return new h(e.toBuffer(t)).toNumber()},e.bufferToHex=function(t){return"0x"+(t=e.toBuffer(t)).toString("hex")},e.fromSigned=function(e){return new h(e).fromTwos(256)},e.toUnsigned=function(e){return d.from(e.toTwos(256).toArray())},e.keccak=function(t,r){switch(t=e.toBuffer(t),r||(r=256),r){case 224:return n(t);case 256:return s(t);case 384:return i(t);case 512:return a(t);default:throw new Error("Invald algorithm: keccak"+r)}},e.keccak256=function(t){return e.keccak(t)},e.sha3=e.keccak,e.sha256=function(t){return t=e.toBuffer(t),f("sha256").update(t).digest()},e.ripemd160=function(t,r){t=e.toBuffer(t);var n=f("rmd160").update(t).digest();return!0===r?e.setLength(n,32):n},e.rlphash=function(t){return e.keccak(l.encode(t))},e.isValidPrivate=function(e){return u.privateKeyVerify(e)},e.isValidPublic=function(e,t){return 64===e.length?u.publicKeyVerify(d.concat([d.from([4]),e])):!!t&&u.publicKeyVerify(e)},e.pubToAddress=e.publicToAddress=function(t,r){return t=e.toBuffer(t),r&&64!==t.length&&(t=u.publicKeyConvert(t,!1).slice(1)),c(64===t.length),e.keccak(t).slice(-20)};var p=e.privateToPublic=function(t){return t=e.toBuffer(t),u.publicKeyCreate(t,!1).slice(1)};e.importPublic=function(t){return 64!==(t=e.toBuffer(t)).length&&(t=u.publicKeyConvert(t,!1).slice(1)),t},e.ecsign=function(e,t){var r=u.sign(e,t),n={};return n.r=r.signature.slice(0,32),n.s=r.signature.slice(32,64),n.v=r.recovery+27,n},e.hashPersonalMessage=function(t){var r=e.toBuffer("Ethereum Signed Message:\n"+t.length.toString());return e.keccak(d.concat([r,t]))},e.ecrecover=function(t,r,n,i){var o=d.concat([e.setLength(n,32),e.setLength(i,32)],64),s=r-27;if(0!==s&&1!==s)throw new Error("Invalid signature v value");var a=u.recover(t,o,s);return u.publicKeyConvert(a,!1).slice(1)},e.toRpcSig=function(t,r,n){if(27!==t&&28!==t)throw new Error("Invalid recovery id");return e.bufferToHex(d.concat([e.setLengthLeft(r,32),e.setLengthLeft(n,32),e.toBuffer(t-27)]))},e.fromRpcSig=function(t){if(65!==(t=e.toBuffer(t)).length)throw new Error("Invalid signature length");var r=t[64];return r<27&&(r+=27),{v:r,r:t.slice(0,32),s:t.slice(32,64)}},e.privateToAddress=function(t){return e.publicToAddress(p(t))},e.isValidAddress=function(e){return/^0x[0-9a-fA-F]{40}$/.test(e)},e.isZeroAddress=function(t){return e.zeroAddress()===e.addHexPrefix(t)},e.toChecksumAddress=function(t){t=e.stripHexPrefix(t).toLowerCase();for(var r=e.keccak(t).toString("hex"),n="0x",i=0;i<t.length;i++)parseInt(r[i],16)>=8?n+=t[i].toUpperCase():n+=t[i];return n},e.isValidChecksumAddress=function(t){return e.isValidAddress(t)&&e.toChecksumAddress(t)===t},e.generateAddress=function(t,r){return t=e.toBuffer(t),r=(r=new h(r)).isZero()?null:d.from(r.toArray()),e.rlphash([t,r]).slice(-20)},e.isPrecompiled=function(t){var r=e.unpad(t);return 1===r.length&&r[0]>=1&&r[0]<=8},e.addHexPrefix=function(t){return"string"!=typeof t||e.isHexPrefixed(t)?t:"0x"+t},e.isValidSignature=function(e,t,r,n){var i=new h("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),o=new h("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",16);return 32===t.length&&32===r.length&&((27===e||28===e)&&(t=new h(t),r=new h(r),!(t.isZero()||t.gt(o)||r.isZero()||r.gt(o))&&(!1!==n||1!==new h(r).cmp(i))))},e.baToJSON=function(t){if(d.isBuffer(t))return"0x"+t.toString("hex");if(t instanceof Array){for(var r=[],n=0;n<t.length;n++)r.push(e.baToJSON(t[n]));return r}},e.defineProperties=function(r,n,i){if(r.raw=[],r._fields=[],r.toJSON=function(t){if(t){var n={};return r._fields.forEach((function(e){n[e]="0x"+r[e].toString("hex")})),n}return e.baToJSON(this.raw)},r.serialize=function(){return l.encode(r.raw)},n.forEach((function(t,n){function i(){return r.raw[n]}function o(i){"00"!==(i=e.toBuffer(i)).toString("hex")||t.allowZero||(i=d.allocUnsafe(0)),t.allowLess&&t.length?(i=e.stripZeros(i),c(t.length>=i.length,"The field "+t.name+" must not have more "+t.length+" bytes")):t.allowZero&&0===i.length||!t.length||c(t.length===i.length,"The field "+t.name+" must have byte length of "+t.length),r.raw[n]=i}r._fields.push(t.name),Object.defineProperty(r,t.name,{enumerable:!0,configurable:!0,get:i,set:o}),t.default&&(r[t.name]=t.default),t.alias&&Object.defineProperty(r,t.alias,{enumerable:!1,configurable:!0,set:o,get:i})})),i)if("string"==typeof i&&(i=d.from(e.stripHexPrefix(i),"hex")),d.isBuffer(i)&&(i=l.decode(i)),Array.isArray(i)){if(i.length>r._fields.length)throw new Error("wrong number of fields in data");i.forEach((function(t,n){r[r._fields[n]]=e.toBuffer(t)}))}else{if("object"!==(void 0===i?"undefined":t(i)))throw new Error("invalid data");var o=Object.keys(i);n.forEach((function(e){-1!==o.indexOf(e.name)&&(r[e.name]=i[e.name]),-1!==o.indexOf(e.alias)&&(r[e.alias]=i[e.alias])}))}}}(mu)),mu}var gl,vl,yl,wl,bl,El,Ml,Sl={exports:{}};function xl(){if(gl)return Sl.exports;gl=1;var e,t="object"==typeof Reflect?Reflect:null,r=t&&"function"==typeof t.apply?t.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};e=t&&"function"==typeof t.ownKeys?t.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var n=Number.isNaN||function(e){return e!=e};function i(){i.init.call(this)}Sl.exports=i,Sl.exports.once=function(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,o),n(r)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}p(e,t,o,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&p(e,"error",t,r)}(e,i,{once:!0})}))},i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var o=10;function s(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function a(e){return void 0===e._maxListeners?i.defaultMaxListeners:e._maxListeners}function u(e,t,r,n){var i,o,u,c;if(s(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),u=o[t]),void 0===u)u=o[t]=r,++e._eventsCount;else if("function"==typeof u?u=o[t]=n?[r,u]:[u,r]:n?u.unshift(r):u.push(r),(i=a(e))>0&&u.length>i&&!u.warned){u.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+u.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=u.length,c=l,console&&console.warn&&console.warn(c)}return e}function c(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function l(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=c.bind(n);return i.listener=r,n.wrapFn=i,i}function h(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(i):d(i,i.length)}function f(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function d(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function p(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function i(o){n.once&&e.removeEventListener(t,i),r(o)}))}}return Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(e){if("number"!=typeof e||e<0||n(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");o=e}}),i.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},i.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||n(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},i.prototype.getMaxListeners=function(){return a(this)},i.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i="error"===e,o=this._events;if(void 0!==o)i=i&&void 0===o.error;else if(!i)return!1;if(i){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var u=o[e];if(void 0===u)return!1;if("function"==typeof u)r(u,this,t);else{var c=u.length,l=d(u,c);for(n=0;n<c;++n)r(l[n],this,t)}return!0},i.prototype.addListener=function(e,t){return u(this,e,t,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(e,t){return u(this,e,t,!0)},i.prototype.once=function(e,t){return s(t),this.on(e,l(this,e,t)),this},i.prototype.prependOnceListener=function(e,t){return s(t),this.prependListener(e,l(this,e,t)),this},i.prototype.removeListener=function(e,t){var r,n,i,o,a;if(s(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){a=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,a||t)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(i=o[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},i.prototype.listeners=function(e){return h(this,e,!0)},i.prototype.rawListeners=function(e){return h(this,e,!1)},i.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):f.call(e,t)},i.prototype.listenerCount=f,i.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]},Sl.exports}function kl(){if(yl)return vl;yl=1;const e=R,t=xl();var r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};function i(){t.call(this)}function o(e,t,r){try{n(e,t,r)}catch(e){setTimeout((()=>{throw e}))}}return vl=i,e.inherits(i,t),i.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return!1;if(n){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var u=i[e];if(void 0===u)return!1;if("function"==typeof u)o(u,this,t);else{var c=u.length,l=function(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}(u,c);for(r=0;r<c;++r)o(l[r],this,t)}return!0},vl}function Rl(){if(Ml)return El;Ml=1;const e=B,t=function(){if(bl)return wl;bl=1,s();const e=kl(),t=(e,t)=>e+t,r=["sync","latest"];function n(e){return Number.parseInt(e,16)}return wl=class extends e{constructor(e={}){super(),this._blockResetDuration=e.blockResetDuration||2e4,this._blockResetTimeout,this._currentBlock=null,this._isRunning=!1,this._onNewListener=this._onNewListener.bind(this),this._onRemoveListener=this._onRemoveListener.bind(this),this._resetCurrentBlock=this._resetCurrentBlock.bind(this),this._setupInternalEvents()}isRunning(){return this._isRunning}getCurrentBlock(){return this._currentBlock}async getLatestBlock(){return this._currentBlock?this._currentBlock:await new Promise((e=>this.once("latest",e)))}removeAllListeners(e){e?super.removeAllListeners(e):super.removeAllListeners(),this._setupInternalEvents(),this._onRemoveListener()}_start(){}_end(){}_setupInternalEvents(){this.removeListener("newListener",this._onNewListener),this.removeListener("removeListener",this._onRemoveListener),this.on("newListener",this._onNewListener),this.on("removeListener",this._onRemoveListener)}_onNewListener(e,t){r.includes(e)&&this._maybeStart()}_onRemoveListener(e,t){this._getBlockTrackerEventCount()>0||this._maybeEnd()}_maybeStart(){this._isRunning||(this._isRunning=!0,this._cancelBlockResetTimeout(),this._start())}_maybeEnd(){this._isRunning&&(this._isRunning=!1,this._setupBlockResetTimeout(),this._end())}_getBlockTrackerEventCount(){return r.map((e=>this.listenerCount(e))).reduce(t)}_newPotentialLatest(e){const t=this._currentBlock;t&&n(e)<=n(t)||this._setCurrentBlock(e)}_setCurrentBlock(e){const t=this._currentBlock;this._currentBlock=e,this.emit("latest",e),this.emit("sync",{oldBlock:t,newBlock:e})}_setupBlockResetTimeout(){this._cancelBlockResetTimeout(),this._blockResetTimeout=setTimeout(this._resetCurrentBlock,this._blockResetDuration),this._blockResetTimeout.unref&&this._blockResetTimeout.unref()}_cancelBlockResetTimeout(){clearTimeout(this._blockResetTimeout)}_resetCurrentBlock(){this._currentBlock=null}}}();function r(e,t){return new Promise((r=>{const n=setTimeout(r,e);n.unref&&t&&n.unref()}))}return El=class extends t{constructor(e={}){if(!e.provider)throw new Error("PollingBlockTracker - no provider specified.");const t=e.pollingInterval||2e4,r=e.retryTimeout||t/10,n=void 0===e.keepEventLoopActive||e.keepEventLoopActive,i=e.setSkipCacheFlag||!1;super(Object.assign({blockResetDuration:t},e)),this._provider=e.provider,this._pollingInterval=t,this._retryTimeout=r,this._keepEventLoopActive=n,this._setSkipCacheFlag=i}async checkForLatestBlock(){return await this._updateLatestBlock(),await this.getLatestBlock()}_start(){this._performSync().catch((e=>this.emit("error",e)))}async _performSync(){for(;this._isRunning;)try{await this._updateLatestBlock(),await r(this._pollingInterval,!this._keepEventLoopActive)}catch(e){const t=new Error(`PollingBlockTracker - encountered an error while attempting to update latest block:\n${e.stack}`);try{this.emit("error",t)}catch(e){console.error(t)}await r(this._retryTimeout,!this._keepEventLoopActive)}}async _updateLatestBlock(){const e=await this._fetchLatestBlock();this._newPotentialLatest(e)}async _fetchLatestBlock(){const t={jsonrpc:"2.0",id:1,method:"eth_blockNumber",params:[]};this._setSkipCacheFlag&&(t.skipCache=!0);const r=await e((e=>this._provider.sendAsync(t,e)))();if(r.error)throw new Error(`PollingBlockTracker - encountered error fetching block:\n${r.error}`);return r.result}}}var Tl,Cl,Al,Ol,Ll,Bl,Pl,Il,Nl,Dl,Ul,jl,Hl,ql,Fl,Wl,Kl,zl,Gl,Vl,$l={exports:{}},Yl={exports:{}},Zl={exports:{}};function Jl(){if(Cl)return Tl;Cl=1;var e="object"==typeof l&&l&&l.Object===Object&&l;return Tl=e}function Ql(){if(Ol)return Al;Ol=1;var e=Jl(),t="object"==typeof self&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return Al=r}function Xl(){if(Bl)return Ll;Bl=1;var e=Ql().Symbol;return Ll=e}function eh(){if(jl)return Ul;jl=1;var e=Xl(),t=function(){if(Il)return Pl;Il=1;var e=Xl(),t=Object.prototype,r=t.hasOwnProperty,n=t.toString,i=e?e.toStringTag:void 0;return Pl=function(e){var t=r.call(e,i),o=e[i];try{e[i]=void 0;var s=!0}catch(e){}var a=n.call(e);return s&&(t?e[i]=o:delete e[i]),a}}(),r=function(){if(Dl)return Nl;Dl=1;var e=Object.prototype.toString;return Nl=function(t){return e.call(t)}}(),n=e?e.toStringTag:void 0;return Ul=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":n&&n in Object(e)?t(e):r(e)}}function th(){if(ql)return Hl;return ql=1,Hl=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}}function rh(){if(zl)return Kl;zl=1;return Kl=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}}function nh(){if(Vl)return Gl;Vl=1;var e=function(){if(Wl)return Fl;Wl=1;var e=eh(),t=th();return Fl=function(r){if(!t(r))return!1;var n=e(r);return"[object Function]"==n||"[object GeneratorFunction]"==n||"[object AsyncFunction]"==n||"[object Proxy]"==n}}(),t=rh();return Gl=function(r){return null!=r&&t(r.length)&&!e(r)}}var ih,oh={exports:{}};function sh(){return ih||(ih=1,e=oh,t=oh.exports,Object.defineProperty(t,"__esModule",{value:!0}),t.default={},e.exports=t.default),oh.exports;var e,t}var ah,uh,ch={exports:{}},lh={exports:{}};function hh(){if(uh)return ah;return uh=1,ah=function(){}}var fh,dh={exports:{}};function ph(){return fh||(fh=1,e=dh,t=dh.exports,Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return function(){if(null!==e){var t=e;e=null,t.apply(this,arguments)}}},e.exports=t.default),dh.exports;var e,t}var mh,_h,gh,vh,yh,wh,bh,Eh,Mh,Sh,xh,kh={exports:{}},Rh={exports:{}};function Th(){if(yh)return vh;return yh=1,vh=function(e){return null!=e&&"object"==typeof e}}function Ch(){if(Mh)return Eh;Mh=1;var e=function(){if(bh)return wh;bh=1;var e=eh(),t=Th();return wh=function(r){return t(r)&&"[object Arguments]"==e(r)}}(),t=Th(),r=Object.prototype,n=r.hasOwnProperty,i=r.propertyIsEnumerable,o=e(function(){return arguments}())?e:function(e){return t(e)&&n.call(e,"callee")&&!i.call(e,"callee")};return Eh=o}function Ah(){if(xh)return Sh;xh=1;var e=Array.isArray;return Sh=e}var Oh,Lh,Bh,Ph,Ih,Nh,Dh,Uh,jh,Hh={exports:{}};function qh(){return Bh||(Bh=1,function(e,t){var r=Ql(),n=Lh?Oh:(Lh=1,Oh=function(){return!1}),i=t&&!t.nodeType&&t,o=i&&e&&!e.nodeType&&e,s=o&&o.exports===i?r.Buffer:void 0,a=(s?s.isBuffer:void 0)||n;e.exports=a}(Hh,Hh.exports)),Hh.exports}var Fh,Wh,Kh,zh,Gh,Vh,$h,Yh,Zh,Jh,Qh,Xh,ef,tf,rf,nf,of={exports:{}};function sf(){if(Kh)return Wh;Kh=1;var e=function(){if(Dh)return Nh;Dh=1;var e=eh(),t=rh(),r=Th(),n={};return n["[object Float32Array]"]=n["[object Float64Array]"]=n["[object Int8Array]"]=n["[object Int16Array]"]=n["[object Int32Array]"]=n["[object Uint8Array]"]=n["[object Uint8ClampedArray]"]=n["[object Uint16Array]"]=n["[object Uint32Array]"]=!0,n["[object Arguments]"]=n["[object Array]"]=n["[object ArrayBuffer]"]=n["[object Boolean]"]=n["[object DataView]"]=n["[object Date]"]=n["[object Error]"]=n["[object Function]"]=n["[object Map]"]=n["[object Number]"]=n["[object Object]"]=n["[object RegExp]"]=n["[object Set]"]=n["[object String]"]=n["[object WeakMap]"]=!1,Nh=function(i){return r(i)&&t(i.length)&&!!n[e(i)]}}(),t=jh?Uh:(jh=1,Uh=function(e){return function(t){return e(t)}}),r=function(){return Fh||(Fh=1,e=of,t=of.exports,r=Jl(),n=t&&!t.nodeType&&t,i=n&&e&&!e.nodeType&&e,o=i&&i.exports===n&&r.process,s=function(){try{return i&&i.require&&i.require("util").types||o&&o.binding&&o.binding("util")}catch(e){}}(),e.exports=s),of.exports;var e,t,r,n,i,o,s}(),n=r&&r.isTypedArray,i=n?t(n):e;return Wh=i}function af(){if(Gh)return zh;Gh=1;var e=gh?_h:(gh=1,_h=function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}),t=Ch(),r=Ah(),n=qh(),i=function(){if(Ih)return Ph;Ih=1;var e=/^(?:0|[1-9]\d*)$/;return Ph=function(t,r){var n=typeof t;return!!(r=null==r?9007199254740991:r)&&("number"==n||"symbol"!=n&&e.test(t))&&t>-1&&t%1==0&&t<r},Ph}(),o=sf(),s=Object.prototype.hasOwnProperty;return zh=function(a,u){var c=r(a),l=!c&&t(a),h=!c&&!l&&n(a),f=!c&&!l&&!h&&o(a),d=c||l||h||f,p=d?e(a.length,String):[],m=p.length;for(var _ in a)!u&&!s.call(a,_)||d&&("length"==_||h&&("offset"==_||"parent"==_)||f&&("buffer"==_||"byteLength"==_||"byteOffset"==_)||i(_,m))||p.push(_);return p},zh}function uf(){if(Qh)return Jh;Qh=1;var e=(Zh?Yh:(Zh=1,Yh=function(e,t){return function(r){return e(t(r))}}))(Object.keys,Object);return Jh=e}function cf(){if(ef)return Xh;ef=1;var e=function(){if($h)return Vh;$h=1;var e=Object.prototype;return Vh=function(t){var r=t&&t.constructor;return t===("function"==typeof r&&r.prototype||e)}}(),t=uf(),r=Object.prototype.hasOwnProperty;return Xh=function(n){if(!e(n))return t(n);var i=[];for(var o in Object(n))r.call(n,o)&&"constructor"!=o&&i.push(o);return i},Xh}function lf(){return nf||(nf=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){if((0,r.default)(e))return function(e){var t=-1,r=e.length;return function(){return++t<r?{value:e[t],key:t}:null}}(e);var t=(0,i.default)(e);return t?function(e){var t=-1;return function(){var r=e.next();return r.done?null:(t++,{value:r.value,key:t})}}(t):(n=e,o=(0,s.default)(n),a=-1,u=o.length,function e(){var t=o[++a];return"__proto__"===t?e():a<u?{value:n[t],key:t}:null});var n,o,a,u};var r=a(nh()),n=(mh||(mh=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return r&&e[r]&&e[r]()};var r="function"==typeof Symbol&&Symbol.iterator;e.exports=t.default}(Rh,Rh.exports)),Rh.exports),i=a(n),o=function(){if(rf)return tf;rf=1;var e=af(),t=cf(),r=nh();return tf=function(n){return r(n)?e(n):t(n)},tf}(),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default}(kh,kh.exports)),kh.exports}var hf,ff,df={exports:{}};function pf(){return hf||(hf=1,e=df,t=df.exports,Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return function(){if(null===e)throw new Error("Callback was already called.");var t=e;e=null,t.apply(this,arguments)}},e.exports=t.default),df.exports;var e,t}function mf(){return ff||(ff=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return function(t,a,u){if(u=(0,n.default)(u||r.default),e<=0||!t)return u(null);var c=(0,i.default)(t),l=!1,h=0,f=!1;function d(e,t){if(h-=1,e)l=!0,u(e);else{if(t===s.default||l&&h<=0)return l=!0,u(null);f||p()}}function p(){for(f=!0;h<e&&!l;){var t=c();if(null===t)return l=!0,void(h<=0&&u(null));h+=1,a(t.value,t.key,(0,o.default)(d))}f=!1}p()}};var r=a(hh()),n=a(ph()),i=a(lf()),o=a(pf()),s=a(sh());function a(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default}(lh,lh.exports)),lh.exports}var _f,gf,vf={},yf={exports:{}},wf={exports:{}},bf={exports:{}};function Ef(){return _f||(_f=1,e=bf,t=bf.exports,Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){t|=0;for(var r=Math.max(e.length-t,0),n=Array(r),i=0;i<r;i++)n[i]=e[t+i];return n},e.exports=t.default),bf.exports;var e,t}var Mf,Sf,xf,kf,Rf={};function Tf(){return Sf||(Sf=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return(0,i.default)((function(t,n){var i;try{i=e.apply(this,t)}catch(e){return n(e)}(0,r.default)(i)&&"function"==typeof i.then?i.then((function(e){u(n,null,e)}),(function(e){u(n,e.message?e:new Error(e))})):n(null,i)}))};var r=a(th()),n=(gf||(gf=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return function(){var t=(0,n.default)(arguments),r=t.pop();e.call(this,t,r)}};var r,n=(r=Ef())&&r.__esModule?r:{default:r};e.exports=t.default}(wf,wf.exports)),wf.exports),i=a(n),o=function(){if(Mf)return Rf;Mf=1,Object.defineProperty(Rf,"__esModule",{value:!0}),Rf.hasNextTick=Rf.hasSetImmediate=void 0,Rf.fallback=s,Rf.wrap=a;var e,t,r=Ef(),n=(e=r)&&e.__esModule?e:{default:e},i=Rf.hasSetImmediate="function"==typeof setImmediate&&setImmediate,o=Rf.hasNextTick="object"==typeof process&&"function"==typeof process.nextTick;function s(e){setTimeout(e,0)}function a(e){return function(t){var r=(0,n.default)(arguments,1);e((function(){t.apply(null,r)}))}}return t=i?setImmediate:o?process.nextTick:s,Rf.default=a(t),Rf}(),s=a(o);function a(e){return e&&e.__esModule?e:{default:e}}function u(e,t,r){try{e(t,r)}catch(e){(0,s.default)(c,e)}}function c(e){throw e}e.exports=t.default}(yf,yf.exports)),yf.exports}function Cf(){if(xf)return vf;xf=1,Object.defineProperty(vf,"__esModule",{value:!0}),vf.isAsync=void 0;var e,t=Tf(),r=(e=t)&&e.__esModule?e:{default:e};var n="function"==typeof Symbol;function i(e){return n&&"AsyncFunction"===e[Symbol.toStringTag]}return vf.default=function(e){return i(e)?(0,r.default)(e):e},vf.isAsync=i,vf}var Af,Of,Lf,Bf={exports:{}};function Pf(){return Af||(Af=1,e=Bf,t=Bf.exports,Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){return function(r,n,i){return e(r,t,n,i)}},e.exports=t.default),Bf.exports;var e,t}function If(){return Of||(Of=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,n){((0,r.default)(e)?f:d)(e,(0,l.default)(t),n)};var r=h(nh()),n=h(sh()),i=(kf||(kf=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,i,o){(0,r.default)(t)(e,(0,n.default)(i),o)};var r=i(mf()),n=i(Cf());function i(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default}(ch,ch.exports)),ch.exports),o=h(i),s=h(Pf()),a=h(hh()),u=h(ph()),c=h(pf()),l=h(Cf());function h(e){return e&&e.__esModule?e:{default:e}}function f(e,t,r){r=(0,u.default)(r||a.default);var i=0,o=0,s=e.length;function l(e,t){e?r(e):++o!==s&&t!==n.default||r(null)}for(0===s&&r(null);i<s;i++)t(e[i],i,(0,c.default)(l))}var d=(0,s.default)(o.default,1/0);e.exports=t.default}(Zl,Zl.exports)),Zl.exports}var Nf,Df,Uf={exports:{}};function jf(){return Df||(Df=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=(Lf||(Lf=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return function(t,i,o){return e(r.default,t,(0,n.default)(i),o)}};var r=i(If()),n=i(Cf());function i(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default}(Yl,Yl.exports)),Yl.exports),n=s(r),i=(Nf||(Nf=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,i,o){o=o||r.default,t=t||[];var s=[],a=0,u=(0,n.default)(i);e(t,(function(e,t,r){var n=a++;u(e,(function(e,t){s[n]=t,r(e)}))}),(function(e){o(e,s)}))};var r=i(hh()),n=i(Cf());function i(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default}(Uf,Uf.exports)),Uf.exports),o=s(i);function s(e){return e&&e.__esModule?e:{default:e}}t.default=(0,n.default)(o.default),e.exports=t.default}($l,$l.exports)),$l.exports}var Hf,qf,Ff,Wf,Kf,zf,Gf,Vf,$f,Yf,Zf,Jf,Qf,Xf,ed,td,rd,nd,id,od,sd,ad,ud,cd,ld,hd,fd,dd={exports:{}},pd={exports:{}},md={exports:{}};function _d(){return qf||(qf=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,n,s){(0,r.default)(t)(e,(0,i.default)((0,o.default)(n)),s)};var r=s(mf()),n=function(){return Hf||(Hf=1,e=md,t=md.exports,Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return function(t,r,n){return e(t,n)}},e.exports=t.default),md.exports;var e,t}(),i=s(n),o=s(Cf());function s(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default}(pd,pd.exports)),pd.exports}function gd(){return Ff||(Ff=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=i(_d()),n=i(Pf());function i(e){return e&&e.__esModule?e:{default:e}}t.default=(0,n.default)(r.default,1),e.exports=t.default}(dd,dd.exports)),dd.exports}function vd(){if(Gf)return zf;Gf=1;const e=L;function t(e){return"never"!==i(e)}function r(e){var t=n(e);return t>=e.params.length?e.params:"eth_getBlockByNumber"===e.method?e.params.slice(1):e.params.slice(0,t)}function n(e){switch(e.method){case"eth_getStorageAt":return 2;case"eth_getBalance":case"eth_getCode":case"eth_getTransactionCount":case"eth_call":case"eth_estimateGas":return 1;case"eth_getBlockByNumber":return 0;default:return}}function i(e){switch(e.method){case"web3_clientVersion":case"web3_sha3":case"eth_protocolVersion":case"eth_getBlockTransactionCountByHash":case"eth_getUncleCountByBlockHash":case"eth_getCode":case"eth_getBlockByHash":case"eth_getTransactionByHash":case"eth_getTransactionByBlockHashAndIndex":case"eth_getTransactionReceipt":case"eth_getUncleByBlockHashAndIndex":case"eth_getCompilers":case"eth_compileLLL":case"eth_compileSolidity":case"eth_compileSerpent":case"shh_version":return"perma";case"eth_getBlockByNumber":case"eth_getBlockTransactionCountByNumber":case"eth_getUncleCountByBlockNumber":case"eth_getTransactionByBlockNumberAndIndex":case"eth_getUncleByBlockNumberAndIndex":return"fork";case"eth_gasPrice":case"eth_getBalance":case"eth_getStorageAt":case"eth_getTransactionCount":case"eth_call":case"eth_estimateGas":case"eth_getFilterLogs":case"eth_getLogs":case"eth_blockNumber":return"block";case"net_version":case"net_peerCount":case"net_listening":case"eth_syncing":case"eth_sign":case"eth_coinbase":case"eth_mining":case"eth_hashrate":case"eth_accounts":case"eth_sendTransaction":case"eth_sendRawTransaction":case"eth_newFilter":case"eth_newBlockFilter":case"eth_newPendingTransactionFilter":case"eth_uninstallFilter":case"eth_getFilterChanges":case"eth_getWork":case"eth_submitWork":case"eth_submitHashrate":case"db_putString":case"db_getString":case"db_putHex":case"db_getHex":case"shh_post":case"shh_newIdentity":case"shh_hasIdentity":case"shh_newGroup":case"shh_addToGroup":case"shh_newFilter":case"shh_uninstallFilter":case"shh_getFilterChanges":case"shh_getMessages":return"never"}}return zf={cacheIdentifierForPayload:function(n,i={}){if(!t(n))return null;const{includeBlockRef:o}=i,s=o?n.params:r(n);return n.method+":"+e(s)},canCache:t,blockTagForPayload:function(e){var t=n(e);if(t>=e.params.length)return null;return e.params[t]},paramsWithoutBlockTag:r,blockTagParamIndex:n,cacheTypeForPayload:i},zf}function yd(){if(Zf)return Yf;Zf=1;const e=$f?Vf:($f=1,Vf=function(){return Math.floor(Number.MAX_SAFE_INTEGER*Math.random())}),t=a();return Yf=function(r){return t({id:e(),jsonrpc:"2.0",params:[]},r)}}function wd(){if(ed)return Xf;ed=1;const e=yd();function t(){}return Xf=t,t.prototype.setEngine=function(e){const t=this;t.engine||(t.engine=e,e.on("block",(function(e){t.currentBlock=e})),e.on("start",(function(){t.start()})),e.on("stop",(function(){t.stop()})))},t.prototype.handleRequest=function(e,t,r){throw new Error("Subproviders should override `handleRequest`.")},t.prototype.emitPayload=function(t,r){this.engine.sendAsync(e(t),r)},t.prototype.stop=function(){},t.prototype.start=function(){},Xf}function bd(){if(rd)return td;rd=1;const e=wd();return td=class extends e{constructor(e){if(super(),!e)throw new Error("JsonRpcEngineMiddlewareSubprovider - no constructorFn specified");this._constructorFn=e}setEngine(e){if(this.middleware)throw new Error("JsonRpcEngineMiddlewareSubprovider - subprovider added to engine twice");const t=e._blockTracker,r=this._constructorFn({engine:e,provider:e,blockTracker:t});if(!r)throw new Error("JsonRpcEngineMiddlewareSubprovider - _constructorFn did not return middleware");if("function"!=typeof r)throw new Error("JsonRpcEngineMiddlewareSubprovider - specified middleware is not a function");this.middleware=r}handleRequest(e,t,r){const n={id:e.id};this.middleware(e,n,(function(e){t(((t,r,i)=>{t?(delete n.result,n.error={message:t.message||t}):n.result=r,e?e(i):i()}))}),(function(e){if(e)return r(e);r(null,n.result)}))}}}function Ed(){if(id)return nd;id=1;const e=L;function t(e){return"never"!==i(e)}function r(e){const t=n(e);return t>=e.params.length?e.params:"eth_getBlockByNumber"===e.method?e.params.slice(1):e.params.slice(0,t)}function n(e){switch(e.method){case"eth_getStorageAt":return 2;case"eth_getBalance":case"eth_getCode":case"eth_getTransactionCount":case"eth_call":return 1;case"eth_getBlockByNumber":return 0;default:return}}function i(e){switch(e.method){case"web3_clientVersion":case"web3_sha3":case"eth_protocolVersion":case"eth_getBlockTransactionCountByHash":case"eth_getUncleCountByBlockHash":case"eth_getCode":case"eth_getBlockByHash":case"eth_getTransactionByHash":case"eth_getTransactionByBlockHashAndIndex":case"eth_getTransactionReceipt":case"eth_getUncleByBlockHashAndIndex":case"eth_getCompilers":case"eth_compileLLL":case"eth_compileSolidity":case"eth_compileSerpent":case"shh_version":case"test_permaCache":return"perma";case"eth_getBlockByNumber":case"eth_getBlockTransactionCountByNumber":case"eth_getUncleCountByBlockNumber":case"eth_getTransactionByBlockNumberAndIndex":case"eth_getUncleByBlockNumberAndIndex":case"test_forkCache":return"fork";case"eth_gasPrice":case"eth_blockNumber":case"eth_getBalance":case"eth_getStorageAt":case"eth_getTransactionCount":case"eth_call":case"eth_estimateGas":case"eth_getFilterLogs":case"eth_getLogs":case"test_blockCache":return"block";case"net_version":case"net_peerCount":case"net_listening":case"eth_syncing":case"eth_sign":case"eth_coinbase":case"eth_mining":case"eth_hashrate":case"eth_accounts":case"eth_sendTransaction":case"eth_sendRawTransaction":case"eth_newFilter":case"eth_newBlockFilter":case"eth_newPendingTransactionFilter":case"eth_uninstallFilter":case"eth_getFilterChanges":case"eth_getWork":case"eth_submitWork":case"eth_submitHashrate":case"db_putString":case"db_getString":case"db_putHex":case"db_getHex":case"shh_post":case"shh_newIdentity":case"shh_hasIdentity":case"shh_newGroup":case"shh_addToGroup":case"shh_newFilter":case"shh_uninstallFilter":case"shh_getFilterChanges":case"shh_getMessages":case"test_neverCache":return"never"}}return nd={cacheIdentifierForPayload:function(n,i){const o=i?r(n):n.params;return t(n)?n.method+":"+e(o):null},canCache:t,blockTagForPayload:function(e){let t=n(e);if(t>=e.params.length)return null;return e.params[t]},paramsWithoutBlockTag:r,blockTagParamIndex:n,cacheTypeForPayload:i},nd}function Md(){return sd||(sd=1,od=function(e){return(t,r,n,i)=>{let o;const s=new Promise((e=>{o=e}));let a,u;e(t,r,(async()=>{u=!0,n((e=>{a=e,o()})),await s})).then((async()=>{u?(await s,a(null)):i(null)})).catch((e=>{a?a(e):i(e)}))}}),od}var Sd,xd,kd,Rd,Td,Cd,Ad,Od,Ld,Bd,Pd,Id,Nd,Dd,Ud,jd,Hd,qd,Fd,Wd,Kd,zd,Gd,Vd={exports:{}};function $d(){return kd||(kd=1,Vd.exports=xd?Sd:(xd=1,Sd=function(e){return(t,r,n,i)=>{const o=e[t.method];return void 0===o?n():"function"==typeof o?o(t,r,n,i):(r.result=o,i())}})),Vd.exports}function Yd(){if(Td)return Rd;Td=1;const e=(e,t,r,n)=>function(...i){return new(0,t.promiseModule)(((o,s)=>{t.multiArgs?i.push(((...e)=>{t.errorFirst?e[0]?s(e):(e.shift(),o(e)):o(e)})):t.errorFirst?i.push(((e,t)=>{e?s(e):o(t)})):i.push(o);const a=this===r?n:this;Reflect.apply(e,a,i)}))},t=new WeakMap;return Rd=(r,n)=>{n={exclude:[/.+(?:Sync|Stream)$/],errorFirst:!0,promiseModule:Promise,...n};const i=typeof r;if(null===r||"object"!==i&&"function"!==i)throw new TypeError(`Expected \`input\` to be a \`Function\` or \`Object\`, got \`${null===r?"null":i}\``);const o=new WeakMap,s=new Proxy(r,{apply(t,r,i){const a=o.get(t);if(a)return Reflect.apply(a,r,i);const u=n.excludeMain?t:e(t,n,s,t);return o.set(t,u),Reflect.apply(u,r,i)},get(r,i){const a=r[i];if(!((e,r)=>{let i=t.get(e);if(i||(i={},t.set(e,i)),r in i)return i[r];const o=e=>"string"==typeof e||"symbol"==typeof r?r===e:e.test(r),s=Reflect.getOwnPropertyDescriptor(e,r),a=void 0===s||s.writable||s.configurable,u=(n.include?n.include.some(o):!n.exclude.some(o))&&a;return i[r]=u,u})(r,i)||a===Function.prototype[i])return a;const u=o.get(a);if(u)return u;if("function"==typeof a){const t=e(a,n,s,r);return o.set(a,t),t}return a}});return s},Rd}function Zd(){if(Ad)return Cd;Ad=1;const e=P.default;return Cd=class extends e{constructor(){super(),this.updates=[]}async initialize(){}async update(){throw new Error("BaseFilter - no update method specified")}addResults(e){this.updates=this.updates.concat(e),e.forEach((e=>this.emit("update",e)))}addInitialResults(e){}getChangesAndClear(){const e=this.updates;return this.updates=[],e}}}function Jd(){if(Pd)return Bd;function e(e){return e.sort(((e,r)=>"latest"===e||"earliest"===r?1:"latest"===r||"earliest"===e?-1:t(e)-t(r)))}function t(e){return null==e?e:Number.parseInt(e,16)}function r(e){if(null==e)return e;let t=e.toString(16);return t.length%2&&(t="0"+t),"0x"+t}function n(){return Math.floor(16*Math.random()).toString(16)}return Pd=1,Bd={minBlockRef:function(...t){return e(t)[0]},maxBlockRef:function(...t){const r=e(t);return r[r.length-1]},sortBlockRefs:e,bnToHex:function(e){return"0x"+e.toString(16)},blockRefIsNumber:function(e){return e&&!["earliest","latest","pending"].includes(e)},hexToInt:t,incrementHexInt:function(e){if(null==e)return e;return r(t(e)+1)},intToHex:r,unsafeRandomBytes:function(e){let t="0x";for(let r=0;r<e;r++)t+=n(),t+=n();return t}},Bd}function Qd(){if(Nd)return Id;Nd=1;const e=s(),t=Yd(),r=function(){if(Ld)return Od;Ld=1;const e=Zd();return Od=class extends e{constructor(){super(),this.allResults=[]}async update(){throw new Error("BaseFilterWithHistory - no update method specified")}addResults(e){this.allResults=this.allResults.concat(e),super.addResults(e)}addInitialResults(e){this.allResults=this.allResults.concat(e),super.addInitialResults(e)}getAllResults(){return this.allResults}}}(),{bnToHex:n,hexToInt:i,incrementHexInt:o,minBlockRef:a,blockRefIsNumber:u}=Jd();return Id=class extends r{constructor({provider:t,params:r}){super(),this.type="log",this.ethQuery=new e(t),this.params=Object.assign({fromBlock:"latest",toBlock:"latest",address:void 0,topics:[]},r),this.params.address&&(Array.isArray(this.params.address)||(this.params.address=[this.params.address]),this.params.address=this.params.address.map((e=>e.toLowerCase())))}async initialize({currentBlock:e}){let t=this.params.fromBlock;["latest","pending"].includes(t)&&(t=e),"earliest"===t&&(t="0x0"),this.params.fromBlock=t;const r=a(this.params.toBlock,e),n=Object.assign({},this.params,{toBlock:r}),i=await this._fetchLogs(n);this.addInitialResults(i)}async update({oldBlock:e,newBlock:t}){const r=t;let n;n=e?o(e):t;const i=Object.assign({},this.params,{fromBlock:n,toBlock:r}),s=(await this._fetchLogs(i)).filter((e=>this.matchLog(e)));this.addResults(s)}async _fetchLogs(e){return await t((t=>this.ethQuery.getLogs(e,t)))()}matchLog(e){if(i(this.params.fromBlock)>=i(e.blockNumber))return!1;if(u(this.params.toBlock)&&i(this.params.toBlock)<=i(e.blockNumber))return!1;const t=e.address&&e.address.toLowerCase();if(this.params.address&&t&&!this.params.address.includes(t))return!1;return this.params.topics.every(((t,r)=>{let n=e.topics[r];if(!n)return!1;n=n.toLowerCase();let i=Array.isArray(t)?t:[t];if(i.includes(null))return!0;i=i.map((e=>e.toLowerCase()));return i.includes(n)}))}}}function Xd(){if(Ud)return Dd;function e(e){return null==e?e:Number.parseInt(e,16)}function t(e){if(null==e)return e;return"0x"+e.toString(16)}return Ud=1,Dd=async function({provider:r,fromBlock:n,toBlock:i}){n||(n=i);const o=e(n),s=e(i),a=Array(s-o+1).fill().map(((e,t)=>o+t)).map(t);return await Promise.all(a.map((e=>function(e,t,r){return new Promise(((n,i)=>{e.sendAsync({id:1,jsonrpc:"2.0",method:t,params:r},((e,t)=>{if(e)return i(e);n(t.result)}))}))}(r,"eth_getBlockByNumber",[e,!1]))))}}function ep(){if(Kd)return Wd;Kd=1;const e=u().Mutex,{createAsyncMiddleware:t}=I,r=$d(),n=Qd(),i=function(){if(Hd)return jd;Hd=1;const e=Zd(),t=Xd(),{incrementHexInt:r}=Jd();return jd=class extends e{constructor({provider:e,params:t}){super(),this.type="block",this.provider=e}async update({oldBlock:e,newBlock:n}){const i=n,o=r(e),s=(await t({provider:this.provider,fromBlock:o,toBlock:i})).map((e=>e.hash));this.addResults(s)}}}(),o=function(){if(Fd)return qd;Fd=1;const e=Zd(),t=Xd(),{incrementHexInt:r}=Jd();return qd=class extends e{constructor({provider:e}){super(),this.type="tx",this.provider=e}async update({oldBlock:e}){const n=e,i=r(e),o=await t({provider:this.provider,fromBlock:i,toBlock:n}),s=[];for(const e of o)s.push(...e.transactions);this.addResults(s)}}}(),{intToHex:s,hexToInt:a}=Jd();function c(e){return l((async(...t)=>{const r=await e(...t);return s(r.id)}))}function l(e){return t((async(t,r)=>{const n=await e.apply(null,t.params);r.result=n}))}function h(e,t){const r=[];for(let t in e)r.push(e[t]);return r}return Wd=function({blockTracker:t,provider:u}){let f=0,d={};const p=new e,m=function({mutex:e}){return t=>async(r,n,i,o)=>{(await e.acquire())(),t(r,n,i,o)}}({mutex:p}),_=r({eth_newFilter:m(c(v)),eth_newBlockFilter:m(c(y)),eth_newPendingTransactionFilter:m(c(w)),eth_uninstallFilter:m(l(M)),eth_getFilterChanges:m(l(b)),eth_getFilterLogs:m(l(E))}),g=async({oldBlock:e,newBlock:t})=>{if(0===d.length)return;const r=await p.acquire();try{await Promise.all(h(d).map((async r=>{try{await r.update({oldBlock:e,newBlock:t})}catch(e){console.error(e)}})))}catch(e){console.error(e)}r()};return _.newLogFilter=v,_.newBlockFilter=y,_.newPendingTransactionFilter=w,_.uninstallFilter=M,_.getFilterChanges=b,_.getFilterLogs=E,_.destroy=()=>{!async function(){const e=h(d).length;d={},x({prevFilterCount:e,newFilterCount:0})}()},_;async function v(e){const t=new n({provider:u,params:e});return await S(t),t}async function y(){const e=new i({provider:u});return await S(e),e}async function w(){const e=new o({provider:u});return await S(e),e}async function b(e){const t=a(e),r=d[t];if(!r)throw new Error(`No filter for index "${t}"`);return r.getChangesAndClear()}async function E(e){const t=a(e),r=d[t];if(!r)throw new Error(`No filter for index "${t}"`);return"log"===r.type?results=r.getAllResults():results=[],results}async function M(e){const t=a(e),r=d[t],n=Boolean(r);return n&&await async function(e){const t=h(d).length;delete d[e];const r=h(d).length;x({prevFilterCount:t,newFilterCount:r})}(t),n}async function S(e){const r=h(d).length,n=await t.getLatestBlock();await e.initialize({currentBlock:n}),f++,d[f]=e,e.id=f,e.idHex=s(f);return x({prevFilterCount:r,newFilterCount:h(d).length}),f}function x({prevFilterCount:e,newFilterCount:r}){0===e&&r>0?t.on("sync",g):e>0&&0===r&&t.removeListener("sync",g)}},Wd}var tp,rp={exports:{}};function np(){return tp||(tp=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if(t=(0,i.default)(t||n.default),!(0,r.default)(e))return t(new Error("First argument to waterfall must be an array of functions"));if(!e.length)return t();var u=0;function c(t){var r=(0,a.default)(e[u++]);t.push((0,s.default)(l)),r.apply(null,t)}function l(r){if(r||u===e.length)return t.apply(null,arguments);c((0,o.default)(arguments,1))}c([])};var r=u(Ah()),n=u(hh()),i=u(ph()),o=u(Ef()),s=u(pf()),a=u(Cf());function u(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default}(rp,rp.exports)),rp.exports}var ip,op,sp={exports:{}},ap={exports:{}};function up(){return op||(op=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){(0,i.default)(r.default,e,t)};var r=o(If()),n=(ip||(ip=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,s){s=s||r.default;var a=(0,n.default)(t)?[]:{};e(t,(function(e,t,r){(0,o.default)(e)((function(e,n){arguments.length>2&&(n=(0,i.default)(arguments,1)),a[t]=n,r(e)}))}),(function(e){s(e,a)}))};var r=s(hh()),n=s(nh()),i=s(Ef()),o=s(Cf());function s(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default}(ap,ap.exports)),ap.exports),i=o(n);function o(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default}(sp,sp.exports)),sp.exports}var cp,lp={exports:{}},hp={},fp={},dp={};var pp,mp,_p={};function gp(){if(pp)return _p;pp=1,Object.defineProperty(_p,"__esModule",{value:!0});var e=Buffer.from([48,129,211,2,1,1,4,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,129,133,48,129,130,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,33,2,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,36,3,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),t=Buffer.from([48,130,1,19,2,1,1,4,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,129,165,48,129,162,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,65,4,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,72,58,218,119,38,163,196,101,93,164,251,252,14,17,8,168,253,23,180,72,166,133,84,25,156,71,208,143,251,16,212,184,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,68,3,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);return _p.privateKeyExport=function(r,n,i){void 0===i&&(i=!0);var o=Buffer.from(i?e:t);return r.copy(o,i?8:9),n.copy(o,i?181:214),o},_p.privateKeyImport=function(e){var t=e.length,r=0;if(t<r+1||48!==e[r])return null;if(t<(r+=1)+1||!(128&e[r]))return null;var n=127&e[r];if(n<1||n>2)return null;if(t<(r+=1)+n)return null;var i=e[r+n-1]|(n>1?e[r+n-2]<<8:0);return t<(r+=n)+i||t<r+3||2!==e[r]||1!==e[r+1]||1!==e[r+2]||t<(r+=3)+2||4!==e[r]||e[r+1]>32||t<r+2+e[r+1]?null:e.slice(r+2,r+2+e[r+1])},_p.signatureImportLax=function(e){var t=Buffer.alloc(32,0),r=Buffer.alloc(32,0),n=e.length,i=0;if(48!==e[i++])return null;var o=e[i++];if(128&o&&(i+=o-128)>n)return null;if(2!==e[i++])return null;var s=e[i++];if(128&s){if(i+(o=s-128)>n)return null;for(;o>0&&0===e[i];i+=1,o-=1);for(s=0;o>0;i+=1,o-=1)s=(s<<8)+e[i]}if(s>n-i)return null;var a=i;if(i+=s,2!==e[i++])return null;var u=e[i++];if(128&u){if(i+(o=u-128)>n)return null;for(;o>0&&0===e[i];i+=1,o-=1);for(u=0;o>0;i+=1,o-=1)u=(u<<8)+e[i]}if(u>n-i)return null;var c=i;for(i+=u;s>0&&0===e[a];s-=1,a+=1);if(s>32)return null;var l=e.slice(a,a+s);for(l.copy(t,32-l.length);u>0&&0===e[c];u-=1,c+=1);if(u>32)return null;var h=e.slice(c,c+u);return h.copy(r,32-h.length),{r:t,s:r}},_p}function vp(){return mp||(mp=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ecdhUnsafe=e.ecdh=e.recover=e.verify=e.sign=e.signatureImportLax=e.signatureImport=e.signatureExport=e.signatureNormalize=e.publicKeyCombine=e.publicKeyTweakMul=e.publicKeyTweakAdd=e.publicKeyVerify=e.publicKeyConvert=e.publicKeyCreate=e.privateKeyTweakMul=e.privateKeyTweakAdd=e.privateKeyModInverse=e.privateKeyNegate=e.privateKeyImport=e.privateKeyExport=e.privateKeyVerify=void 0;var t=Qc(),r=function(){if(cp)return dp;cp=1,Object.defineProperty(dp,"__esModule",{value:!0});var e=b.exports,t=new(0,A.ec)("secp256k1"),r=t.curve;dp.privateKeyExport=function(i,o){void 0===o&&(o=!0);var s=new e(i);if(s.ucmp(r.n)>=0)throw new Error("couldn't export to DER format");var a=t.g.mul(s);return n(a.getX(),a.getY(),o)},dp.privateKeyModInverse=function(t){var n=new e(t);if(n.ucmp(r.n)>=0||n.isZero())throw new Error("private key range is invalid");return n.invm(r.n).toArrayLike(Buffer,"be",32)},dp.signatureImport=function(t){var n=new e(t.r);n.ucmp(r.n)>=0&&(n=new e(0));var i=new e(t.s);return i.ucmp(r.n)>=0&&(i=new e(0)),Buffer.concat([n.toArrayLike(Buffer,"be",32),i.toArrayLike(Buffer,"be",32)])},dp.ecdhUnsafe=function(i,o,s){void 0===s&&(s=!0);var a=t.keyFromPublic(i),u=new e(o);if(u.ucmp(r.n)>=0||u.isZero())throw new Error("scalar was invalid (zero or overflow)");var c=a.pub.mul(u);return n(c.getX(),c.getY(),s)};var n=function(e,t,r){var n;return r?((n=Buffer.alloc(33))[0]=t.isOdd()?3:2,e.toArrayLike(Buffer,"be",32).copy(n,1)):((n=Buffer.alloc(65))[0]=4,e.toArrayLike(Buffer,"be",32).copy(n,1),t.toArrayLike(Buffer,"be",32).copy(n,33)),n};return dp}(),n=gp();e.privateKeyVerify=function(e){return 32===e.length&&t.privateKeyVerify(Uint8Array.from(e))},e.privateKeyExport=function(e,t){if(32!==e.length)throw new RangeError("private key length is invalid");var i=r.privateKeyExport(e,t);return n.privateKeyExport(e,i,t)},e.privateKeyImport=function(t){if(null!==(t=n.privateKeyImport(t))&&32===t.length&&e.privateKeyVerify(t))return t;throw new Error("couldn't import from DER format")},e.privateKeyNegate=function(e){return Buffer.from(t.privateKeyNegate(Uint8Array.from(e)))},e.privateKeyModInverse=function(e){if(32!==e.length)throw new Error("private key length is invalid");return Buffer.from(r.privateKeyModInverse(Uint8Array.from(e)))},e.privateKeyTweakAdd=function(e,r){return Buffer.from(t.privateKeyTweakAdd(Uint8Array.from(e),r))},e.privateKeyTweakMul=function(e,r){return Buffer.from(t.privateKeyTweakMul(Uint8Array.from(e),Uint8Array.from(r)))},e.publicKeyCreate=function(e,r){return Buffer.from(t.publicKeyCreate(Uint8Array.from(e),r))},e.publicKeyConvert=function(e,r){return Buffer.from(t.publicKeyConvert(Uint8Array.from(e),r))},e.publicKeyVerify=function(e){return(33===e.length||65===e.length)&&t.publicKeyVerify(Uint8Array.from(e))},e.publicKeyTweakAdd=function(e,r,n){return Buffer.from(t.publicKeyTweakAdd(Uint8Array.from(e),Uint8Array.from(r),n))},e.publicKeyTweakMul=function(e,r,n){return Buffer.from(t.publicKeyTweakMul(Uint8Array.from(e),Uint8Array.from(r),n))},e.publicKeyCombine=function(e,r){var n=[];return e.forEach((function(e){n.push(Uint8Array.from(e))})),Buffer.from(t.publicKeyCombine(n,r))},e.signatureNormalize=function(e){return Buffer.from(t.signatureNormalize(Uint8Array.from(e)))},e.signatureExport=function(e){return Buffer.from(t.signatureExport(Uint8Array.from(e)))},e.signatureImport=function(e){return Buffer.from(t.signatureImport(Uint8Array.from(e)))},e.signatureImportLax=function(e){if(0===e.length)throw new RangeError("signature length is invalid");var t=n.signatureImportLax(e);if(null===t)throw new Error("couldn't parse DER signature");return r.signatureImport(t)},e.sign=function(e,r,n){if(null===n)throw new TypeError("options should be an Object");var i=void 0;if(n){if(i={},null===n.data)throw new TypeError("options.data should be a Buffer");if(n.data){if(32!=n.data.length)throw new RangeError("options.data length is invalid");i.data=new Uint8Array(n.data)}if(null===n.noncefn)throw new TypeError("options.noncefn should be a Function");n.noncefn&&(i.noncefn=function(e,t,r,i,o){var s=null!=r?Buffer.from(r):null,a=null!=i?Buffer.from(i):null,u=Buffer.from("");return n.noncefn&&(u=n.noncefn(Buffer.from(e),Buffer.from(t),s,a,o)),new Uint8Array(u)})}var o=t.ecdsaSign(Uint8Array.from(e),Uint8Array.from(r),i);return{signature:Buffer.from(o.signature),recovery:o.recid}},e.verify=function(e,r,n){return t.ecdsaVerify(Uint8Array.from(r),Uint8Array.from(e),n)},e.recover=function(e,r,n,i){return Buffer.from(t.ecdsaRecover(Uint8Array.from(r),n,Uint8Array.from(e),i))},e.ecdh=function(e,r){return Buffer.from(t.ecdh(Uint8Array.from(e),Uint8Array.from(r),{}))},e.ecdhUnsafe=function(e,t,n){if(33!==e.length&&65!==e.length)throw new RangeError("public key length is invalid");if(32!==t.length)throw new RangeError("private key length is invalid");return Buffer.from(r.ecdhUnsafe(Uint8Array.from(e),Uint8Array.from(t),n))}}(fp)),fp}var yp,wp={};var bp,Ep={},Mp={};function Sp(){return bp||(bp=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.baToJSON=e.addHexPrefix=e.toUnsigned=e.fromSigned=e.bufferToHex=e.bufferToInt=e.toBuffer=e.stripZeros=e.unpad=e.setLengthRight=e.setLength=e.setLengthLeft=e.zeros=void 0;var t=O,r=b.exports;e.zeros=function(e){return Buffer.allocUnsafe(e).fill(0)},e.setLengthLeft=function(t,r,n){void 0===n&&(n=!1);var i=e.zeros(r);return t=e.toBuffer(t),n?t.length<r?(t.copy(i),i):t.slice(0,r):t.length<r?(t.copy(i,r-t.length),i):t.slice(-r)},e.setLength=e.setLengthLeft,e.setLengthRight=function(t,r){return e.setLength(t,r,!0)},e.unpad=function(e){for(var r=(e=t.stripHexPrefix(e))[0];e.length>0&&"0"===r.toString();)r=(e=e.slice(1))[0];return e},e.stripZeros=e.unpad,e.toBuffer=function(e){if(!Buffer.isBuffer(e))if(Array.isArray(e))e=Buffer.from(e);else if("string"==typeof e){if(!t.isHexString(e))throw new Error("Cannot convert string to buffer. toBuffer only supports 0x-prefixed hex strings and this string was given: "+e);e=Buffer.from(t.padToEven(t.stripHexPrefix(e)),"hex")}else if("number"==typeof e)e=t.intToBuffer(e);else if(null==e)e=Buffer.allocUnsafe(0);else if(r.isBN(e))e=e.toArrayLike(Buffer);else{if(!e.toArray)throw new Error("invalid type");e=Buffer.from(e.toArray())}return e},e.bufferToInt=function(t){return new r(e.toBuffer(t)).toNumber()},e.bufferToHex=function(t){return"0x"+(t=e.toBuffer(t)).toString("hex")},e.fromSigned=function(e){return new r(e).fromTwos(256)},e.toUnsigned=function(e){return Buffer.from(e.toTwos(256).toArray())},e.addHexPrefix=function(e){return"string"!=typeof e||t.isHexPrefixed(e)?e:"0x"+e},e.baToJSON=function(t){if(Buffer.isBuffer(t))return"0x"+t.toString("hex");if(t instanceof Array){for(var r=[],n=0;n<t.length;n++)r.push(e.baToJSON(t[n]));return r}}}(Mp)),Mp}var xp,kp,Rp={};function Tp(){return xp||(xp=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.rlphash=e.ripemd160=e.sha256=e.keccak256=e.keccak=void 0;var t=Oc(),r=t.keccak224,n=t.keccak384,i=t.keccak256,o=t.keccak512,s=ml(),a=O,u=pl(),c=Sp();e.keccak=function(e,t){switch(void 0===t&&(t=256),e="string"!=typeof e||a.isHexString(e)?c.toBuffer(e):Buffer.from(e,"utf8"),t||(t=256),t){case 224:return r(e);case 256:return i(e);case 384:return n(e);case 512:return o(e);default:throw new Error("Invald algorithm: keccak"+t)}},e.keccak256=function(t){return e.keccak(t)},e.sha256=function(e){return e=c.toBuffer(e),s("sha256").update(e).digest()},e.ripemd160=function(e,t){e=c.toBuffer(e);var r=s("rmd160").update(e).digest();return!0===t?c.setLength(r,32):r},e.rlphash=function(t){return e.keccak(u.encode(t))}}(Rp)),Rp}var Cp,Ap={};var Op,Lp,Bp,Pp,Ip,Np,Dp,Up={};function jp(){return Lp||(Lp=1,function(e){var t=l&&l.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=l&&l.__exportStar||function(e,r){for(var n in e)"default"===n||r.hasOwnProperty(n)||t(r,e,n)};Object.defineProperty(e,"__esModule",{value:!0}),e.secp256k1=e.rlp=e.BN=void 0;var n=vp();e.secp256k1=n;var i=O,o=b.exports;e.BN=o;var s=pl();e.rlp=s,Object.assign(e,i),r((yp||(yp=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.KECCAK256_RLP=e.KECCAK256_RLP_S=e.KECCAK256_RLP_ARRAY=e.KECCAK256_RLP_ARRAY_S=e.KECCAK256_NULL=e.KECCAK256_NULL_S=e.TWO_POW256=e.MAX_INTEGER=void 0;var t=b.exports;e.MAX_INTEGER=new t("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16),e.TWO_POW256=new t("10000000000000000000000000000000000000000000000000000000000000000",16),e.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",e.KECCAK256_NULL=Buffer.from(e.KECCAK256_NULL_S,"hex"),e.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",e.KECCAK256_RLP_ARRAY=Buffer.from(e.KECCAK256_RLP_ARRAY_S,"hex"),e.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",e.KECCAK256_RLP=Buffer.from(e.KECCAK256_RLP_S,"hex")}(wp)),wp),e),r((kp||(kp=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.importPublic=e.privateToPublic=e.privateToAddress=e.publicToAddress=e.pubToAddress=e.isValidPublic=e.isValidPrivate=e.isPrecompiled=e.generateAddress2=e.generateAddress=e.isValidChecksumAddress=e.toChecksumAddress=e.isZeroAddress=e.isValidAddress=e.zeroAddress=void 0;var t=T,r=O,n=vp(),i=b.exports,o=Sp(),s=Tp();e.zeroAddress=function(){var e=o.zeros(20);return o.bufferToHex(e)},e.isValidAddress=function(e){return/^0x[0-9a-fA-F]{40}$/.test(e)},e.isZeroAddress=function(t){return e.zeroAddress()===o.addHexPrefix(t)},e.toChecksumAddress=function(e,t){e=r.stripHexPrefix(e).toLowerCase();for(var n=void 0!==t?t.toString()+"0x":"",i=s.keccak(n+e).toString("hex"),o="0x",a=0;a<e.length;a++)parseInt(i[a],16)>=8?o+=e[a].toUpperCase():o+=e[a];return o},e.isValidChecksumAddress=function(t,r){return e.isValidAddress(t)&&e.toChecksumAddress(t,r)===t},e.generateAddress=function(e,t){e=o.toBuffer(e);var r=new i(t);return r.isZero()?s.rlphash([e,null]).slice(-20):s.rlphash([e,Buffer.from(r.toArray())]).slice(-20)},e.generateAddress2=function(e,r,n){var i=o.toBuffer(e),a=o.toBuffer(r),u=o.toBuffer(n);return t(20===i.length),t(32===a.length),s.keccak256(Buffer.concat([Buffer.from("ff","hex"),i,a,s.keccak256(u)])).slice(-20)},e.isPrecompiled=function(e){var t=o.unpad(e);return 1===t.length&&t[0]>=1&&t[0]<=8},e.isValidPrivate=function(e){return n.privateKeyVerify(e)},e.isValidPublic=function(e,t){return void 0===t&&(t=!1),64===e.length?n.publicKeyVerify(Buffer.concat([Buffer.from([4]),e])):!!t&&n.publicKeyVerify(e)},e.pubToAddress=function(e,r){return void 0===r&&(r=!1),e=o.toBuffer(e),r&&64!==e.length&&(e=n.publicKeyConvert(e,!1).slice(1)),t(64===e.length),s.keccak(e).slice(-20)},e.publicToAddress=e.pubToAddress,e.privateToAddress=function(t){return e.publicToAddress(e.privateToPublic(t))},e.privateToPublic=function(e){return e=o.toBuffer(e),n.publicKeyCreate(e,!1).slice(1)},e.importPublic=function(e){return 64!==(e=o.toBuffer(e)).length&&(e=n.publicKeyConvert(e,!1).slice(1)),e}}(Ep)),Ep),e),r(Tp(),e),r(function(){if(Cp)return Ap;Cp=1,Object.defineProperty(Ap,"__esModule",{value:!0}),Ap.hashPersonalMessage=Ap.isValidSignature=Ap.fromRpcSig=Ap.toRpcSig=Ap.ecrecover=Ap.ecsign=void 0;var e=vp(),t=b.exports,r=Sp(),n=Tp();function i(e,t){return t?e-(2*t+35):e-27}function o(e){return 0===e||1===e}return Ap.ecsign=function(t,r,n){var i=e.sign(t,r),o=i.recovery;return{r:i.signature.slice(0,32),s:i.signature.slice(32,64),v:n?o+(2*n+35):o+27}},Ap.ecrecover=function(t,n,s,a,u){var c=Buffer.concat([r.setLength(s,32),r.setLength(a,32)],64),l=i(n,u);if(!o(l))throw new Error("Invalid signature v value");var h=e.recover(t,c,l);return e.publicKeyConvert(h,!1).slice(1)},Ap.toRpcSig=function(e,t,n,s){if(!o(i(e,s)))throw new Error("Invalid signature v value");return r.bufferToHex(Buffer.concat([r.setLengthLeft(t,32),r.setLengthLeft(n,32),r.toBuffer(e)]))},Ap.fromRpcSig=function(e){var t=r.toBuffer(e);if(65!==t.length)throw new Error("Invalid signature length");var n=t[64];return n<27&&(n+=27),{v:n,r:t.slice(0,32),s:t.slice(32,64)}},Ap.isValidSignature=function(e,r,n,s,a){void 0===s&&(s=!0);var u=new t("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),c=new t("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",16);if(32!==r.length||32!==n.length)return!1;if(!o(i(e,a)))return!1;var l=new t(r),h=new t(n);return!(l.isZero()||l.gt(c)||h.isZero()||h.gt(c)||s&&1===h.cmp(u))},Ap.hashPersonalMessage=function(e){var t=Buffer.from("Ethereum Signed Message:\n"+e.length.toString(),"utf-8");return n.keccak(Buffer.concat([t,e]))},Ap}(),e),r(Sp(),e),r(function(){if(Op)return Up;Op=1,Object.defineProperty(Up,"__esModule",{value:!0}),Up.defineProperties=void 0;var e=T,t=O,r=pl(),n=Sp();return Up.defineProperties=function(i,o,s){if(i.raw=[],i._fields=[],i.toJSON=function(e){if(void 0===e&&(e=!1),e){var t={};return i._fields.forEach((function(e){t[e]="0x"+i[e].toString("hex")})),t}return n.baToJSON(i.raw)},i.serialize=function(){return r.encode(i.raw)},o.forEach((function(t,r){function o(){return i.raw[r]}function s(o){"00"!==(o=n.toBuffer(o)).toString("hex")||t.allowZero||(o=Buffer.allocUnsafe(0)),t.allowLess&&t.length?(o=n.stripZeros(o),e(t.length>=o.length,"The field "+t.name+" must not have more "+t.length+" bytes")):t.allowZero&&0===o.length||!t.length||e(t.length===o.length,"The field "+t.name+" must have byte length of "+t.length),i.raw[r]=o}i._fields.push(t.name),Object.defineProperty(i,t.name,{enumerable:!0,configurable:!0,get:o,set:s}),t.default&&(i[t.name]=t.default),t.alias&&Object.defineProperty(i,t.alias,{enumerable:!1,configurable:!0,set:s,get:o})})),s)if("string"==typeof s&&(s=Buffer.from(t.stripHexPrefix(s),"hex")),Buffer.isBuffer(s)&&(s=r.decode(s)),Array.isArray(s)){if(s.length>i._fields.length)throw new Error("wrong number of fields in data");s.forEach((function(e,t){i[i._fields[t]]=n.toBuffer(e)}))}else{if("object"!=typeof s)throw new Error("invalid data");var a=Object.keys(s);o.forEach((function(e){-1!==a.indexOf(e.name)&&(i[e.name]=s[e.name]),-1!==a.indexOf(e.alias)&&(i[e.alias]=s[e.alias])}))}},Up}(),e)}(hp)),hp}function Hp(){return Ip||(Ip=1,lp.exports=function(){if(Pp)return Bp;Pp=1;const e=jp(),t=b.exports;var r=function(){};function n(e){return e.startsWith("int[")?"int256"+e.slice(3):"int"===e?"int256":e.startsWith("uint[")?"uint256"+e.slice(4):"uint"===e?"uint256":e.startsWith("fixed[")?"fixed128x128"+e.slice(5):"fixed"===e?"fixed128x128":e.startsWith("ufixed[")?"ufixed128x128"+e.slice(6):"ufixed"===e?"ufixed128x128":e}function i(e){return parseInt(/^\D+(\d+)$/.exec(e)[1],10)}function o(e){var t=/^\D+(\d+)x(\d+)$/.exec(e);return[parseInt(t[1],10),parseInt(t[2],10)]}function s(e){var t=e.match(/(.*)\[(.*?)\]$/);return t?""===t[2]?"dynamic":parseInt(t[2],10):null}function a(r){var n=typeof r;if("string"===n)return e.isHexPrefixed(r)?new t(e.stripHexPrefix(r),16):new t(r,10);if("number"===n)return new t(r);if(r.toArray)return r;throw new Error("Argument is not a number")}function u(e){var t=/^(\w+)\((.*)\)$/.exec(e);if(3!==t.length)throw new Error("Invalid method signature");var r=/^(.+)\):\((.+)$/.exec(t[2]);if(null!==r&&3===r.length)return{method:t[1],args:r[1].split(","),retargs:r[2].split(",")};var n=t[2].split(",");return 1===n.length&&""===n[0]&&(n=[]),{method:t[1],args:n}}function c(r,n){var u,l,h,f;if("address"===r)return c("uint160",a(n));if("bool"===r)return c("uint8",n?1:0);if("string"===r)return c("bytes",Buffer.from(n,"utf8"));if(d(r)){if(void 0===n.length)throw new Error("Not an array?");if("dynamic"!==(u=s(r))&&0!==u&&n.length>u)throw new Error("Elements exceed array size: "+u);for(f in h=[],r=r.slice(0,r.lastIndexOf("[")),"string"==typeof n&&(n=JSON.parse(n)),n)h.push(c(r,n[f]));if("dynamic"===u){var p=c("uint256",n.length);h.unshift(p)}return Buffer.concat(h)}if("bytes"===r)return n=Buffer.from(n),h=Buffer.concat([c("uint256",n.length),n]),n.length%32!=0&&(h=Buffer.concat([h,e.zeros(32-n.length%32)])),h;if(r.startsWith("bytes")){if((u=i(r))<1||u>32)throw new Error("Invalid bytes<N> width: "+u);return e.setLengthRight(n,32)}if(r.startsWith("uint")){if((u=i(r))%8||u<8||u>256)throw new Error("Invalid uint<N> width: "+u);if((l=a(n)).bitLength()>u)throw new Error("Supplied uint exceeds width: "+u+" vs "+l.bitLength());if(l<0)throw new Error("Supplied uint is negative");return l.toArrayLike(Buffer,"be",32)}if(r.startsWith("int")){if((u=i(r))%8||u<8||u>256)throw new Error("Invalid int<N> width: "+u);if((l=a(n)).bitLength()>u)throw new Error("Supplied int exceeds width: "+u+" vs "+l.bitLength());return l.toTwos(256).toArrayLike(Buffer,"be",32)}if(r.startsWith("ufixed")){if(u=o(r),(l=a(n))<0)throw new Error("Supplied ufixed is negative");return c("uint256",l.mul(new t(2).pow(new t(u[1]))))}if(r.startsWith("fixed"))return u=o(r),c("int256",a(n).mul(new t(2).pow(new t(u[1]))));throw new Error("Unsupported or invalid type: "+r)}function l(e,r,n){var i,o,s,a;if("string"==typeof e&&(e=h(e)),"address"===e.name)return l(e.rawType,r,n).toArrayLike(Buffer,"be",20).toString("hex");if("bool"===e.name)return l(e.rawType,r,n).toString()===new t(1).toString();if("string"===e.name){var u=l(e.rawType,r,n);return Buffer.from(u,"utf8").toString()}if(e.isArray){for(s=[],i=e.size,"dynamic"===e.size&&(n=l("uint256",r,n).toNumber(),i=l("uint256",r,n).toNumber(),n+=32),a=0;a<i;a++){var c=l(e.subArray,r,n);s.push(c),n+=e.subArray.memoryUsage}return s}if("bytes"===e.name)return n=l("uint256",r,n).toNumber(),i=l("uint256",r,n).toNumber(),r.slice(n+32,n+32+i);if(e.name.startsWith("bytes"))return r.slice(n,n+e.size);if(e.name.startsWith("uint")){if((o=new t(r.slice(n,n+32),16,"be")).bitLength()>e.size)throw new Error("Decoded int exceeds width: "+e.size+" vs "+o.bitLength());return o}if(e.name.startsWith("int")){if((o=new t(r.slice(n,n+32),16,"be").fromTwos(256)).bitLength()>e.size)throw new Error("Decoded uint exceeds width: "+e.size+" vs "+o.bitLength());return o}if(e.name.startsWith("ufixed")){if(i=new t(2).pow(new t(e.size[1])),!(o=l("uint256",r,n)).mod(i).isZero())throw new Error("Decimals not supported yet");return o.div(i)}if(e.name.startsWith("fixed")){if(i=new t(2).pow(new t(e.size[1])),!(o=l("int256",r,n)).mod(i).isZero())throw new Error("Decimals not supported yet");return o.div(i)}throw new Error("Unsupported or invalid type: "+e.name)}function h(e){var t,r,n;if(d(e)){t=s(e);var a=e.slice(0,e.lastIndexOf("["));return a=h(a),{isArray:!0,name:e,size:t,memoryUsage:"dynamic"===t?32:a.memoryUsage*t,subArray:a}}switch(e){case"address":n="uint160";break;case"bool":n="uint8";break;case"string":n="bytes"}if(r={rawType:n,name:e,memoryUsage:32},e.startsWith("bytes")&&"bytes"!==e||e.startsWith("uint")||e.startsWith("int")?r.size=i(e):(e.startsWith("ufixed")||e.startsWith("fixed"))&&(r.size=o(e)),e.startsWith("bytes")&&"bytes"!==e&&(r.size<1||r.size>32))throw new Error("Invalid bytes<N> width: "+r.size);if((e.startsWith("uint")||e.startsWith("int"))&&(r.size%8||r.size<8||r.size>256))throw new Error("Invalid int/uint<N> width: "+r.size);return r}function f(e){return"string"===e||"bytes"===e||"dynamic"===s(e)}function d(e){return e.lastIndexOf("]")===e.length-1}function p(e,t){return e.startsWith("address")||e.startsWith("bytes")?"0x"+t.toString("hex"):t.toString()}return r.eventID=function(t,r){var i=t+"("+r.map(n).join(",")+")";return e.keccak256(Buffer.from(i))},r.methodID=function(e,t){return r.eventID(e,t).slice(0,4)},r.rawEncode=function(e,t){var r=[],i=[],o=0;e.forEach((function(e){if(d(e)){var t=s(e);o+="dynamic"!==t?32*t:32}else o+=32}));for(var a=0;a<e.length;a++){var u=n(e[a]),l=c(u,t[a]);f(u)?(r.push(c("uint256",o)),i.push(l),o+=l.length):r.push(l)}return Buffer.concat(r.concat(i))},r.rawDecode=function(e,t){var r=[];t=Buffer.from(t);for(var i=0,o=0;o<e.length;o++){var s=h(n(e[o])),a=l(s,t,i);i+=s.memoryUsage,r.push(a)}return r},r.simpleEncode=function(e){var t=Array.prototype.slice.call(arguments).slice(1),n=u(e);if(t.length!==n.args.length)throw new Error("Argument count mismatch");return Buffer.concat([r.methodID(n.method,n.args),r.rawEncode(n.args,t)])},r.simpleDecode=function(e,t){var n=u(e);if(!n.retargs)throw new Error("No return values in method");return r.rawDecode(n.retargs,t)},r.stringify=function(e,t){var r=[];for(var n in e){var i=e[n],o=t[n];o=/^[^\[]+\[.*\]$/.test(i)?o.map((function(e){return p(i,e)})).join(", "):p(i,o),r.push(o)}return r},r.solidityHexValue=function(t,n,o){var u,c;if(d(t)){var l=t.replace(/\[.*?\]/,"");if(!d(l)){var h=s(t);if("dynamic"!==h&&0!==h&&n.length>h)throw new Error("Elements exceed array size: "+h)}var f=n.map((function(e){return r.solidityHexValue(l,e,256)}));return Buffer.concat(f)}if("bytes"===t)return n;if("string"===t)return Buffer.from(n,"utf8");if("bool"===t){o=o||8;var p=Array(o/4).join("0");return Buffer.from(n?p+"1":p+"0","hex")}if("address"===t){var m=20;return o&&(m=o/8),e.setLengthLeft(n,m)}if(t.startsWith("bytes")){if((u=i(t))<1||u>32)throw new Error("Invalid bytes<N> width: "+u);return e.setLengthRight(n,u)}if(t.startsWith("uint")){if((u=i(t))%8||u<8||u>256)throw new Error("Invalid uint<N> width: "+u);if((c=a(n)).bitLength()>u)throw new Error("Supplied uint exceeds width: "+u+" vs "+c.bitLength());return o=o||u,c.toArrayLike(Buffer,"be",o/8)}if(t.startsWith("int")){if((u=i(t))%8||u<8||u>256)throw new Error("Invalid int<N> width: "+u);if((c=a(n)).bitLength()>u)throw new Error("Supplied int exceeds width: "+u+" vs "+c.bitLength());return o=o||u,c.toTwos(u).toArrayLike(Buffer,"be",o/8)}throw new Error("Unsupported or invalid type: "+t)},r.solidityPack=function(e,t){if(e.length!==t.length)throw new Error("Number of types are not matching the values");for(var i=[],o=0;o<e.length;o++){var s=n(e[o]),a=t[o];i.push(r.solidityHexValue(s,a,null))}return Buffer.concat(i)},r.soliditySHA3=function(t,n){return e.keccak256(r.solidityPack(t,n))},r.soliditySHA256=function(t,n){return e.sha256(r.solidityPack(t,n))},r.solidityRIPEMD160=function(t,n){return e.ripemd160(r.solidityPack(t,n),!0)},r.fromSerpent=function(e){for(var t,r=[],n=0;n<e.length;n++){var i=e[n];if("s"===i)r.push("bytes");else if("b"===i){for(var o="bytes",s=n+1;s<e.length&&(t=e[s])>="0"&&t<="9";)o+=e[s]-"0",s++;n=s-1,r.push(o)}else if("i"===i)r.push("int256");else{if("a"!==i)throw new Error("Unsupported or invalid type: "+i);r.push("int256[]")}}return r},r.toSerpent=function(e){for(var t=[],r=0;r<e.length;r++){var n=e[r];if("bytes"===n)t.push("s");else if(n.startsWith("bytes"))t.push("b"+i(n));else if("int256"===n)t.push("i");else{if("int256[]"!==n)throw new Error("Unsupported or invalid type: "+n);t.push("a")}}return t.join("")},Bp=r}()),lp.exports}var qp,Fp,Wp,Kp,zp,Gp={exports:{}};var Vp,$p,Yp,Zp,Jp,Qp,Xp,em,tm={genesisGasLimit:{v:5e3,d:"Gas limit of the Genesis block."},genesisDifficulty:{v:17179869184,d:"Difficulty of the Genesis block."},genesisNonce:{v:"0x0000000000000042",d:"the geneis nonce"},genesisExtraData:{v:"0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa",d:"extra data "},genesisHash:{v:"0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3",d:"genesis hash"},genesisStateRoot:{v:"0xd7f8974fb5ac78d9ac099b9ad5018bedc2ce0a72dad1827a1709da30580f0544",d:"the genesis state root"},minGasLimit:{v:5e3,d:"Minimum the gas limit may ever be."},gasLimitBoundDivisor:{v:1024,d:"The bound divisor of the gas limit, used in update calculations."},minimumDifficulty:{v:131072,d:"The minimum that the difficulty may ever be."},difficultyBoundDivisor:{v:2048,d:"The bound divisor of the difficulty, used in the update calculations."},durationLimit:{v:13,d:"The decision boundary on the blocktime duration used to determine whether difficulty should go up or not."},maximumExtraDataSize:{v:32,d:"Maximum size extra data may be after Genesis."},epochDuration:{v:3e4,d:"Duration between proof-of-work epochs."},stackLimit:{v:1024,d:"Maximum size of VM stack allowed."},callCreateDepth:{v:1024,d:"Maximum depth of call/create stack."},tierStepGas:{v:[0,2,3,5,8,10,20],d:"Once per operation, for a selection of them."},expGas:{v:10,d:"Once per EXP instuction."},expByteGas:{v:10,d:"Times ceil(log256(exponent)) for the EXP instruction."},sha3Gas:{v:30,d:"Once per SHA3 operation."},sha3WordGas:{v:6,d:"Once per word of the SHA3 operation's data."},sloadGas:{v:50,d:"Once per SLOAD operation."},sstoreSetGas:{v:2e4,d:"Once per SSTORE operation if the zeroness changes from zero."},sstoreResetGas:{v:5e3,d:"Once per SSTORE operation if the zeroness does not change from zero."},sstoreRefundGas:{v:15e3,d:"Once per SSTORE operation if the zeroness changes to zero."},jumpdestGas:{v:1,d:"Refunded gas, once per SSTORE operation if the zeroness changes to zero."},logGas:{v:375,d:"Per LOG* operation."},logDataGas:{v:8,d:"Per byte in a LOG* operation's data."},logTopicGas:{v:375,d:"Multiplied by the * of the LOG*, per LOG transaction. e.g. LOG0 incurs 0 * c_txLogTopicGas, LOG4 incurs 4 * c_txLogTopicGas."},createGas:{v:32e3,d:"Once per CREATE operation & contract-creation transaction."},callGas:{v:40,d:"Once per CALL operation & message call transaction."},callStipend:{v:2300,d:"Free gas given at beginning of call."},callValueTransferGas:{v:9e3,d:"Paid for CALL when the value transfor is non-zero."},callNewAccountGas:{v:25e3,d:"Paid for CALL when the destination address didn't exist prior."},suicideRefundGas:{v:24e3,d:"Refunded following a suicide operation."},memoryGas:{v:3,d:"Times the address of the (highest referenced byte in memory + 1). NOTE: referencing happens on read, write and in instructions such as RETURN and CALL."},quadCoeffDiv:{v:512,d:"Divisor for the quadratic particle of the memory cost equation."},createDataGas:{v:200,d:""},txGas:{v:21e3,d:"Per transaction. NOTE: Not payable on data of calls between transactions."},txCreation:{v:32e3,d:"the cost of creating a contract via tx"},txDataZeroGas:{v:4,d:"Per byte of data attached to a transaction that equals zero. NOTE: Not payable on data of calls between transactions."},txDataNonZeroGas:{v:68,d:"Per byte of data attached to a transaction that is not equal to zero. NOTE: Not payable on data of calls between transactions."},copyGas:{v:3,d:"Multiplied by the number of 32-byte words that are copied (round up) for any *COPY operation and added."},ecrecoverGas:{v:3e3,d:""},sha256Gas:{v:60,d:""},sha256WordGas:{v:12,d:""},ripemd160Gas:{v:600,d:""},ripemd160WordGas:{v:120,d:""},identityGas:{v:15,d:""},identityWordGas:{v:3,d:""},minerReward:{v:"5000000000000000000",d:"the amount a miner get rewarded for mining a block"},ommerReward:{v:"625000000000000000",d:"The amount of wei a miner of an uncle block gets for being inculded in the blockchain"},niblingReward:{v:"156250000000000000",d:"the amount a miner gets for inculding a uncle"},homeSteadForkNumber:{v:115e4,d:"the block that the Homestead fork started at"},homesteadRepriceForkNumber:{v:2463e3,d:"the block that the Homestead Reprice (EIP150) fork started at"},timebombPeriod:{v:1e5,d:"Exponential difficulty timebomb period"},freeBlockPeriod:{v:2}};function rm(){if($p)return Vp;$p=1;var e=_l(),t=tm,r=e.BN,n=new r("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),i=function(){function i(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),t=t||{};var r=[{name:"nonce",length:32,allowLess:!0,default:new Buffer([])},{name:"gasPrice",length:32,allowLess:!0,default:new Buffer([])},{name:"gasLimit",alias:"gas",length:32,allowLess:!0,default:new Buffer([])},{name:"to",allowZero:!0,length:20,default:new Buffer([])},{name:"value",length:32,allowLess:!0,default:new Buffer([])},{name:"data",alias:"input",allowZero:!0,default:new Buffer([])},{name:"v",allowZero:!0,default:new Buffer([28])},{name:"r",length:32,allowZero:!0,allowLess:!0,default:new Buffer([])},{name:"s",length:32,allowZero:!0,allowLess:!0,default:new Buffer([])}];e.defineProperties(this,r,t),Object.defineProperty(this,"from",{enumerable:!0,configurable:!0,get:this.getSenderAddress.bind(this)});var n=e.bufferToInt(this.v),o=Math.floor((n-35)/2);o<0&&(o=0),this._chainId=o||t.chainId||0,this._homestead=!0}return i.prototype.toCreationAddress=function(){return""===this.to.toString("hex")},i.prototype.hash=function(t){void 0===t&&(t=!0);var r=void 0;if(t)r=this.raw;else if(this._chainId>0){var n=this.raw.slice();this.v=this._chainId,this.r=0,this.s=0,r=this.raw,this.raw=n}else r=this.raw.slice(0,6);return e.rlphash(r)},i.prototype.getChainId=function(){return this._chainId},i.prototype.getSenderAddress=function(){if(this._from)return this._from;var t=this.getSenderPublicKey();return this._from=e.publicToAddress(t),this._from},i.prototype.getSenderPublicKey=function(){if(!(this._senderPubKey&&this._senderPubKey.length||this.verifySignature()))throw new Error("Invalid Signature");return this._senderPubKey},i.prototype.verifySignature=function(){var t=this.hash(!1);if(this._homestead&&1===new r(this.s).cmp(n))return!1;try{var i=e.bufferToInt(this.v);this._chainId>0&&(i-=2*this._chainId+8),this._senderPubKey=e.ecrecover(t,i,this.r,this.s)}catch(e){return!1}return!!this._senderPubKey},i.prototype.sign=function(t){var r=this.hash(!1),n=e.ecsign(r,t);this._chainId>0&&(n.v+=2*this._chainId+8),Object.assign(this,n)},i.prototype.getDataFee=function(){for(var e=this.raw[5],n=new r(0),i=0;i<e.length;i++)0===e[i]?n.iaddn(t.txDataZeroGas.v):n.iaddn(t.txDataNonZeroGas.v);return n},i.prototype.getBaseFee=function(){var e=this.getDataFee().iaddn(t.txGas.v);return this._homestead&&this.toCreationAddress()&&e.iaddn(t.txCreation.v),e},i.prototype.getUpfrontCost=function(){return new r(this.gasLimit).imul(new r(this.gasPrice)).iadd(new r(this.value))},i.prototype.validate=function(e){var t=[];return this.verifySignature()||t.push("Invalid Signature"),this.getBaseFee().cmp(new r(this.gasLimit))>0&&t.push(["gas limit is too low. Need at least "+this.getBaseFee()]),void 0===e||!1===e?0===t.length:t.join(" ")},i}();return Vp=i}Object.defineProperty(U,"__esModule",{value:!0});const nm=n,im=nm.__importDefault(function(){if(Ai)return j;Ai=1,Object.defineProperty(j,"__esModule",{value:!0});const e=n,t=e.__importDefault(Kn()),r=e.__importStar(function(){if(Ci)return Gn;Ci=1,Object.defineProperty(Gn,"__esModule",{value:!0}),Gn.decrypt=Gn.encrypt=Gn.verifyHmac=Gn.generateKey=void 0;const e=n,t=e.__importStar(Li()),r=e.__importStar(Mt),i=Or();function o(n){return e.__awaiter(this,void 0,void 0,(function*(){const e=(n||256)/8,o=t.randomBytes(e);return(0,i.convertBufferToArrayBuffer)(r.arrayToBuffer(o))}))}function s(n,i){return e.__awaiter(this,void 0,void 0,(function*(){const e=r.hexToArray(n.data),o=r.hexToArray(n.iv),s=r.hexToArray(n.hmac),a=r.arrayToHex(s,!1),u=r.concatArrays(e,o),c=yield t.hmacSha256Sign(i,u),l=r.arrayToHex(c,!1);return r.removeHexPrefix(a)===r.removeHexPrefix(l)}))}return Gn.generateKey=o,Gn.verifyHmac=s,Gn.encrypt=function(n,s,a){return e.__awaiter(this,void 0,void 0,(function*(){const e=r.bufferToArray((0,i.convertArrayBufferToBuffer)(s)),u=a||(yield o(128)),c=r.bufferToArray((0,i.convertArrayBufferToBuffer)(u)),l=r.arrayToHex(c,!1),h=JSON.stringify(n),f=r.utf8ToArray(h),d=yield t.aesCbcEncrypt(c,e,f),p=r.arrayToHex(d,!1),m=r.concatArrays(d,c),_=yield t.hmacSha256Sign(e,m);return{data:p,hmac:r.arrayToHex(_,!1),iv:l}}))},Gn.decrypt=function(n,o){return e.__awaiter(this,void 0,void 0,(function*(){const e=r.bufferToArray((0,i.convertArrayBufferToBuffer)(o));if(!e)throw new Error("Missing key: required for decryption");if(!(yield s(n,e)))return null;const a=r.hexToArray(n.data),u=r.hexToArray(n.iv),c=yield t.aesCbcDecrypt(u,e,a),l=r.arrayToUtf8(c);let h;try{h=JSON.parse(l)}catch(e){return null}return h}))},Gn}());class i extends t.default{constructor(e,t){super({cryptoLib:r,connectorOpts:e,pushServerOpts:t})}}return j.default=i,j}()),om=nm.__importDefault(function(){if(Fa)return qa;function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Fa=1;var t=Se(),r=e((Ta||(Ta=1,Ii.exports=Na()),Ii.exports)),n=e(Da()),i=Va(),o=':root {\n --animation-duration: 300ms;\n}\n\n@keyframes fadeIn {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n\n@keyframes fadeOut {\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n}\n\n.animated {\n animation-duration: var(--animation-duration);\n animation-fill-mode: both;\n}\n\n.fadeIn {\n animation-name: fadeIn;\n}\n\n.fadeOut {\n animation-name: fadeOut;\n}\n\n#walletconnect-wrapper {\n -webkit-user-select: none;\n align-items: center;\n display: flex;\n height: 100%;\n justify-content: center;\n left: 0;\n pointer-events: none;\n position: fixed;\n top: 0;\n user-select: none;\n width: 100%;\n z-index: 99999999999999;\n}\n\n.walletconnect-modal__headerLogo {\n height: 21px;\n}\n\n.walletconnect-modal__header p {\n color: #ffffff;\n font-size: 20px;\n font-weight: 600;\n margin: 0;\n align-items: flex-start;\n display: flex;\n flex: 1;\n margin-left: 5px;\n}\n\n.walletconnect-modal__close__wrapper {\n position: absolute;\n top: 0px;\n right: 0px;\n z-index: 10000;\n background: white;\n border-radius: 26px;\n padding: 6px;\n box-sizing: border-box;\n width: 26px;\n height: 26px;\n cursor: pointer;\n}\n\n.walletconnect-modal__close__icon {\n position: relative;\n top: 7px;\n right: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n transform: rotate(45deg);\n}\n\n.walletconnect-modal__close__line1 {\n position: absolute;\n width: 100%;\n border: 1px solid rgb(48, 52, 59);\n}\n\n.walletconnect-modal__close__line2 {\n position: absolute;\n width: 100%;\n border: 1px solid rgb(48, 52, 59);\n transform: rotate(90deg);\n}\n\n.walletconnect-qrcode__base {\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n background: rgba(37, 41, 46, 0.95);\n height: 100%;\n left: 0;\n pointer-events: auto;\n position: fixed;\n top: 0;\n transition: 0.4s cubic-bezier(0.19, 1, 0.22, 1);\n width: 100%;\n will-change: opacity;\n padding: 40px;\n box-sizing: border-box;\n}\n\n.walletconnect-qrcode__text {\n color: rgba(60, 66, 82, 0.6);\n font-size: 16px;\n font-weight: 600;\n letter-spacing: 0;\n line-height: 1.1875em;\n margin: 10px 0 20px 0;\n text-align: center;\n width: 100%;\n}\n\n@media only screen and (max-width: 768px) {\n .walletconnect-qrcode__text {\n font-size: 4vw;\n }\n}\n\n@media only screen and (max-width: 320px) {\n .walletconnect-qrcode__text {\n font-size: 14px;\n }\n}\n\n.walletconnect-qrcode__image {\n width: calc(100% - 30px);\n box-sizing: border-box;\n cursor: none;\n margin: 0 auto;\n}\n\n.walletconnect-qrcode__notification {\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n font-size: 16px;\n padding: 16px 20px;\n border-radius: 16px;\n text-align: center;\n transition: all 0.1s ease-in-out;\n background: white;\n color: black;\n margin-bottom: -60px;\n opacity: 0;\n}\n\n.walletconnect-qrcode__notification.notification__show {\n opacity: 1;\n}\n\n@media only screen and (max-width: 768px) {\n .walletconnect-modal__header {\n height: 130px;\n }\n .walletconnect-modal__base {\n overflow: auto;\n }\n}\n\n@media only screen and (min-device-width: 415px) and (max-width: 768px) {\n #content {\n max-width: 768px;\n box-sizing: border-box;\n }\n}\n\n@media only screen and (min-width: 375px) and (max-width: 415px) {\n #content {\n max-width: 414px;\n box-sizing: border-box;\n }\n}\n\n@media only screen and (min-width: 320px) and (max-width: 375px) {\n #content {\n max-width: 375px;\n box-sizing: border-box;\n }\n}\n\n@media only screen and (max-width: 320px) {\n #content {\n max-width: 320px;\n box-sizing: border-box;\n }\n}\n\n.walletconnect-modal__base {\n -webkit-font-smoothing: antialiased;\n background: #ffffff;\n border-radius: 24px;\n box-shadow: 0 10px 50px 5px rgba(0, 0, 0, 0.4);\n font-family: ui-rounded, "SF Pro Rounded", "SF Pro Text", medium-content-sans-serif-font,\n -apple-system, BlinkMacSystemFont, ui-sans-serif, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell,\n "Open Sans", "Helvetica Neue", sans-serif;\n margin-top: 41px;\n padding: 24px 24px 22px;\n pointer-events: auto;\n position: relative;\n text-align: center;\n transition: 0.4s cubic-bezier(0.19, 1, 0.22, 1);\n will-change: transform;\n overflow: visible;\n transform: translateY(-50%);\n top: 50%;\n max-width: 500px;\n margin: auto;\n}\n\n@media only screen and (max-width: 320px) {\n .walletconnect-modal__base {\n padding: 24px 12px;\n }\n}\n\n.walletconnect-modal__base .hidden {\n transform: translateY(150%);\n transition: 0.125s cubic-bezier(0.4, 0, 1, 1);\n}\n\n.walletconnect-modal__header {\n align-items: center;\n display: flex;\n height: 26px;\n left: 0;\n justify-content: space-between;\n position: absolute;\n top: -42px;\n width: 100%;\n}\n\n.walletconnect-modal__base .wc-logo {\n align-items: center;\n display: flex;\n height: 26px;\n margin-top: 15px;\n padding-bottom: 15px;\n pointer-events: auto;\n}\n\n.walletconnect-modal__base .wc-logo div {\n background-color: #3399ff;\n height: 21px;\n margin-right: 5px;\n mask-image: url("images/wc-logo.svg") center no-repeat;\n width: 32px;\n}\n\n.walletconnect-modal__base .wc-logo p {\n color: #ffffff;\n font-size: 20px;\n font-weight: 600;\n margin: 0;\n}\n\n.walletconnect-modal__base h2 {\n color: rgba(60, 66, 82, 0.6);\n font-size: 16px;\n font-weight: 600;\n letter-spacing: 0;\n line-height: 1.1875em;\n margin: 0 0 19px 0;\n text-align: center;\n width: 100%;\n}\n\n.walletconnect-modal__base__row {\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n align-items: center;\n border-radius: 20px;\n cursor: pointer;\n display: flex;\n height: 56px;\n justify-content: space-between;\n padding: 0 15px;\n position: relative;\n margin: 0px 0px 8px;\n text-align: left;\n transition: 0.15s cubic-bezier(0.25, 0.46, 0.45, 0.94);\n will-change: transform;\n text-decoration: none;\n}\n\n.walletconnect-modal__base__row:hover {\n background: rgba(60, 66, 82, 0.06);\n}\n\n.walletconnect-modal__base__row:active {\n background: rgba(60, 66, 82, 0.06);\n transform: scale(0.975);\n transition: 0.1s cubic-bezier(0.25, 0.46, 0.45, 0.94);\n}\n\n.walletconnect-modal__base__row__h3 {\n color: #25292e;\n font-size: 20px;\n font-weight: 700;\n margin: 0;\n padding-bottom: 3px;\n}\n\n.walletconnect-modal__base__row__right {\n align-items: center;\n display: flex;\n justify-content: center;\n}\n\n.walletconnect-modal__base__row__right__app-icon {\n border-radius: 8px;\n height: 34px;\n margin: 0 11px 2px 0;\n width: 34px;\n background-size: 100%;\n box-shadow: 0 4px 12px 0 rgba(37, 41, 46, 0.25);\n}\n\n.walletconnect-modal__base__row__right__caret {\n height: 18px;\n opacity: 0.3;\n transition: 0.1s cubic-bezier(0.25, 0.46, 0.45, 0.94);\n width: 8px;\n will-change: opacity;\n}\n\n.walletconnect-modal__base__row:hover .caret,\n.walletconnect-modal__base__row:active .caret {\n opacity: 0.6;\n}\n\n.walletconnect-modal__mobile__toggle {\n width: 80%;\n display: flex;\n margin: 0 auto;\n position: relative;\n overflow: hidden;\n border-radius: 8px;\n margin-bottom: 18px;\n background: #d4d5d9;\n}\n\n.walletconnect-modal__single_wallet {\n display: flex;\n justify-content: center;\n margin-top: 7px;\n margin-bottom: 18px;\n}\n\n.walletconnect-modal__single_wallet a {\n cursor: pointer;\n color: rgb(64, 153, 255);\n font-size: 21px;\n font-weight: 800;\n text-decoration: none !important;\n margin: 0 auto;\n}\n\n.walletconnect-modal__mobile__toggle_selector {\n width: calc(50% - 8px);\n background: white;\n position: absolute;\n border-radius: 5px;\n height: calc(100% - 8px);\n top: 4px;\n transition: all 0.2s ease-in-out;\n transform: translate3d(4px, 0, 0);\n}\n\n.walletconnect-modal__mobile__toggle.right__selected .walletconnect-modal__mobile__toggle_selector {\n transform: translate3d(calc(100% + 12px), 0, 0);\n}\n\n.walletconnect-modal__mobile__toggle a {\n font-size: 12px;\n width: 50%;\n text-align: center;\n padding: 8px;\n margin: 0;\n font-weight: 600;\n z-index: 1;\n}\n\n.walletconnect-modal__footer {\n display: flex;\n justify-content: center;\n margin-top: 20px;\n}\n\n@media only screen and (max-width: 768px) {\n .walletconnect-modal__footer {\n margin-top: 5vw;\n }\n}\n\n.walletconnect-modal__footer a {\n cursor: pointer;\n color: #898d97;\n font-size: 15px;\n margin: 0 auto;\n}\n\n@media only screen and (max-width: 320px) {\n .walletconnect-modal__footer a {\n font-size: 14px;\n }\n}\n\n.walletconnect-connect__buttons__wrapper {\n max-height: 44vh;\n}\n\n.walletconnect-connect__buttons__wrapper__android {\n margin: 50% 0;\n}\n\n.walletconnect-connect__buttons__wrapper__wrap {\n display: grid;\n grid-template-columns: repeat(4, 1fr);\n margin: 10px 0;\n}\n\n@media only screen and (min-width: 768px) {\n .walletconnect-connect__buttons__wrapper__wrap {\n margin-top: 40px;\n }\n}\n\n.walletconnect-connect__button {\n background-color: rgb(64, 153, 255);\n padding: 12px;\n border-radius: 8px;\n text-decoration: none;\n color: rgb(255, 255, 255);\n font-weight: 500;\n}\n\n.walletconnect-connect__button__icon_anchor {\n cursor: pointer;\n display: flex;\n justify-content: flex-start;\n align-items: center;\n margin: 8px;\n width: 42px;\n justify-self: center;\n flex-direction: column;\n text-decoration: none !important;\n}\n\n@media only screen and (max-width: 320px) {\n .walletconnect-connect__button__icon_anchor {\n margin: 4px;\n }\n}\n\n.walletconnect-connect__button__icon {\n border-radius: 10px;\n height: 42px;\n margin: 0;\n width: 42px;\n background-size: cover !important;\n box-shadow: 0 4px 12px 0 rgba(37, 41, 46, 0.25);\n}\n\n.walletconnect-connect__button__text {\n color: #424952;\n font-size: 2.7vw;\n text-decoration: none !important;\n padding: 0;\n margin-top: 1.8vw;\n font-weight: 600;\n}\n\n@media only screen and (min-width: 768px) {\n .walletconnect-connect__button__text {\n font-size: 16px;\n margin-top: 12px;\n }\n}\n\n.walletconnect-search__input {\n border: none;\n background: #d4d5d9;\n border-style: none;\n padding: 8px 16px;\n outline: none;\n font-style: normal;\n font-stretch: normal;\n font-size: 16px;\n font-style: normal;\n font-stretch: normal;\n line-height: normal;\n letter-spacing: normal;\n text-align: left;\n border-radius: 8px;\n width: calc(100% - 16px);\n margin: 0;\n margin-bottom: 8px;\n}\n';"undefined"==typeof Symbol||(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"==typeof Symbol||(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var s="data:image/svg+xml,%3Csvg height='185' viewBox='0 0 300 185' width='300' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m61.4385429 36.2562612c48.9112241-47.8881663 128.2119871-47.8881663 177.1232091 0l5.886545 5.7634174c2.445561 2.3944081 2.445561 6.2765112 0 8.6709204l-20.136695 19.715503c-1.222781 1.1972051-3.2053 1.1972051-4.428081 0l-8.100584-7.9311479c-34.121692-33.4079817-89.443886-33.4079817-123.5655788 0l-8.6750562 8.4936051c-1.2227816 1.1972041-3.205301 1.1972041-4.4280806 0l-20.1366949-19.7155031c-2.4455612-2.3944092-2.4455612-6.2765122 0-8.6709204zm218.7677961 40.7737449 17.921697 17.546897c2.445549 2.3943969 2.445563 6.2764769.000031 8.6708899l-80.810171 79.121134c-2.445544 2.394426-6.410582 2.394453-8.85616.000062-.00001-.00001-.000022-.000022-.000032-.000032l-57.354143-56.154572c-.61139-.598602-1.60265-.598602-2.21404 0-.000004.000004-.000007.000008-.000011.000011l-57.3529212 56.154531c-2.4455368 2.394432-6.4105755 2.394472-8.8561612.000087-.0000143-.000014-.0000296-.000028-.0000449-.000044l-80.81241943-79.122185c-2.44556021-2.394408-2.44556021-6.2765115 0-8.6709197l17.92172963-17.5468673c2.4455602-2.3944082 6.4105989-2.3944082 8.8561602 0l57.3549775 56.155357c.6113908.598602 1.602649.598602 2.2140398 0 .0000092-.000009.0000174-.000017.0000265-.000024l57.3521031-56.155333c2.445505-2.3944633 6.410544-2.3945531 8.856161-.0002.000034.0000336.000068.0000673.000101.000101l57.354902 56.155432c.61139.598601 1.60265.598601 2.21404 0l57.353975-56.1543249c2.445561-2.3944092 6.410599-2.3944092 8.85616 0z' fill='%233b99fc'/%3E%3C/svg%3E",a="WalletConnect",u=300,c="rgb(64, 153, 255)",l="walletconnect-wrapper",h="walletconnect-style-sheet",f="walletconnect-qrcode-modal",d="walletconnect-qrcode-close",p="walletconnect-qrcode-text",m="walletconnect-connect-button";function _(e){return i.createElement("div",{className:"walletconnect-modal__header"},i.createElement("img",{src:s,className:"walletconnect-modal__headerLogo"}),i.createElement("p",null,a),i.createElement("div",{className:"walletconnect-modal__close__wrapper",onClick:e.onClose},i.createElement("div",{id:d,className:"walletconnect-modal__close__icon"},i.createElement("div",{className:"walletconnect-modal__close__line1"}),i.createElement("div",{className:"walletconnect-modal__close__line2"}))))}function g(e){return i.createElement("a",{className:"walletconnect-connect__button",href:e.href,id:m+"-"+e.name,onClick:e.onClick,rel:"noopener noreferrer",style:{backgroundColor:e.color},target:"_blank"},e.name)}var v="data:image/svg+xml,%3Csvg fill='none' height='18' viewBox='0 0 8 18' width='8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath clip-rule='evenodd' d='m.586301.213898c-.435947.33907-.5144813.967342-.175411 1.403292l4.87831 6.27212c.28087.36111.28087.86677 0 1.22788l-4.878311 6.27211c-.33907.436-.260536 1.0642.175412 1.4033.435949.3391 1.064219.2605 1.403289-.1754l4.87832-6.2721c.84259-1.08336.84259-2.60034 0-3.68367l-4.87832-6.27212c-.33907-.4359474-.96734-.514482-1.403289-.175412z' fill='%233c4252' fill-rule='evenodd'/%3E%3C/svg%3E";function y(e){var t=e.color,r=e.href,n=e.name,o=e.logo,s=e.onClick;return i.createElement("a",{className:"walletconnect-modal__base__row",href:r,onClick:s,rel:"noopener noreferrer",target:"_blank"},i.createElement("h3",{className:"walletconnect-modal__base__row__h3"},n),i.createElement("div",{className:"walletconnect-modal__base__row__right"},i.createElement("div",{className:"walletconnect-modal__base__row__right__app-icon",style:{background:"url('"+o+"') "+t,backgroundSize:"100%"}}),i.createElement("img",{src:v,className:"walletconnect-modal__base__row__right__caret"})))}function w(e){var t=e.color,r=e.href,n=e.name,o=e.logo,s=e.onClick,a=window.innerWidth<768?(n.length>8?2.5:2.7)+"vw":"inherit";return i.createElement("a",{className:"walletconnect-connect__button__icon_anchor",href:r,onClick:s,rel:"noopener noreferrer",target:"_blank"},i.createElement("div",{className:"walletconnect-connect__button__icon",style:{background:"url('"+o+"') "+t,backgroundSize:"100%"}}),i.createElement("div",{style:{fontSize:a},className:"walletconnect-connect__button__text"},n))}var b=5,E=12;function M(e){var r=t.isAndroid(),n=i.useState(""),o=n[0],s=n[1],a=i.useState(""),u=a[0],l=a[1],h=i.useState(1),f=h[0],d=h[1],m=u?e.links.filter((function(e){return e.name.toLowerCase().includes(u.toLowerCase())})):e.links,_=e.errorMessage,v=u||m.length>b,M=Math.ceil(m.length/E),S=[(f-1)*E+1,f*E],x=m.length?m.filter((function(e,t){return t+1>=S[0]&&t+1<=S[1]})):[],k=!(r||!(M>1)),R=void 0;return i.createElement("div",null,i.createElement("p",{id:p,className:"walletconnect-qrcode__text"},r?e.text.connect_mobile_wallet:e.text.choose_preferred_wallet),!r&&i.createElement("input",{className:"walletconnect-search__input",placeholder:"Search",value:o,onChange:function(e){s(e.target.value),clearTimeout(R),e.target.value?R=setTimeout((function(){l(e.target.value),d(1)}),1e3):(s(""),l(""),d(1))}}),i.createElement("div",{className:"walletconnect-connect__buttons__wrapper"+(r?"__android":v&&m.length?"__wrap":"")},r?i.createElement(g,{name:e.text.connect,color:c,href:e.uri,onClick:i.useCallback((function(){t.saveMobileLinkInfo({name:"Unknown",href:e.uri})}),[])}):x.length?x.map((function(r){var n=r.color,o=r.name,s=r.shortName,a=r.logo,u=t.formatIOSMobile(e.uri,r),c=i.useCallback((function(){t.saveMobileLinkInfo({name:o,href:u})}),[x]);return v?i.createElement(w,{color:n,href:u,name:s||o,logo:a,onClick:c}):i.createElement(y,{color:n,href:u,name:o,logo:a,onClick:c})})):i.createElement(i.Fragment,null,i.createElement("p",null,_.length?e.errorMessage:e.links.length&&!m.length?e.text.no_wallets_found:e.text.loading))),k&&i.createElement("div",{className:"walletconnect-modal__footer"},Array(M).fill(0).map((function(e,t){var r=t+1,n=f===r;return i.createElement("a",{style:{margin:"auto 10px",fontWeight:n?"bold":"normal"},onClick:function(){return d(r)}},r)}))))}function S(e){var t=!!e.message.trim();return i.createElement("div",{className:"walletconnect-qrcode__notification"+(t?" notification__show":"")},e.message)}var x=function(e){try{var t="";return Promise.resolve(r.toString(e,{margin:0,type:"svg"})).then((function(e){return"string"==typeof e&&(t=e.replace("<svg",'<svg class="walletconnect-qrcode__image"')),t}))}catch(e){return Promise.reject(e)}};function k(e){var t=i.useState(""),r=t[0],o=t[1],s=i.useState(""),a=s[0],u=s[1];i.useEffect((function(){try{return Promise.resolve(x(e.uri)).then((function(e){u(e)}))}catch(e){Promise.reject(e)}}),[]);return i.createElement("div",null,i.createElement("p",{id:p,className:"walletconnect-qrcode__text"},e.text.scan_qrcode_with_wallet),i.createElement("div",{dangerouslySetInnerHTML:{__html:a}}),i.createElement("div",{className:"walletconnect-modal__footer"},i.createElement("a",{onClick:function(){n(e.uri)?(o(e.text.copied_to_clipboard),setInterval((function(){return o("")}),1200)):(o("Error"),setInterval((function(){return o("")}),1200))}},e.text.copy_to_clipboard)),i.createElement(S,{message:r}))}function R(e){var r=t.isAndroid(),n=t.isMobile(),o=n?e.qrcodeModalOptions&&e.qrcodeModalOptions.mobileLinks?e.qrcodeModalOptions.mobileLinks:void 0:e.qrcodeModalOptions&&e.qrcodeModalOptions.desktopLinks?e.qrcodeModalOptions.desktopLinks:void 0,s=i.useState(!1),a=s[0],u=s[1],c=i.useState(!1),l=c[0],h=c[1],d=i.useState(!n),p=d[0],m=d[1],g={mobile:n,text:e.text,uri:e.uri,qrcodeModalOptions:e.qrcodeModalOptions},v=i.useState(""),y=v[0],w=v[1],b=i.useState(!1),E=b[0],S=b[1],x=i.useState([]),R=x[0],T=x[1],C=i.useState(""),A=C[0],O=C[1],L=function(){l||a||o&&!o.length||R.length>0||i.useEffect((function(){!function(){try{if(r)return Promise.resolve();u(!0);var i=function(e,t){try{var r=e()}catch(e){return t(e)}return r&&r.then?r.then(void 0,t):r}((function(){var r=e.qrcodeModalOptions&&e.qrcodeModalOptions.registryUrl?e.qrcodeModalOptions.registryUrl:t.getWalletRegistryUrl();return Promise.resolve(fetch(r)).then((function(r){return Promise.resolve(r.json()).then((function(r){var i=r.listings,s=n?"mobile":"desktop",a=t.getMobileLinkRegistry(t.formatMobileRegistry(i,s),o);u(!1),h(!0),O(a.length?"":e.text.no_supported_wallets),T(a);var c=1===a.length;c&&(w(t.formatIOSMobile(e.uri,a[0])),m(!0)),S(c)}))}))}),(function(t){u(!1),h(!0),O(e.text.something_went_wrong),console.error(t)}));return Promise.resolve(i&&i.then?i.then((function(){})):void 0)}catch(e){return Promise.reject(e)}}()}))};L();var B=n?p:!p;return i.createElement("div",{id:f,className:"walletconnect-qrcode__base animated fadeIn"},i.createElement("div",{className:"walletconnect-modal__base"},i.createElement(_,{onClose:e.onClose}),E&&p?i.createElement("div",{className:"walletconnect-modal__single_wallet"},i.createElement("a",{onClick:function(){return t.saveMobileLinkInfo({name:R[0].name,href:y})},href:y,rel:"noopener noreferrer",target:"_blank"},e.text.connect_with+" "+(E?R[0].name:"")+" ›")):r||a||!a&&R.length?i.createElement("div",{className:"walletconnect-modal__mobile__toggle"+(B?" right__selected":"")},i.createElement("div",{className:"walletconnect-modal__mobile__toggle_selector"}),n?i.createElement(i.Fragment,null,i.createElement("a",{onClick:function(){return m(!1),L()}},e.text.mobile),i.createElement("a",{onClick:function(){return m(!0)}},e.text.qrcode)):i.createElement(i.Fragment,null,i.createElement("a",{onClick:function(){return m(!0)}},e.text.qrcode),i.createElement("a",{onClick:function(){return m(!1),L()}},e.text.desktop))):null,i.createElement("div",null,p||!r&&!a&&!R.length?i.createElement(k,Object.assign({},g)):i.createElement(M,Object.assign({},g,{links:R,errorMessage:A})))))}var T={de:{choose_preferred_wallet:"Wähle bevorzugte Wallet",connect_mobile_wallet:"Verbinde mit Mobile Wallet",scan_qrcode_with_wallet:"Scanne den QR-code mit einer WalletConnect kompatiblen Wallet",connect:"Verbinden",qrcode:"QR-Code",mobile:"Mobile",desktop:"Desktop",copy_to_clipboard:"In die Zwischenablage kopieren",copied_to_clipboard:"In die Zwischenablage kopiert!",connect_with:"Verbinden mit Hilfe von",loading:"Laden...",something_went_wrong:"Etwas ist schief gelaufen",no_supported_wallets:"Es gibt noch keine unterstützten Wallet",no_wallets_found:"keine Wallet gefunden"},en:{choose_preferred_wallet:"Choose your preferred wallet",connect_mobile_wallet:"Connect to Mobile Wallet",scan_qrcode_with_wallet:"Scan QR code with a WalletConnect-compatible wallet",connect:"Connect",qrcode:"QR Code",mobile:"Mobile",desktop:"Desktop",copy_to_clipboard:"Copy to clipboard",copied_to_clipboard:"Copied to clipboard!",connect_with:"Connect with",loading:"Loading...",something_went_wrong:"Something went wrong",no_supported_wallets:"There are no supported wallets yet",no_wallets_found:"No wallets found"},es:{choose_preferred_wallet:"Elige tu billetera preferida",connect_mobile_wallet:"Conectar a billetera móvil",scan_qrcode_with_wallet:"Escanea el código QR con una billetera compatible con WalletConnect",connect:"Conectar",qrcode:"Código QR",mobile:"Móvil",desktop:"Desktop",copy_to_clipboard:"Copiar",copied_to_clipboard:"Copiado!",connect_with:"Conectar mediante",loading:"Cargando...",something_went_wrong:"Algo salió mal",no_supported_wallets:"Todavía no hay billeteras compatibles",no_wallets_found:"No se encontraron billeteras"},fr:{choose_preferred_wallet:"Choisissez votre portefeuille préféré",connect_mobile_wallet:"Se connecter au portefeuille mobile",scan_qrcode_with_wallet:"Scannez le QR code avec un portefeuille compatible WalletConnect",connect:"Se connecter",qrcode:"QR Code",mobile:"Mobile",desktop:"Desktop",copy_to_clipboard:"Copier",copied_to_clipboard:"Copié!",connect_with:"Connectez-vous à l'aide de",loading:"Chargement...",something_went_wrong:"Quelque chose a mal tourné",no_supported_wallets:"Il n'y a pas encore de portefeuilles pris en charge",no_wallets_found:"Aucun portefeuille trouvé"},ko:{choose_preferred_wallet:"원하는 지갑을 선택하세요",connect_mobile_wallet:"모바일 지갑과 연결",scan_qrcode_with_wallet:"WalletConnect 지원 지갑에서 QR코드를 스캔하세요",connect:"연결",qrcode:"QR 코드",mobile:"모바일",desktop:"데스크탑",copy_to_clipboard:"클립보드에 복사",copied_to_clipboard:"클립보드에 복사되었습니다!",connect_with:"와 연결하다",loading:"로드 중...",something_went_wrong:"문제가 발생했습니다.",no_supported_wallets:"아직 지원되는 지갑이 없습니다",no_wallets_found:"지갑을 찾을 수 없습니다"},pt:{choose_preferred_wallet:"Escolha sua carteira preferida",connect_mobile_wallet:"Conectar-se à carteira móvel",scan_qrcode_with_wallet:"Ler o código QR com uma carteira compatível com WalletConnect",connect:"Conectar",qrcode:"Código QR",mobile:"Móvel",desktop:"Desktop",copy_to_clipboard:"Copiar",copied_to_clipboard:"Copiado!",connect_with:"Ligar por meio de",loading:"Carregamento...",something_went_wrong:"Algo correu mal",no_supported_wallets:"Ainda não há carteiras suportadas",no_wallets_found:"Nenhuma carteira encontrada"},zh:{choose_preferred_wallet:"选择你的钱包",connect_mobile_wallet:"连接至移动端钱包",scan_qrcode_with_wallet:"使用兼容 WalletConnect 的钱包扫描二维码",connect:"连接",qrcode:"二维码",mobile:"移动",desktop:"桌面",copy_to_clipboard:"复制到剪贴板",copied_to_clipboard:"复制到剪贴板成功!",connect_with:"通过以下方式连接",loading:"正在加载...",something_went_wrong:"出了问题",no_supported_wallets:"目前还没有支持的钱包",no_wallets_found:"没有找到钱包"},fa:{choose_preferred_wallet:"کیف پول مورد نظر خود را انتخاب کنید",connect_mobile_wallet:"به کیف پول موبایل وصل شوید",scan_qrcode_with_wallet:"کد QR را با یک کیف پول سازگار با WalletConnect اسکن کنید",connect:"اتصال",qrcode:"کد QR",mobile:"سیار",desktop:"دسکتاپ",copy_to_clipboard:"کپی به کلیپ بورد",copied_to_clipboard:"در کلیپ بورد کپی شد!",connect_with:"ارتباط با",loading:"...بارگذاری",something_went_wrong:"مشکلی پیش آمد",no_supported_wallets:"هنوز هیچ کیف پول پشتیبانی شده ای وجود ندارد",no_wallets_found:"هیچ کیف پولی پیدا نشد"}};function C(){var e=t.getDocumentOrThrow(),r=e.getElementById(f);r&&(r.className=r.className.replace("fadeIn","fadeOut"),setTimeout((function(){var t=e.getElementById(l);t&&e.body.removeChild(t)}),u))}function A(e){return function(){C(),e&&e()}}function O(e,r,n){!function(){var e=t.getDocumentOrThrow(),r=e.getElementById(h);r&&e.head.removeChild(r);var n=e.createElement("style");n.setAttribute("id",h),n.innerText=o,e.head.appendChild(n)}();var s,a=function(){var e=t.getDocumentOrThrow(),r=e.createElement("div");return r.setAttribute("id",l),e.body.appendChild(r),r}();i.render(i.createElement(R,{text:(s=t.getNavigatorOrThrow().language.split("-")[0]||"en",T[s]||T.en),uri:e,onClose:A(r),qrcodeModalOptions:n}),a)}var L=function(){return"undefined"!=typeof process&&void 0!==process.versions&&void 0!==process.versions.node};return qa={open:function(e,t,n){console.log(e),L()?function(e){r.toString(e,{type:"terminal"}).then(console.log)}(e):O(e,t,n)},close:function(){L()||C()}}}()),sm=nm.__importDefault(function(){if(hu)return Ya;hu=1,Object.defineProperty(Ya,"__esModule",{value:!0});const e=n.__importDefault(($a||($a=1,function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}function i(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function o(e,t,n,o,s){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new i(n,o||e,s),u=r?r+t:t;return e._events[u]?e._events[u].fn?e._events[u]=[e._events[u],a]:e._events[u].push(a):(e._events[u]=a,e._eventsCount++),e}function s(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function a(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),a.prototype.eventNames=function(){var e,n,i=[];if(0===this._eventsCount)return i;for(n in e=this._events)t.call(e,n)&&i.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},a.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,o=n.length,s=new Array(o);i<o;i++)s[i]=n[i].fn;return s},a.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},a.prototype.emit=function(e,t,n,i,o,s){var a=r?r+e:e;if(!this._events[a])return!1;var u,c,l=this._events[a],h=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),h){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,n),!0;case 4:return l.fn.call(l.context,t,n,i),!0;case 5:return l.fn.call(l.context,t,n,i,o),!0;case 6:return l.fn.call(l.context,t,n,i,o,s),!0}for(c=1,u=new Array(h-1);c<h;c++)u[c-1]=arguments[c];l.fn.apply(l.context,u)}else{var f,d=l.length;for(c=0;c<d;c++)switch(l[c].once&&this.removeListener(e,l[c].fn,void 0,!0),h){case 1:l[c].fn.call(l[c].context);break;case 2:l[c].fn.call(l[c].context,t);break;case 3:l[c].fn.call(l[c].context,t,n);break;case 4:l[c].fn.call(l[c].context,t,n,i);break;default:if(!u)for(f=1,u=new Array(h-1);f<h;f++)u[f-1]=arguments[f];l[c].fn.apply(l[c].context,u)}}return!0},a.prototype.on=function(e,t,r){return o(this,e,t,r,!1)},a.prototype.once=function(e,t,r){return o(this,e,t,r,!0)},a.prototype.removeListener=function(e,t,n,i){var o=r?r+e:e;if(!this._events[o])return this;if(!t)return s(this,o),this;var a=this._events[o];if(a.fn)a.fn!==t||i&&!a.once||n&&a.context!==n||s(this,o);else{for(var u=0,c=[],l=a.length;u<l;u++)(a[u].fn!==t||i&&!a[u].once||n&&a[u].context!==n)&&c.push(a[u]);c.length?this._events[o]=1===c.length?c[0]:c:s(this,o)}return this},a.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&s(this,t)):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=r,a.EventEmitter=a,e.exports=a}(Za)),Za.exports)),t=(lu||(lu=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),function(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}(du());var t=ou();e.XMLHttpRequestEventTarget=t.XMLHttpRequestEventTarget}(Qa)),Qa),r=(0,Or().getFromWindow)("XMLHttpRequest")||t.XMLHttpRequest;class i extends e.default{constructor(e){super(),this.url=e}formatError(e,t,r=-1){return{error:{message:t,code:r},id:e.id,jsonrpc:e.jsonrpc}}send(e,t){return new Promise((n=>{if("eth_subscribe"===e.method){const t=this.formatError(e,"Subscriptions are not supported by this HTTP endpoint");return this.emit("error",t),n(t)}const i=new r;let o=!1;const s=(r,s)=>{if(!o)if(i.abort(),o=!0,t)t(r,s);else{const{id:t,jsonrpc:i}=e,o=r?{id:t,jsonrpc:i,error:{message:r.message,code:r.code}}:{id:t,jsonrpc:i,result:s};this.emit("payload",o),n(o)}};i.open("POST",this.url,!0),i.setRequestHeader("Content-Type","application/json"),i.timeout=6e4,i.onerror=s,i.ontimeout=s,i.onreadystatechange=()=>{if(4===i.readyState)try{const e=JSON.parse(i.responseText);s(e.error,e.result)}catch(e){s(e)}},i.send(JSON.stringify(e))}))}}return Ya.default=i,Ya}()),am=Or(),um=function(){if(Qf)return Jf;Qf=1;const e=f.EventEmitter,t=R.inherits,r=_l(),n=Rl(),i=jf(),o=gd(),s=function(){if(Kf)return Wf;Kf=1;const e=f.EventEmitter,t=R.inherits;function r(){e.call(this),this.isLocked=!0}return Wf=r,t(r,e),r.prototype.go=function(){this.isLocked=!1,this.emit("unlock")},r.prototype.stop=function(){this.isLocked=!0,this.emit("lock")},r.prototype.await=function(e){const t=this;t.isLocked?t.once("unlock",e):setTimeout(e)},Wf}();vd();const a=yd(),u=function(){};function c(t){const r=this;e.call(r),r.setMaxListeners(30),t=t||{};const i={sendAsync:r._handleAsync.bind(r)},o=t.blockTrackerProvider||i;r._blockTracker=t.blockTracker||new n({provider:o,pollingInterval:t.pollingInterval||4e3,setSkipCacheFlag:!0}),r._ready=new s,r.currentBlock=null,r._providers=[]}return Jf=c,t(c,e),c.prototype.start=function(e=u){const t=this;t._ready.go(),t._blockTracker.on("latest",(e=>{t._getBlockByNumberWithRetry(e,((e,n)=>{if(e)return void this.emit("error",e);if(!n)return console.log(n),void this.emit("error",new Error("Could not find block"));const i=(o=n,{number:r.toBuffer(o.number),hash:r.toBuffer(o.hash),parentHash:r.toBuffer(o.parentHash),nonce:r.toBuffer(o.nonce),mixHash:r.toBuffer(o.mixHash),sha3Uncles:r.toBuffer(o.sha3Uncles),logsBloom:r.toBuffer(o.logsBloom),transactionsRoot:r.toBuffer(o.transactionsRoot),stateRoot:r.toBuffer(o.stateRoot),receiptsRoot:r.toBuffer(o.receiptRoot||o.receiptsRoot),miner:r.toBuffer(o.miner),difficulty:r.toBuffer(o.difficulty),totalDifficulty:r.toBuffer(o.totalDifficulty),size:r.toBuffer(o.size),extraData:r.toBuffer(o.extraData),gasLimit:r.toBuffer(o.gasLimit),gasUsed:r.toBuffer(o.gasUsed),timestamp:r.toBuffer(o.timestamp),transactions:o.transactions});var o;t._setCurrentBlock(i),t.emit("rawBlock",n),t.emit("latest",n)}))})),t._blockTracker.on("sync",t.emit.bind(t,"sync")),t._blockTracker.on("error",t.emit.bind(t,"error")),t._running=!0,t.emit("start")},c.prototype.stop=function(){const e=this;e._blockTracker.removeAllListeners(),e._running=!1,e.emit("stop")},c.prototype.isRunning=function(){return this._running},c.prototype.addProvider=function(e,t){const r=this;"number"==typeof t?r._providers.splice(t,0,e):r._providers.push(e),e.setEngine(this)},c.prototype.removeProvider=function(e){const t=this._providers.indexOf(e);if(t<0)throw new Error("Provider not found.");this._providers.splice(t,1)},c.prototype.send=function(e){throw new Error("Web3ProviderEngine does not support synchronous requests.")},c.prototype.sendAsync=function(e,t){const r=this;r._ready.await((function(){Array.isArray(e)?i(e,r._handleAsync.bind(r),t):r._handleAsync(e,t)}))},c.prototype._getBlockByNumberWithRetry=function(e,t){const r=this;let n=5;return void i();function i(){r._getBlockByNumber(e,o)}function o(e,r){return e?t(e):r?void t(null,r):n>0?(n--,void setTimeout((function(){i()}),1e3)):void t(null,null)}},c.prototype._getBlockByNumber=function(e,t){const r=a({method:"eth_getBlockByNumber",params:[e,!1],skipCache:!0});this._handleAsync(r,((e,r)=>e?t(e):t(null,r.result)))},c.prototype._handleAsync=function(e,t){var r=this,n=-1,i=null,s=null,a=[];function u(r,n){s=r,i=n,o(a,(function(e,t){e?e(s,i,t):t()}),(function(){var r={id:e.id,jsonrpc:e.jsonrpc,result:i};null!=s?(r.error={message:s.stack||s.message||s,code:-32e3},t(s,r)):t(null,r)}))}!function t(i){if(n+=1,a.unshift(i),n>=r._providers.length)u(new Error('Request for method "'+e.method+'" not handled by any subprovider. Please check your subprovider configuration to ensure this method is handled.'));else try{r._providers[n].handleRequest(e,t,u)}catch(e){u(e)}}()},c.prototype._setCurrentBlock=function(e){this.currentBlock=e,this.emit("block",e)},Jf}(),cm=function(){if(ld)return cd;ld=1;const e=bd(),t=function(){if(ud)return ad;ud=1;const e=Ed(),t=Md(),r=[void 0,null,"<nil>"];ad=function(r={}){const{blockTracker:i}=r;if(!i)throw new Error("createBlockCacheMiddleware - No BlockTracker specified");const o=new n,s={perma:o,block:o,fork:o};return t((async(t,r,n)=>{if(t.skipCache)return n();const a=e.cacheTypeForPayload(t),u=s[a];if(!u)return n();if(!u.canCacheRequest(t))return n();let c,l=e.blockTagForPayload(t);if(l||(l="latest"),"earliest"===l)c="0x00";else if("latest"===l){const e=await i.getLatestBlock();o.clearBefore(e),c=e}else c=l;const h=await u.get(t,c);void 0===h?(await n(),await u.set(t,c,r.result)):r.result=h}))};class n{constructor(){this.cache={}}getBlockCacheForPayload(e,t){const r=Number.parseInt(t,16);let n=this.cache[r];if(!n){const e={};this.cache[r]=e,n=e}return n}async get(t,r){const n=this.getBlockCacheForPayload(t,r);if(n)return n[e.cacheIdentifierForPayload(t,!0)]}async set(t,r,n){this.canCacheResult(t,n)&&(this.getBlockCacheForPayload(t,r)[e.cacheIdentifierForPayload(t,!0)]=n)}canCacheRequest(t){return!!e.canCache(t)&&"pending"!==e.blockTagForPayload(t)}canCacheResult(e,t){if(!r.includes(t))return!!(!["eth_getTransactionByHash","eth_getTransactionReceipt"].includes(e.method)||t&&t.blockHash&&"0x0000000000000000000000000000000000000000000000000000000000000000"!==t.blockHash)}clearBefore(e){const t=this,r=Number.parseInt(e,16);Object.keys(t.cache).map(Number).filter((e=>e<r)).forEach((e=>delete t.cache[e]))}}return ad}();return cd=class extends e{constructor(e){super((({blockTracker:r})=>t(Object.assign({blockTracker:r},e))))}}}(),lm=function(){if(fd)return hd;fd=1;const e=R.inherits,t=wd();function r(e){e=e||{},this.staticResponses=e}return hd=r,e(r,t),r.prototype.handleRequest=function(e,t,r){var n=this.staticResponses[e.method];"function"==typeof n?n(e,t,r):void 0!==n?setTimeout((()=>r(null,n))):t()},hd}(),hm=function(){if(Gd)return zd;Gd=1;const e=bd(),t=ep();return zd=class extends e{constructor(){super((({blockTracker:e,provider:r,engine:n})=>t({blockTracker:e,provider:r})))}}}(),fm=function(){if(zp)return Kp;zp=1;const e=np(),t=up(),r=R.inherits,n=_l(),i=function(){if(Dp)return Np;Dp=1;const e=_l(),t=Hp();function r(r){const n=new Error("Expect argument to be non-empty array");if("object"!=typeof r||!r.length)throw n;const i=r.map((function(t){return"bytes"===t.type?e.toBuffer(t.value):t.value})),o=r.map((function(e){return e.type})),s=r.map((function(e){if(!e.name)throw n;return e.type+" "+e.name}));return t.soliditySHA3(["bytes32","bytes32"],[t.soliditySHA3(new Array(r.length).fill("string"),s),t.soliditySHA3(o,i)])}function n(t,r){const n=e.toBuffer(r),i=e.fromRpcSig(n);return e.ecrecover(t,i.v,i.r,i.s)}function i(t){const r=e.toBuffer(t.data);return n(e.hashPersonalMessage(r),t.sig)}function o(e,t){for(var r=""+e;r.length<t;)r="0"+r;return r}return Np={concatSig:function(t,r,n){const i=e.fromSigned(r),s=e.fromSigned(n),a=e.bufferToInt(t),u=o(e.toUnsigned(i).toString("hex"),64),c=o(e.toUnsigned(s).toString("hex"),64),l=e.stripHexPrefix(e.intToHex(a));return e.addHexPrefix(u.concat(c,l)).toString("hex")},normalize:function(t){if(t){if("number"==typeof t){const r=e.toBuffer(t);t=e.bufferToHex(r)}if("string"!=typeof t){var r="eth-sig-util.normalize() requires hex string or integer input.";throw new Error(r+=" received "+typeof t+": "+t)}return e.addHexPrefix(t.toLowerCase())}},personalSign:function(t,r){var n=e.toBuffer(r.data),i=e.hashPersonalMessage(n),o=e.ecsign(i,t);return e.bufferToHex(this.concatSig(o.v,o.r,o.s))},recoverPersonalSignature:function(t){const r=i(t),n=e.publicToAddress(r);return e.bufferToHex(n)},extractPublicKey:function(e){return"0x"+i(e).toString("hex")},typedSignatureHash:function(t){const n=r(t);return e.bufferToHex(n)},signTypedData:function(t,n){const i=r(n.data),o=e.ecsign(i,t);return e.bufferToHex(this.concatSig(o.v,o.r,o.s))},recoverTypedSignature:function(t){const i=n(r(t.data),t.sig),o=e.publicToAddress(i);return e.bufferToHex(o)}},Np}(),o=a(),s=(qp||(qp=1,u=Gp,c=function(e){setTimeout(e,0)},"undefined"!=typeof process&&process&&"function"==typeof process.nextTick&&(c=process.nextTick),u.exports=function(e){var t={capacity:e||1,current:0,queue:[],firstHere:!1,take:function(){if(!1===t.firstHere){t.current++,t.firstHere=!0;var e=1}else e=0;var r={n:1};"function"==typeof arguments[0]?r.task=arguments[0]:r.n=arguments[0],arguments.length>=2&&("function"==typeof arguments[1]?r.task=arguments[1]:r.n=arguments[1]);var n=r.task;if(r.task=function(){n(t.leave)},t.current+r.n-e>t.capacity)return 1===e&&(t.current--,t.firstHere=!1),t.queue.push(r);t.current+=r.n-e,r.task(t.leave),1===e&&(t.firstHere=!1)},leave:function(e){if(e=e||1,t.current-=e,t.queue.length){var r=t.queue[0];r.n+t.current>t.capacity||(t.queue.shift(),t.current+=r.n,c(r.task))}else if(t.current<0)throw new Error("leave called too many times.")},available:function(e){return e=e||1,t.current+e<=t.capacity}};return t}),Gp.exports);var u,c;const l=wd(),h=function(){if(Wp)return Fp;Wp=1;const e=yd();return Fp=function(t,r,n){t.sendAsync(e({method:"eth_estimateGas",params:[r]}),(function(e,t){if(e)return"no contract code at given address"===e.message?n(null,"0xcf08"):n(e);n(null,t.result)}))}}(),f=/^[0-9A-Fa-f]+$/g;function d(e){const t=this;t.nonceLock=s(1),e.getAccounts&&(t.getAccounts=e.getAccounts),e.processTransaction&&(t.processTransaction=e.processTransaction),e.processMessage&&(t.processMessage=e.processMessage),e.processPersonalMessage&&(t.processPersonalMessage=e.processPersonalMessage),e.processTypedMessage&&(t.processTypedMessage=e.processTypedMessage),t.approveTransaction=e.approveTransaction||t.autoApprove,t.approveMessage=e.approveMessage||t.autoApprove,t.approvePersonalMessage=e.approvePersonalMessage||t.autoApprove,t.approveDecryptMessage=e.approveDecryptMessage||t.autoApprove,t.approveEncryptionPublicKey=e.approveEncryptionPublicKey||t.autoApprove,t.approveTypedMessage=e.approveTypedMessage||t.autoApprove,e.signTransaction&&(t.signTransaction=e.signTransaction||v("signTransaction")),e.signMessage&&(t.signMessage=e.signMessage||v("signMessage")),e.signPersonalMessage&&(t.signPersonalMessage=e.signPersonalMessage||v("signPersonalMessage")),e.decryptMessage&&(t.decryptMessage=e.decryptMessage||v("decryptMessage")),e.encryptionPublicKey&&(t.encryptionPublicKey=e.encryptionPublicKey||v("encryptionPublicKey")),e.signTypedMessage&&(t.signTypedMessage=e.signTypedMessage||v("signTypedMessage")),e.recoverPersonalSignature&&(t.recoverPersonalSignature=e.recoverPersonalSignature),e.publishTransaction&&(t.publishTransaction=e.publishTransaction),t.estimateGas=e.estimateGas||t.estimateGas,t.getGasPrice=e.getGasPrice||t.getGasPrice}function p(e){return e.toLowerCase()}function m(e){const t=n.addHexPrefix(e);return n.isValidAddress(t)}function _(e){const t=n.addHexPrefix(e);return!n.isValidAddress(t)&&g(e)}function g(e){if(!("string"==typeof e))return!1;if(!("0x"===e.slice(0,2)))return!1;return e.slice(2).match(f)}function v(e){return function(t,r){r(new Error('ProviderEngine - HookedWalletSubprovider - Must provide "'+e+'" fn in constructor options'))}}return Kp=d,r(d,l),d.prototype.handleRequest=function(t,r,n){const i=this;let s,a,u,c,l;switch(i._parityRequests={},i._parityRequestCount=0,t.method){case"eth_coinbase":return void i.getAccounts((function(e,t){if(e)return n(e);let r=t[0]||null;n(null,r)}));case"eth_accounts":return void i.getAccounts((function(e,t){if(e)return n(e);n(null,t)}));case"eth_sendTransaction":return s=t.params[0],void e([e=>i.validateTransaction(s,e),e=>i.processTransaction(s,e)],n);case"eth_signTransaction":return s=t.params[0],void e([e=>i.validateTransaction(s,e),e=>i.processSignTransaction(s,e)],n);case"eth_sign":return l=t.params[0],c=t.params[1],u=t.params[2]||{},a=o(u,{from:l,data:c}),void e([e=>i.validateMessage(a,e),e=>i.processMessage(a,e)],n);case"personal_sign":return function(){const r=t.params[0];if(_(t.params[1])&&m(r)){let e="The eth_personalSign method requires params ordered ";e+="[message, address]. This was previously handled incorrectly, ",e+="and has been corrected automatically. ",e+="Please switch this param order for smooth behavior in the future.",console.warn(e),l=t.params[0],c=t.params[1]}else c=t.params[0],l=t.params[1];u=t.params[2]||{},a=o(u,{from:l,data:c}),e([e=>i.validatePersonalMessage(a,e),e=>i.processPersonalMessage(a,e)],n)}();case"eth_decryptMessage":return function(){const r=t.params[0];if(_(t.params[1])&&m(r)){let e="The eth_decryptMessage method requires params ordered ";e+="[message, address]. This was previously handled incorrectly, ",e+="and has been corrected automatically. ",e+="Please switch this param order for smooth behavior in the future.",console.warn(e),l=t.params[0],c=t.params[1]}else c=t.params[0],l=t.params[1];u=t.params[2]||{},a=o(u,{from:l,data:c}),e([e=>i.validateDecryptMessage(a,e),e=>i.processDecryptMessage(a,e)],n)}();case"encryption_public_key":return function(){const r=t.params[0];e([e=>i.validateEncryptionPublicKey(r,e),e=>i.processEncryptionPublicKey(r,e)],n)}();case"personal_ecRecover":return function(){c=t.params[0];let e=t.params[1];u=t.params[2]||{},a=o(u,{sig:e,data:c}),i.recoverPersonalSignature(a,n)}();case"eth_signTypedData":case"eth_signTypedData_v3":case"eth_signTypedData_v4":return function(){const r=t.params[0],s=t.params[1];m(r)?(l=r,c=s):(c=r,l=s),u=t.params[2]||{},a=o(u,{from:l,data:c}),e([e=>i.validateTypedMessage(a,e),e=>i.processTypedMessage(a,e)],n)}();case"parity_postTransaction":return s=t.params[0],void i.parityPostTransaction(s,n);case"parity_postSign":return l=t.params[0],c=t.params[1],void i.parityPostSign(l,c,n);case"parity_checkRequest":return function(){const e=t.params[0];i.parityCheckRequest(e,n)}();case"parity_defaultAccount":return void i.getAccounts((function(e,t){if(e)return n(e);const r=t[0]||null;n(null,r)}));default:return void r()}},d.prototype.getAccounts=function(e){e(null,[])},d.prototype.processTransaction=function(t,r){const n=this;e([e=>n.approveTransaction(t,e),(e,t)=>n.checkApproval("transaction",e,t),e=>n.finalizeAndSubmitTx(t,e)],r)},d.prototype.processSignTransaction=function(t,r){const n=this;e([e=>n.approveTransaction(t,e),(e,t)=>n.checkApproval("transaction",e,t),e=>n.finalizeTx(t,e)],r)},d.prototype.processMessage=function(t,r){const n=this;e([e=>n.approveMessage(t,e),(e,t)=>n.checkApproval("message",e,t),e=>n.signMessage(t,e)],r)},d.prototype.processPersonalMessage=function(t,r){const n=this;e([e=>n.approvePersonalMessage(t,e),(e,t)=>n.checkApproval("message",e,t),e=>n.signPersonalMessage(t,e)],r)},d.prototype.processDecryptMessage=function(t,r){const n=this;e([e=>n.approveDecryptMessage(t,e),(e,t)=>n.checkApproval("decryptMessage",e,t),e=>n.decryptMessage(t,e)],r)},d.prototype.processEncryptionPublicKey=function(t,r){const n=this;e([e=>n.approveEncryptionPublicKey(t,e),(e,t)=>n.checkApproval("encryptionPublicKey",e,t),e=>n.encryptionPublicKey(t,e)],r)},d.prototype.processTypedMessage=function(t,r){const n=this;e([e=>n.approveTypedMessage(t,e),(e,t)=>n.checkApproval("message",e,t),e=>n.signTypedMessage(t,e)],r)},d.prototype.autoApprove=function(e,t){t(null,!0)},d.prototype.checkApproval=function(e,t,r){r(t?null:new Error("User denied "+e+" signature."))},d.prototype.parityPostTransaction=function(e,t){const r=this,n=`0x${r._parityRequestCount.toString(16)}`;r._parityRequestCount++,r.emitPayload({method:"eth_sendTransaction",params:[e]},(function(e,t){if(e)return void(r._parityRequests[n]={error:e});const i=t.result;r._parityRequests[n]=i})),t(null,n)},d.prototype.parityPostSign=function(e,t,r){const n=this,i=`0x${n._parityRequestCount.toString(16)}`;n._parityRequestCount++,n.emitPayload({method:"eth_sign",params:[e,t]},(function(e,t){if(e)return void(n._parityRequests[i]={error:e});const r=t.result;n._parityRequests[i]=r})),r(null,i)},d.prototype.parityCheckRequest=function(e,t){const r=this._parityRequests[e]||null;return r?r.error?t(r.error):void t(null,r):t(null,null)},d.prototype.recoverPersonalSignature=function(e,t){let r;try{r=i.recoverPersonalSignature(e)}catch(e){return t(e)}t(null,r)},d.prototype.validateTransaction=function(e,t){if(void 0===e.from)return t(new Error("Undefined address - from address required to sign transaction."));this.validateSender(e.from,(function(r,n){return r?t(r):n?void t():t(new Error(`Unknown address - unable to sign transaction for this address: "${e.from}"`))}))},d.prototype.validateMessage=function(e,t){if(void 0===e.from)return t(new Error("Undefined address - from address required to sign message."));this.validateSender(e.from,(function(r,n){return r?t(r):n?void t():t(new Error(`Unknown address - unable to sign message for this address: "${e.from}"`))}))},d.prototype.validatePersonalMessage=function(e,t){return void 0===e.from?t(new Error("Undefined address - from address required to sign personal message.")):void 0===e.data?t(new Error("Undefined message - message required to sign personal message.")):g(e.data)?void this.validateSender(e.from,(function(r,n){return r?t(r):n?void t():t(new Error(`Unknown address - unable to sign message for this address: "${e.from}"`))})):t(new Error("HookedWalletSubprovider - validateMessage - message was not encoded as hex."))},d.prototype.validateDecryptMessage=function(e,t){return void 0===e.from?t(new Error("Undefined address - from address required to decrypt message.")):void 0===e.data?t(new Error("Undefined message - message required to decrypt message.")):g(e.data)?void this.validateSender(e.from,(function(r,n){return r?t(r):n?void t():t(new Error(`Unknown address - unable to decrypt message for this address: "${e.from}"`))})):t(new Error("HookedWalletSubprovider - validateDecryptMessage - message was not encoded as hex."))},d.prototype.validateEncryptionPublicKey=function(e,t){this.validateSender(e,(function(r,n){return r?t(r):n?void t():t(new Error(`Unknown address - unable to obtain encryption public key for this address: "${e}"`))}))},d.prototype.validateTypedMessage=function(e,t){return void 0===e.from?t(new Error("Undefined address - from address required to sign typed data.")):void 0===e.data?t(new Error("Undefined data - message required to sign typed data.")):void this.validateSender(e.from,(function(r,n){return r?t(r):n?void t():t(new Error(`Unknown address - unable to sign message for this address: "${e.from}"`))}))},d.prototype.validateSender=function(e,t){if(!e)return t(null,!1);this.getAccounts((function(r,n){if(r)return t(r);const i=-1!==n.map(p).indexOf(e.toLowerCase());t(null,i)}))},d.prototype.finalizeAndSubmitTx=function(t,r){const n=this;n.nonceLock.take((function(){e([n.fillInTxExtras.bind(n,t),n.signTransaction.bind(n),n.publishTransaction.bind(n)],(function(e,t){if(n.nonceLock.leave(),e)return r(e);r(null,t)}))}))},d.prototype.finalizeTx=function(t,r){const n=this;n.nonceLock.take((function(){e([n.fillInTxExtras.bind(n,t),n.signTransaction.bind(n)],(function(e,i){if(n.nonceLock.leave(),e)return r(e);r(null,{raw:i,tx:t})}))}))},d.prototype.publishTransaction=function(e,t){this.emitPayload({method:"eth_sendRawTransaction",params:[e]},(function(e,r){if(e)return t(e);t(null,r.result)}))},d.prototype.estimateGas=function(e,t){h(this.engine,e,t)},d.prototype.getGasPrice=function(e){this.emitPayload({method:"eth_gasPrice",params:[]},(function(t,r){if(t)return e(t);e(null,r.result)}))},d.prototype.fillInTxExtras=function(e,r){const n=this,i=e.from,s={};void 0===e.gasPrice&&(s.gasPrice=n.getGasPrice.bind(n)),void 0===e.nonce&&(s.nonce=n.emitPayload.bind(n,{method:"eth_getTransactionCount",params:[i,"pending"]})),void 0===e.gas&&(s.gas=n.estimateGas.bind(n,function(e){return{from:e.from,to:e.to,value:e.value,data:e.data,gas:e.gas,gasPrice:e.gasPrice,nonce:e.nonce}}(e))),t(s,(function(t,n){if(t)return r(t);const i={};n.gasPrice&&(i.gasPrice=n.gasPrice),n.nonce&&(i.nonce=n.nonce.result),n.gas&&(i.gas=n.gas),r(null,o(e,i))}))},Kp}(),dm=function(){if(Zp)return Yp;Zp=1;const e=R.inherits,t=rm(),r=_l(),n=wd(),i=vd().blockTagForPayload;function o(e){this.nonceCache={}}return Yp=o,e(o,n),o.prototype.handleRequest=function(e,n,o){const s=this;switch(e.method){case"eth_getTransactionCount":var a=i(e),u=e.params[0].toLowerCase(),c=s.nonceCache[u];return void("pending"===a?c?o(null,c):n((function(e,t,r){if(e)return r();void 0===s.nonceCache[u]&&(s.nonceCache[u]=t),r()})):n());case"eth_sendRawTransaction":return void n((function(n,i,o){if(n)return o();var a=e.params[0];r.stripHexPrefix(a),Buffer.from(r.stripHexPrefix(a),"hex");var u=new t(Buffer.from(r.stripHexPrefix(a),"hex")),c="0x"+u.getSenderAddress().toString("hex").toLowerCase(),l=r.bufferToInt(u.nonce),h=(++l).toString(16);h.length%2&&(h="0"+h),h="0x"+h,s.nonceCache[c]=h,o()}));case"evm_revert":return s.nonceCache={},void n();default:return void n()}},Yp}(),pm=function(){if(em)return Xp;em=1;const e=bd(),t=function(){if(Qp)return Jp;Qp=1;const e=P.default,t=$d(),{createAsyncMiddleware:r}=I,n=ep(),{unsafeRandomBytes:i,incrementHexInt:o}=Jd(),s=Xd();function a(e){return{hash:e.hash,parentHash:e.parentHash,sha3Uncles:e.sha3Uncles,miner:e.miner,stateRoot:e.stateRoot,transactionsRoot:e.transactionsRoot,receiptsRoot:e.receiptsRoot,logsBloom:e.logsBloom,difficulty:e.difficulty,number:e.number,gasLimit:e.gasLimit,gasUsed:e.gasUsed,nonce:e.nonce,mixHash:e.mixHash,timestamp:e.timestamp,extraData:e.extraData}}return Jp=function({blockTracker:u,provider:c}){const l={},h=n({blockTracker:u,provider:c});let f=!1;const d=new e,p=t({eth_subscribe:r((async function(e,t){if(f)throw new Error("SubscriptionManager - attempting to use after destroying");const r=e.params[0],n=i(16);let d;switch(r){case"newHeads":d=p({subId:n});break;case"logs":const t=e.params[1];d=_({subId:n,filter:await h.newLogFilter(t)});break;default:throw new Error(`SubscriptionManager - unsupported subscription type "${r}"`)}return l[n]=d,void(t.result=n);function p({subId:e}){const t={type:r,destroy:async()=>{u.removeListener("sync",t.update)},update:async({oldBlock:t,newBlock:r})=>{const n=r,i=o(t);(await s({provider:c,fromBlock:i,toBlock:n})).map(a).forEach((t=>{m(e,t)}))}};return u.on("sync",t.update),t}function _({subId:e,filter:t}){return t.on("update",(t=>m(e,t))),{type:r,destroy:async()=>await h.uninstallFilter(t.idHex)}}})),eth_unsubscribe:r((async function(e,t){if(f)throw new Error("SubscriptionManager - attempting to use after destroying");const r=e.params[0],n=l[r];n?(delete l[r],await n.destroy(),t.result=!0):t.result=!1}))});return p.destroy=_,{events:d,middleware:p};function m(e,t){d.emit("notification",{jsonrpc:"2.0",method:"eth_subscription",params:{subscription:e,result:t}})}function _(){d.removeAllListeners();for(const e in l)l[e].destroy(),delete l[e];f=!0}},Jp}();return Xp=class extends e{constructor(){super((({blockTracker:e,provider:r,engine:n})=>{const{events:i,middleware:o}=t({blockTracker:e,provider:r});return i.on("notification",(e=>n.emit("data",null,e))),o}))}},Xp}();var mm=U.default=class extends um{constructor(e){if(super({pollingInterval:e.pollingInterval||8e3}),this.bridge="https://bridge.walletconnect.org",this.qrcode=!0,this.qrcodeModal=om.default,this.qrcodeModalOptions=void 0,this.rpc=null,this.infuraId="",this.http=null,this.isConnecting=!1,this.connected=!1,this.connectCallbacks=[],this.accounts=[],this.chainId=1,this.rpcUrl="",this.enable=()=>nm.__awaiter(this,void 0,void 0,(function*(){const e=yield this.getWalletConnector();if(e)return this.start(),this.subscribeWalletConnector(),e.accounts;throw new Error("Failed to connect to WalleConnect")})),this.request=e=>nm.__awaiter(this,void 0,void 0,(function*(){return this.send(e)})),this.send=(e,t)=>nm.__awaiter(this,void 0,void 0,(function*(){var r;if("string"==typeof e){const r=e;let n=t;return"personal_sign"===r&&(n=(0,am.parsePersonalSign)(n)),this.sendAsyncPromise(r,n)}if("personal_sign"===(e=Object.assign({id:(0,am.payloadId)(),jsonrpc:"2.0"},e)).method&&(e.params=(0,am.parsePersonalSign)(e.params)),!t){if("eth_signTypedData_v4"===e.method&&"MetaMask"===(null===(r=this.walletMeta)||void 0===r?void 0:r.name)){const{result:t}=yield this.handleOtherRequests(e);return t}return this.sendAsyncPromise(e.method,e.params)}this.sendAsync(e,t)})),this.onConnect=e=>{this.connectCallbacks.push(e)},this.triggerConnect=e=>{this.connectCallbacks&&this.connectCallbacks.length&&this.connectCallbacks.forEach((t=>t(e)))},this.bridge=e.connector?e.connector.bridge:e.bridge||"https://bridge.walletconnect.org",this.qrcode=void 0===e.qrcode||!1!==e.qrcode,this.qrcodeModal=e.qrcodeModal||this.qrcodeModal,this.qrcodeModalOptions=e.qrcodeModalOptions,this.wc=e.connector||new im.default({bridge:this.bridge,qrcodeModal:this.qrcode?this.qrcodeModal:void 0,qrcodeModalOptions:this.qrcodeModalOptions,storageId:null==e?void 0:e.storageId,signingMethods:null==e?void 0:e.signingMethods,clientMeta:null==e?void 0:e.clientMeta}),this.rpc=e.rpc||null,!(this.rpc||e.infuraId&&"string"==typeof e.infuraId&&e.infuraId.trim()))throw new Error("Missing one of the required parameters: rpc or infuraId");this.infuraId=e.infuraId||"",this.chainId=(null==e?void 0:e.chainId)||this.chainId,this.initialize()}get isWalletConnect(){return!0}get connector(){return this.wc}get walletMeta(){return this.wc.peerMeta}disconnect(){return nm.__awaiter(this,void 0,void 0,(function*(){this.close()}))}close(){return nm.__awaiter(this,void 0,void 0,(function*(){const e=yield this.getWalletConnector({disableSessionCreation:!0});yield e.killSession(),yield this.onDisconnect()}))}handleRequest(e){return nm.__awaiter(this,void 0,void 0,(function*(){try{let t,r=null;const n=yield this.getWalletConnector();switch(e.method){case"wc_killSession":yield this.close(),r=null;break;case"eth_accounts":r=n.accounts;break;case"eth_coinbase":r=n.accounts[0];break;case"eth_chainId":case"net_version":r=n.chainId;break;case"eth_uninstallFilter":this.sendAsync(e,(e=>e)),r=!0;break;default:t=yield this.handleOtherRequests(e)}return t||this.formatResponse(e,r)}catch(e){throw this.emit("error",e),e}}))}handleOtherRequests(e){return nm.__awaiter(this,void 0,void 0,(function*(){if(!am.signingMethods.includes(e.method)&&e.method.startsWith("eth_"))return this.handleReadRequests(e);const t=yield this.getWalletConnector(),r=yield t.sendCustomRequest(e);return this.formatResponse(e,r)}))}handleReadRequests(e){return nm.__awaiter(this,void 0,void 0,(function*(){if(!this.http){const e=new Error("HTTP Connection not available");throw this.emit("error",e),e}return this.http.send(e)}))}formatResponse(e,t){return{id:e.id,jsonrpc:e.jsonrpc,result:t}}getWalletConnector(e={}){const{disableSessionCreation:t=!1}=e;return new Promise(((e,r)=>{const n=this.wc;this.isConnecting?this.onConnect((t=>e(t))):n.connected||t?(this.connected||(this.connected=!0,this.updateState(n.session)),e(n)):(this.isConnecting=!0,n.on("modal_closed",(()=>{r(new Error("User closed modal"))})),n.createSession({chainId:this.chainId}).then((()=>{n.on("connect",((t,i)=>{if(t)return this.isConnecting=!1,r(t);this.isConnecting=!1,this.connected=!0,i&&this.updateState(i.params[0]),this.emit("connect"),this.triggerConnect(n),e(n)}))})).catch((e=>{this.isConnecting=!1,r(e)})))}))}subscribeWalletConnector(){return nm.__awaiter(this,void 0,void 0,(function*(){const e=yield this.getWalletConnector();e.on("disconnect",(e=>{e?this.emit("error",e):this.onDisconnect()})),e.on("session_update",((e,t)=>{e?this.emit("error",e):this.updateState(t.params[0])}))}))}onDisconnect(){return nm.__awaiter(this,void 0,void 0,(function*(){yield this.stop(),this.emit("close",1e3,"Connection closed"),this.emit("disconnect",1e3,"Connection disconnected"),this.connected=!1}))}updateState(e){return nm.__awaiter(this,void 0,void 0,(function*(){const{accounts:t,chainId:r,networkId:n,rpcUrl:i}=e;(!this.accounts||t&&this.accounts!==t)&&(this.accounts=t,this.emit("accountsChanged",t)),(!this.chainId||r&&this.chainId!==r)&&(this.chainId=r,this.emit("chainChanged",r)),(!this.networkId||n&&this.networkId!==n)&&(this.networkId=n,this.emit("networkChanged",n)),this.updateRpcUrl(this.chainId,i||"")}))}updateRpcUrl(e,t=""){const r={infuraId:this.infuraId,custom:this.rpc||void 0};(t=t||(0,am.getRpcUrl)(e,r))?(this.rpcUrl=t,this.updateHttpConnection()):this.emit("error",new Error(`No RPC Url available for chainId: ${e}`))}updateHttpConnection(){this.rpcUrl&&(this.http=new sm.default(this.rpcUrl),this.http.on("payload",(e=>this.emit("payload",e))),this.http.on("error",(e=>this.emit("error",e))))}sendAsyncPromise(e,t){return new Promise(((r,n)=>{this.sendAsync({id:(0,am.payloadId)(),jsonrpc:"2.0",method:e,params:t||[]},((e,t)=>{e?n(e):r(t.result)}))}))}initialize(){this.updateRpcUrl(this.chainId),this.addProvider(new lm({eth_hashrate:"0x00",eth_mining:!1,eth_syncing:!0,net_listening:!0,web3_clientVersion:"WalletConnect/v1.x.x/javascript"})),this.addProvider(new cm),this.addProvider(new pm),this.addProvider(new hm),this.addProvider(new dm),this.addProvider(new fm(this.configWallet())),this.addProvider({handleRequest:(e,t,r)=>nm.__awaiter(this,void 0,void 0,(function*(){try{const{error:t,result:n}=yield this.handleRequest(e);r(t,n)}catch(e){r(e)}})),setEngine:e=>e})}configWallet(){return{getAccounts:e=>nm.__awaiter(this,void 0,void 0,(function*(){try{const t=(yield this.getWalletConnector()).accounts;t&&t.length?e(null,t):e(new Error("Failed to get accounts"))}catch(t){e(t)}})),processMessage:(e,t)=>nm.__awaiter(this,void 0,void 0,(function*(){try{const r=yield this.getWalletConnector(),n=yield r.signMessage([e.from,e.data]);t(null,n)}catch(e){t(e)}})),processPersonalMessage:(e,t)=>nm.__awaiter(this,void 0,void 0,(function*(){try{const r=yield this.getWalletConnector(),n=yield r.signPersonalMessage([e.data,e.from]);t(null,n)}catch(e){t(e)}})),processSignTransaction:(e,t)=>nm.__awaiter(this,void 0,void 0,(function*(){try{const r=yield this.getWalletConnector(),n=yield r.signTransaction(e);t(null,n)}catch(e){t(e)}})),processTransaction:(e,t)=>nm.__awaiter(this,void 0,void 0,(function*(){try{const r=yield this.getWalletConnector(),n=yield r.sendTransaction(e);t(null,n)}catch(e){t(e)}})),processTypedMessage:(e,t)=>nm.__awaiter(this,void 0,void 0,(function*(){try{const r=yield this.getWalletConnector(),n=yield r.signTypedData([e.from,e.data]);t(null,n)}catch(e){t(e)}}))}}};function _m(n,i){var o=n.chainId,s=n.rpcUrl,a=n.rpc,u=n.walletConnectParams;return e(this,void 0,void 0,(function(){var e,n,c,l,h,f,d;return t(this,(function(t){switch(t.label){case 0:return e="https://bridge.walletconnect.org",n=!0,u&&(e=u.bridge||e,n=void 0!==u.qrcode?u.qrcode:n,c=u.infuraId||void 0,h=u.qrcodeModalOptions||void 0),a?l=a:o&&s&&((d={})[o]=s,l=d),[4,(f=new mm({bridge:e,qrcode:n,infuraId:c,rpc:l,chainId:o,qrcodeModal:null==u?void 0:u.qrcodeModal,qrcodeModalOptions:h})).enable()];case 1:return t.sent(),f.on("connect",i.connect),f.on("disconnect",(function(e){i.disconnect(e),i.accountsChanged([])})),f.on("accountsChanged",i.accountsChanged),f.on("chainChanged",i.chainChanged),f.on("message",i.message),[2,r(f)]}}))}))}export{_m as default};
|