@dodoex/wallet-web3 0.0.43-7 → 0.0.43-9
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/__tslib-3dd70e03.js +1 -0
- package/dist/{alchemy-provider-5870b6fa-31ff6f89.js → alchemy-provider-5870b6fa-1ce84df2.js} +1 -1
- package/dist/{alchemy-websocket-provider-213da986-6f09bc45.js → alchemy-websocket-provider-213da986-69d4f728.js} +1 -1
- package/dist/{blocto-f249d88f.js → blocto-77cdb45e.js} +1 -1
- package/dist/{ccip-37802a12.js → ccip-905356e0.js} +1 -1
- package/dist/cjs/__tslib-5e28bf2f.cjs +1 -0
- package/dist/cjs/{alchemy-provider-5870b6fa-9b7efcc2.cjs → alchemy-provider-5870b6fa-b20d22e1.cjs} +1 -1
- package/dist/cjs/{alchemy-websocket-provider-213da986-dadf0475.cjs → alchemy-websocket-provider-213da986-ec5326f5.cjs} +1 -1
- package/dist/cjs/{blocto-94f2ba99.cjs → blocto-ed655cb1.cjs} +1 -1
- package/dist/cjs/{ccip-d40f1141.cjs → ccip-6752db14.cjs} +1 -1
- package/dist/cjs/{draggabilly-e7dba61e.cjs → draggabilly-6836d845.cjs} +1 -1
- package/dist/cjs/{ethers-bc588825.cjs → ethers-0d7f1144.cjs} +1 -1
- package/dist/cjs/id-08303099.cjs +1 -0
- package/dist/cjs/{index-5465ad4e.cjs → index-0b99fd95.cjs} +2 -2
- package/dist/cjs/{index-a9b11111.cjs → index-1b4f3af5.cjs} +1 -1
- package/dist/cjs/{index-9eb3debf.cjs → index-2c691098.cjs} +1 -1
- package/dist/cjs/{index-0deec6d9.cjs → index-5349903a.cjs} +1 -1
- package/dist/cjs/{index-665434db.cjs → index-78abdb84.cjs} +4 -4
- package/dist/cjs/{index-e8bc54f6.cjs → index-868f579e.cjs} +1 -1
- package/dist/cjs/{index-1d67f05e.cjs → index-c3b1fbfe.cjs} +1 -1
- package/dist/cjs/{index-30df89d5.cjs → index-d0ebfb49.cjs} +1 -1
- package/dist/cjs/{index-6eab4c71.cjs → index-daa77fab.cjs} +1 -1
- package/dist/cjs/{index-ea4bfacb.cjs → index-e5864d2b.cjs} +1 -1
- package/dist/cjs/{index-c7785862.cjs → index-fb961bec.cjs} +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/{index.es-df73405d.cjs → index.es-144c4d58.cjs} +1 -1
- package/dist/cjs/{interface-2faf1a27.cjs → interface-014d38fb.cjs} +1 -1
- package/dist/cjs/{lib-typedarrays-a6dc0c98.cjs → lib-typedarrays-a9515d81.cjs} +1 -1
- package/dist/cjs/{portis-94cbac04.cjs → portis-4f3e3aec.cjs} +1 -1
- package/dist/cjs/{provider-0ef6c31a.cjs → provider-6599c0fa.cjs} +1 -1
- package/dist/cjs/{rainbow-6b7a9167.cjs → rainbow-928bd362.cjs} +1 -1
- package/dist/cjs/{sha224-71bfefb8.cjs → sha224-89e4042d.cjs} +1 -1
- package/dist/cjs/{sha256-f8aa1c05.cjs → sha256-9c1fea0b.cjs} +1 -1
- package/dist/cjs/{typed-data-84ae13ad.cjs → typed-data-ff3e657a.cjs} +1 -1
- package/dist/cjs/{uAuth-d871ce86.cjs → uAuth-1a5fbef0.cjs} +1 -1
- package/dist/cjs/{walletConnect-56b29a02.cjs → walletConnect-631a92e4.cjs} +1 -1
- package/dist/cjs/walletLink-8aab9950.cjs +3 -0
- package/dist/{draggabilly-1b0df7fa.js → draggabilly-abf23d09.js} +1 -1
- package/dist/{ethers-c1b1122e.js → ethers-2d0f4734.js} +1 -1
- package/dist/id-16f1175b.js +1 -0
- package/dist/{index-f75e193c.js → index-15819a69.js} +1 -1
- package/dist/{index-62f9e96d.js → index-393f17d1.js} +1 -1
- package/dist/{index-f0df1b84.js → index-44f987e4.js} +4 -4
- package/dist/{index-0ea58048.js → index-507245ba.js} +1 -1
- package/dist/index-85bb315f.js +1 -0
- package/dist/{index-5259e25a.js → index-9cb785a9.js} +2 -2
- package/dist/{index-54e310d4.js → index-bd8bdc55.js} +1 -1
- package/dist/index-c589cc3f.js +1 -0
- package/dist/{index-5f8a4bfe.js → index-d0d9b4ff.js} +1 -1
- package/dist/{index-fe197f34.js → index-e408c90d.js} +1 -1
- package/dist/{index-7cda4f49.js → index-fc569931.js} +1 -1
- package/dist/{index.es-183def38.js → index.es-3bf5487a.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/{interface-73aba78a.js → interface-733abbc3.js} +1 -1
- package/dist/{lib-typedarrays-1c9d6c71.js → lib-typedarrays-d4295589.js} +1 -1
- package/dist/{portis-1576a67e.js → portis-ca7b029d.js} +1 -1
- package/dist/{provider-e8d27051.js → provider-bff30d90.js} +1 -1
- package/dist/{rainbow-05a1f2bf.js → rainbow-3112945a.js} +1 -1
- package/dist/sha224-d779d917.js +1 -0
- package/dist/{sha256-16ffc229.js → sha256-923dbce7.js} +1 -1
- package/dist/{typed-data-4a7e8c38.js → typed-data-d94015b9.js} +1 -1
- package/dist/{uAuth-4a709afd.js → uAuth-3bdeb72a.js} +1 -1
- package/dist/{walletConnect-57302439.js → walletConnect-12f4b4e2.js} +1 -1
- package/dist/walletLink-acd432ec.js +3 -0
- package/package.json +1 -1
- package/dist/__tslib-d4997183.js +0 -1
- package/dist/cjs/__tslib-56aaef99.cjs +0 -1
- package/dist/cjs/id-709283a5.cjs +0 -1
- package/dist/cjs/walletLink-d0cde82c.cjs +0 -3
- package/dist/id-ebb9f5ed.js +0 -1
- package/dist/index-99e44b6a.js +0 -1
- package/dist/index-9fd42ec3.js +0 -1
- package/dist/sha224-43f02863.js +0 -1
- package/dist/walletLink-02254a5d.js +0 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var e=require("./index-665434db.cjs");require("@ethersproject/address"),require("@ethersproject/providers"),require("zustand"),require("events"),require("@ethersproject/bytes"),require("@ethersproject/properties"),require("@ethersproject/abstract-signer"),require("buffer"),require("@ethersproject/abstract-provider"),require("@ethersproject/contracts"),require("@ethersproject/constants"),require("@ethersproject/transactions");var t={exports:{}};!function(t,n){e.commonjsGlobal,function(t){var n=void 0!==e.commonjsGlobal?e.commonjsGlobal:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==e.commonjsGlobal?e.commonjsGlobal:"undefined"!=typeof self?self:{};function i(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function o(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})})),n}var a={exports:{}};!function(e,t){var n="undefined"!=typeof self?self:r,i=function(){function e(){this.fetch=!1,this.DOMException=n.DOMException}return e.prototype=n,new e}();!function(e){!function(t){var n="URLSearchParams"in e,r="Symbol"in e&&"iterator"in Symbol,i="FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),o="FormData"in e,a="ArrayBuffer"in e;if(a)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(e){return e&&s.indexOf(Object.prototype.toString.call(e))>-1};function l(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function c(e){return"string"!=typeof e&&(e=String(e)),e}function d(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return r&&(t[Symbol.iterator]=function(){return t}),t}function f(e){this.map={},e instanceof f?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function h(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function p(e){return new Promise((function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function m(e){var t=new FileReader,n=p(t);return t.readAsArrayBuffer(e),n}function g(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function v(){return this.bodyUsed=!1,this._initBody=function(e){var t;this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:i&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:o&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:n&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():a&&i&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=g(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a&&(ArrayBuffer.prototype.isPrototypeOf(e)||u(e))?this._bodyArrayBuffer=g(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var e=h(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?h(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(m)}),this.text=function(){var e,t,n,r=h(this);if(r)return r;if(this._bodyBlob)return e=this._bodyBlob,n=p(t=new FileReader),t.readAsText(e),n;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=new Array(t.length),r=0;r<t.length;r++)n[r]=String.fromCharCode(t[r]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},o&&(this.formData=function(){return this.text().then(w)}),this.json=function(){return this.text().then(JSON.parse)},this}f.prototype.append=function(e,t){e=l(e),t=c(t);var n=this.map[e];this.map[e]=n?n+", "+t:t},f.prototype.delete=function(e){delete this.map[l(e)]},f.prototype.get=function(e){return e=l(e),this.has(e)?this.map[e]:null},f.prototype.has=function(e){return this.map.hasOwnProperty(l(e))},f.prototype.set=function(e,t){this.map[l(e)]=c(t)},f.prototype.forEach=function(e,t){for(var n in this.map)this.map.hasOwnProperty(n)&&e.call(t,this.map[n],n,this)},f.prototype.keys=function(){var e=[];return this.forEach((function(t,n){e.push(n)})),d(e)},f.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),d(e)},f.prototype.entries=function(){var e=[];return this.forEach((function(t,n){e.push([n,t])})),d(e)},r&&(f.prototype[Symbol.iterator]=f.prototype.entries);var y=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function b(e,t){var n=(t=t||{}).body;if(e instanceof b){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new f(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,n||null==e._bodyInit||(n=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new f(t.headers)),this.method=function(e){var t=e.toUpperCase();return y.indexOf(t)>-1?t:e}(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function w(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(i))}})),t}function A(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new f(t.headers),this.url=t.url||"",this._initBody(e)}b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},v.call(b.prototype),v.call(A.prototype),A.prototype.clone=function(){return new A(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},A.error=function(){var e=new A(null,{status:0,statusText:""});return e.type="error",e};var _=[301,302,303,307,308];A.redirect=function(e,t){if(-1===_.indexOf(t))throw new RangeError("Invalid status code");return new A(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function E(e,n){return new Promise((function(r,o){var a=new b(e,n);if(a.signal&&a.signal.aborted)return o(new t.DOMException("Aborted","AbortError"));var s=new XMLHttpRequest;function u(){s.abort()}s.onload=function(){var e,t,n={status:s.status,statusText:s.statusText,headers:(e=s.getAllResponseHeaders()||"",t=new f,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var n=e.split(":"),r=n.shift().trim();if(r){var i=n.join(":").trim();t.append(r,i)}})),t)};n.url="responseURL"in s?s.responseURL:n.headers.get("X-Request-URL");var i="response"in s?s.response:s.responseText;r(new A(i,n))},s.onerror=function(){o(new TypeError("Network request failed"))},s.ontimeout=function(){o(new TypeError("Network request failed"))},s.onabort=function(){o(new t.DOMException("Aborted","AbortError"))},s.open(a.method,a.url,!0),"include"===a.credentials?s.withCredentials=!0:"omit"===a.credentials&&(s.withCredentials=!1),"responseType"in s&&i&&(s.responseType="blob"),a.headers.forEach((function(e,t){s.setRequestHeader(t,e)})),a.signal&&(a.signal.addEventListener("abort",u),s.onreadystatechange=function(){4===s.readyState&&a.signal.removeEventListener("abort",u)}),s.send(void 0===a._bodyInit?null:a._bodyInit)}))}E.polyfill=!0,e.fetch||(e.fetch=E,e.Headers=f,e.Request=b,e.Response=A),t.Headers=f,t.Request=b,t.Response=A,t.fetch=E,Object.defineProperty(t,"__esModule",{value:!0})}({})}(i),i.fetch.ponyfill=!0,delete i.fetch.polyfill;var o=i;(t=o.fetch).default=o.fetch,t.fetch=o.fetch,t.Headers=o.Headers,t.Request=o.Request,t.Response=o.Response,e.exports=t}(a,a.exports);var s=i(a.exports);function u(){throw new Error("setTimeout has not been defined")}function l(){throw new Error("clearTimeout has not been defined")}var c=u,d=l;function f(e){if(c===setTimeout)return setTimeout(e,0);if((c===u||!c)&&setTimeout)return c=setTimeout,setTimeout(e,0);try{return c(e,0)}catch(t){try{return c.call(null,e,0)}catch(t){return c.call(this,e,0)}}}"function"==typeof n.setTimeout&&(c=setTimeout),"function"==typeof n.clearTimeout&&(d=clearTimeout);var h,p=[],m=!1,g=-1;function v(){m&&h&&(m=!1,h.length?p=h.concat(p):g=-1,p.length&&y())}function y(){if(!m){var e=f(v);m=!0;for(var t=p.length;t;){for(h=p,p=[];++g<t;)h&&h[g].run();g=-1,t=p.length}h=null,m=!1,function(e){if(d===clearTimeout)return clearTimeout(e);if((d===l||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(e);try{return d(e)}catch(t){try{return d.call(null,e)}catch(t){return d.call(this,e)}}}(e)}}function b(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];p.push(new w(e,t)),1!==p.length||m||f(y)}function w(e,t){this.fun=e,this.array=t}function A(){}w.prototype.run=function(){this.fun.apply(null,this.array)};var _=A,E=A,S=A,k=A,M=A,C=A,x=A,R=n.performance||{},O=R.now||R.mozNow||R.msNow||R.oNow||R.webkitNow||function(){return(new Date).getTime()},T=new Date,P={nextTick:b,title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:_,addListener:E,once:S,off:k,removeListener:M,removeAllListeners:C,emit:x,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*O.call(R),n=Math.floor(t),r=Math.floor(t%1*1e9);return e&&(n-=e[0],(r-=e[1])<0&&(n--,r+=1e9)),[n,r]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-T)/1e3}},L={exports:{}};!function(e,t){!function(t){var n=Object.hasOwnProperty,r=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},i="object"==typeof P&&!0,o="function"==typeof Symbol,a="object"==typeof Reflect,s="function"==typeof setImmediate?setImmediate:setTimeout,u=o?a&&"function"==typeof Reflect.ownKeys?Reflect.ownKeys:function(e){var t=Object.getOwnPropertyNames(e);return t.push.apply(t,Object.getOwnPropertySymbols(e)),t}:Object.keys;function l(){this._events={},this._conf&&c.call(this,this._conf)}function c(e){e&&(this._conf=e,e.delimiter&&(this.delimiter=e.delimiter),e.maxListeners!==t&&(this._maxListeners=e.maxListeners),e.wildcard&&(this.wildcard=e.wildcard),e.newListener&&(this._newListener=e.newListener),e.removeListener&&(this._removeListener=e.removeListener),e.verboseMemoryLeak&&(this.verboseMemoryLeak=e.verboseMemoryLeak),e.ignoreErrors&&(this.ignoreErrors=e.ignoreErrors),this.wildcard&&(this.listenerTree={}))}function d(e,t){var n="(node) warning: possible EventEmitter memory leak detected. "+e+" listeners added. Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak&&(n+=" Event name: "+t+"."),void 0!==P&&P.emitWarning){var r=new Error(n);r.name="MaxListenersExceededWarning",r.emitter=this,r.count=e,P.emitWarning(r)}else console.error(n),console.trace&&console.trace()}var f=function(e,t,n){var r=arguments.length;switch(r){case 0:return[];case 1:return[e];case 2:return[e,t];case 3:return[e,t,n];default:for(var i=new Array(r);r--;)i[r]=arguments[r];return i}};function h(e,n){for(var r={},i=e.length,o=n?n.length:0,a=0;a<i;a++)r[e[a]]=a<o?n[a]:t;return r}function p(e,t,n){var r,i;if(this._emitter=e,this._target=t,this._listeners={},this._listenersCount=0,(n.on||n.off)&&(r=n.on,i=n.off),t.addEventListener?(r=t.addEventListener,i=t.removeEventListener):t.addListener?(r=t.addListener,i=t.removeListener):t.on&&(r=t.on,i=t.off),!r&&!i)throw Error("target does not implement any known event API");if("function"!=typeof r)throw TypeError("on method must be a function");if("function"!=typeof i)throw TypeError("off method must be a function");this._on=r,this._off=i;var o=e._observers;o?o.push(this):e._observers=[this]}function m(e,r,i,o){var a=Object.assign({},r);if(!e)return a;if("object"!=typeof e)throw TypeError("options must be an object");var s,u,l,c=Object.keys(e),d=c.length;function f(e){throw Error('Invalid "'+s+'" option value'+(e?". Reason: "+e:""))}for(var h=0;h<d;h++){if(s=c[h],!o&&!n.call(r,s))throw Error('Unknown "'+s+'" option');(u=e[s])!==t&&(l=i[s],a[s]=l?l(u,f):u)}return a}function g(e,t){return"function"==typeof e&&e.hasOwnProperty("prototype")||t("value must be a constructor"),e}function v(e){var t="value must be type of "+e.join("|"),n=e.length,r=e[0],i=e[1];return 1===n?function(e,n){if(typeof e===r)return e;n(t)}:2===n?function(e,n){var o=typeof e;if(o===r||o===i)return e;n(t)}:function(r,i){for(var o=typeof r,a=n;a-- >0;)if(o===e[a])return r;i(t)}}Object.assign(p.prototype,{subscribe:function(e,t,n){var r=this,i=this._target,o=this._emitter,a=this._listeners,s=function(){var r=f.apply(null,arguments),a={data:r,name:t,original:e};n?!1!==n.call(i,a)&&o.emit.apply(o,[a.name].concat(r)):o.emit.apply(o,[t].concat(r))};if(a[e])throw Error("Event '"+e+"' is already listening");this._listenersCount++,o._newListener&&o._removeListener&&!r._onNewListener?(this._onNewListener=function(n){n===t&&null===a[e]&&(a[e]=s,r._on.call(i,e,s))},o.on("newListener",this._onNewListener),this._onRemoveListener=function(n){n===t&&!o.hasListeners(n)&&a[e]&&(a[e]=null,r._off.call(i,e,s))},a[e]=null,o.on("removeListener",this._onRemoveListener)):(a[e]=s,r._on.call(i,e,s))},unsubscribe:function(e){var t,n,r,i=this,o=this._listeners,a=this._emitter,s=this._off,l=this._target;if(e&&"string"!=typeof e)throw TypeError("event must be a string");function c(){i._onNewListener&&(a.off("newListener",i._onNewListener),a.off("removeListener",i._onRemoveListener),i._onNewListener=null,i._onRemoveListener=null);var e=_.call(a,i);a._observers.splice(e,1)}if(e){if(!(t=o[e]))return;s.call(l,e,t),delete o[e],--this._listenersCount||c()}else{for(r=(n=u(o)).length;r-- >0;)e=n[r],s.call(l,e,o[e]);this._listeners={},this._listenersCount=0,c()}}});var y=v(["function"]),w=v(["object","function"]);function A(e,t,n){var r,i,o,a=0,s=new e((function(u,l,c){function d(){i&&(i=null),a&&(clearTimeout(a),a=0)}n=m(n,{timeout:0,overload:!1},{timeout:function(e,t){return("number"!=typeof(e*=1)||e<0||!Number.isFinite(e))&&t("timeout must be a positive number"),e}}),r=!n.overload&&"function"==typeof e.prototype.cancel&&"function"==typeof c;var f=function(e){d(),u(e)},h=function(e){d(),l(e)};r?t(f,h,c):(i=[function(e){h(e||Error("canceled"))}],t(f,h,(function(e){if(o)throw Error("Unable to subscribe on cancel event asynchronously");if("function"!=typeof e)throw TypeError("onCancel callback must be a function");i.push(e)})),o=!0),n.timeout>0&&(a=setTimeout((function(){var e=Error("timeout");e.code="ETIMEDOUT",a=0,s.cancel(e),l(e)}),n.timeout))}));return r||(s.cancel=function(e){if(i){for(var t=i.length,n=1;n<t;n++)i[n](e);i[0](e),i=null}}),s}function _(e){var t=this._observers;if(!t)return-1;for(var n=t.length,r=0;r<n;r++)if(t[r]._target===e)return r;return-1}function E(e,t,n,r,i){if(!n)return null;if(0===r){var o=typeof t;if("string"===o){var a,s,l=0,c=0,d=this.delimiter,f=d.length;if(-1!==(s=t.indexOf(d))){a=new Array(5);do{a[l++]=t.slice(c,s),c=s+f}while(-1!==(s=t.indexOf(d,c)));a[l++]=t.slice(c),t=a,i=l}else t=[t],i=1}else"object"===o?i=t.length:(t=[t],i=1)}var h,p,m,g,v,y,b,w=null,A=t[r],_=t[r+1];if(r===i)n._listeners&&("function"==typeof n._listeners?(e&&e.push(n._listeners),w=[n]):(e&&e.push.apply(e,n._listeners),w=[n]));else{if("*"===A){for(s=(y=u(n)).length;s-- >0;)"_listeners"!==(h=y[s])&&(b=E(e,t,n[h],r+1,i))&&(w?w.push.apply(w,b):w=b);return w}if("**"===A){for((v=r+1===i||r+2===i&&"*"===_)&&n._listeners&&(w=E(e,t,n,i,i)),s=(y=u(n)).length;s-- >0;)"_listeners"!==(h=y[s])&&("*"===h||"**"===h?(n[h]._listeners&&!v&&(b=E(e,t,n[h],i,i))&&(w?w.push.apply(w,b):w=b),b=E(e,t,n[h],r,i)):b=E(e,t,n[h],h===_?r+2:r,i),b&&(w?w.push.apply(w,b):w=b));return w}n[A]&&(w=E(e,t,n[A],r+1,i))}if((p=n["*"])&&E(e,t,p,r+1,i),m=n["**"])if(r<i)for(m._listeners&&E(e,t,m,i,i),s=(y=u(m)).length;s-- >0;)"_listeners"!==(h=y[s])&&(h===_?E(e,t,m[h],r+2,i):h===A?E(e,t,m[h],r+1,i):((g={})[h]=m[h],E(e,t,{"**":g},r+1,i)));else m._listeners?E(e,t,m,i,i):m["*"]&&m["*"]._listeners&&E(e,t,m["*"],i,i);return w}function S(e,t,n){var r,i,o=0,a=0,s=this.delimiter,u=s.length;if("string"==typeof e)if(-1!==(r=e.indexOf(s))){i=new Array(5);do{i[o++]=e.slice(a,r),a=r+u}while(-1!==(r=e.indexOf(s,a)));i[o++]=e.slice(a)}else i=[e],o=1;else i=e,o=e.length;if(o>1)for(r=0;r+1<o;r++)if("**"===i[r]&&"**"===i[r+1])return;var l,c=this.listenerTree;for(r=0;r<o;r++)if(c=c[l=i[r]]||(c[l]={}),r===o-1)return c._listeners?("function"==typeof c._listeners&&(c._listeners=[c._listeners]),n?c._listeners.unshift(t):c._listeners.push(t),!c._listeners.warned&&this._maxListeners>0&&c._listeners.length>this._maxListeners&&(c._listeners.warned=!0,d.call(this,c._listeners.length,l))):c._listeners=t,!0;return!0}function k(e,t,n,r){for(var i,o,a,s,l=u(e),c=l.length,d=e._listeners;c-- >0;)i=e[o=l[c]],a="_listeners"===o?n:n?n.concat(o):[o],s=r||"symbol"==typeof o,d&&t.push(s?a:a.join(this.delimiter)),"object"==typeof i&&k.call(this,i,t,a,s);return t}function M(e){for(var t,n,r,i=u(e),o=i.length;o-- >0;)(t=e[n=i[o]])&&(r=!0,"_listeners"===n||M(t)||delete e[n]);return r}function C(e,t,n){this.emitter=e,this.event=t,this.listener=n}function x(e,n,r){if(!0===r)a=!0;else if(!1===r)o=!0;else{if(!r||"object"!=typeof r)throw TypeError("options should be an object or true");var o=r.async,a=r.promisify,u=r.nextTick,l=r.objectify}if(o||u||a){var c=n,d=n._origin||n;if(u&&!i)throw Error("process.nextTick is not supported");a===t&&(a="AsyncFunction"===n.constructor.name),n=function(){var e=arguments,t=this,n=this.event;return a?u?Promise.resolve():new Promise((function(e){s(e)})).then((function(){return t.event=n,c.apply(t,e)})):(u?b:s)((function(){t.event=n,c.apply(t,e)}))},n._async=!0,n._origin=d}return[n,l?new C(this,e,n):this]}function R(e){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,c.call(this,e)}C.prototype.off=function(){return this.emitter.off(this.event,this.listener),this},R.EventEmitter2=R,R.prototype.listenTo=function(e,n,i){if("object"!=typeof e)throw TypeError("target musts be an object");var o=this;function a(t){if("object"!=typeof t)throw TypeError("events must be an object");var n,r=i.reducers,a=_.call(o,e);n=-1===a?new p(o,e,i):o._observers[a];for(var s,l=u(t),c=l.length,d="function"==typeof r,f=0;f<c;f++)s=l[f],n.subscribe(s,t[s]||s,d?r:r&&r[s])}return i=m(i,{on:t,off:t,reducers:t},{on:y,off:y,reducers:w}),r(n)?a(h(n)):a("string"==typeof n?h(n.split(/\s+/)):n),this},R.prototype.stopListeningTo=function(e,t){var n=this._observers;if(!n)return!1;var r,i=n.length,o=!1;if(e&&"object"!=typeof e)throw TypeError("target should be an object");for(;i-- >0;)r=n[i],e&&r._target!==e||(r.unsubscribe(t),o=!0);return o},R.prototype.delimiter=".",R.prototype.setMaxListeners=function(e){e!==t&&(this._maxListeners=e,this._conf||(this._conf={}),this._conf.maxListeners=e)},R.prototype.getMaxListeners=function(){return this._maxListeners},R.prototype.event="",R.prototype.once=function(e,t,n){return this._once(e,t,!1,n)},R.prototype.prependOnceListener=function(e,t,n){return this._once(e,t,!0,n)},R.prototype._once=function(e,t,n,r){return this._many(e,1,t,n,r)},R.prototype.many=function(e,t,n,r){return this._many(e,t,n,!1,r)},R.prototype.prependMany=function(e,t,n,r){return this._many(e,t,n,!0,r)},R.prototype._many=function(e,t,n,r,i){var o=this;if("function"!=typeof n)throw new Error("many only accepts instances of Function");function a(){return 0==--t&&o.off(e,a),n.apply(this,arguments)}return a._origin=n,this._on(e,a,r,i)},R.prototype.emit=function(){if(!this._events&&!this._all)return!1;this._events||l.call(this);var e,t,n,r,i,a,s=arguments[0],u=this.wildcard;if("newListener"===s&&!this._newListener&&!this._events.newListener)return!1;if(u&&(e=s,"newListener"!==s&&"removeListener"!==s&&"object"==typeof s)){if(n=s.length,o)for(r=0;r<n;r++)if("symbol"==typeof s[r]){a=!0;break}a||(s=s.join(this.delimiter))}var c,d=arguments.length;if(this._all&&this._all.length)for(r=0,n=(c=this._all.slice()).length;r<n;r++)switch(this.event=s,d){case 1:c[r].call(this,s);break;case 2:c[r].call(this,s,arguments[1]);break;case 3:c[r].call(this,s,arguments[1],arguments[2]);break;default:c[r].apply(this,arguments)}if(u)c=[],E.call(this,c,e,this.listenerTree,0,n);else{if("function"==typeof(c=this._events[s])){switch(this.event=s,d){case 1:c.call(this);break;case 2:c.call(this,arguments[1]);break;case 3:c.call(this,arguments[1],arguments[2]);break;default:for(t=new Array(d-1),i=1;i<d;i++)t[i-1]=arguments[i];c.apply(this,t)}return!0}c&&(c=c.slice())}if(c&&c.length){if(d>3)for(t=new Array(d-1),i=1;i<d;i++)t[i-1]=arguments[i];for(r=0,n=c.length;r<n;r++)switch(this.event=s,d){case 1:c[r].call(this);break;case 2:c[r].call(this,arguments[1]);break;case 3:c[r].call(this,arguments[1],arguments[2]);break;default:c[r].apply(this,t)}return!0}if(!this.ignoreErrors&&!this._all&&"error"===s)throw arguments[1]instanceof Error?arguments[1]:new Error("Uncaught, unspecified 'error' event.");return!!this._all},R.prototype.emitAsync=function(){if(!this._events&&!this._all)return!1;this._events||l.call(this);var e,t,n,r,i,a,s=arguments[0],u=this.wildcard;if("newListener"===s&&!this._newListener&&!this._events.newListener)return Promise.resolve([!1]);if(u&&(e=s,"newListener"!==s&&"removeListener"!==s&&"object"==typeof s)){if(r=s.length,o)for(i=0;i<r;i++)if("symbol"==typeof s[i]){t=!0;break}t||(s=s.join(this.delimiter))}var c,d=[],f=arguments.length;if(this._all)for(i=0,r=this._all.length;i<r;i++)switch(this.event=s,f){case 1:d.push(this._all[i].call(this,s));break;case 2:d.push(this._all[i].call(this,s,arguments[1]));break;case 3:d.push(this._all[i].call(this,s,arguments[1],arguments[2]));break;default:d.push(this._all[i].apply(this,arguments))}if(u?(c=[],E.call(this,c,e,this.listenerTree,0)):c=this._events[s],"function"==typeof c)switch(this.event=s,f){case 1:d.push(c.call(this));break;case 2:d.push(c.call(this,arguments[1]));break;case 3:d.push(c.call(this,arguments[1],arguments[2]));break;default:for(n=new Array(f-1),a=1;a<f;a++)n[a-1]=arguments[a];d.push(c.apply(this,n))}else if(c&&c.length){if(c=c.slice(),f>3)for(n=new Array(f-1),a=1;a<f;a++)n[a-1]=arguments[a];for(i=0,r=c.length;i<r;i++)switch(this.event=s,f){case 1:d.push(c[i].call(this));break;case 2:d.push(c[i].call(this,arguments[1]));break;case 3:d.push(c[i].call(this,arguments[1],arguments[2]));break;default:d.push(c[i].apply(this,n))}}else if(!this.ignoreErrors&&!this._all&&"error"===s)return arguments[1]instanceof Error?Promise.reject(arguments[1]):Promise.reject("Uncaught, unspecified 'error' event.");return Promise.all(d)},R.prototype.on=function(e,t,n){return this._on(e,t,!1,n)},R.prototype.prependListener=function(e,t,n){return this._on(e,t,!0,n)},R.prototype.onAny=function(e){return this._onAny(e,!1)},R.prototype.prependAny=function(e){return this._onAny(e,!0)},R.prototype.addListener=R.prototype.on,R.prototype._onAny=function(e,t){if("function"!=typeof e)throw new Error("onAny only accepts instances of Function");return this._all||(this._all=[]),t?this._all.unshift(e):this._all.push(e),this},R.prototype._on=function(e,n,r,i){if("function"==typeof e)return this._onAny(e,n),this;if("function"!=typeof n)throw new Error("on only accepts instances of Function");this._events||l.call(this);var o,a=this;return i!==t&&(n=(o=x.call(this,e,n,i))[0],a=o[1]),this._newListener&&this.emit("newListener",e,n),this.wildcard?(S.call(this,e,n,r),a):(this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),r?this._events[e].unshift(n):this._events[e].push(n),!this._events[e].warned&&this._maxListeners>0&&this._events[e].length>this._maxListeners&&(this._events[e].warned=!0,d.call(this,this._events[e].length,e))):this._events[e]=n,a)},R.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var n,i=[];if(this.wildcard){var o="string"==typeof e?e.split(this.delimiter):e.slice();if(!(i=E.call(this,null,o,this.listenerTree,0)))return this}else{if(!this._events[e])return this;n=this._events[e],i.push({_listeners:n})}for(var a=0;a<i.length;a++){var s=i[a];if(n=s._listeners,r(n)){for(var u=-1,l=0,c=n.length;l<c;l++)if(n[l]===t||n[l].listener&&n[l].listener===t||n[l]._origin&&n[l]._origin===t){u=l;break}if(u<0)continue;return this.wildcard?s._listeners.splice(u,1):this._events[e].splice(u,1),0===n.length&&(this.wildcard?delete s._listeners:delete this._events[e]),this._removeListener&&this.emit("removeListener",e,t),this}(n===t||n.listener&&n.listener===t||n._origin&&n._origin===t)&&(this.wildcard?delete s._listeners:delete this._events[e],this._removeListener&&this.emit("removeListener",e,t))}return this.listenerTree&&M(this.listenerTree),this},R.prototype.offAny=function(e){var t,n=0,r=0;if(e&&this._all&&this._all.length>0){for(n=0,r=(t=this._all).length;n<r;n++)if(e===t[n])return t.splice(n,1),this._removeListener&&this.emit("removeListenerAny",e),this}else{if(t=this._all,this._removeListener)for(n=0,r=t.length;n<r;n++)this.emit("removeListenerAny",t[n]);this._all=[]}return this},R.prototype.removeListener=R.prototype.off,R.prototype.removeAllListeners=function(e){if(e===t)return!this._events||l.call(this),this;if(this.wildcard){var n,r=E.call(this,null,e,this.listenerTree,0);if(!r)return this;for(n=0;n<r.length;n++)r[n]._listeners=null;this.listenerTree&&M(this.listenerTree)}else this._events&&(this._events[e]=null);return this},R.prototype.listeners=function(e){var n,r,i,o,a,s=this._events;if(e===t){if(this.wildcard)throw Error("event name required for wildcard emitter");if(!s)return[];for(o=(n=u(s)).length,i=[];o-- >0;)"function"==typeof(r=s[n[o]])?i.push(r):i.push.apply(i,r);return i}if(this.wildcard){if(!(a=this.listenerTree))return[];var l=[],c="string"==typeof e?e.split(this.delimiter):e.slice();return E.call(this,l,c,a,0),l}return s&&(r=s[e])?"function"==typeof r?[r]:r:[]},R.prototype.eventNames=function(e){var t=this._events;return this.wildcard?k.call(this,this.listenerTree,[],null,e):t?u(t):[]},R.prototype.listenerCount=function(e){return this.listeners(e).length},R.prototype.hasListeners=function(e){if(this.wildcard){var n=[],r="string"==typeof e?e.split(this.delimiter):e.slice();return E.call(this,n,r,this.listenerTree,0),n.length>0}var i=this._events,o=this._all;return!!(o&&o.length||i&&(e===t?u(i).length:i[e]))},R.prototype.listenersAny=function(){return this._all?this._all:[]},R.prototype.waitFor=function(e,n){var r=this,i=typeof n;return"number"===i?n={timeout:n}:"function"===i&&(n={filter:n}),A((n=m(n,{timeout:0,filter:t,handleError:!1,Promise:Promise,overload:!1},{filter:y,Promise:g})).Promise,(function(t,i,o){function a(){var o=n.filter;if(!o||o.apply(r,arguments))if(r.off(e,a),n.handleError){var s=arguments[0];s?i(s):t(f.apply(null,arguments).slice(1))}else t(f.apply(null,arguments))}o((function(){r.off(e,a)})),r._on(e,a,!1)}),{timeout:n.timeout,overload:n.overload})};var O=R.prototype;Object.defineProperties(R,{defaultMaxListeners:{get:function(){return O._maxListeners},set:function(e){if("number"!=typeof e||e<0||Number.isNaN(e))throw TypeError("n must be a non-negative number");O._maxListeners=e},enumerable:!0},once:{value:function(e,t,n){return A((n=m(n,{Promise:Promise,timeout:0,overload:!1},{Promise:g})).Promise,(function(n,r,i){var o;if("function"==typeof e.addEventListener)return o=function(){n(f.apply(null,arguments))},i((function(){e.removeEventListener(t,o)})),void e.addEventListener(t,o,{once:!0});var a,s=function(){a&&e.removeListener("error",a),n(f.apply(null,arguments))};"error"!==t&&(a=function(n){e.removeListener(t,s),r(n)},e.once("error",a)),i((function(){a&&e.removeListener("error",a),e.removeListener(t,s)})),e.once(t,s)}),{timeout:n.timeout,overload:n.overload})},writable:!0,configurable:!0}}),Object.defineProperties(O,{_maxListeners:{value:10,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),"function"==typeof t&&t.amd?t((function(){return R})):e.exports=R}()}(L);var I,N=L.exports,D=new Uint8Array(16);function B(){if(!I&&!(I="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return I(D)}var j=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function U(e){return"string"==typeof e&&j.test(e)}for(var z=[],F=0;F<256;++F)z.push((F+256).toString(16).substr(1));function q(e,t,n){var r=(e=e||{}).random||(e.rng||B)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(var i=0;i<16;++i)t[n+i]=r[i];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(z[e[t+0]]+z[e[t+1]]+z[e[t+2]]+z[e[t+3]]+"-"+z[e[t+4]]+z[e[t+5]]+"-"+z[e[t+6]]+z[e[t+7]]+"-"+z[e[t+8]]+z[e[t+9]]+"-"+z[e[t+10]]+z[e[t+11]]+z[e[t+12]]+z[e[t+13]]+z[e[t+14]]+z[e[t+15]]).toLowerCase();if(!U(n))throw TypeError("Stringified UUID is invalid");return n}(r)}const W=Object.create(null);W.open="0",W.close="1",W.ping="2",W.pong="3",W.message="4",W.upgrade="5",W.noop="6";const V=Object.create(null);Object.keys(W).forEach((e=>{V[W[e]]=e}));const K={type:"error",data:"parser error"},H="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),$="function"==typeof ArrayBuffer,Y=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,G=({type:e,data:t},n,r)=>H&&t instanceof Blob?n?r(t):Q(t,r):$&&(t instanceof ArrayBuffer||Y(t))?n?r(t):Q(new Blob([t]),r):r(W[e]+(t||"")),Q=(e,t)=>{const n=new FileReader;return n.onload=function(){const e=n.result.split(",")[1];t("b"+(e||""))},n.readAsDataURL(e)};function Z(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let X;function J(e,t){return H&&e.data instanceof Blob?e.data.arrayBuffer().then(Z).then(t):$&&(e.data instanceof ArrayBuffer||Y(e.data))?t(Z(e.data)):void G(e,!1,(e=>{X||(X=new TextEncoder),t(X.encode(e))}))}const ee="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",te="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e<64;e++)te[ee.charCodeAt(e)]=e;const ne="function"==typeof ArrayBuffer,re=(e,t)=>{if("string"!=typeof e)return{type:"message",data:oe(e,t)};const n=e.charAt(0);return"b"===n?{type:"message",data:ie(e.substring(1),t)}:V[n]?e.length>1?{type:V[n],data:e.substring(1)}:{type:V[n]}:K},ie=(e,t)=>{if(ne){const n=(e=>{let t,n,r,i,o,a=.75*e.length,s=e.length,u=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);const l=new ArrayBuffer(a),c=new Uint8Array(l);for(t=0;t<s;t+=4)n=te[e.charCodeAt(t)],r=te[e.charCodeAt(t+1)],i=te[e.charCodeAt(t+2)],o=te[e.charCodeAt(t+3)],c[u++]=n<<2|r>>4,c[u++]=(15&r)<<4|i>>2,c[u++]=(3&i)<<6|63&o;return l})(e);return oe(n,t)}return{base64:!0,data:e}},oe=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer,ae=String.fromCharCode(30);let se;function ue(e){if(e)return function(e){for(var t in ue.prototype)e[t]=ue.prototype[t];return e}(e)}ue.prototype.on=ue.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},ue.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},ue.prototype.off=ue.prototype.removeListener=ue.prototype.removeAllListeners=ue.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var i=0;i<r.length;i++)if((n=r[i])===t||n.fn===t){r.splice(i,1);break}return 0===r.length&&delete this._callbacks["$"+e],this},ue.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){r=0;for(var i=(n=n.slice(0)).length;r<i;++r)n[r].apply(this,t)}return this},ue.prototype.emitReserved=ue.prototype.emit,ue.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},ue.prototype.hasListeners=function(e){return!!this.listeners(e).length};const le="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function ce(e,...t){return t.reduce(((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t)),{})}const de=le.setTimeout,fe=le.clearTimeout;function he(e,t){t.useNativeTimers?(e.setTimeoutFn=de.bind(le),e.clearTimeoutFn=fe.bind(le)):(e.setTimeoutFn=le.setTimeout.bind(le),e.clearTimeoutFn=le.clearTimeout.bind(le))}class pe extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type="TransportError"}}class me extends ue{constructor(e){super(),this.writable=!1,he(this,e),this.opts=e,this.query=e.query,this.socket=e.socket}onError(e,t,n){return super.emitReserved("error",new pe(e,t,n)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(e){"open"===this.readyState&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=re(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return-1===e.indexOf(":")?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(443!==this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(e){const t=function(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}(e);return t.length?"?"+t:""}}const ge="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),ve=64,ye={};let be,we=0,Ae=0;function _e(e){let t="";do{t=ge[e%ve]+t,e=Math.floor(e/ve)}while(e>0);return t}function Ee(){const e=_e(+new Date);return e!==be?(we=0,be=e):e+"."+_e(we++)}for(;Ae<ve;Ae++)ye[ge[Ae]]=Ae;let Se=!1;try{Se="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(t){}const ke=Se;function Me(e){const t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||ke))return new XMLHttpRequest}catch(e){}if(!t)try{return new(le[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}function Ce(){}const xe=null!=new Me({xdomain:!1}).responseType;class Re extends ue{constructor(e,t){super(),he(this,t),this.opts=t,this.method=t.method||"GET",this.uri=e,this.data=void 0!==t.data?t.data:null,this.create()}create(){var e;const t=ce(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this.opts.xd;const n=this.xhr=new Me(t);try{n.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0);for(let e in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(e)&&n.setRequestHeader(e,this.opts.extraHeaders[e])}}catch(e){}if("POST"===this.method)try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{n.setRequestHeader("Accept","*/*")}catch(e){}null===(e=this.opts.cookieJar)||void 0===e||e.addCookies(n),"withCredentials"in n&&(n.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(n.timeout=this.opts.requestTimeout),n.onreadystatechange=()=>{var e;3===n.readyState&&(null===(e=this.opts.cookieJar)||void 0===e||e.parseCookies(n)),4===n.readyState&&(200===n.status||1223===n.status?this.onLoad():this.setTimeoutFn((()=>{this.onError("number"==typeof n.status?n.status:0)}),0))},n.send(this.data)}catch(e){return void this.setTimeoutFn((()=>{this.onError(e)}),0)}"undefined"!=typeof document&&(this.index=Re.requestsCount++,Re.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(e){if(void 0!==this.xhr&&null!==this.xhr){if(this.xhr.onreadystatechange=Ce,e)try{this.xhr.abort()}catch(e){}"undefined"!=typeof document&&delete Re.requests[this.index],this.xhr=null}}onLoad(){const e=this.xhr.responseText;null!==e&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}function Oe(){for(let e in Re.requests)Re.requests.hasOwnProperty(e)&&Re.requests[e].abort()}Re.requestsCount=0,Re.requests={},"undefined"!=typeof document&&("function"==typeof attachEvent?attachEvent("onunload",Oe):"function"==typeof addEventListener&&addEventListener("onpagehide"in le?"pagehide":"unload",Oe,!1));var Te=[],Pe=[],Le="undefined"!=typeof Uint8Array?Uint8Array:Array,Ie=!1;function Ne(){Ie=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)Te[t]=e[t],Pe[e.charCodeAt(t)]=t;Pe["-".charCodeAt(0)]=62,Pe["_".charCodeAt(0)]=63}function De(e,t,n){for(var r,i,o=[],a=t;a<n;a+=3)r=(e[a]<<16)+(e[a+1]<<8)+e[a+2],o.push(Te[(i=r)>>18&63]+Te[i>>12&63]+Te[i>>6&63]+Te[63&i]);return o.join("")}function Be(e){var t;Ie||Ne();for(var n=e.length,r=n%3,i="",o=[],a=16383,s=0,u=n-r;s<u;s+=a)o.push(De(e,s,s+a>u?u:s+a));return 1===r?(t=e[n-1],i+=Te[t>>2],i+=Te[t<<4&63],i+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],i+=Te[t>>10],i+=Te[t>>4&63],i+=Te[t<<2&63],i+="="),o.push(i),o.join("")}function je(e,t,n,r,i){var o,a,s=8*i-r-1,u=(1<<s)-1,l=u>>1,c=-7,d=n?i-1:0,f=n?-1:1,h=e[t+d];for(d+=f,o=h&(1<<-c)-1,h>>=-c,c+=s;c>0;o=256*o+e[t+d],d+=f,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=r;c>0;a=256*a+e[t+d],d+=f,c-=8);if(0===o)o=1-l;else{if(o===u)return a?NaN:1/0*(h?-1:1);a+=Math.pow(2,r),o-=l}return(h?-1:1)*a*Math.pow(2,o-r)}function Ue(e,t,n,r,i,o){var a,s,u,l=8*o-i-1,c=(1<<l)-1,d=c>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:o-1,p=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+d>=1?f/u:f*Math.pow(2,1-d))*u>=2&&(a++,u/=2),a+d>=c?(s=0,a=c):a+d>=1?(s=(t*u-1)*Math.pow(2,i),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),a=0));i>=8;e[n+h]=255&s,h+=p,s/=256,i-=8);for(a=a<<i|s,l+=i;l>0;e[n+h]=255&a,h+=p,a/=256,l-=8);e[n+h-p]|=128*m}var ze={}.toString,Fe=Array.isArray||function(e){return"[object Array]"==ze.call(e)};Ke.TYPED_ARRAY_SUPPORT=void 0===n.TYPED_ARRAY_SUPPORT||n.TYPED_ARRAY_SUPPORT;var qe=We();function We(){return Ke.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Ve(e,t){if(We()<t)throw new RangeError("Invalid typed array length");return Ke.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=Ke.prototype:(null===e&&(e=new Ke(t)),e.length=t),e}function Ke(e,t,n){if(!(Ke.TYPED_ARRAY_SUPPORT||this instanceof Ke))return new Ke(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return Ye(this,e)}return He(this,e,t,n)}function He(e,t,n,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");return t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r),Ke.TYPED_ARRAY_SUPPORT?(e=t).__proto__=Ke.prototype:e=Ge(e,t),e}(e,t,n,r):"string"==typeof t?function(e,t,n){if("string"==typeof n&&""!==n||(n="utf8"),!Ke.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|Xe(t,n),i=(e=Ve(e,r)).write(t,n);return i!==r&&(e=e.slice(0,i)),e}(e,t,n):function(e,t){if(Ze(t)){var n=0|Qe(t.length);return 0===(e=Ve(e,n)).length||t.copy(e,0,0,n),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(r=t.length)!=r?Ve(e,0):Ge(e,t);if("Buffer"===t.type&&Fe(t.data))return Ge(e,t.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function $e(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')}function Ye(e,t){if($e(t),e=Ve(e,t<0?0:0|Qe(t)),!Ke.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function Ge(e,t){var n=t.length<0?0:0|Qe(t.length);e=Ve(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function Qe(e){if(e>=We())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+We().toString(16)+" bytes");return 0|e}function Ze(e){return!(null==e||!e._isBuffer)}function Xe(e,t){if(Ze(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return kt(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Mt(e).length;default:if(r)return kt(e).length;t=(""+t).toLowerCase(),r=!0}}function Je(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return pt(this,t,n);case"utf8":case"utf-8":return ct(this,t,n);case"ascii":return ft(this,t,n);case"latin1":case"binary":return ht(this,t,n);case"base64":return lt(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return mt(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function et(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function tt(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=Ke.from(t,r)),Ze(t))return 0===t.length?-1:nt(e,t,n,r,i);if("number"==typeof t)return t&=255,Ke.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):nt(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function nt(e,t,n,r,i){var o,a=1,s=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,n/=2}function l(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var c=-1;for(o=n;o<s;o++)if(l(e,o)===l(t,-1===c?0:o-c)){if(-1===c&&(c=o),o-c+1===u)return c*a}else-1!==c&&(o-=o-c),c=-1}else for(n+u>s&&(n=s-u),o=n;o>=0;o--){for(var d=!0,f=0;f<u;f++)if(l(e,o+f)!==l(t,f)){d=!1;break}if(d)return o}return-1}function rt(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a<r;++a){var s=parseInt(t.substr(2*a,2),16);if(isNaN(s))return a;e[n+a]=s}return a}function it(e,t,n,r){return Ct(kt(t,e.length-n),e,n,r)}function ot(e,t,n,r){return Ct(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function at(e,t,n,r){return ot(e,t,n,r)}function st(e,t,n,r){return Ct(Mt(t),e,n,r)}function ut(e,t,n,r){return Ct(function(e,t){for(var n,r,i,o=[],a=0;a<e.length&&!((t-=2)<0);++a)r=(n=e.charCodeAt(a))>>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function lt(e,t,n){return 0===t&&n===e.length?Be(e):Be(e.slice(t,n))}function ct(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var o,a,s,u,l=e[i],c=null,d=l>239?4:l>223?3:l>191?2:1;if(i+d<=n)switch(d){case 1:l<128&&(c=l);break;case 2:128==(192&(o=e[i+1]))&&(u=(31&l)<<6|63&o)>127&&(c=u);break;case 3:o=e[i+1],a=e[i+2],128==(192&o)&&128==(192&a)&&(u=(15&l)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:o=e[i+1],a=e[i+2],s=e[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(u=(15&l)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(c=u)}null===c?(c=65533,d=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),i+=d}return function(e){var t=e.length;if(t<=dt)return String.fromCharCode.apply(String,e);for(var n="",r=0;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=dt));return n}(r)}Ke.poolSize=8192,Ke._augment=function(e){return e.__proto__=Ke.prototype,e},Ke.from=function(e,t,n){return He(null,e,t,n)},Ke.TYPED_ARRAY_SUPPORT&&(Ke.prototype.__proto__=Uint8Array.prototype,Ke.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&Ke[Symbol.species]),Ke.alloc=function(e,t,n){return function(e,t,n,r){return $e(t),t<=0?Ve(e,t):void 0!==n?"string"==typeof r?Ve(e,t).fill(n,r):Ve(e,t).fill(n):Ve(e,t)}(null,e,t,n)},Ke.allocUnsafe=function(e){return Ye(null,e)},Ke.allocUnsafeSlow=function(e){return Ye(null,e)},Ke.isBuffer=xt,Ke.compare=function(e,t){if(!Ze(e)||!Ze(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i<o;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},Ke.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},Ke.concat=function(e,t){if(!Fe(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return Ke.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=Ke.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var o=e[n];if(!Ze(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(r,i),i+=o.length}return r},Ke.byteLength=Xe,Ke.prototype._isBuffer=!0,Ke.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)et(this,t,t+1);return this},Ke.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)et(this,t,t+3),et(this,t+1,t+2);return this},Ke.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)et(this,t,t+7),et(this,t+1,t+6),et(this,t+2,t+5),et(this,t+3,t+4);return this},Ke.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?ct(this,0,e):Je.apply(this,arguments)},Ke.prototype.equals=function(e){if(!Ze(e))throw new TypeError("Argument must be a Buffer");return this===e||0===Ke.compare(this,e)},Ke.prototype.inspect=function(){var e="";return this.length>0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),"<Buffer "+e+">"},Ke.prototype.compare=function(e,t,n,r,i){if(!Ze(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0),s=Math.min(o,a),u=this.slice(r,i),l=e.slice(t,n),c=0;c<s;++c)if(u[c]!==l[c]){o=u[c],a=l[c];break}return o<a?-1:a<o?1:0},Ke.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},Ke.prototype.indexOf=function(e,t,n){return tt(this,e,t,n,!0)},Ke.prototype.lastIndexOf=function(e,t,n){return tt(this,e,t,n,!1)},Ke.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return rt(this,e,t,n);case"utf8":case"utf-8":return it(this,e,t,n);case"ascii":return ot(this,e,t,n);case"latin1":case"binary":return at(this,e,t,n);case"base64":return st(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ut(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},Ke.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var dt=4096;function ft(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function ht(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function pt(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=t;o<n;++o)i+=St(e[o]);return i}function mt(e,t,n){for(var r=e.slice(t,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function gt(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function vt(e,t,n,r,i,o){if(!Ze(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function yt(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i<o;++i)e[n+i]=(t&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function bt(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i<o;++i)e[n+i]=t>>>8*(r?i:3-i)&255}function wt(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function At(e,t,n,r,i){return i||wt(e,0,n,4),Ue(e,t,n,r,23,4),n+4}function _t(e,t,n,r,i){return i||wt(e,0,n,8),Ue(e,t,n,r,52,8),n+8}Ke.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e),Ke.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=Ke.prototype;else{var i=t-e;n=new Ke(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+e]}return n},Ke.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||gt(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r},Ke.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||gt(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},Ke.prototype.readUInt8=function(e,t){return t||gt(e,1,this.length),this[e]},Ke.prototype.readUInt16LE=function(e,t){return t||gt(e,2,this.length),this[e]|this[e+1]<<8},Ke.prototype.readUInt16BE=function(e,t){return t||gt(e,2,this.length),this[e]<<8|this[e+1]},Ke.prototype.readUInt32LE=function(e,t){return t||gt(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},Ke.prototype.readUInt32BE=function(e,t){return t||gt(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},Ke.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||gt(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},Ke.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||gt(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},Ke.prototype.readInt8=function(e,t){return t||gt(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},Ke.prototype.readInt16LE=function(e,t){t||gt(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},Ke.prototype.readInt16BE=function(e,t){t||gt(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},Ke.prototype.readInt32LE=function(e,t){return t||gt(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},Ke.prototype.readInt32BE=function(e,t){return t||gt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},Ke.prototype.readFloatLE=function(e,t){return t||gt(e,4,this.length),je(this,e,!0,23,4)},Ke.prototype.readFloatBE=function(e,t){return t||gt(e,4,this.length),je(this,e,!1,23,4)},Ke.prototype.readDoubleLE=function(e,t){return t||gt(e,8,this.length),je(this,e,!0,52,8)},Ke.prototype.readDoubleBE=function(e,t){return t||gt(e,8,this.length),je(this,e,!1,52,8)},Ke.prototype.writeUIntLE=function(e,t,n,r){e=+e,t|=0,n|=0,r||vt(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o<n&&(i*=256);)this[t+o]=e/i&255;return t+n},Ke.prototype.writeUIntBE=function(e,t,n,r){e=+e,t|=0,n|=0,r||vt(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},Ke.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||vt(this,e,t,1,255,0),Ke.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},Ke.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||vt(this,e,t,2,65535,0),Ke.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):yt(this,e,t,!0),t+2},Ke.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||vt(this,e,t,2,65535,0),Ke.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):yt(this,e,t,!1),t+2},Ke.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||vt(this,e,t,4,4294967295,0),Ke.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):bt(this,e,t,!0),t+4},Ke.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||vt(this,e,t,4,4294967295,0),Ke.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):bt(this,e,t,!1),t+4},Ke.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);vt(this,e,t,n,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o<n&&(a*=256);)e<0&&0===s&&0!==this[t+o-1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},Ke.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);vt(this,e,t,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},Ke.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||vt(this,e,t,1,127,-128),Ke.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},Ke.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||vt(this,e,t,2,32767,-32768),Ke.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):yt(this,e,t,!0),t+2},Ke.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||vt(this,e,t,2,32767,-32768),Ke.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):yt(this,e,t,!1),t+2},Ke.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||vt(this,e,t,4,2147483647,-2147483648),Ke.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):bt(this,e,t,!0),t+4},Ke.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||vt(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),Ke.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):bt(this,e,t,!1),t+4},Ke.prototype.writeFloatLE=function(e,t,n){return At(this,e,t,!0,n)},Ke.prototype.writeFloatBE=function(e,t,n){return At(this,e,t,!1,n)},Ke.prototype.writeDoubleLE=function(e,t,n){return _t(this,e,t,!0,n)},Ke.prototype.writeDoubleBE=function(e,t,n){return _t(this,e,t,!1,n)},Ke.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i,o=r-n;if(this===e&&n<t&&t<r)for(i=o-1;i>=0;--i)e[i+t]=this[i+n];else if(o<1e3||!Ke.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)e[i+t]=this[i+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+o),t);return o},Ke.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!Ke.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var o;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o<n;++o)this[o]=e;else{var a=Ze(e)?e:kt(new Ke(e,r).toString()),s=a.length;for(o=0;o<n-t;++o)this[o+t]=a[o%s]}return this};var Et=/[^+\/0-9A-Za-z-_]/g;function St(e){return e<16?"0"+e.toString(16):e.toString(16)}function kt(e,t){var n;t=t||1/0;for(var r=e.length,i=null,o=[],a=0;a<r;++a){if((n=e.charCodeAt(a))>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function Mt(e){return function(e){var t,n,r,i,o,a;Ie||Ne();var s=e.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===e[s-2]?2:"="===e[s-1]?1:0,a=new Le(3*s/4-o),r=o>0?s-4:s;var u=0;for(t=0,n=0;t<r;t+=4,n+=3)i=Pe[e.charCodeAt(t)]<<18|Pe[e.charCodeAt(t+1)]<<12|Pe[e.charCodeAt(t+2)]<<6|Pe[e.charCodeAt(t+3)],a[u++]=i>>16&255,a[u++]=i>>8&255,a[u++]=255&i;return 2===o?(i=Pe[e.charCodeAt(t)]<<2|Pe[e.charCodeAt(t+1)]>>4,a[u++]=255&i):1===o&&(i=Pe[e.charCodeAt(t)]<<10|Pe[e.charCodeAt(t+1)]<<4|Pe[e.charCodeAt(t+2)]>>2,a[u++]=i>>8&255,a[u++]=255&i),a}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(Et,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Ct(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function xt(e){return null!=e&&(!!e._isBuffer||Rt(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&Rt(e.slice(0,0))}(e))}function Rt(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var Ot=Object.freeze({__proto__:null,Buffer:Ke,INSPECT_MAX_BYTES:50,SlowBuffer:function(e){return+e!=e&&(e=0),Ke.alloc(+e)},isBuffer:xt,kMaxLength:qe});const Tt="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),Pt=le.WebSocket||le.MozWebSocket,Lt="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();function It(e,t){return"message"===e.type&&"string"!=typeof e.data&&t[0]>=48&&t[0]<=54}const Nt={websocket:class extends me{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const e=this.uri(),t=this.opts.protocols,n=Lt?{}:ce(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=Lt?new Pt(e,t,n):t?new Pt(e,t):new Pt(e)}catch(e){return this.emitReserved("error",e)}this.ws.binaryType=this.socket.binaryType||"arraybuffer",this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],r=t===e.length-1;G(n,this.supportsBinary,(e=>{try{this.ws.send(e)}catch(e){}r&&Tt((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}}doClose(){void 0!==this.ws&&(this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=Ee()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}check(){return!!Pt}},webtransport:class extends me{get name(){return"webtransport"}doOpen(){"function"==typeof WebTransport&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then((()=>{this.onClose()})).catch((e=>{this.onError("webtransport error",e)})),this.transport.ready.then((()=>{this.transport.createBidirectionalStream().then((e=>{const t=e.readable.getReader();let n;this.writer=e.writable.getWriter();const r=()=>{t.read().then((({done:e,value:t})=>{e||(n||1!==t.byteLength||54!==t[0]?(this.onPacket(function(e,t,n){se||(se=new TextDecoder);const r=t||e[0]<48||e[0]>54;return re(r?e:se.decode(e),n)}(t,n,"arraybuffer")),n=!1):n=!0,r())})).catch((e=>{}))};r();const i=this.query.sid?`0{"sid":"${this.query.sid}"}`:"0";this.writer.write((new TextEncoder).encode(i)).then((()=>this.onOpen()))}))})))}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],r=t===e.length-1;J(n,(e=>{It(n,e)&&this.writer.write(Uint8Array.of(54)),this.writer.write(e).then((()=>{r&&Tt((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}))}}doClose(){var e;null===(e=this.transport)||void 0===e||e.close()}},polling:class extends me{constructor(e){if(super(e),this.polling=!1,"undefined"!=typeof location){const t="https:"===location.protocol;let n=location.port;n||(n=t?"443":"80"),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||n!==e.port}const t=e&&e.forceBase64;this.supportsBinary=xe&&!t,this.opts.withCredentials&&(this.cookieJar=void 0)}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this.polling||!this.writable){let e=0;this.polling&&(e++,this.once("pollComplete",(function(){--e||t()}))),this.writable||(e++,this.once("drain",(function(){--e||t()})))}else t()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){((e,t)=>{const n=e.split(ae),r=[];for(let e=0;e<n.length;e++){const i=re(n[e],t);if(r.push(i),"error"===i.type)break}return r})(e,this.socket.binaryType).forEach((e=>{if("opening"===this.readyState&&"open"===e.type&&this.onOpen(),"close"===e.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(e)})),"closed"!==this.readyState&&(this.polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this.poll())}doClose(){const e=()=>{this.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}write(e){this.writable=!1,((e,t)=>{const n=e.length,r=new Array(n);let i=0;e.forEach(((e,o)=>{G(e,!1,(e=>{r[o]=e,++i===n&&t(r.join(ae))}))}))})(e,(e=>{this.doWrite(e,(()=>{this.writable=!0,this.emitReserved("drain")}))}))}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=Ee()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}request(e={}){return Object.assign(e,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new Re(this.uri(),e)}doWrite(e,t){const n=this.request({method:"POST",data:e});n.on("success",t),n.on("error",((e,t)=>{this.onError("xhr post error",e,t)}))}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",((e,t)=>{this.onError("xhr poll error",e,t)})),this.pollXhr=e}}},Dt=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Bt=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function jt(e){const t=e,n=e.indexOf("["),r=e.indexOf("]");-1!=n&&-1!=r&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let i=Dt.exec(e||""),o={},a=14;for(;a--;)o[Bt[a]]=i[a]||"";return-1!=n&&-1!=r&&(o.source=t,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=function(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");return"/"!=t.slice(0,1)&&0!==t.length||r.splice(0,1),"/"==t.slice(-1)&&r.splice(r.length-1,1),r}(0,o.path),o.queryKey=function(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,(function(e,t,r){t&&(n[t]=r)})),n}(0,o.query),o}let Ut=class e extends ue{constructor(e,t={}){super(),this.writeBuffer=[],e&&"object"==typeof e&&(t=e,e=null),e?(e=jt(e),t.hostname=e.host,t.secure="https"===e.protocol||"wss"===e.protocol,t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=jt(t.host).host),he(this,t),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=t.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(e){let t={},n=e.split("&");for(let e=0,r=n.length;e<r;e++){let r=n[e].split("=");t[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return t}(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,"function"==typeof addEventListener&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);const n=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new Nt[e](n)}open(){let t;if(this.opts.rememberUpgrade&&e.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))t="websocket";else{if(0===this.transports.length)return void this.setTimeoutFn((()=>{this.emitReserved("error","No transports available")}),0);t=this.transports[0]}this.readyState="opening";try{t=this.createTransport(t)}catch(e){return this.transports.shift(),void this.open()}t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",(e=>this.onClose("transport close",e)))}probe(t){let n=this.createTransport(t),r=!1;e.priorWebsocketSuccess=!1;const i=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",(t=>{if(!r)if("pong"===t.type&&"probe"===t.data){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;e.priorWebsocketSuccess="websocket"===n.name,this.transport.pause((()=>{r||"closed"!==this.readyState&&(c(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())}))}else{const e=new Error("probe error");e.transport=n.name,this.emitReserved("upgradeError",e)}})))};function o(){r||(r=!0,c(),n.close(),n=null)}const a=e=>{const t=new Error("probe error: "+e);t.transport=n.name,o(),this.emitReserved("upgradeError",t)};function s(){a("transport closed")}function u(){a("socket closed")}function l(e){n&&e.name!==n.name&&o()}const c=()=>{n.removeListener("open",i),n.removeListener("error",a),n.removeListener("close",s),this.off("close",u),this.off("upgrading",l)};n.once("open",i),n.once("error",a),n.once("close",s),this.once("close",u),this.once("upgrading",l),-1!==this.upgrades.indexOf("webtransport")&&"webtransport"!==t?this.setTimeoutFn((()=>{r||n.open()}),200):n.open()}onOpen(){if(this.readyState="open",e.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush(),"open"===this.readyState&&this.opts.upgrade){let e=0;const t=this.upgrades.length;for(;e<t;e++)this.probe(this.upgrades[e])}}onPacket(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this.resetPingTimeout(),this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":const t=new Error("server error");t.code=e.data,this.onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data)}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=this.filterUpgrades(e.upgrades),this.pingInterval=e.pingInterval,this.pingTimeout=e.pingTimeout,this.maxPayload=e.maxPayload,this.onOpen(),"closed"!==this.readyState&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn((()=>{this.onClose("ping timeout")}),this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this.getWritablePackets();this.transport.send(e),this.prevBufferLen=e.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let n=0;n<this.writeBuffer.length;n++){const r=this.writeBuffer[n].data;if(r&&(e+="string"==typeof(t=r)?function(e){let t=0,n=0;for(let r=0,i=e.length;r<i;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n}(t):Math.ceil(1.33*(t.byteLength||t.size))),n>0&&e>this.maxPayload)return this.writeBuffer.slice(0,n);e+=2}var t;return this.writeBuffer}write(e,t,n){return this.sendPacket("message",e,t,n),this}send(e,t,n){return this.sendPacket("message",e,t,n),this}sendPacket(e,t,n,r){if("function"==typeof t&&(r=t,t=void 0),"function"==typeof n&&(r=n,n=null),"closing"===this.readyState||"closed"===this.readyState)return;(n=n||{}).compress=!1!==n.compress;const i={type:e,data:t,options:n};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),r&&this.once("flush",r),this.flush()}close(){const e=()=>{this.onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},n=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",(()=>{this.upgrading?n():e()})):this.upgrading?n():e()),this}onError(t){e.priorWebsocketSuccess=!1,this.emitReserved("error",t),this.onClose("transport error",t)}onClose(e,t){"opening"!==this.readyState&&"open"!==this.readyState&&"closing"!==this.readyState||(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),"function"==typeof removeEventListener&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){const t=[];let n=0;const r=e.length;for(;n<r;n++)~this.transports.indexOf(e[n])&&t.push(e[n]);return t}};Ut.protocol=4;const zt="function"==typeof ArrayBuffer,Ft=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,qt=Object.prototype.toString,Wt="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===qt.call(Blob),Vt="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===qt.call(File);function Kt(e){return zt&&(e instanceof ArrayBuffer||Ft(e))||Wt&&e instanceof Blob||Vt&&e instanceof File}function Ht(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t<n;t++)if(Ht(e[t]))return!0;return!1}if(Kt(e))return!0;if(e.toJSON&&"function"==typeof e.toJSON&&1===arguments.length)return Ht(e.toJSON(),!0);for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&Ht(e[t]))return!0;return!1}function $t(e){const t=[],n=e.data,r=e;return r.data=Yt(n,t),r.attachments=t.length,{packet:r,buffers:t}}function Yt(e,t){if(!e)return e;if(Kt(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}if(Array.isArray(e)){const n=new Array(e.length);for(let r=0;r<e.length;r++)n[r]=Yt(e[r],t);return n}if("object"==typeof e&&!(e instanceof Date)){const n={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=Yt(e[r],t));return n}return e}function Gt(e,t){return e.data=Qt(e.data,t),delete e.attachments,e}function Qt(e,t){if(!e)return e;if(e&&!0===e._placeholder){if("number"==typeof e.num&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=Qt(e[n],t);else if("object"==typeof e)for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=Qt(e[n],t));return e}const Zt=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Xt;function Jt(e){return"[object Object]"===Object.prototype.toString.call(e)}!function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"}(Xt||(Xt={}));class en extends ue{constructor(e){super(),this.reviver=e}add(e){let t;if("string"==typeof e){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const n=t.type===Xt.BINARY_EVENT;n||t.type===Xt.BINARY_ACK?(t.type=n?Xt.EVENT:Xt.ACK,this.reconstructor=new tn(t),0===t.attachments&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else{if(!Kt(e)&&!e.base64)throw new Error("Unknown type: "+e);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t))}}decodeString(e){let t=0;const n={type:Number(e.charAt(0))};if(void 0===Xt[n.type])throw new Error("unknown packet type "+n.type);if(n.type===Xt.BINARY_EVENT||n.type===Xt.BINARY_ACK){const r=t+1;for(;"-"!==e.charAt(++t)&&t!=e.length;);const i=e.substring(r,t);if(i!=Number(i)||"-"!==e.charAt(t))throw new Error("Illegal attachments");n.attachments=Number(i)}if("/"===e.charAt(t+1)){const r=t+1;for(;++t&&","!==e.charAt(t)&&t!==e.length;);n.nsp=e.substring(r,t)}else n.nsp="/";const r=e.charAt(t+1);if(""!==r&&Number(r)==r){const r=t+1;for(;++t;){const n=e.charAt(t);if(null==n||Number(n)!=n){--t;break}if(t===e.length)break}n.id=Number(e.substring(r,t+1))}if(e.charAt(++t)){const r=this.tryParse(e.substr(t));if(!en.isPayloadValid(n.type,r))throw new Error("invalid payload");n.data=r}return n}tryParse(e){try{return JSON.parse(e,this.reviver)}catch(e){return!1}}static isPayloadValid(e,t){switch(e){case Xt.CONNECT:return Jt(t);case Xt.DISCONNECT:return void 0===t;case Xt.CONNECT_ERROR:return"string"==typeof t||Jt(t);case Xt.EVENT:case Xt.BINARY_EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===Zt.indexOf(t[0]));case Xt.ACK:case Xt.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class tn{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const e=Gt(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}var nn=Object.freeze({__proto__:null,Decoder:en,Encoder:class{constructor(e){this.replacer=e}encode(e){return e.type!==Xt.EVENT&&e.type!==Xt.ACK||!Ht(e)?[this.encodeAsString(e)]:this.encodeAsBinary({type:e.type===Xt.EVENT?Xt.BINARY_EVENT:Xt.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id})}encodeAsString(e){let t=""+e.type;return e.type!==Xt.BINARY_EVENT&&e.type!==Xt.BINARY_ACK||(t+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(t+=e.nsp+","),null!=e.id&&(t+=e.id),null!=e.data&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=$t(e),n=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(n),r}},get PacketType(){return Xt},protocol:5});function rn(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const on=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class an extends ue{constructor(e,t,n){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[rn(e,"open",this.onopen.bind(this)),rn(e,"packet",this.onpacket.bind(this)),rn(e,"error",this.onerror.bind(this)),rn(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){if(on.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const n={type:Xt.EVENT,data:t,options:{}};if(n.options.compress=!1!==this.flags.compress,"function"==typeof t[t.length-1]){const e=this.ids++,r=t.pop();this._registerAckCallback(e,r),n.id=e}const r=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!r||!this.connected)||(this.connected?(this.notifyOutgoingListeners(n),this.packet(n)):this.sendBuffer.push(n)),this.flags={},this}_registerAckCallback(e,t){var n;const r=null!==(n=this.flags.timeout)&&void 0!==n?n:this._opts.ackTimeout;if(void 0===r)return void(this.acks[e]=t);const i=this.io.setTimeoutFn((()=>{delete this.acks[e];for(let t=0;t<this.sendBuffer.length;t++)this.sendBuffer[t].id===e&&this.sendBuffer.splice(t,1);t.call(this,new Error("operation has timed out"))}),r);this.acks[e]=(...e)=>{this.io.clearTimeoutFn(i),t.apply(this,[null,...e])}}emitWithAck(e,...t){const n=void 0!==this.flags.timeout||void 0!==this._opts.ackTimeout;return new Promise(((r,i)=>{t.push(((e,t)=>n?e?i(e):r(t):r(e))),this.emit(e,...t)}))}_addToQueue(e){let t;"function"==typeof e[e.length-1]&&(t=e.pop());const n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push(((e,...r)=>{if(n===this._queue[0])return null!==e?n.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)):(this._queue.shift(),t&&t(null,...r)),n.pending=!1,this._drainQueue()})),this._queue.push(n),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||0===this._queue.length)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){"function"==typeof this.auth?this.auth((e=>{this._sendConnectPacket(e)})):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:Xt.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t)}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case Xt.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Xt.EVENT:case Xt.BINARY_EVENT:this.onevent(e);break;case Xt.ACK:case Xt.BINARY_ACK:this.onack(e);break;case Xt.DISCONNECT:this.ondisconnect();break;case Xt.CONNECT_ERROR:this.destroy();const t=new Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t)}}onevent(e){const t=e.data||[];null!=e.id&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const n of t)n.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&"string"==typeof e[e.length-1]&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let n=!1;return function(...r){n||(n=!0,t.packet({type:Xt.ACK,id:e,data:r}))}}onack(e){const t=this.acks[e.id];"function"==typeof t&&(t.apply(this,e.data),delete this.acks[e.id])}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach((e=>this.emitEvent(e))),this.receiveBuffer=[],this.sendBuffer.forEach((e=>{this.notifyOutgoingListeners(e),this.packet(e)})),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach((e=>e())),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Xt.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const n of t)n.apply(this,e.data)}}}function sn(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}sn.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=0==(1&Math.floor(10*t))?e-n:e+n}return 0|Math.min(e,this.max)},sn.prototype.reset=function(){this.attempts=0},sn.prototype.setMin=function(e){this.ms=e},sn.prototype.setMax=function(e){this.max=e},sn.prototype.setJitter=function(e){this.jitter=e};class un extends ue{constructor(e,t){var n;super(),this.nsps={},this.subs=[],e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.opts=t,he(this,t),this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(n=t.randomizationFactor)&&void 0!==n?n:.5),this.backoff=new sn({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this._readyState="closed",this.uri=e;const r=t.parser||nn;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=!1!==t.autoConnect,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return void 0===e?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return void 0===e?this._reconnectionDelay:(this._reconnectionDelay=e,null===(t=this.backoff)||void 0===t||t.setMin(e),this)}randomizationFactor(e){var t;return void 0===e?this._randomizationFactor:(this._randomizationFactor=e,null===(t=this.backoff)||void 0===t||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return void 0===e?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,null===(t=this.backoff)||void 0===t||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new Ut(this.uri,this.opts);const t=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const r=rn(t,"open",(function(){n.onopen(),e&&e()})),i=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},o=rn(t,"error",i);if(!1!==this._timeout){const e=this._timeout,n=this.setTimeoutFn((()=>{r(),i(new Error("timeout")),t.close()}),e);this.opts.autoUnref&&n.unref(),this.subs.push((()=>{this.clearTimeoutFn(n)}))}return this.subs.push(r),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(rn(e,"ping",this.onping.bind(this)),rn(e,"data",this.ondata.bind(this)),rn(e,"error",this.onerror.bind(this)),rn(e,"close",this.onclose.bind(this)),rn(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(e){this.onclose("parse error",e)}}ondecoded(e){Tt((()=>{this.emitReserved("packet",e)}),this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new an(this,e,t),this.nsps[e]=n),n}_destroy(e){const t=Object.keys(this.nsps);for(const e of t)if(this.nsps[e].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let n=0;n<t.length;n++)this.engine.write(t[n],e.options)}cleanup(){this.subs.forEach((e=>e())),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e,t){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const n=this.setTimeoutFn((()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open((t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",t)):e.onreconnect()})))}),t);this.opts.autoUnref&&n.unref(),this.subs.push((()=>{this.clearTimeoutFn(n)}))}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const ln={};function cn(e,t){"object"==typeof e&&(t=e,e=void 0);const n=function(e,t="",n){let r=e;n=n||"undefined"!=typeof location&&location,null==e&&(e=n.protocol+"//"+n.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?n.protocol+e:n.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==n?n.protocol+"//"+e:"https://"+e),r=jt(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const i=-1!==r.host.indexOf(":")?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+i+":"+r.port+t,r.href=r.protocol+"://"+i+(n&&n.port===r.port?"":":"+r.port),r}(e,(t=t||{}).path||"/socket.io"),r=n.source,i=n.id,o=n.path,a=ln[i]&&o in ln[i].nsps;let s;return t.forceNew||t["force new connection"]||!1===t.multiplex||a?s=new un(r,t):(ln[i]||(ln[i]=new un(r,t)),s=ln[i]),n.query&&!t.query&&(t.query=n.queryKey),s.socket(n.path,t)}function dn(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))}Object.assign(cn,{Manager:un,Socket:an,io:cn,connect:cn}),"function"==typeof SuppressedError&&SuppressedError;const fn=(e,t)=>dn(void 0,void 0,void 0,(function*(){const n=t.endsWith("/")?`${t}debug`:`${t}/debug`,r=JSON.stringify(e),i=yield s(n,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:r});return yield i.text()}));var hn=void 0!==n?n:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},pn=[],mn=[],gn="undefined"!=typeof Uint8Array?Uint8Array:Array,vn=!1;function yn(){vn=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)pn[t]=e[t],mn[e.charCodeAt(t)]=t;mn["-".charCodeAt(0)]=62,mn["_".charCodeAt(0)]=63}function bn(e,t,n){for(var r,i,o=[],a=t;a<n;a+=3)r=(e[a]<<16)+(e[a+1]<<8)+e[a+2],o.push(pn[(i=r)>>18&63]+pn[i>>12&63]+pn[i>>6&63]+pn[63&i]);return o.join("")}function wn(e){var t;vn||yn();for(var n=e.length,r=n%3,i="",o=[],a=16383,s=0,u=n-r;s<u;s+=a)o.push(bn(e,s,s+a>u?u:s+a));return 1===r?(t=e[n-1],i+=pn[t>>2],i+=pn[t<<4&63],i+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],i+=pn[t>>10],i+=pn[t>>4&63],i+=pn[t<<2&63],i+="="),o.push(i),o.join("")}function An(e,t,n,r,i){var o,a,s=8*i-r-1,u=(1<<s)-1,l=u>>1,c=-7,d=n?i-1:0,f=n?-1:1,h=e[t+d];for(d+=f,o=h&(1<<-c)-1,h>>=-c,c+=s;c>0;o=256*o+e[t+d],d+=f,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=r;c>0;a=256*a+e[t+d],d+=f,c-=8);if(0===o)o=1-l;else{if(o===u)return a?NaN:1/0*(h?-1:1);a+=Math.pow(2,r),o-=l}return(h?-1:1)*a*Math.pow(2,o-r)}function _n(e,t,n,r,i,o){var a,s,u,l=8*o-i-1,c=(1<<l)-1,d=c>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:o-1,p=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+d>=1?f/u:f*Math.pow(2,1-d))*u>=2&&(a++,u/=2),a+d>=c?(s=0,a=c):a+d>=1?(s=(t*u-1)*Math.pow(2,i),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),a=0));i>=8;e[n+h]=255&s,h+=p,s/=256,i-=8);for(a=a<<i|s,l+=i;l>0;e[n+h]=255&a,h+=p,a/=256,l-=8);e[n+h-p]|=128*m}var En={}.toString,Sn=Array.isArray||function(e){return"[object Array]"==En.call(e)};xn.TYPED_ARRAY_SUPPORT=void 0===hn.TYPED_ARRAY_SUPPORT||hn.TYPED_ARRAY_SUPPORT;var kn=Mn();function Mn(){return xn.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Cn(e,t){if(Mn()<t)throw new RangeError("Invalid typed array length");return xn.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=xn.prototype:(null===e&&(e=new xn(t)),e.length=t),e}function xn(e,t,n){if(!(xn.TYPED_ARRAY_SUPPORT||this instanceof xn))return new xn(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return Tn(this,e)}return Rn(this,e,t,n)}function Rn(e,t,n,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");return t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r),xn.TYPED_ARRAY_SUPPORT?(e=t).__proto__=xn.prototype:e=Pn(e,t),e}(e,t,n,r):"string"==typeof t?function(e,t,n){if("string"==typeof n&&""!==n||(n="utf8"),!xn.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|Nn(t,n),i=(e=Cn(e,r)).write(t,n);return i!==r&&(e=e.slice(0,i)),e}(e,t,n):function(e,t){if(In(t)){var n=0|Ln(t.length);return 0===(e=Cn(e,n)).length||t.copy(e,0,0,n),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(r=t.length)!=r?Cn(e,0):Pn(e,t);if("Buffer"===t.type&&Sn(t.data))return Pn(e,t.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function On(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')}function Tn(e,t){if(On(t),e=Cn(e,t<0?0:0|Ln(t)),!xn.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function Pn(e,t){var n=t.length<0?0:0|Ln(t.length);e=Cn(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function Ln(e){if(e>=Mn())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Mn().toString(16)+" bytes");return 0|e}function In(e){return!(null==e||!e._isBuffer)}function Nn(e,t){if(In(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return ur(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return lr(e).length;default:if(r)return ur(e).length;t=(""+t).toLowerCase(),r=!0}}function Dn(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return Zn(this,t,n);case"utf8":case"utf-8":return $n(this,t,n);case"ascii":return Gn(this,t,n);case"latin1":case"binary":return Qn(this,t,n);case"base64":return Hn(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Xn(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function Bn(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function jn(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=xn.from(t,r)),In(t))return 0===t.length?-1:Un(e,t,n,r,i);if("number"==typeof t)return t&=255,xn.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):Un(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function Un(e,t,n,r,i){var o,a=1,s=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,n/=2}function l(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var c=-1;for(o=n;o<s;o++)if(l(e,o)===l(t,-1===c?0:o-c)){if(-1===c&&(c=o),o-c+1===u)return c*a}else-1!==c&&(o-=o-c),c=-1}else for(n+u>s&&(n=s-u),o=n;o>=0;o--){for(var d=!0,f=0;f<u;f++)if(l(e,o+f)!==l(t,f)){d=!1;break}if(d)return o}return-1}function zn(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a<r;++a){var s=parseInt(t.substr(2*a,2),16);if(isNaN(s))return a;e[n+a]=s}return a}function Fn(e,t,n,r){return cr(ur(t,e.length-n),e,n,r)}function qn(e,t,n,r){return cr(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function Wn(e,t,n,r){return qn(e,t,n,r)}function Vn(e,t,n,r){return cr(lr(t),e,n,r)}function Kn(e,t,n,r){return cr(function(e,t){for(var n,r,i,o=[],a=0;a<e.length&&!((t-=2)<0);++a)r=(n=e.charCodeAt(a))>>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function Hn(e,t,n){return 0===t&&n===e.length?wn(e):wn(e.slice(t,n))}function $n(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var o,a,s,u,l=e[i],c=null,d=l>239?4:l>223?3:l>191?2:1;if(i+d<=n)switch(d){case 1:l<128&&(c=l);break;case 2:128==(192&(o=e[i+1]))&&(u=(31&l)<<6|63&o)>127&&(c=u);break;case 3:o=e[i+1],a=e[i+2],128==(192&o)&&128==(192&a)&&(u=(15&l)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:o=e[i+1],a=e[i+2],s=e[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(u=(15&l)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(c=u)}null===c?(c=65533,d=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),i+=d}return function(e){var t=e.length;if(t<=Yn)return String.fromCharCode.apply(String,e);for(var n="",r=0;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=Yn));return n}(r)}xn.poolSize=8192,xn._augment=function(e){return e.__proto__=xn.prototype,e},xn.from=function(e,t,n){return Rn(null,e,t,n)},xn.TYPED_ARRAY_SUPPORT&&(xn.prototype.__proto__=Uint8Array.prototype,xn.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&xn[Symbol.species]),xn.alloc=function(e,t,n){return function(e,t,n,r){return On(t),t<=0?Cn(e,t):void 0!==n?"string"==typeof r?Cn(e,t).fill(n,r):Cn(e,t).fill(n):Cn(e,t)}(null,e,t,n)},xn.allocUnsafe=function(e){return Tn(null,e)},xn.allocUnsafeSlow=function(e){return Tn(null,e)},xn.isBuffer=dr,xn.compare=function(e,t){if(!In(e)||!In(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i<o;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},xn.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},xn.concat=function(e,t){if(!Sn(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return xn.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=xn.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var o=e[n];if(!In(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(r,i),i+=o.length}return r},xn.byteLength=Nn,xn.prototype._isBuffer=!0,xn.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)Bn(this,t,t+1);return this},xn.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)Bn(this,t,t+3),Bn(this,t+1,t+2);return this},xn.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)Bn(this,t,t+7),Bn(this,t+1,t+6),Bn(this,t+2,t+5),Bn(this,t+3,t+4);return this},xn.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?$n(this,0,e):Dn.apply(this,arguments)},xn.prototype.equals=function(e){if(!In(e))throw new TypeError("Argument must be a Buffer");return this===e||0===xn.compare(this,e)},xn.prototype.inspect=function(){var e="";return this.length>0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),"<Buffer "+e+">"},xn.prototype.compare=function(e,t,n,r,i){if(!In(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0),s=Math.min(o,a),u=this.slice(r,i),l=e.slice(t,n),c=0;c<s;++c)if(u[c]!==l[c]){o=u[c],a=l[c];break}return o<a?-1:a<o?1:0},xn.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},xn.prototype.indexOf=function(e,t,n){return jn(this,e,t,n,!0)},xn.prototype.lastIndexOf=function(e,t,n){return jn(this,e,t,n,!1)},xn.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return zn(this,e,t,n);case"utf8":case"utf-8":return Fn(this,e,t,n);case"ascii":return qn(this,e,t,n);case"latin1":case"binary":return Wn(this,e,t,n);case"base64":return Vn(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Kn(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},xn.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Yn=4096;function Gn(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function Qn(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function Zn(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=t;o<n;++o)i+=sr(e[o]);return i}function Xn(e,t,n){for(var r=e.slice(t,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function Jn(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function er(e,t,n,r,i,o){if(!In(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function tr(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i<o;++i)e[n+i]=(t&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function nr(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i<o;++i)e[n+i]=t>>>8*(r?i:3-i)&255}function rr(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function ir(e,t,n,r,i){return i||rr(e,0,n,4),_n(e,t,n,r,23,4),n+4}function or(e,t,n,r,i){return i||rr(e,0,n,8),_n(e,t,n,r,52,8),n+8}xn.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e),xn.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=xn.prototype;else{var i=t-e;n=new xn(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+e]}return n},xn.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||Jn(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r},xn.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||Jn(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},xn.prototype.readUInt8=function(e,t){return t||Jn(e,1,this.length),this[e]},xn.prototype.readUInt16LE=function(e,t){return t||Jn(e,2,this.length),this[e]|this[e+1]<<8},xn.prototype.readUInt16BE=function(e,t){return t||Jn(e,2,this.length),this[e]<<8|this[e+1]},xn.prototype.readUInt32LE=function(e,t){return t||Jn(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},xn.prototype.readUInt32BE=function(e,t){return t||Jn(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},xn.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||Jn(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},xn.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||Jn(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},xn.prototype.readInt8=function(e,t){return t||Jn(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},xn.prototype.readInt16LE=function(e,t){t||Jn(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},xn.prototype.readInt16BE=function(e,t){t||Jn(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},xn.prototype.readInt32LE=function(e,t){return t||Jn(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},xn.prototype.readInt32BE=function(e,t){return t||Jn(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},xn.prototype.readFloatLE=function(e,t){return t||Jn(e,4,this.length),An(this,e,!0,23,4)},xn.prototype.readFloatBE=function(e,t){return t||Jn(e,4,this.length),An(this,e,!1,23,4)},xn.prototype.readDoubleLE=function(e,t){return t||Jn(e,8,this.length),An(this,e,!0,52,8)},xn.prototype.readDoubleBE=function(e,t){return t||Jn(e,8,this.length),An(this,e,!1,52,8)},xn.prototype.writeUIntLE=function(e,t,n,r){e=+e,t|=0,n|=0,r||er(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o<n&&(i*=256);)this[t+o]=e/i&255;return t+n},xn.prototype.writeUIntBE=function(e,t,n,r){e=+e,t|=0,n|=0,r||er(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},xn.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||er(this,e,t,1,255,0),xn.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},xn.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||er(this,e,t,2,65535,0),xn.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):tr(this,e,t,!0),t+2},xn.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||er(this,e,t,2,65535,0),xn.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):tr(this,e,t,!1),t+2},xn.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||er(this,e,t,4,4294967295,0),xn.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):nr(this,e,t,!0),t+4},xn.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||er(this,e,t,4,4294967295,0),xn.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):nr(this,e,t,!1),t+4},xn.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);er(this,e,t,n,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o<n&&(a*=256);)e<0&&0===s&&0!==this[t+o-1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},xn.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);er(this,e,t,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},xn.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||er(this,e,t,1,127,-128),xn.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},xn.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||er(this,e,t,2,32767,-32768),xn.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):tr(this,e,t,!0),t+2},xn.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||er(this,e,t,2,32767,-32768),xn.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):tr(this,e,t,!1),t+2},xn.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||er(this,e,t,4,2147483647,-2147483648),xn.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):nr(this,e,t,!0),t+4},xn.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||er(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),xn.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):nr(this,e,t,!1),t+4},xn.prototype.writeFloatLE=function(e,t,n){return ir(this,e,t,!0,n)},xn.prototype.writeFloatBE=function(e,t,n){return ir(this,e,t,!1,n)},xn.prototype.writeDoubleLE=function(e,t,n){return or(this,e,t,!0,n)},xn.prototype.writeDoubleBE=function(e,t,n){return or(this,e,t,!1,n)},xn.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i,o=r-n;if(this===e&&n<t&&t<r)for(i=o-1;i>=0;--i)e[i+t]=this[i+n];else if(o<1e3||!xn.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)e[i+t]=this[i+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+o),t);return o},xn.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!xn.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var o;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o<n;++o)this[o]=e;else{var a=In(e)?e:ur(new xn(e,r).toString()),s=a.length;for(o=0;o<n-t;++o)this[o+t]=a[o%s]}return this};var ar=/[^+\/0-9A-Za-z-_]/g;function sr(e){return e<16?"0"+e.toString(16):e.toString(16)}function ur(e,t){var n;t=t||1/0;for(var r=e.length,i=null,o=[],a=0;a<r;++a){if((n=e.charCodeAt(a))>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function lr(e){return function(e){var t,n,r,i,o,a;vn||yn();var s=e.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===e[s-2]?2:"="===e[s-1]?1:0,a=new gn(3*s/4-o),r=o>0?s-4:s;var u=0;for(t=0,n=0;t<r;t+=4,n+=3)i=mn[e.charCodeAt(t)]<<18|mn[e.charCodeAt(t+1)]<<12|mn[e.charCodeAt(t+2)]<<6|mn[e.charCodeAt(t+3)],a[u++]=i>>16&255,a[u++]=i>>8&255,a[u++]=255&i;return 2===o?(i=mn[e.charCodeAt(t)]<<2|mn[e.charCodeAt(t+1)]>>4,a[u++]=255&i):1===o&&(i=mn[e.charCodeAt(t)]<<10|mn[e.charCodeAt(t+1)]<<4|mn[e.charCodeAt(t+2)]>>2,a[u++]=i>>8&255,a[u++]=255&i),a}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(ar,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function cr(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function dr(e){return null!=e&&(!!e._isBuffer||fr(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&fr(e.slice(0,0))}(e))}function fr(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var hr="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n?n:"undefined"!=typeof self?self:{};function pr(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})})),n}var mr={},gr={},vr={},yr=pr(Object.freeze({__proto__:null,Buffer:xn,INSPECT_MAX_BYTES:50,SlowBuffer:function(e){return+e!=e&&(e=0),xn.alloc(+e)},isBuffer:dr,kMaxLength:kn})),br={};function wr(){throw new Error("setTimeout has not been defined")}function Ar(){throw new Error("clearTimeout has not been defined")}var _r=wr,Er=Ar;function Sr(e){if(_r===setTimeout)return setTimeout(e,0);if((_r===wr||!_r)&&setTimeout)return _r=setTimeout,setTimeout(e,0);try{return _r(e,0)}catch(t){try{return _r.call(null,e,0)}catch(t){return _r.call(this,e,0)}}}"function"==typeof hn.setTimeout&&(_r=setTimeout),"function"==typeof hn.clearTimeout&&(Er=clearTimeout);var kr,Mr=[],Cr=!1,xr=-1;function Rr(){Cr&&kr&&(Cr=!1,kr.length?Mr=kr.concat(Mr):xr=-1,Mr.length&&Or())}function Or(){if(!Cr){var e=Sr(Rr);Cr=!0;for(var t=Mr.length;t;){for(kr=Mr,Mr=[];++xr<t;)kr&&kr[xr].run();xr=-1,t=Mr.length}kr=null,Cr=!1,function(e){if(Er===clearTimeout)return clearTimeout(e);if((Er===Ar||!Er)&&clearTimeout)return Er=clearTimeout,clearTimeout(e);try{return Er(e)}catch(t){try{return Er.call(null,e)}catch(t){return Er.call(this,e)}}}(e)}}function Tr(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];Mr.push(new Pr(e,t)),1!==Mr.length||Cr||Sr(Or)}function Pr(e,t){this.fun=e,this.array=t}function Lr(){}Pr.prototype.run=function(){this.fun.apply(null,this.array)};var Ir=Lr,Nr=Lr,Dr=Lr,Br=Lr,jr=Lr,Ur=Lr,zr=Lr,Fr=hn.performance||{},qr=Fr.now||Fr.mozNow||Fr.msNow||Fr.oNow||Fr.webkitNow||function(){return(new Date).getTime()},Wr=new Date,Vr={nextTick:Tr,title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:Ir,addListener:Nr,once:Dr,off:Br,removeListener:jr,removeAllListeners:Ur,emit:zr,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*qr.call(Fr),n=Math.floor(t),r=Math.floor(t%1*1e9);return e&&(n-=e[0],(r-=e[1])<0&&(n--,r+=1e9)),[n,r]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-Wr)/1e3}},Kr={exports:{}},Hr={exports:{}};!function(e,t){var n=yr,r=n.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}function o(e,t,n){return r(e,t,n)}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?e.exports=n:(i(n,t),t.Buffer=o),o.prototype=Object.create(r.prototype),i(r,o),o.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return r(e,t,n)},o.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=r(e);return void 0!==t?"string"==typeof n?i.fill(t,n):i.fill(t):i.fill(0),i},o.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}}(Hr,Hr.exports);var $r=Hr.exports,Yr=65536,Gr=$r.Buffer,Qr=hr.crypto||hr.msCrypto;Qr&&Qr.getRandomValues?Kr.exports=function(e,t){if(e>4294967295)throw new RangeError("requested too many random bytes");var n=Gr.allocUnsafe(e);if(e>0)if(e>Yr)for(var r=0;r<e;r+=Yr)Qr.getRandomValues(n.slice(r,r+Yr));else Qr.getRandomValues(n);return"function"==typeof t?Tr((function(){t(null,n)})):n}:Kr.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")};var Zr=Kr.exports,Xr={exports:{}};"function"==typeof Object.create?Xr.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Xr.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}};var Jr=Xr.exports,ei={exports:{}};function ti(){}function ni(){ni.init.call(this)}function ri(e){return void 0===e._maxListeners?ni.defaultMaxListeners:e._maxListeners}function ii(e,t,n,r){var i,o,a,s;if("function"!=typeof n)throw new TypeError('"listener" argument must be a function');if((o=e._events)?(o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),a=o[t]):(o=e._events=new ti,e._eventsCount=0),a){if("function"==typeof a?a=o[t]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),!a.warned&&(i=ri(e))&&i>0&&a.length>i){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=a.length,s=u,"function"==typeof console.warn?console.warn(s):console.log(s)}}else a=o[t]=n,++e._eventsCount;return e}function oi(e,t,n){var r=!1;function i(){e.removeListener(t,i),r||(r=!0,n.apply(e,arguments))}return i.listener=n,i}function ai(e){var t=this._events;if(t){var n=t[e];if("function"==typeof n)return 1;if(n)return n.length}return 0}function si(e,t){for(var n=new Array(t);t--;)n[t]=e[t];return n}ti.prototype=Object.create(null),ni.EventEmitter=ni,ni.usingDomains=!1,ni.prototype.domain=void 0,ni.prototype._events=void 0,ni.prototype._maxListeners=void 0,ni.defaultMaxListeners=10,ni.init=function(){this.domain=null,ni.usingDomains&&(void 0).active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new ti,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},ni.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},ni.prototype.getMaxListeners=function(){return ri(this)},ni.prototype.emit=function(e){var t,n,r,i,o,a,s,u="error"===e;if(a=this._events)u=u&&null==a.error;else if(!u)return!1;if(s=this.domain,u){if(t=arguments[1],!s){if(t instanceof Error)throw t;var l=new Error('Uncaught, unspecified "error" event. ('+t+")");throw l.context=t,l}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=s,t.domainThrown=!1,s.emit("error",t),!1}if(!(n=a[e]))return!1;var c="function"==typeof n;switch(r=arguments.length){case 1:!function(e,t,n){if(t)e.call(n);else for(var r=e.length,i=si(e,r),o=0;o<r;++o)i[o].call(n)}(n,c,this);break;case 2:!function(e,t,n,r){if(t)e.call(n,r);else for(var i=e.length,o=si(e,i),a=0;a<i;++a)o[a].call(n,r)}(n,c,this,arguments[1]);break;case 3:!function(e,t,n,r,i){if(t)e.call(n,r,i);else for(var o=e.length,a=si(e,o),s=0;s<o;++s)a[s].call(n,r,i)}(n,c,this,arguments[1],arguments[2]);break;case 4:!function(e,t,n,r,i,o){if(t)e.call(n,r,i,o);else for(var a=e.length,s=si(e,a),u=0;u<a;++u)s[u].call(n,r,i,o)}(n,c,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(r-1),o=1;o<r;o++)i[o-1]=arguments[o];!function(e,t,n,r){if(t)e.apply(n,r);else for(var i=e.length,o=si(e,i),a=0;a<i;++a)o[a].apply(n,r)}(n,c,this,i)}return!0},ni.prototype.addListener=function(e,t){return ii(this,e,t,!1)},ni.prototype.on=ni.prototype.addListener,ni.prototype.prependListener=function(e,t){return ii(this,e,t,!0)},ni.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,oi(this,e,t)),this},ni.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,oi(this,e,t)),this},ni.prototype.removeListener=function(e,t){var n,r,i,o,a;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(r=this._events))return this;if(!(n=r[e]))return this;if(n===t||n.listener&&n.listener===t)0==--this._eventsCount?this._events=new ti:(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,o=n.length;o-- >0;)if(n[o]===t||n[o].listener&&n[o].listener===t){a=n[o].listener,i=o;break}if(i<0)return this;if(1===n.length){if(n[0]=void 0,0==--this._eventsCount)return this._events=new ti,this;delete r[e]}else!function(e,t){for(var n=t,r=n+1,i=e.length;r<i;n+=1,r+=1)e[n]=e[r];e.pop()}(n,i);r.removeListener&&this.emit("removeListener",e,a||t)}return this},ni.prototype.removeAllListeners=function(e){var t,n;if(!(n=this._events))return this;if(!n.removeListener)return 0===arguments.length?(this._events=new ti,this._eventsCount=0):n[e]&&(0==--this._eventsCount?this._events=new ti:delete n[e]),this;if(0===arguments.length){for(var r,i=Object.keys(n),o=0;o<i.length;++o)"removeListener"!==(r=i[o])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=new ti,this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(t)do{this.removeListener(e,t[t.length-1])}while(t[0]);return this},ni.prototype.listeners=function(e){var t,n=this._events;return n&&(t=n[e])?"function"==typeof t?[t.listener||t]:function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(t):[]},ni.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):ai.call(e,t)},ni.prototype.listenerCount=ai,ni.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};var ui=pr(Object.freeze({__proto__:null,EventEmitter:ni,default:ni})),li=ui.EventEmitter,ci="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e},di=/%[sdj%]/g;function fi(e){if(!Ri(e)){for(var t=[],n=0;n<arguments.length;n++)t.push(yi(arguments[n]));return t.join(" ")}n=1;for(var r=arguments,i=r.length,o=String(e).replace(di,(function(e){if("%%"===e)return"%";if(n>=i)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}})),a=r[n];n<i;a=r[++n])Mi(a)||!Li(a)?o+=" "+a:o+=" "+yi(a);return o}function hi(e,t){if(Ti(hn.process))return function(){return hi(e,t).apply(this,arguments)};if(!0===Vr.noDeprecation)return e;var n=!1;return function(){if(!n){if(Vr.throwDeprecation)throw new Error(t);Vr.traceDeprecation?console.trace(t):console.error(t),n=!0}return e.apply(this,arguments)}}var pi,mi={};function gi(e){return Ti(pi)&&(pi=Vr.env.NODE_DEBUG||""),e=e.toUpperCase(),mi[e]||(new RegExp("\\b"+e+"\\b","i").test(pi)?mi[e]=function(){var t=fi.apply(null,arguments);console.error("%s %d: %s",e,0,t)}:mi[e]=function(){}),mi[e]}function yi(e,t){var n={seen:[],stylize:wi};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),ki(t)?n.showHidden=t:t&&Wi(n,t),Ti(n.showHidden)&&(n.showHidden=!1),Ti(n.depth)&&(n.depth=2),Ti(n.colors)&&(n.colors=!1),Ti(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=bi),Ai(n,e,n.depth)}function bi(e,t){var n=yi.styles[t];return n?"["+yi.colors[n][0]+"m"+e+"["+yi.colors[n][1]+"m":e}function wi(e,t){return e}function Ai(e,t,n){if(e.customInspect&&t&&Di(t.inspect)&&t.inspect!==yi&&(!t.constructor||t.constructor.prototype!==t)){var r=t.inspect(n,e);return Ri(r)||(r=Ai(e,r,n)),r}var i=function(e,t){if(Ti(t))return e.stylize("undefined","undefined");if(Ri(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return xi(t)?e.stylize(""+t,"number"):ki(t)?e.stylize(""+t,"boolean"):Mi(t)?e.stylize("null","null"):void 0}(e,t);if(i)return i;var o=Object.keys(t),a=function(e){var t={};return e.forEach((function(e,n){t[e]=!0})),t}(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(t)),Ni(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return _i(t);if(0===o.length){if(Di(t)){var s=t.name?": "+t.name:"";return e.stylize("[Function"+s+"]","special")}if(Pi(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(Ii(t))return e.stylize(Date.prototype.toString.call(t),"date");if(Ni(t))return _i(t)}var u,l="",c=!1,d=["{","}"];return Si(t)&&(c=!0,d=["[","]"]),Di(t)&&(l=" [Function"+(t.name?": "+t.name:"")+"]"),Pi(t)&&(l=" "+RegExp.prototype.toString.call(t)),Ii(t)&&(l=" "+Date.prototype.toUTCString.call(t)),Ni(t)&&(l=" "+_i(t)),0!==o.length||c&&0!=t.length?n<0?Pi(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),u=c?function(e,t,n,r,i){for(var o=[],a=0,s=t.length;a<s;++a)Vi(t,String(a))?o.push(Ei(e,t,n,r,String(a),!0)):o.push("");return i.forEach((function(i){i.match(/^\d+$/)||o.push(Ei(e,t,n,r,i,!0))})),o}(e,t,n,a,o):o.map((function(r){return Ei(e,t,n,a,r,c)})),e.seen.pop(),function(e,t,n){var r=e.reduce((function(e,t){return t.indexOf("\n"),e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0);return r>60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}(u,l,d)):d[0]+l+d[1]}function _i(e){return"["+Error.prototype.toString.call(e)+"]"}function Ei(e,t,n,r,i,o){var a,s,u;if((u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?s=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(s=e.stylize("[Setter]","special")),Vi(r,i)||(a="["+i+"]"),s||(e.seen.indexOf(u.value)<0?(s=Mi(n)?Ai(e,u.value,null):Ai(e,u.value,n-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+s.split("\n").map((function(e){return" "+e})).join("\n")):s=e.stylize("[Circular]","special")),Ti(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function Si(e){return Array.isArray(e)}function ki(e){return"boolean"==typeof e}function Mi(e){return null===e}function Ci(e){return null==e}function xi(e){return"number"==typeof e}function Ri(e){return"string"==typeof e}function Oi(e){return"symbol"==typeof e}function Ti(e){return void 0===e}function Pi(e){return Li(e)&&"[object RegExp]"===Ui(e)}function Li(e){return"object"==typeof e&&null!==e}function Ii(e){return Li(e)&&"[object Date]"===Ui(e)}function Ni(e){return Li(e)&&("[object Error]"===Ui(e)||e instanceof Error)}function Di(e){return"function"==typeof e}function Bi(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function ji(e){return dr(e)}function Ui(e){return Object.prototype.toString.call(e)}function zi(e){return e<10?"0"+e.toString(10):e.toString(10)}yi.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},yi.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};var Fi=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function qi(){var e,t;console.log("%s - %s",(t=[zi((e=new Date).getHours()),zi(e.getMinutes()),zi(e.getSeconds())].join(":"),[e.getDate(),Fi[e.getMonth()],t].join(" ")),fi.apply(null,arguments))}function Wi(e,t){if(!t||!Li(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}function Vi(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var Ki,Hi,$i={inherits:ci,_extend:Wi,log:qi,isBuffer:ji,isPrimitive:Bi,isFunction:Di,isError:Ni,isDate:Ii,isObject:Li,isRegExp:Pi,isUndefined:Ti,isSymbol:Oi,isString:Ri,isNumber:xi,isNullOrUndefined:Ci,isNull:Mi,isBoolean:ki,isArray:Si,inspect:yi,deprecate:hi,format:fi,debuglog:gi},Yi=pr(Object.freeze({__proto__:null,_extend:Wi,debuglog:gi,default:$i,deprecate:hi,format:fi,inherits:ci,inspect:yi,isArray:Si,isBoolean:ki,isBuffer:ji,isDate:Ii,isError:Ni,isFunction:Di,isNull:Mi,isNullOrUndefined:Ci,isNumber:xi,isObject:Li,isPrimitive:Bi,isRegExp:Pi,isString:Ri,isSymbol:Oi,isUndefined:Ti,log:qi}));function Gi(e,t){Zi(e,t),Qi(e)}function Qi(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function Zi(e,t){e.emit("error",t)}var Xi={destroy:function(e,t){var n=this,r=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return r||i?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,Tr(Zi,this,e)):Tr(Zi,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?n._writableState?n._writableState.errorEmitted?Tr(Qi,n):(n._writableState.errorEmitted=!0,Tr(Gi,n,e)):Tr(Gi,n,e):t?(Tr(Qi,n),t(e)):Tr(Qi,n)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var n=e._readableState,r=e._writableState;n&&n.autoDestroy||r&&r.autoDestroy?e.destroy(t):e.emit("error",t)}},Ji={},eo={};function to(e,t,n){n||(n=Error);var r=function(e){var n,r;function i(n,r,i){return e.call(this,function(e,n,r){return"string"==typeof t?t:t(e,n,r)}(n,r,i))||this}return r=e,(n=i).prototype=Object.create(r.prototype),n.prototype.constructor=n,n.__proto__=r,i}(n);r.prototype.name=n.name,r.prototype.code=e,eo[e]=r}function no(e,t){if(Array.isArray(e)){var n=e.length;return e=e.map((function(e){return String(e)})),n>2?"one of ".concat(t," ").concat(e.slice(0,n-1).join(", "),", or ")+e[n-1]:2===n?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}to("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),to("ERR_INVALID_ARG_TYPE",(function(e,t,n){var r,i,o;if("string"==typeof t&&(i="not ",t.substr(0,4)===i)?(r="must not be",t=t.replace(/^not /,"")):r="must be",function(e,t,n){return(void 0===n||n>e.length)&&(n=e.length),e.substring(n-9,n)===t}(e," argument"))o="The ".concat(e," ").concat(r," ").concat(no(t,"type"));else{var a=function(e,t,n){return"number"!=typeof n&&(n=0),!(n+1>e.length)&&-1!==e.indexOf(".",n)}(e)?"property":"argument";o='The "'.concat(e,'" ').concat(a," ").concat(r," ").concat(no(t,"type"))}return o+". Received type ".concat(typeof n)}),TypeError),to("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),to("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),to("ERR_STREAM_PREMATURE_CLOSE","Premature close"),to("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),to("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),to("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),to("ERR_STREAM_WRITE_AFTER_END","write after end"),to("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),to("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),to("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),Ji.codes=eo;var ro,io,oo,ao,so,uo,lo=Ji.codes.ERR_INVALID_OPT_VALUE,co={getHighWaterMark:function(e,t,n,r){var i=function(e,t,n){return null!=e.highWaterMark?e.highWaterMark:t?e[n]:null}(t,r,n);if(null!=i){if(!isFinite(i)||Math.floor(i)!==i||i<0)throw new lo(r?n:"highWaterMark",i);return Math.floor(i)}return e.objectMode?16:16384}};function fo(){if(io)return ro;function e(e){try{if(!hr.localStorage)return!1}catch(e){return!1}var t=hr.localStorage[e];return null!=t&&"true"===String(t).toLowerCase()}return io=1,ro=function(t,n){if(e("noDeprecation"))return t;var r=!1;return function(){if(!r){if(e("throwDeprecation"))throw new Error(n);e("traceDeprecation")?console.trace(n):console.warn(n),r=!0}return t.apply(this,arguments)}},ro}function ho(){if(ao)return oo;function e(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,n){var r=e.entry;for(e.entry=null;r;){var i=r.callback;t.pendingcb--,i(void 0),r=r.next}t.corkedRequestsFree.next=e}(t,e)}}var t;ao=1,oo=A,A.WritableState=w;var n,r={deprecate:fo()},i=li,o=yr.Buffer,a=(void 0!==hr?hr:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},s=Xi,u=co.getHighWaterMark,l=Ji.codes,c=l.ERR_INVALID_ARG_TYPE,d=l.ERR_METHOD_NOT_IMPLEMENTED,f=l.ERR_MULTIPLE_CALLBACK,h=l.ERR_STREAM_CANNOT_PIPE,p=l.ERR_STREAM_DESTROYED,m=l.ERR_STREAM_NULL_VALUES,g=l.ERR_STREAM_WRITE_AFTER_END,v=l.ERR_UNKNOWN_ENCODING,y=s.errorOrDestroy;function b(){}function w(n,r,i){t=t||po(),n=n||{},"boolean"!=typeof i&&(i=r instanceof t),this.objectMode=!!n.objectMode,i&&(this.objectMode=this.objectMode||!!n.writableObjectMode),this.highWaterMark=u(this,n,"writableHighWaterMark",i),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var o=!1===n.decodeStrings;this.decodeStrings=!o,this.defaultEncoding=n.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,i=n.writecb;if("function"!=typeof i)throw new f;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,i){--t.pendingcb,n?(Tr(i,r),Tr(C,e,t),e._writableState.errorEmitted=!0,y(e,r)):(i(r),e._writableState.errorEmitted=!0,y(e,r),C(e,t))}(e,n,r,t,i);else{var o=k(n)||e.destroyed;o||n.corked||n.bufferProcessing||!n.bufferedRequest||S(e,n),r?Tr(E,e,n,o,i):E(e,n,o,i)}}(r,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==n.emitClose,this.autoDestroy=!!n.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}function A(e){var r=this instanceof(t=t||po());if(!r&&!n.call(A,this))return new A(e);this._writableState=new w(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)),i.call(this)}function _(e,t,n,r,i,o,a){t.writelen=r,t.writecb=a,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new p("write")):n?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function E(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),C(e,t)}function S(t,n){n.bufferProcessing=!0;var r=n.bufferedRequest;if(t._writev&&r&&r.next){var i=n.bufferedRequestCount,o=new Array(i),a=n.corkedRequestsFree;a.entry=r;for(var s=0,u=!0;r;)o[s]=r,r.isBuf||(u=!1),r=r.next,s+=1;o.allBuffers=u,_(t,n,!0,n.length,o,"",a.finish),n.pendingcb++,n.lastBufferedRequest=null,a.next?(n.corkedRequestsFree=a.next,a.next=null):n.corkedRequestsFree=new e(n),n.bufferedRequestCount=0}else{for(;r;){var l=r.chunk,c=r.encoding,d=r.callback;if(_(t,n,!1,n.objectMode?1:l.length,l,c,d),r=r.next,n.bufferedRequestCount--,n.writing)break}null===r&&(n.lastBufferedRequest=null)}n.bufferedRequest=r,n.bufferProcessing=!1}function k(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function M(e,t){e._final((function(n){t.pendingcb--,n&&y(e,n),t.prefinished=!0,e.emit("prefinish"),C(e,t)}))}function C(e,t){var n=k(t);if(n&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,Tr(M,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var r=e._readableState;(!r||r.autoDestroy&&r.endEmitted)&&e.destroy()}return n}return Jr(A,i),w.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(w.prototype,"buffer",{get:r.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(n=Function.prototype[Symbol.hasInstance],Object.defineProperty(A,Symbol.hasInstance,{value:function(e){return!!n.call(this,e)||this===A&&e&&e._writableState instanceof w}})):n=function(e){return e instanceof this},A.prototype.pipe=function(){y(this,new h)},A.prototype.write=function(e,t,n){var r,i=this._writableState,s=!1,u=!i.objectMode&&(r=e,o.isBuffer(r)||r instanceof a);return u&&!o.isBuffer(e)&&(e=function(e){return o.from(e)}(e)),"function"==typeof t&&(n=t,t=null),u?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof n&&(n=b),i.ending?function(e,t){var n=new g;y(e,n),Tr(t,n)}(this,n):(u||function(e,t,n,r){var i;return null===n?i=new m:"string"==typeof n||t.objectMode||(i=new c("chunk",["string","Buffer"],n)),!i||(y(e,i),Tr(r,i),!1)}(this,i,e,n))&&(i.pendingcb++,s=function(e,t,n,r,i,a){if(!n){var s=function(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=o.from(t,n)),t}(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var u=t.objectMode?1:r.length;t.length+=u;var l=t.length<t.highWaterMark;if(l||(t.needDrain=!0),t.writing||t.corked){var c=t.lastBufferedRequest;t.lastBufferedRequest={chunk:r,encoding:i,isBuf:n,callback:a,next:null},c?c.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else _(e,t,!1,u,r,i,a);return l}(this,i,u,e,t,n)),s},A.prototype.cork=function(){this._writableState.corked++},A.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||S(this,e))},A.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 v(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(A.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(A.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),A.prototype._write=function(e,t,n){n(new d("_write()"))},A.prototype._writev=null,A.prototype.end=function(e,t,n){var r=this._writableState;return"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||function(e,t,n){t.ending=!0,C(e,t),n&&(t.finished?Tr(n):e.once("finish",n)),t.ended=!0,e.writable=!1}(this,r,n),this},Object.defineProperty(A.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(A.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),A.prototype.destroy=s.destroy,A.prototype._undestroy=s.undestroy,A.prototype._destroy=function(e,t){t(e)},oo}function po(){if(uo)return so;uo=1;var e=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};so=a;var t=Co(),n=ho();Jr(a,t);for(var r=e(n.prototype),i=0;i<r.length;i++){var o=r[i];a.prototype[o]||(a.prototype[o]=n.prototype[o])}function a(e){if(!(this instanceof a))return new a(e);t.call(this,e),n.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",s)))}function s(){this._writableState.ended||Tr(u,this)}function u(e){e.end()}return Object.defineProperty(a.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(a.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(a.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(a.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._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)}}),so}var mo,go={};function vo(){if(mo)return go;mo=1;var e=$r.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 n(n){var r;switch(this.encoding=function(n){var r=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}}(n);if("string"!=typeof r&&(e.isEncoding===t||!t(n)))throw new Error("Unknown encoding: "+n);return r||n}(n),this.encoding){case"utf16le":this.text=o,this.end=a,r=4;break;case"utf8":this.fillLast=i,r=4;break;case"base64":this.text=s,this.end=u,r=3;break;default:return this.write=l,void(this.end=c)}this.lastNeed=0,this.lastTotal=0,this.lastChar=e.allocUnsafe(r)}function r(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,n=function(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function o(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function a(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function s(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function u(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 c(e){return e&&e.length?this.write(e):""}return go.StringDecoder=n,n.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||""},n.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},n.prototype.text=function(e,t){var n=function(e,t,n){var i=t.length-1;if(i<n)return 0;var o=r(t[i]);return o>=0?(o>0&&(e.lastNeed=o-1),o):--i<n||-2===o?0:(o=r(t[i]))>=0?(o>0&&(e.lastNeed=o-2),o):--i<n||-2===o?0:(o=r(t[i]))>=0?(o>0&&(2===o?o=0:e.lastNeed=o-3),o):0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var i=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,i),e.toString("utf8",t,i)},n.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length},go}var yo=Ji.codes.ERR_STREAM_PREMATURE_CLOSE;function bo(){}var wo,Ao,_o,Eo,So,ko,Mo=function e(t,n,r){if("function"==typeof n)return e(t,null,n);n||(n={}),r=function(e){var t=!1;return function(){if(!t){t=!0;for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];e.apply(this,r)}}}(r||bo);var i=n.readable||!1!==n.readable&&t.readable,o=n.writable||!1!==n.writable&&t.writable,a=function(){t.writable||u()},s=t._writableState&&t._writableState.finished,u=function(){o=!1,s=!0,i||r.call(t)},l=t._readableState&&t._readableState.endEmitted,c=function(){i=!1,l=!0,o||r.call(t)},d=function(e){r.call(t,e)},f=function(){var e;return i&&!l?(t._readableState&&t._readableState.ended||(e=new yo),r.call(t,e)):o&&!s?(t._writableState&&t._writableState.ended||(e=new yo),r.call(t,e)):void 0},h=function(){t.req.on("finish",u)};return function(e){return e.setHeader&&"function"==typeof e.abort}(t)?(t.on("complete",u),t.on("abort",f),t.req?h():t.on("request",h)):o&&!t._writableState&&(t.on("end",a),t.on("close",a)),t.on("end",c),t.on("finish",u),!1!==n.error&&t.on("error",d),t.on("close",f),function(){t.removeListener("complete",u),t.removeListener("abort",f),t.removeListener("request",h),t.req&&t.req.removeListener("finish",u),t.removeListener("end",a),t.removeListener("close",a),t.removeListener("finish",u),t.removeListener("end",c),t.removeListener("error",d),t.removeListener("close",f)}};function Co(){if(ko)return So;var e;ko=1,So=A,A.ReadableState=w,ui.EventEmitter;var t,n=function(e,t){return e.listeners(t).length},r=li,i=yr.Buffer,o=(void 0!==hr?hr:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},a=Yi;t=a&&a.debuglog?a.debuglog("stream"):function(){};var s,u,l,c=function(){if(Hi)return Ki;function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function t(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?e(Object(i),!0).forEach((function(e){n(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 n(e,t,n){return(t=i(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,i(r.key),r)}}function i(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}Hi=1;var o=yr.Buffer,a=Yi.inspect,s=a&&a.custom||"inspect";return Ki=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 n,i;return n=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,n=""+t.data;t=t.next;)n+=e+t.data;return n}},{key:"concat",value:function(e){if(0===this.length)return o.alloc(0);for(var t,n,r,i=o.allocUnsafe(e>>>0),a=this.head,s=0;a;)t=a.data,n=i,r=s,o.prototype.copy.call(t,n,r),s+=a.data.length,a=a.next;return i}},{key:"consume",value:function(e,t){var n;return e<this.head.data.length?(n=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):n=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),n}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,n=1,r=t.data;for(e-=r.length;t=t.next;){var i=t.data,o=e>i.length?i.length:e;if(o===i.length?r+=i:r+=i.slice(0,e),0==(e-=o)){o===i.length?(++n,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(e){var t=o.allocUnsafe(e),n=this.head,r=1;for(n.data.copy(t),e-=n.data.length;n=n.next;){var i=n.data,a=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,a),0==(e-=a)){a===i.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=i.slice(a));break}++r}return this.length-=r,t}},{key:s,value:function(e,n){return a(this,t(t({},n),{},{depth:0,customInspect:!1}))}}],i&&r(n.prototype,i),Object.defineProperty(n,"prototype",{writable:!1}),e}(),Ki}(),d=Xi,f=co.getHighWaterMark,h=Ji.codes,p=h.ERR_INVALID_ARG_TYPE,m=h.ERR_STREAM_PUSH_AFTER_EOF,g=h.ERR_METHOD_NOT_IMPLEMENTED,v=h.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;Jr(A,r);var y=d.errorOrDestroy,b=["error","close","destroy","pause","resume"];function w(t,n,r){e=e||po(),t=t||{},"boolean"!=typeof r&&(r=n instanceof e),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=f(this,t,"readableHighWaterMark",r),this.buffer=new c,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&&(s||(s=vo().StringDecoder),this.decoder=new s(t.encoding),this.encoding=t.encoding)}function A(t){if(e=e||po(),!(this instanceof A))return new A(t);var n=this instanceof e;this._readableState=new w(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 _(e,n,r,a,s){t("readableAddChunk",n);var u,l=e._readableState;if(null===n)l.reading=!1,function(e,n){if(t("onEofChunk"),!n.ended){if(n.decoder){var r=n.decoder.end();r&&r.length&&(n.buffer.push(r),n.length+=n.objectMode?1:r.length)}n.ended=!0,n.sync?M(e):(n.needReadable=!1,n.emittedReadable||(n.emittedReadable=!0,C(e)))}}(e,l);else if(s||(u=function(e,t){var n,r;return r=t,i.isBuffer(r)||r instanceof o||"string"==typeof t||void 0===t||e.objectMode||(n=new p("chunk",["string","Buffer","Uint8Array"],t)),n}(l,n)),u)y(e,u);else if(l.objectMode||n&&n.length>0)if("string"==typeof n||l.objectMode||Object.getPrototypeOf(n)===i.prototype||(n=function(e){return i.from(e)}(n)),a)l.endEmitted?y(e,new v):E(e,l,n,!0);else if(l.ended)y(e,new m);else{if(l.destroyed)return!1;l.reading=!1,l.decoder&&!r?(n=l.decoder.write(n),l.objectMode||0!==n.length?E(e,l,n,!1):x(e,l)):E(e,l,n,!1)}else a||(l.reading=!1,x(e,l));return!l.ended&&(l.length<l.highWaterMark||0===l.length)}function E(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",n)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&M(e)),x(e,t)}Object.defineProperty(A.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),A.prototype.destroy=d.destroy,A.prototype._undestroy=d.undestroy,A.prototype._destroy=function(e,t){t(e)},A.prototype.push=function(e,t){var n,r=this._readableState;return r.objectMode?n=!0:"string"==typeof e&&((t=t||r.defaultEncoding)!==r.encoding&&(e=i.from(e,t),t=""),n=!0),_(this,e,t,!1,n)},A.prototype.unshift=function(e){return _(this,e,null,!0,!1)},A.prototype.isPaused=function(){return!1===this._readableState.flowing},A.prototype.setEncoding=function(e){s||(s=vo().StringDecoder);var t=new s(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,r="";null!==n;)r+=t.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==r&&this._readableState.buffer.push(r),this._readableState.length=r.length,this};var S=1073741824;function k(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>=S?e=S:(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 M(e){var n=e._readableState;t("emitReadable",n.needReadable,n.emittedReadable),n.needReadable=!1,n.emittedReadable||(t("emitReadable",n.flowing),n.emittedReadable=!0,Tr(C,e))}function C(e){var n=e._readableState;t("emitReadable_",n.destroyed,n.length,n.ended),n.destroyed||!n.length&&!n.ended||(e.emit("readable"),n.emittedReadable=!1),n.needReadable=!n.flowing&&!n.ended&&n.length<=n.highWaterMark,L(e)}function x(e,t){t.readingMore||(t.readingMore=!0,Tr(R,e,t))}function R(e,n){for(;!n.reading&&!n.ended&&(n.length<n.highWaterMark||n.flowing&&0===n.length);){var r=n.length;if(t("maybeReadMore read 0"),e.read(0),r===n.length)break}n.readingMore=!1}function O(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 T(e){t("readable nexttick read 0"),e.read(0)}function P(e,n){t("resume",n.reading),n.reading||e.read(0),n.resumeScheduled=!1,e.emit("resume"),L(e),n.flowing&&!n.reading&&e.read(0)}function L(e){var n=e._readableState;for(t("flow",n.flowing);n.flowing&&null!==e.read(););}function I(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n);var n}function N(e){var n=e._readableState;t("endReadable",n.endEmitted),n.endEmitted||(n.ended=!0,Tr(D,n,e))}function D(e,n){if(t("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,n.readable=!1,n.emit("end"),e.autoDestroy)){var r=n._writableState;(!r||r.autoDestroy&&r.finished)&&n.destroy()}}function B(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}return A.prototype.read=function(e){t("read",e),e=parseInt(e,10);var n=this._readableState,r=e;if(0!==e&&(n.emittedReadable=!1),0===e&&n.needReadable&&((0!==n.highWaterMark?n.length>=n.highWaterMark:n.length>0)||n.ended))return t("read: emitReadable",n.length,n.ended),0===n.length&&n.ended?N(this):M(this),null;if(0===(e=k(e,n))&&n.ended)return 0===n.length&&N(this),null;var i,o=n.needReadable;return t("need readable",o),(0===n.length||n.length-e<n.highWaterMark)&&t("length less than watermark",o=!0),n.ended||n.reading?t("reading or ended",o=!1):o&&(t("do read"),n.reading=!0,n.sync=!0,0===n.length&&(n.needReadable=!0),this._read(n.highWaterMark),n.sync=!1,n.reading||(e=k(r,n))),null===(i=e>0?I(e,n):null)?(n.needReadable=n.length<=n.highWaterMark,e=0):(n.length-=e,n.awaitDrain=0),0===n.length&&(n.ended||(n.needReadable=!0),r!==e&&n.ended&&N(this)),null!==i&&this.emit("data",i),i},A.prototype._read=function(e){y(this,new g("_read()"))},A.prototype.pipe=function(e,r){var i=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,t("pipe count=%d opts=%j",o.pipesCount,r);var a=r&&!1===r.end||e===Vr.stdout||e===Vr.stderr?p:s;function s(){t("onend"),e.end()}o.endEmitted?Tr(a):i.once("end",a),e.on("unpipe",(function n(r,a){t("onunpipe"),r===i&&a&&!1===a.hasUnpiped&&(a.hasUnpiped=!0,t("cleanup"),e.removeListener("close",f),e.removeListener("finish",h),e.removeListener("drain",u),e.removeListener("error",d),e.removeListener("unpipe",n),i.removeListener("end",s),i.removeListener("end",p),i.removeListener("data",c),l=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||u())}));var u=function(e){return function(){var r=e._readableState;t("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,0===r.awaitDrain&&n(e,"data")&&(r.flowing=!0,L(e))}}(i);e.on("drain",u);var l=!1;function c(n){t("ondata");var r=e.write(n);t("dest.write",r),!1===r&&((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==B(o.pipes,e))&&!l&&(t("false write response, pause",o.awaitDrain),o.awaitDrain++),i.pause())}function d(r){t("onerror",r),p(),e.removeListener("error",d),0===n(e,"error")&&y(e,r)}function f(){e.removeListener("finish",h),p()}function h(){t("onfinish"),e.removeListener("close",f),p()}function p(){t("unpipe"),i.unpipe(e)}return i.on("data",c),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",d),e.once("close",f),e.once("finish",h),e.emit("pipe",i),o.flowing||(t("pipe resume"),i.resume()),e},A.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n)),this;if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<i;o++)r[o].emit("unpipe",this,{hasUnpiped:!1});return this}var a=B(t.pipes,e);return-1===a||(t.pipes.splice(a,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,n)),this},A.prototype.on=function(e,n){var i=r.prototype.on.call(this,e,n),o=this._readableState;return"data"===e?(o.readableListening=this.listenerCount("readable")>0,!1!==o.flowing&&this.resume()):"readable"===e&&(o.endEmitted||o.readableListening||(o.readableListening=o.needReadable=!0,o.flowing=!1,o.emittedReadable=!1,t("on readable",o.length,o.reading),o.length?M(this):o.reading||Tr(T,this))),i},A.prototype.addListener=A.prototype.on,A.prototype.removeListener=function(e,t){var n=r.prototype.removeListener.call(this,e,t);return"readable"===e&&Tr(O,this),n},A.prototype.removeAllListeners=function(e){var t=r.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||Tr(O,this),t},A.prototype.resume=function(){var e=this._readableState;return e.flowing||(t("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,Tr(P,e,t))}(this,e)),e.paused=!1,this},A.prototype.pause=function(){return t("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(t("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},A.prototype.wrap=function(e){var n=this,r=this._readableState,i=!1;for(var o in e.on("end",(function(){if(t("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&n.push(e)}n.push(null)})),e.on("data",(function(o){t("wrapped data"),r.decoder&&(o=r.decoder.write(o)),r.objectMode&&null==o||(r.objectMode||o&&o.length)&&(n.push(o)||(i=!0,e.pause()))})),e)void 0===this[o]&&"function"==typeof e[o]&&(this[o]=function(t){return function(){return e[t].apply(e,arguments)}}(o));for(var a=0;a<b.length;a++)e.on(b[a],this.emit.bind(this,b[a]));return this._read=function(n){t("wrapped _read",n),i&&(i=!1,e.resume())},this},"function"==typeof Symbol&&(A.prototype[Symbol.asyncIterator]=function(){return void 0===u&&(u=function(){if(Ao)return wo;var e;function t(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Ao=1;var n=Mo,r=Symbol("lastResolve"),i=Symbol("lastReject"),o=Symbol("error"),a=Symbol("ended"),s=Symbol("lastPromise"),u=Symbol("handlePromise"),l=Symbol("stream");function c(e,t){return{value:e,done:t}}function d(e){var t=e[r];if(null!==t){var n=e[l].read();null!==n&&(e[s]=null,e[r]=null,e[i]=null,t(c(n,!1)))}}function f(e){Tr(d,e)}var h=Object.getPrototypeOf((function(){})),p=Object.setPrototypeOf((t(e={get stream(){return this[l]},next:function(){var e=this,t=this[o];if(null!==t)return Promise.reject(t);if(this[a])return Promise.resolve(c(void 0,!0));if(this[l].destroyed)return new Promise((function(t,n){Tr((function(){e[o]?n(e[o]):t(c(void 0,!0))}))}));var n,r=this[s];if(r)n=new Promise(function(e,t){return function(n,r){e.then((function(){t[a]?n(c(void 0,!0)):t[u](n,r)}),r)}}(r,this));else{var i=this[l].read();if(null!==i)return Promise.resolve(c(i,!1));n=new Promise(this[u])}return this[s]=n,n}},Symbol.asyncIterator,(function(){return this})),t(e,"return",(function(){var e=this;return new Promise((function(t,n){e[l].destroy(null,(function(e){e?n(e):t(c(void 0,!0))}))}))})),e),h);return wo=function(e){var d,h=Object.create(p,(t(d={},l,{value:e,writable:!0}),t(d,r,{value:null,writable:!0}),t(d,i,{value:null,writable:!0}),t(d,o,{value:null,writable:!0}),t(d,a,{value:e._readableState.endEmitted,writable:!0}),t(d,u,{value:function(e,t){var n=h[l].read();n?(h[s]=null,h[r]=null,h[i]=null,e(c(n,!1))):(h[r]=e,h[i]=t)},writable:!0}),d));return h[s]=null,n(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=h[i];return null!==t&&(h[s]=null,h[r]=null,h[i]=null,t(e)),void(h[o]=e)}var n=h[r];null!==n&&(h[s]=null,h[r]=null,h[i]=null,n(c(void 0,!0))),h[a]=!0})),e.on("readable",f.bind(null,h)),h},wo}()),u(this)}),Object.defineProperty(A.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(A.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(A.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),A._fromList=I,Object.defineProperty(A.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(A.from=function(e,t){return void 0===l&&(l=Eo?_o:(Eo=1,_o=function(){throw new Error("Readable.from is not available in the browser")})),l(A,e,t)}),So}var xo=Do,Ro=Ji.codes,Oo=Ro.ERR_METHOD_NOT_IMPLEMENTED,To=Ro.ERR_MULTIPLE_CALLBACK,Po=Ro.ERR_TRANSFORM_ALREADY_TRANSFORMING,Lo=Ro.ERR_TRANSFORM_WITH_LENGTH_0,Io=po();function No(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(null===r)return this.emit("error",new To);n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function Do(e){if(!(this instanceof Do))return new Do(e);Io.call(this,e),this._transformState={afterTransform:No.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",Bo)}function Bo(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?jo(this,null,null):this._flush((function(t,n){jo(e,t,n)}))}function jo(e,t,n){if(t)return e.emit("error",t);if(null!=n&&e.push(n),e._writableState.length)throw new Lo;if(e._transformState.transforming)throw new Po;return e.push(null)}Jr(Do,Io),Do.prototype.push=function(e,t){return this._transformState.needTransform=!1,Io.prototype.push.call(this,e,t)},Do.prototype._transform=function(e,t,n){n(new Oo("_transform()"))},Do.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},Do.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))},Do.prototype._destroy=function(e,t){Io.prototype._destroy.call(this,e,(function(e){t(e)}))};var Uo,zo=qo,Fo=xo;function qo(e){if(!(this instanceof qo))return new qo(e);Fo.call(this,e)}Jr(qo,Fo),qo.prototype._transform=function(e,t,n){n(null,e)};var Wo=Ji.codes,Vo=Wo.ERR_MISSING_ARGS,Ko=Wo.ERR_STREAM_DESTROYED;function Ho(e){if(e)throw e}function $o(e){e()}function Yo(e,t){return e.pipe(t)}var Go,Qo=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r,i=function(e){return e.length?"function"!=typeof e[e.length-1]?Ho:e.pop():Ho}(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new Vo("streams");var o=t.map((function(e,n){var a=n<t.length-1;return function(e,t,n,r){r=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(r);var i=!1;e.on("close",(function(){i=!0})),void 0===Uo&&(Uo=Mo),Uo(e,{readable:t,writable:n},(function(e){if(e)return r(e);i=!0,r()}));var o=!1;return function(t){if(!i&&!o)return o=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void r(t||new Ko("pipe"))}}(e,a,n>0,(function(e){r||(r=e),e&&o.forEach($o),a||(o.forEach($o),i(r))}))}));return t.reduce(Yo)};Go=ei.exports,(Go=ei.exports=Co()).Stream=Go,Go.Readable=Go,Go.Writable=ho(),Go.Duplex=po(),Go.Transform=xo,Go.PassThrough=zo,Go.finished=Mo,Go.pipeline=Qo;var Zo=ei.exports,Xo=$r.Buffer,Jo=Zo.Transform;function ea(e){Jo.call(this),this._block=Xo.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}Jr(ea,Jo),ea.prototype._transform=function(e,t,n){var r=null;try{this.update(e,t)}catch(e){r=e}n(r)},ea.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)},ea.prototype.update=function(e,t){if(function(e,t){if(!Xo.isBuffer(e)&&"string"!=typeof e)throw new TypeError("Data must be a string or a buffer")}(e),this._finalized)throw new Error("Digest already called");Xo.isBuffer(e)||(e=Xo.from(e,t));for(var n=this._block,r=0;this._blockOffset+e.length-r>=this._blockSize;){for(var i=this._blockOffset;i<this._blockSize;)n[i++]=e[r++];this._update(),this._blockOffset=0}for(;r<e.length;)n[this._blockOffset++]=e[r++];for(var o=0,a=8*e.length;a>0;++o)this._length[o]+=a,(a=this._length[o]/4294967296|0)>0&&(this._length[o]-=4294967296*a);return this},ea.prototype._update=function(){throw new Error("_update is not implemented")},ea.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();void 0!==e&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var n=0;n<4;++n)this._length[n]=0;return t},ea.prototype._digest=function(){throw new Error("_digest is not implemented")};var ta=ea,na=Jr,ra=ta,ia=$r.Buffer,oa=new Array(16);function aa(){ra.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function sa(e,t){return e<<t|e>>>32-t}function ua(e,t,n,r,i,o,a){return sa(e+(t&n|~t&r)+i+o|0,a)+t|0}function la(e,t,n,r,i,o,a){return sa(e+(t&r|n&~r)+i+o|0,a)+t|0}function ca(e,t,n,r,i,o,a){return sa(e+(t^n^r)+i+o|0,a)+t|0}function da(e,t,n,r,i,o,a){return sa(e+(n^(t|~r))+i+o|0,a)+t|0}na(aa,ra),aa.prototype._update=function(){for(var e=oa,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var n=this._a,r=this._b,i=this._c,o=this._d;n=ua(n,r,i,o,e[0],3614090360,7),o=ua(o,n,r,i,e[1],3905402710,12),i=ua(i,o,n,r,e[2],606105819,17),r=ua(r,i,o,n,e[3],3250441966,22),n=ua(n,r,i,o,e[4],4118548399,7),o=ua(o,n,r,i,e[5],1200080426,12),i=ua(i,o,n,r,e[6],2821735955,17),r=ua(r,i,o,n,e[7],4249261313,22),n=ua(n,r,i,o,e[8],1770035416,7),o=ua(o,n,r,i,e[9],2336552879,12),i=ua(i,o,n,r,e[10],4294925233,17),r=ua(r,i,o,n,e[11],2304563134,22),n=ua(n,r,i,o,e[12],1804603682,7),o=ua(o,n,r,i,e[13],4254626195,12),i=ua(i,o,n,r,e[14],2792965006,17),n=la(n,r=ua(r,i,o,n,e[15],1236535329,22),i,o,e[1],4129170786,5),o=la(o,n,r,i,e[6],3225465664,9),i=la(i,o,n,r,e[11],643717713,14),r=la(r,i,o,n,e[0],3921069994,20),n=la(n,r,i,o,e[5],3593408605,5),o=la(o,n,r,i,e[10],38016083,9),i=la(i,o,n,r,e[15],3634488961,14),r=la(r,i,o,n,e[4],3889429448,20),n=la(n,r,i,o,e[9],568446438,5),o=la(o,n,r,i,e[14],3275163606,9),i=la(i,o,n,r,e[3],4107603335,14),r=la(r,i,o,n,e[8],1163531501,20),n=la(n,r,i,o,e[13],2850285829,5),o=la(o,n,r,i,e[2],4243563512,9),i=la(i,o,n,r,e[7],1735328473,14),n=ca(n,r=la(r,i,o,n,e[12],2368359562,20),i,o,e[5],4294588738,4),o=ca(o,n,r,i,e[8],2272392833,11),i=ca(i,o,n,r,e[11],1839030562,16),r=ca(r,i,o,n,e[14],4259657740,23),n=ca(n,r,i,o,e[1],2763975236,4),o=ca(o,n,r,i,e[4],1272893353,11),i=ca(i,o,n,r,e[7],4139469664,16),r=ca(r,i,o,n,e[10],3200236656,23),n=ca(n,r,i,o,e[13],681279174,4),o=ca(o,n,r,i,e[0],3936430074,11),i=ca(i,o,n,r,e[3],3572445317,16),r=ca(r,i,o,n,e[6],76029189,23),n=ca(n,r,i,o,e[9],3654602809,4),o=ca(o,n,r,i,e[12],3873151461,11),i=ca(i,o,n,r,e[15],530742520,16),n=da(n,r=ca(r,i,o,n,e[2],3299628645,23),i,o,e[0],4096336452,6),o=da(o,n,r,i,e[7],1126891415,10),i=da(i,o,n,r,e[14],2878612391,15),r=da(r,i,o,n,e[5],4237533241,21),n=da(n,r,i,o,e[12],1700485571,6),o=da(o,n,r,i,e[3],2399980690,10),i=da(i,o,n,r,e[10],4293915773,15),r=da(r,i,o,n,e[1],2240044497,21),n=da(n,r,i,o,e[8],1873313359,6),o=da(o,n,r,i,e[15],4264355552,10),i=da(i,o,n,r,e[6],2734768916,15),r=da(r,i,o,n,e[13],1309151649,21),n=da(n,r,i,o,e[4],4149444226,6),o=da(o,n,r,i,e[11],3174756917,10),i=da(i,o,n,r,e[2],718787259,15),r=da(r,i,o,n,e[9],3951481745,21),this._a=this._a+n|0,this._b=this._b+r|0,this._c=this._c+i|0,this._d=this._d+o|0},aa.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=ia.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e};var fa=aa,ha=yr.Buffer,pa=Jr,ma=ta,ga=new Array(16),va=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],ya=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],ba=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],wa=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],Aa=[0,1518500249,1859775393,2400959708,2840853838],_a=[1352829926,1548603684,1836072691,2053994217,0];function Ea(){ma.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function Sa(e,t){return e<<t|e>>>32-t}function ka(e,t,n,r,i,o,a,s){return Sa(e+(t^n^r)+o+a|0,s)+i|0}function Ma(e,t,n,r,i,o,a,s){return Sa(e+(t&n|~t&r)+o+a|0,s)+i|0}function Ca(e,t,n,r,i,o,a,s){return Sa(e+((t|~n)^r)+o+a|0,s)+i|0}function xa(e,t,n,r,i,o,a,s){return Sa(e+(t&r|n&~r)+o+a|0,s)+i|0}function Ra(e,t,n,r,i,o,a,s){return Sa(e+(t^(n|~r))+o+a|0,s)+i|0}pa(Ea,ma),Ea.prototype._update=function(){for(var e=ga,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);for(var n=0|this._a,r=0|this._b,i=0|this._c,o=0|this._d,a=0|this._e,s=0|this._a,u=0|this._b,l=0|this._c,c=0|this._d,d=0|this._e,f=0;f<80;f+=1){var h,p;f<16?(h=ka(n,r,i,o,a,e[va[f]],Aa[0],ba[f]),p=Ra(s,u,l,c,d,e[ya[f]],_a[0],wa[f])):f<32?(h=Ma(n,r,i,o,a,e[va[f]],Aa[1],ba[f]),p=xa(s,u,l,c,d,e[ya[f]],_a[1],wa[f])):f<48?(h=Ca(n,r,i,o,a,e[va[f]],Aa[2],ba[f]),p=Ca(s,u,l,c,d,e[ya[f]],_a[2],wa[f])):f<64?(h=xa(n,r,i,o,a,e[va[f]],Aa[3],ba[f]),p=Ma(s,u,l,c,d,e[ya[f]],_a[3],wa[f])):(h=Ra(n,r,i,o,a,e[va[f]],Aa[4],ba[f]),p=ka(s,u,l,c,d,e[ya[f]],_a[4],wa[f])),n=a,a=o,o=Sa(i,10),i=r,r=h,s=d,d=c,c=Sa(l,10),l=u,u=p}var m=this._b+i+c|0;this._b=this._c+o+d|0,this._c=this._d+a+s|0,this._d=this._e+n+u|0,this._e=this._a+r+l|0,this._a=m},Ea.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=ha.alloc?ha.alloc(20):new ha(20);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e.writeInt32LE(this._e,16),e};var Oa=Ea,Ta={exports:{}},Pa=$r.Buffer;function La(e,t){this._block=Pa.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}La.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=Pa.from(e,t));for(var n=this._block,r=this._blockSize,i=e.length,o=this._len,a=0;a<i;){for(var s=o%r,u=Math.min(i-a,r-s),l=0;l<u;l++)n[s+l]=e[a+l];a+=u,(o+=u)%r==0&&this._update(n)}return this._len+=i,this},La.prototype.digest=function(e){var t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=this._finalSize&&(this._update(this._block),this._block.fill(0));var n=8*this._len;if(n<=4294967295)this._block.writeUInt32BE(n,this._blockSize-4);else{var r=(4294967295&n)>>>0,i=(n-r)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(r,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},La.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var Ia=La,Na=Jr,Da=Ia,Ba=$r.Buffer,ja=[1518500249,1859775393,-1894007588,-899497514],Ua=new Array(80);function za(){this.init(),this._w=Ua,Da.call(this,64,56)}function Fa(e){return e<<30|e>>>2}function qa(e,t,n,r){return 0===e?t&n|~t&r:2===e?t&n|t&r|n&r:t^n^r}Na(za,Da),za.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},za.prototype._update=function(e){for(var t,n=this._w,r=0|this._a,i=0|this._b,o=0|this._c,a=0|this._d,s=0|this._e,u=0;u<16;++u)n[u]=e.readInt32BE(4*u);for(;u<80;++u)n[u]=n[u-3]^n[u-8]^n[u-14]^n[u-16];for(var l=0;l<80;++l){var c=~~(l/20),d=0|((t=r)<<5|t>>>27)+qa(c,i,o,a)+s+n[l]+ja[c];s=a,a=o,o=Fa(i),i=r,r=d}this._a=r+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0},za.prototype._hash=function(){var e=Ba.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e};var Wa=za,Va=Jr,Ka=Ia,Ha=$r.Buffer,$a=[1518500249,1859775393,-1894007588,-899497514],Ya=new Array(80);function Ga(){this.init(),this._w=Ya,Ka.call(this,64,56)}function Qa(e){return e<<5|e>>>27}function Za(e){return e<<30|e>>>2}function Xa(e,t,n,r){return 0===e?t&n|~t&r:2===e?t&n|t&r|n&r:t^n^r}Va(Ga,Ka),Ga.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},Ga.prototype._update=function(e){for(var t,n=this._w,r=0|this._a,i=0|this._b,o=0|this._c,a=0|this._d,s=0|this._e,u=0;u<16;++u)n[u]=e.readInt32BE(4*u);for(;u<80;++u)n[u]=(t=n[u-3]^n[u-8]^n[u-14]^n[u-16])<<1|t>>>31;for(var l=0;l<80;++l){var c=~~(l/20),d=Qa(r)+Xa(c,i,o,a)+s+n[l]+$a[c]|0;s=a,a=o,o=Za(i),i=r,r=d}this._a=r+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0},Ga.prototype._hash=function(){var e=Ha.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e};var Ja=Ga,es=Jr,ts=Ia,ns=$r.Buffer,rs=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],is=new Array(64);function os(){this.init(),this._w=is,ts.call(this,64,56)}function as(e,t,n){return n^e&(t^n)}function ss(e,t,n){return e&t|n&(e|t)}function us(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function ls(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function cs(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}es(os,ts),os.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},os.prototype._update=function(e){for(var t,n=this._w,r=0|this._a,i=0|this._b,o=0|this._c,a=0|this._d,s=0|this._e,u=0|this._f,l=0|this._g,c=0|this._h,d=0;d<16;++d)n[d]=e.readInt32BE(4*d);for(;d<64;++d)n[d]=0|(((t=n[d-2])>>>17|t<<15)^(t>>>19|t<<13)^t>>>10)+n[d-7]+cs(n[d-15])+n[d-16];for(var f=0;f<64;++f){var h=c+ls(s)+as(s,u,l)+rs[f]+n[f]|0,p=us(r)+ss(r,i,o)|0;c=l,l=u,u=s,s=a+h|0,a=o,o=i,i=r,r=h+p|0}this._a=r+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0,this._f=u+this._f|0,this._g=l+this._g|0,this._h=c+this._h|0},os.prototype._hash=function(){var e=ns.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e};var ds=os,fs=Jr,hs=ds,ps=Ia,ms=$r.Buffer,gs=new Array(64);function vs(){this.init(),this._w=gs,ps.call(this,64,56)}fs(vs,hs),vs.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},vs.prototype._hash=function(){var e=ms.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e};var ys=vs,bs=Jr,ws=Ia,As=$r.Buffer,_s=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],Es=new Array(160);function Ss(){this.init(),this._w=Es,ws.call(this,128,112)}function ks(e,t,n){return n^e&(t^n)}function Ms(e,t,n){return e&t|n&(e|t)}function Cs(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function xs(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function Rs(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function Os(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function Ts(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function Ps(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function Ls(e,t){return e>>>0<t>>>0?1:0}bs(Ss,ws),Ss.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},Ss.prototype._update=function(e){for(var t=this._w,n=0|this._ah,r=0|this._bh,i=0|this._ch,o=0|this._dh,a=0|this._eh,s=0|this._fh,u=0|this._gh,l=0|this._hh,c=0|this._al,d=0|this._bl,f=0|this._cl,h=0|this._dl,p=0|this._el,m=0|this._fl,g=0|this._gl,v=0|this._hl,y=0;y<32;y+=2)t[y]=e.readInt32BE(4*y),t[y+1]=e.readInt32BE(4*y+4);for(;y<160;y+=2){var b=t[y-30],w=t[y-30+1],A=Rs(b,w),_=Os(w,b),E=Ts(b=t[y-4],w=t[y-4+1]),S=Ps(w,b),k=t[y-14],M=t[y-14+1],C=t[y-32],x=t[y-32+1],R=_+M|0,O=A+k+Ls(R,_)|0;O=(O=O+E+Ls(R=R+S|0,S)|0)+C+Ls(R=R+x|0,x)|0,t[y]=O,t[y+1]=R}for(var T=0;T<160;T+=2){O=t[T],R=t[T+1];var P=Ms(n,r,i),L=Ms(c,d,f),I=Cs(n,c),N=Cs(c,n),D=xs(a,p),B=xs(p,a),j=_s[T],U=_s[T+1],z=ks(a,s,u),F=ks(p,m,g),q=v+B|0,W=l+D+Ls(q,v)|0;W=(W=(W=W+z+Ls(q=q+F|0,F)|0)+j+Ls(q=q+U|0,U)|0)+O+Ls(q=q+R|0,R)|0;var V=N+L|0,K=I+P+Ls(V,N)|0;l=u,v=g,u=s,g=m,s=a,m=p,a=o+W+Ls(p=h+q|0,h)|0,o=i,h=f,i=r,f=d,r=n,d=c,n=W+K+Ls(c=q+V|0,q)|0}this._al=this._al+c|0,this._bl=this._bl+d|0,this._cl=this._cl+f|0,this._dl=this._dl+h|0,this._el=this._el+p|0,this._fl=this._fl+m|0,this._gl=this._gl+g|0,this._hl=this._hl+v|0,this._ah=this._ah+n+Ls(this._al,c)|0,this._bh=this._bh+r+Ls(this._bl,d)|0,this._ch=this._ch+i+Ls(this._cl,f)|0,this._dh=this._dh+o+Ls(this._dl,h)|0,this._eh=this._eh+a+Ls(this._el,p)|0,this._fh=this._fh+s+Ls(this._fl,m)|0,this._gh=this._gh+u+Ls(this._gl,g)|0,this._hh=this._hh+l+Ls(this._hl,v)|0},Ss.prototype._hash=function(){var e=As.allocUnsafe(64);function t(t,n,r){e.writeInt32BE(t,r),e.writeInt32BE(n,r+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e};var Is=Ss,Ns=Jr,Ds=Is,Bs=Ia,js=$r.Buffer,Us=new Array(160);function zs(){this.init(),this._w=Us,Bs.call(this,128,112)}Ns(zs,Ds),zs.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},zs.prototype._hash=function(){var e=js.allocUnsafe(48);function t(t,n,r){e.writeInt32BE(t,r),e.writeInt32BE(n,r+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e};var Fs=zs,qs=Ta.exports=function(e){e=e.toLowerCase();var t=qs[e];if(!t)throw new Error(e+" is not supported (we accept pull requests)");return new t};qs.sha=Wa,qs.sha1=Ja,qs.sha224=ys,qs.sha256=ds,qs.sha384=Fs,qs.sha512=Is;var Ws=Ta.exports;function Vs(){this.head=null,this.tail=null,this.length=0}Vs.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},Vs.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},Vs.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},Vs.prototype.clear=function(){this.head=this.tail=null,this.length=0},Vs.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},Vs.prototype.concat=function(e){if(0===this.length)return xn.alloc(0);if(1===this.length)return this.head.data;for(var t=xn.allocUnsafe(e>>>0),n=this.head,r=0;n;)n.data.copy(t,r),r+=n.data.length,n=n.next;return t};var Ks=xn.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function Hs(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),function(e){if(e&&!Ks(e))throw new Error("Unknown encoding: "+e)}(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=Ys;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=Gs;break;default:return void(this.write=$s)}this.charBuffer=new xn(6),this.charReceived=0,this.charLength=0}function $s(e){return e.toString(this.encoding)}function Ys(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function Gs(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}Hs.prototype.write=function(e){for(var t="";this.charLength;){var n=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived<this.charLength)return"";if(e=e.slice(n,e.length),!((r=(t=this.charBuffer.slice(0,this.charLength).toString(this.encoding)).charCodeAt(t.length-1))>=55296&&r<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var r,i=e.length;if(this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,i),i-=this.charReceived),i=(t+=e.toString(this.encoding,0,i)).length-1,(r=t.charCodeAt(i))>=55296&&r<=56319){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),e.copy(this.charBuffer,0,0,o),t.substring(0,i)}return t},Hs.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var n=e[e.length-t];if(1==t&&n>>5==6){this.charLength=2;break}if(t<=2&&n>>4==14){this.charLength=3;break}if(t<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=t},Hs.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;t+=r.slice(0,n).toString(i)}return t};var Qs=Object.freeze({__proto__:null,StringDecoder:Hs});Js.ReadableState=Xs;var Zs=gi("stream");function Xs(e,t){e=e||{},this.objectMode=!!e.objectMode,t instanceof Cu&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var n=e.highWaterMark,r=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:r,this.highWaterMark=~~this.highWaterMark,this.buffer=new Vs,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(this.decoder=new Hs(e.encoding),this.encoding=e.encoding)}function Js(e){if(!(this instanceof Js))return new Js(e);this._readableState=new Xs(e,this),this.readable=!0,e&&"function"==typeof e.read&&(this._read=e.read),ni.call(this)}function eu(e,t,n,r,i){var o=function(e,t){var n=null;return dr(t)||"string"==typeof t||null==t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}(t,n);if(o)e.emit("error",o);else if(null===n)t.reading=!1,function(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,ru(e)}}(e,t);else if(t.objectMode||n&&n.length>0)if(t.ended&&!i){var a=new Error("stream.push() after EOF");e.emit("error",a)}else if(t.endEmitted&&i){var s=new Error("stream.unshift() after end event");e.emit("error",s)}else{var u;!t.decoder||i||r||(n=t.decoder.write(n),u=!t.objectMode&&0===n.length),i||(t.reading=!1),u||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&ru(e))),function(e,t){t.readingMore||(t.readingMore=!0,Tr(ou,e,t))}(e,t)}else i||(t.reading=!1);return function(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}(t)}ci(Js,ni),Js.prototype.push=function(e,t){var n=this._readableState;return n.objectMode||"string"!=typeof e||(t=t||n.defaultEncoding)!==n.encoding&&(e=xn.from(e,t),t=""),eu(this,n,e,t,!1)},Js.prototype.unshift=function(e){return eu(this,this._readableState,e,"",!0)},Js.prototype.isPaused=function(){return!1===this._readableState.flowing},Js.prototype.setEncoding=function(e){return this._readableState.decoder=new Hs(e),this._readableState.encoding=e,this};var tu=8388608;function nu(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>=tu?e=tu:(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 ru(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(Zs("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?Tr(iu,e):iu(e))}function iu(e){Zs("emit readable"),e.emit("readable"),uu(e)}function ou(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(Zs("maybeReadMore read 0"),e.read(0),n!==t.length);)n=t.length;t.readingMore=!1}function au(e){Zs("readable nexttick read 0"),e.read(0)}function su(e,t){t.reading||(Zs("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),uu(e),t.flowing&&!t.reading&&e.read(0)}function uu(e){var t=e._readableState;for(Zs("flow",t.flowing);t.flowing&&null!==e.read(););}function lu(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=function(e,t,n){var r;return e<t.head.data.length?(r=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):r=e===t.head.data.length?t.shift():n?function(e,t){var n=t.head,r=1,i=n.data;for(e-=i.length;n=n.next;){var o=n.data,a=e>o.length?o.length:e;if(a===o.length?i+=o:i+=o.slice(0,e),0==(e-=a)){a===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(a));break}++r}return t.length-=r,i}(e,t):function(e,t){var n=xn.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,a=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,a),0==(e-=a)){a===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(a));break}++i}return t.length-=i,n}(e,t),r}(e,t.buffer,t.decoder),n);var n}function cu(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,Tr(du,t,e))}function du(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function fu(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}function hu(){}function pu(e,t,n){this.chunk=e,this.encoding=t,this.callback=n,this.next=null}function mu(e,t){Object.defineProperty(this,"buffer",{get:hi((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")}),e=e||{},this.objectMode=!!e.objectMode,t instanceof Cu&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var n=e.highWaterMark,r=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:r,this.highWaterMark=~~this.highWaterMark,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var i=!1===e.decodeStrings;this.decodeStrings=!i,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,i=n.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,i){--t.pendingcb,n?Tr(i,r):i(r),e._writableState.errorEmitted=!0,e.emit("error",r)}(e,n,r,t,i);else{var o=wu(n);o||n.corked||n.bufferProcessing||!n.bufferedRequest||bu(e,n),r?Tr(yu,e,n,o,i):yu(e,n,o,i)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new Eu(this)}function gu(e){if(!(this instanceof gu||this instanceof Cu))return new gu(e);this._writableState=new mu(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev)),ni.call(this)}function vu(e,t,n,r,i,o,a){t.writelen=r,t.writecb=a,t.writing=!0,t.sync=!0,n?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function yu(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),_u(e,t)}function bu(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,i=new Array(r),o=t.corkedRequestsFree;o.entry=n;for(var a=0;n;)i[a]=n,n=n.next,a+=1;vu(e,t,!0,t.length,i,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new Eu(t)}else{for(;n;){var s=n.chunk,u=n.encoding,l=n.callback;if(vu(e,t,!1,t.objectMode?1:s.length,s,u,l),n=n.next,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequestCount=0,t.bufferedRequest=n,t.bufferProcessing=!1}function wu(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function Au(e,t){t.prefinished||(t.prefinished=!0,e.emit("prefinish"))}function _u(e,t){var n=wu(t);return n&&(0===t.pendingcb?(Au(e,t),t.finished=!0,e.emit("finish")):Au(e,t)),n}function Eu(e){var t=this;this.next=null,this.entry=null,this.finish=function(n){var r=t.entry;for(t.entry=null;r;){var i=r.callback;e.pendingcb--,i(n),r=r.next}e.corkedRequestsFree?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}}Js.prototype.read=function(e){Zs("read",e),e=parseInt(e,10);var t=this._readableState,n=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return Zs("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?cu(this):ru(this),null;if(0===(e=nu(e,t))&&t.ended)return 0===t.length&&cu(this),null;var r,i=t.needReadable;return Zs("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&Zs("length less than watermark",i=!0),t.ended||t.reading?Zs("reading or ended",i=!1):i&&(Zs("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=nu(n,t))),null===(r=e>0?lu(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&cu(this)),null!==r&&this.emit("data",r),r},Js.prototype._read=function(e){this.emit("error",new Error("not implemented"))},Js.prototype.pipe=function(e,t){var n=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=e;break;case 1:r.pipes=[r.pipes,e];break;default:r.pipes.push(e)}r.pipesCount+=1,Zs("pipe count=%d opts=%j",r.pipesCount,t);var i=t&&!1===t.end?l:a;function o(e){Zs("onunpipe"),e===n&&l()}function a(){Zs("onend"),e.end()}r.endEmitted?Tr(i):n.once("end",i),e.on("unpipe",o);var s=function(e){return function(){var t=e._readableState;Zs("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&e.listeners("data").length&&(t.flowing=!0,uu(e))}}(n);e.on("drain",s);var u=!1;function l(){Zs("cleanup"),e.removeListener("close",h),e.removeListener("finish",p),e.removeListener("drain",s),e.removeListener("error",f),e.removeListener("unpipe",o),n.removeListener("end",a),n.removeListener("end",l),n.removeListener("data",d),u=!0,!r.awaitDrain||e._writableState&&!e._writableState.needDrain||s()}var c=!1;function d(t){Zs("ondata"),c=!1,!1!==e.write(t)||c||((1===r.pipesCount&&r.pipes===e||r.pipesCount>1&&-1!==fu(r.pipes,e))&&!u&&(Zs("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,c=!0),n.pause())}function f(t){Zs("onerror",t),m(),e.removeListener("error",f),0===e.listeners("error").length&&e.emit("error",t)}function h(){e.removeListener("finish",p),m()}function p(){Zs("onfinish"),e.removeListener("close",h),m()}function m(){Zs("unpipe"),n.unpipe(e)}return n.on("data",d),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",f),e.once("close",h),e.once("finish",p),e.emit("pipe",n),r.flowing||(Zs("pipe resume"),n.resume()),e},Js.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this)),this;if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i<r;i++)n[i].emit("unpipe",this);return this}var o=fu(t.pipes,e);return-1===o||(t.pipes.splice(o,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this)),this},Js.prototype.on=function(e,t){var n=ni.prototype.on.call(this,e,t);if("data"===e)!1!==this._readableState.flowing&&this.resume();else if("readable"===e){var r=this._readableState;r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.emittedReadable=!1,r.reading?r.length&&ru(this):Tr(au,this))}return n},Js.prototype.addListener=Js.prototype.on,Js.prototype.resume=function(){var e=this._readableState;return e.flowing||(Zs("resume"),e.flowing=!0,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,Tr(su,e,t))}(this,e)),this},Js.prototype.pause=function(){return Zs("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(Zs("pause"),this._readableState.flowing=!1,this.emit("pause")),this},Js.prototype.wrap=function(e){var t=this._readableState,n=!1,r=this;for(var i in e.on("end",(function(){if(Zs("wrapped end"),t.decoder&&!t.ended){var e=t.decoder.end();e&&e.length&&r.push(e)}r.push(null)})),e.on("data",(function(i){Zs("wrapped data"),t.decoder&&(i=t.decoder.write(i)),t.objectMode&&null==i||(t.objectMode||i&&i.length)&&(r.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));return function(e,t){for(var n=0,r=e.length;n<r;n++)t(e[n])}(["error","close","destroy","pause","resume"],(function(t){e.on(t,r.emit.bind(r,t))})),r._read=function(t){Zs("wrapped _read",t),n&&(n=!1,e.resume())},r},Js._fromList=lu,gu.WritableState=mu,ci(gu,ni),mu.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},gu.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},gu.prototype.write=function(e,t,n){var r=this._writableState,i=!1;return"function"==typeof t&&(n=t,t=null),xn.isBuffer(e)?t="buffer":t||(t=r.defaultEncoding),"function"!=typeof n&&(n=hu),r.ended?function(e,t){var n=new Error("write after end");e.emit("error",n),Tr(t,n)}(this,n):function(e,t,n,r){var i=!0,o=!1;return null===n?o=new TypeError("May not write null values to stream"):xn.isBuffer(n)||"string"==typeof n||void 0===n||t.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(e.emit("error",o),Tr(r,o),i=!1),i}(this,r,e,n)&&(r.pendingcb++,i=function(e,t,n,r,i){n=function(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=xn.from(t,n)),t}(t,n,r),xn.isBuffer(n)&&(r="buffer");var o=t.objectMode?1:n.length;t.length+=o;var a=t.length<t.highWaterMark;if(a||(t.needDrain=!0),t.writing||t.corked){var s=t.lastBufferedRequest;t.lastBufferedRequest=new pu(n,r,i),s?s.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else vu(e,t,!1,o,n,r,i);return a}(this,r,e,t,n)),i},gu.prototype.cork=function(){this._writableState.corked++},gu.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||bu(this,e))},gu.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 TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},gu.prototype._write=function(e,t,n){n(new Error("not implemented"))},gu.prototype._writev=null,gu.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(e,t,n){t.ending=!0,_u(e,t),n&&(t.finished?Tr(n):e.once("finish",n)),t.ended=!0,e.writable=!1}(this,r,n)},ci(Cu,Js);for(var Su=Object.keys(gu.prototype),ku=0;ku<Su.length;ku++){var Mu=Su[ku];Cu.prototype[Mu]||(Cu.prototype[Mu]=gu.prototype[Mu])}function Cu(e){if(!(this instanceof Cu))return new Cu(e);Js.call(this,e),gu.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",xu)}function xu(){this.allowHalfOpen||this._writableState.ended||Tr(Ru,this)}function Ru(e){e.end()}function Ou(e){this.afterTransform=function(t,n){return function(e,t,n){var r=e._transformState;r.transforming=!1;var i=r.writecb;if(!i)return e.emit("error",new Error("no writecb in Transform class"));r.writechunk=null,r.writecb=null,null!=n&&e.push(n),i(t);var o=e._readableState;o.reading=!1,(o.needReadable||o.length<o.highWaterMark)&&e._read(o.highWaterMark)}(e,t,n)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null,this.writeencoding=null}function Tu(e){if(!(this instanceof Tu))return new Tu(e);Cu.call(this,e),this._transformState=new Ou(this);var t=this;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.once("prefinish",(function(){"function"==typeof this._flush?this._flush((function(e){Pu(t,e)})):Pu(t)}))}function Pu(e,t){if(t)return e.emit("error",t);var n=e._writableState,r=e._transformState;if(n.length)throw new Error("Calling transform done when ws.length != 0");if(r.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}function Lu(e){if(!(this instanceof Lu))return new Lu(e);Tu.call(this,e)}function Iu(){ni.call(this)}ci(Tu,Cu),Tu.prototype.push=function(e,t){return this._transformState.needTransform=!1,Cu.prototype.push.call(this,e,t)},Tu.prototype._transform=function(e,t,n){throw new Error("Not implemented")},Tu.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},Tu.prototype._read=function(e){var t=this._transformState;null!==t.writechunk&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0},ci(Lu,Tu),Lu.prototype._transform=function(e,t,n){n(null,e)},ci(Iu,ni),Iu.Readable=Js,Iu.Writable=gu,Iu.Duplex=Cu,Iu.Transform=Tu,Iu.PassThrough=Lu,Iu.Stream=Iu,Iu.prototype.pipe=function(e,t){var n=this;function r(t){e.writable&&!1===e.write(t)&&n.pause&&n.pause()}function i(){n.readable&&n.resume&&n.resume()}n.on("data",r),e.on("drain",i),e._isStdio||t&&!1===t.end||(n.on("end",a),n.on("close",s));var o=!1;function a(){o||(o=!0,e.end())}function s(){o||(o=!0,"function"==typeof e.destroy&&e.destroy())}function u(e){if(l(),0===ni.listenerCount(this,"error"))throw e}function l(){n.removeListener("data",r),e.removeListener("drain",i),n.removeListener("end",a),n.removeListener("close",s),n.removeListener("error",u),e.removeListener("error",u),n.removeListener("end",l),n.removeListener("close",l),e.removeListener("close",l)}return n.on("error",u),e.on("error",u),n.on("end",l),n.on("close",l),e.on("close",l),e.emit("pipe",n),e};var Nu=pr(Object.freeze({__proto__:null,Duplex:Cu,PassThrough:Lu,Readable:Js,Stream:Iu,Transform:Tu,Writable:gu,default:Iu})),Du=pr(Qs),Bu=$r.Buffer,ju=Nu.Transform,Uu=Du.StringDecoder;function zu(e){ju.call(this),this.hashMode="string"==typeof e,this.hashMode?this[e]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}Jr(zu,ju),zu.prototype.update=function(e,t,n){"string"==typeof e&&(e=Bu.from(e,t));var r=this._update(e);return this.hashMode?this:(n&&(r=this._toString(r,n)),r)},zu.prototype.setAutoPadding=function(){},zu.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},zu.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},zu.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},zu.prototype._transform=function(e,t,n){var r;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(e){r=e}finally{n(r)}},zu.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(e){t=e}e(t)},zu.prototype._finalOrDigest=function(e){var t=this.__final()||Bu.alloc(0);return e&&(t=this._toString(t,e,!0)),t},zu.prototype._toString=function(e,t,n){if(this._decoder||(this._decoder=new Uu(t),this._encoding=t),this._encoding!==t)throw new Error("can't switch encodings");var r=this._decoder.write(e);return n&&(r+=this._decoder.end()),r};var Fu=zu,qu=fa,Wu=Oa,Vu=Ws,Ku=Fu;function Hu(e){Ku.call(this,"digest"),this._hash=e}Jr(Hu,Ku),Hu.prototype._update=function(e){this._hash.update(e)},Hu.prototype._final=function(){return this._hash.digest()};var $u=function(e){return"md5"===(e=e.toLowerCase())?new qu:"rmd160"===e||"ripemd160"===e?new Wu:new Hu(Vu(e))},Yu=Jr,Gu=$r.Buffer,Qu=Fu,Zu=Gu.alloc(128),Xu=64;function Ju(e,t){Qu.call(this,"digest"),"string"==typeof t&&(t=Gu.from(t)),this._alg=e,this._key=t,t.length>Xu?t=e(t):t.length<Xu&&(t=Gu.concat([t,Zu],Xu));for(var n=this._ipad=Gu.allocUnsafe(Xu),r=this._opad=Gu.allocUnsafe(Xu),i=0;i<Xu;i++)n[i]=54^t[i],r[i]=92^t[i];this._hash=[n]}Yu(Ju,Qu),Ju.prototype._update=function(e){this._hash.push(e)},Ju.prototype._final=function(){var e=this._alg(Gu.concat(this._hash));return this._alg(Gu.concat([this._opad,e]))};var el=fa,tl=function(e){return(new el).update(e).digest()},nl=Jr,rl=Ju,il=Fu,ol=$r.Buffer,al=tl,sl=Oa,ul=Ws,ll=ol.alloc(128);function cl(e,t){il.call(this,"digest"),"string"==typeof t&&(t=ol.from(t));var n="sha512"===e||"sha384"===e?128:64;this._alg=e,this._key=t,t.length>n?t=("rmd160"===e?new sl:ul(e)).update(t).digest():t.length<n&&(t=ol.concat([t,ll],n));for(var r=this._ipad=ol.allocUnsafe(n),i=this._opad=ol.allocUnsafe(n),o=0;o<n;o++)r[o]=54^t[o],i[o]=92^t[o];this._hash="rmd160"===e?new sl:ul(e),this._hash.update(r)}nl(cl,il),cl.prototype._update=function(e){this._hash.update(e)},cl.prototype._final=function(){var e=this._hash.digest();return("rmd160"===this._alg?new sl:ul(this._alg)).update(this._opad).update(e).digest()};var dl=function(e,t){return"rmd160"===(e=e.toLowerCase())||"ripemd160"===e?new cl("rmd160",t):"md5"===e?new rl(al,t):new cl(e,t)},fl={sha224WithRSAEncryption:{sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption:{sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption:{sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption:{sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA512":{sign:"ecdsa/rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA1":{sign:"rsa",hash:"sha1",id:"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{sign:"ecdsa",hash:"sha1",id:""},sha256:{sign:"ecdsa",hash:"sha256",id:""},sha224:{sign:"ecdsa",hash:"sha224",id:""},sha384:{sign:"ecdsa",hash:"sha384",id:""},sha512:{sign:"ecdsa",hash:"sha512",id:""},"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA:{sign:"dsa",hash:"sha1",id:""},"DSA-WITH-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-WITH-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-WITH-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-WITH-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-RIPEMD160":{sign:"dsa",hash:"rmd160",id:""},ripemd160WithRSA:{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption:{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}},hl=fl,pl={},ml=Math.pow(2,30)-1,gl=function(e,t){if("number"!=typeof e)throw new TypeError("Iterations not a number");if(e<0)throw new TypeError("Bad iterations");if("number"!=typeof t)throw new TypeError("Key length not a number");if(t<0||t>ml||t!=t)throw new TypeError("Bad key length")},vl=hr.process&&hr.process.browser?"utf-8":hr.process&&hr.process.version?parseInt(Vr.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary":"utf-8",yl=$r.Buffer,bl=function(e,t,n){if(yl.isBuffer(e))return e;if("string"==typeof e)return yl.from(e,t);if(ArrayBuffer.isView(e))return yl.from(e.buffer);throw new TypeError(n+" must be a string, a Buffer, a typed array or a DataView")},wl=tl,Al=Oa,_l=Ws,El=$r.Buffer,Sl=gl,kl=vl,Ml=bl,Cl=El.alloc(128),xl={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function Rl(e,t,n){var r=function(e){return"rmd160"===e||"ripemd160"===e?function(e){return(new Al).update(e).digest()}:"md5"===e?wl:function(t){return _l(e).update(t).digest()}}(e),i="sha512"===e||"sha384"===e?128:64;t.length>i?t=r(t):t.length<i&&(t=El.concat([t,Cl],i));for(var o=El.allocUnsafe(i+xl[e]),a=El.allocUnsafe(i+xl[e]),s=0;s<i;s++)o[s]=54^t[s],a[s]=92^t[s];var u=El.allocUnsafe(i+n+4);o.copy(u,0,0,i),this.ipad1=u,this.ipad2=o,this.opad=a,this.alg=e,this.blocksize=i,this.hash=r,this.size=xl[e]}Rl.prototype.run=function(e,t){return e.copy(t,this.blocksize),this.hash(t).copy(this.opad,this.blocksize),this.hash(this.opad)};var Ol,Tl,Pl=function(e,t,n,r,i){Sl(n,r);var o=new Rl(i=i||"sha1",e=Ml(e,kl,"Password"),(t=Ml(t,kl,"Salt")).length),a=El.allocUnsafe(r),s=El.allocUnsafe(t.length+4);t.copy(s,0,0,t.length);for(var u=0,l=xl[i],c=Math.ceil(r/l),d=1;d<=c;d++){s.writeUInt32BE(d,t.length);for(var f=o.run(s,o.ipad1),h=f,p=1;p<n;p++){h=o.run(h,o.ipad2);for(var m=0;m<l;m++)f[m]^=h[m]}f.copy(a,u),u+=l}return a},Ll=$r.Buffer,Il=gl,Nl=vl,Dl=Pl,Bl=bl,jl=hr.crypto&&hr.crypto.subtle,Ul={sha:"SHA-1","sha-1":"SHA-1",sha1:"SHA-1",sha256:"SHA-256","sha-256":"SHA-256",sha384:"SHA-384","sha-384":"SHA-384","sha-512":"SHA-512",sha512:"SHA-512"},zl=[];function Fl(){return Tl||(Tl=hr.process&&hr.process.nextTick?hr.process.nextTick:hr.queueMicrotask?hr.queueMicrotask:hr.setImmediate?hr.setImmediate:hr.setTimeout)}function ql(e,t,n,r,i){return jl.importKey("raw",e,{name:"PBKDF2"},!1,["deriveBits"]).then((function(e){return jl.deriveBits({name:"PBKDF2",salt:t,iterations:n,hash:{name:i}},e,r<<3)})).then((function(e){return Ll.from(e)}))}pl.pbkdf2=function(e,t,n,r,i,o){"function"==typeof i&&(o=i,i=void 0);var a=Ul[(i=i||"sha1").toLowerCase()];if(a&&"function"==typeof hr.Promise){if(Il(n,r),e=Bl(e,Nl,"Password"),t=Bl(t,Nl,"Salt"),"function"!=typeof o)throw new Error("No callback provided to pbkdf2");!function(e,t){e.then((function(e){Fl()((function(){t(null,e)}))}),(function(e){Fl()((function(){t(e)}))}))}(function(e){if(hr.process&&!hr.process.browser)return Promise.resolve(!1);if(!jl||!jl.importKey||!jl.deriveBits)return Promise.resolve(!1);if(void 0!==zl[e])return zl[e];var t=ql(Ol=Ol||Ll.alloc(8),Ol,10,128,e).then((function(){return!0})).catch((function(){return!1}));return zl[e]=t,t}(a).then((function(o){return o?ql(e,t,n,r,a):Dl(e,t,n,r,i)})),o)}else Fl()((function(){var a;try{a=Dl(e,t,n,r,i)}catch(e){return o(e)}o(null,a)}))},pl.pbkdf2Sync=Pl;var Wl={},Vl={},Kl={readUInt32BE:function(e,t){return(e[0+t]<<24|e[1+t]<<16|e[2+t]<<8|e[3+t])>>>0},writeUInt32BE:function(e,t,n){e[0+n]=t>>>24,e[1+n]=t>>>16&255,e[2+n]=t>>>8&255,e[3+n]=255&t},ip:function(e,t,n,r){for(var i=0,o=0,a=6;a>=0;a-=2){for(var s=0;s<=24;s+=8)i<<=1,i|=t>>>s+a&1;for(s=0;s<=24;s+=8)i<<=1,i|=e>>>s+a&1}for(a=6;a>=0;a-=2){for(s=1;s<=25;s+=8)o<<=1,o|=t>>>s+a&1;for(s=1;s<=25;s+=8)o<<=1,o|=e>>>s+a&1}n[r+0]=i>>>0,n[r+1]=o>>>0},rip:function(e,t,n,r){for(var i=0,o=0,a=0;a<4;a++)for(var s=24;s>=0;s-=8)i<<=1,i|=t>>>s+a&1,i<<=1,i|=e>>>s+a&1;for(a=4;a<8;a++)for(s=24;s>=0;s-=8)o<<=1,o|=t>>>s+a&1,o<<=1,o|=e>>>s+a&1;n[r+0]=i>>>0,n[r+1]=o>>>0},pc1:function(e,t,n,r){for(var i=0,o=0,a=7;a>=5;a--){for(var s=0;s<=24;s+=8)i<<=1,i|=t>>s+a&1;for(s=0;s<=24;s+=8)i<<=1,i|=e>>s+a&1}for(s=0;s<=24;s+=8)i<<=1,i|=t>>s+a&1;for(a=1;a<=3;a++){for(s=0;s<=24;s+=8)o<<=1,o|=t>>s+a&1;for(s=0;s<=24;s+=8)o<<=1,o|=e>>s+a&1}for(s=0;s<=24;s+=8)o<<=1,o|=e>>s+a&1;n[r+0]=i>>>0,n[r+1]=o>>>0},r28shl:function(e,t){return e<<t&268435455|e>>>28-t}},Hl=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];Kl.pc2=function(e,t,n,r){for(var i=0,o=0,a=Hl.length>>>1,s=0;s<a;s++)i<<=1,i|=e>>>Hl[s]&1;for(s=a;s<Hl.length;s++)o<<=1,o|=t>>>Hl[s]&1;n[r+0]=i>>>0,n[r+1]=o>>>0},Kl.expand=function(e,t,n){var r=0,i=0;r=(1&e)<<5|e>>>27;for(var o=23;o>=15;o-=4)r<<=6,r|=e>>>o&63;for(o=11;o>=3;o-=4)i|=e>>>o&63,i<<=6;i|=(31&e)<<1|e>>>31,t[n+0]=r>>>0,t[n+1]=i>>>0};var $l=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];Kl.substitute=function(e,t){for(var n=0,r=0;r<4;r++)n<<=4,n|=$l[64*r+(e>>>18-6*r&63)];for(r=0;r<4;r++)n<<=4,n|=$l[256+64*r+(t>>>18-6*r&63)];return n>>>0};var Yl=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];Kl.permute=function(e){for(var t=0,n=0;n<Yl.length;n++)t<<=1,t|=e>>>Yl[n]&1;return t>>>0},Kl.padSplit=function(e,t,n){for(var r=e.toString(2);r.length<t;)r="0"+r;for(var i=[],o=0;o<t;o+=n)i.push(r.slice(o,o+n));return i.join(" ")};var Gl=Ql;function Ql(e,t){if(!e)throw new Error(t||"Assertion failed")}Ql.equal=function(e,t,n){if(e!=t)throw new Error(n||"Assertion failed: "+e+" != "+t)};var Zl=Gl;function Xl(e){this.options=e,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=new Array(this.blockSize),this.bufferOff=0,this.padding=!1!==e.padding}var Jl=Xl;Xl.prototype._init=function(){},Xl.prototype.update=function(e){return 0===e.length?[]:"decrypt"===this.type?this._updateDecrypt(e):this._updateEncrypt(e)},Xl.prototype._buffer=function(e,t){for(var n=Math.min(this.buffer.length-this.bufferOff,e.length-t),r=0;r<n;r++)this.buffer[this.bufferOff+r]=e[t+r];return this.bufferOff+=n,n},Xl.prototype._flushBuffer=function(e,t){return this._update(this.buffer,0,e,t),this.bufferOff=0,this.blockSize},Xl.prototype._updateEncrypt=function(e){var t=0,n=0,r=(this.bufferOff+e.length)/this.blockSize|0,i=new Array(r*this.blockSize);0!==this.bufferOff&&(t+=this._buffer(e,t),this.bufferOff===this.buffer.length&&(n+=this._flushBuffer(i,n)));for(var o=e.length-(e.length-t)%this.blockSize;t<o;t+=this.blockSize)this._update(e,t,i,n),n+=this.blockSize;for(;t<e.length;t++,this.bufferOff++)this.buffer[this.bufferOff]=e[t];return i},Xl.prototype._updateDecrypt=function(e){for(var t=0,n=0,r=Math.ceil((this.bufferOff+e.length)/this.blockSize)-1,i=new Array(r*this.blockSize);r>0;r--)t+=this._buffer(e,t),n+=this._flushBuffer(i,n);return t+=this._buffer(e,t),i},Xl.prototype.final=function(e){var t,n;return e&&(t=this.update(e)),n="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),t?t.concat(n):n},Xl.prototype._pad=function(e,t){if(0===t)return!1;for(;t<e.length;)e[t++]=0;return!0},Xl.prototype._finalEncrypt=function(){if(!this._pad(this.buffer,this.bufferOff))return[];var e=new Array(this.blockSize);return this._update(this.buffer,0,e,0),e},Xl.prototype._unpad=function(e){return e},Xl.prototype._finalDecrypt=function(){Zl.equal(this.bufferOff,this.blockSize,"Not enough data to decrypt");var e=new Array(this.blockSize);return this._flushBuffer(e,0),this._unpad(e)};var ec=Gl,tc=Kl,nc=Jl;function rc(){this.tmp=new Array(2),this.keys=null}function ic(e){nc.call(this,e);var t=new rc;this._desState=t,this.deriveKeys(t,e.key)}Jr(ic,nc);var oc=ic;ic.create=function(e){return new ic(e)};var ac=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];ic.prototype.deriveKeys=function(e,t){e.keys=new Array(32),ec.equal(t.length,this.blockSize,"Invalid key length");var n=tc.readUInt32BE(t,0),r=tc.readUInt32BE(t,4);tc.pc1(n,r,e.tmp,0),n=e.tmp[0],r=e.tmp[1];for(var i=0;i<e.keys.length;i+=2){var o=ac[i>>>1];n=tc.r28shl(n,o),r=tc.r28shl(r,o),tc.pc2(n,r,e.keys,i)}},ic.prototype._update=function(e,t,n,r){var i=this._desState,o=tc.readUInt32BE(e,t),a=tc.readUInt32BE(e,t+4);tc.ip(o,a,i.tmp,0),o=i.tmp[0],a=i.tmp[1],"encrypt"===this.type?this._encrypt(i,o,a,i.tmp,0):this._decrypt(i,o,a,i.tmp,0),o=i.tmp[0],a=i.tmp[1],tc.writeUInt32BE(n,o,r),tc.writeUInt32BE(n,a,r+4)},ic.prototype._pad=function(e,t){if(!1===this.padding)return!1;for(var n=e.length-t,r=t;r<e.length;r++)e[r]=n;return!0},ic.prototype._unpad=function(e){if(!1===this.padding)return e;for(var t=e[e.length-1],n=e.length-t;n<e.length;n++)ec.equal(e[n],t);return e.slice(0,e.length-t)},ic.prototype._encrypt=function(e,t,n,r,i){for(var o=t,a=n,s=0;s<e.keys.length;s+=2){var u=e.keys[s],l=e.keys[s+1];tc.expand(a,e.tmp,0),u^=e.tmp[0],l^=e.tmp[1];var c=tc.substitute(u,l),d=a;a=(o^tc.permute(c))>>>0,o=d}tc.rip(a,o,r,i)},ic.prototype._decrypt=function(e,t,n,r,i){for(var o=n,a=t,s=e.keys.length-2;s>=0;s-=2){var u=e.keys[s],l=e.keys[s+1];tc.expand(o,e.tmp,0),u^=e.tmp[0],l^=e.tmp[1];var c=tc.substitute(u,l),d=o;o=(a^tc.permute(c))>>>0,a=d}tc.rip(o,a,r,i)};var sc={},uc=Gl,lc=Jr,cc={};function dc(e){uc.equal(e.length,8,"Invalid IV length"),this.iv=new Array(8);for(var t=0;t<this.iv.length;t++)this.iv[t]=e[t]}sc.instantiate=function(e){function t(t){e.call(this,t),this._cbcInit()}lc(t,e);for(var n=Object.keys(cc),r=0;r<n.length;r++){var i=n[r];t.prototype[i]=cc[i]}return t.create=function(e){return new t(e)},t},cc._cbcInit=function(){var e=new dc(this.options.iv);this._cbcState=e},cc._update=function(e,t,n,r){var i=this._cbcState,o=this.constructor.super_.prototype,a=i.iv;if("encrypt"===this.type){for(var s=0;s<this.blockSize;s++)a[s]^=e[t+s];for(o._update.call(this,a,0,n,r),s=0;s<this.blockSize;s++)a[s]=n[r+s]}else{for(o._update.call(this,e,t,n,r),s=0;s<this.blockSize;s++)n[r+s]^=a[s];for(s=0;s<this.blockSize;s++)a[s]=e[t+s]}};var fc=Gl,hc=Jl,pc=oc;function mc(e,t){fc.equal(t.length,24,"Invalid key length");var n=t.slice(0,8),r=t.slice(8,16),i=t.slice(16,24);this.ciphers="encrypt"===e?[pc.create({type:"encrypt",key:n}),pc.create({type:"decrypt",key:r}),pc.create({type:"encrypt",key:i})]:[pc.create({type:"decrypt",key:i}),pc.create({type:"encrypt",key:r}),pc.create({type:"decrypt",key:n})]}function gc(e){hc.call(this,e);var t=new mc(this.type,this.options.key);this._edeState=t}Jr(gc,hc);var vc=gc;gc.create=function(e){return new gc(e)},gc.prototype._update=function(e,t,n,r){var i=this._edeState;i.ciphers[0]._update(e,t,n,r),i.ciphers[1]._update(n,r,n,r),i.ciphers[2]._update(n,r,n,r)},gc.prototype._pad=pc.prototype._pad,gc.prototype._unpad=pc.prototype._unpad,Vl.utils=Kl,Vl.Cipher=Jl,Vl.DES=oc,Vl.CBC=sc,Vl.EDE=vc;var yc=Fu,bc=Vl,wc=Jr,Ac=$r.Buffer,_c={"des-ede3-cbc":bc.CBC.instantiate(bc.EDE),"des-ede3":bc.EDE,"des-ede-cbc":bc.CBC.instantiate(bc.EDE),"des-ede":bc.EDE,"des-cbc":bc.CBC.instantiate(bc.DES),"des-ecb":bc.DES};_c.des=_c["des-cbc"],_c.des3=_c["des-ede3-cbc"];var Ec=Sc;function Sc(e){yc.call(this);var t,n=e.mode.toLowerCase(),r=_c[n];t=e.decrypt?"decrypt":"encrypt";var i=e.key;Ac.isBuffer(i)||(i=Ac.from(i)),"des-ede"!==n&&"des-ede-cbc"!==n||(i=Ac.concat([i,i.slice(0,8)]));var o=e.iv;Ac.isBuffer(o)||(o=Ac.from(o)),this._des=r.create({key:i,iv:o,type:t})}wc(Sc,yc),Sc.prototype._update=function(e){return Ac.from(this._des.update(e))},Sc.prototype._final=function(){return Ac.from(this._des.final())};var kc={},Mc={},Cc={},xc=function(e,t){for(var n=Math.min(e.length,t.length),r=new xn(n),i=0;i<n;++i)r[i]=e[i]^t[i];return r},Rc=xc;Cc.encrypt=function(e,t){var n=Rc(t,e._prev);return e._prev=e._cipher.encryptBlock(n),e._prev},Cc.decrypt=function(e,t){var n=e._prev;e._prev=t;var r=e._cipher.decryptBlock(t);return Rc(r,n)};var Oc={},Tc=$r.Buffer,Pc=xc;function Lc(e,t,n){var r=t.length,i=Pc(t,e._cache);return e._cache=e._cache.slice(r),e._prev=Tc.concat([e._prev,n?t:i]),i}Oc.encrypt=function(e,t,n){for(var r,i=Tc.allocUnsafe(0);t.length;){if(0===e._cache.length&&(e._cache=e._cipher.encryptBlock(e._prev),e._prev=Tc.allocUnsafe(0)),!(e._cache.length<=t.length)){i=Tc.concat([i,Lc(e,t,n)]);break}r=e._cache.length,i=Tc.concat([i,Lc(e,t.slice(0,r),n)]),t=t.slice(r)}return i};var Ic={},Nc=$r.Buffer;function Dc(e,t,n){var r=e._cipher.encryptBlock(e._prev)[0]^t;return e._prev=Nc.concat([e._prev.slice(1),Nc.from([n?t:r])]),r}Ic.encrypt=function(e,t,n){for(var r=t.length,i=Nc.allocUnsafe(r),o=-1;++o<r;)i[o]=Dc(e,t[o],n);return i};var Bc={},jc=$r.Buffer;function Uc(e,t,n){for(var r,i,o=-1,a=0;++o<8;)r=t&1<<7-o?128:0,a+=(128&(i=e._cipher.encryptBlock(e._prev)[0]^r))>>o%8,e._prev=zc(e._prev,n?r:i);return a}function zc(e,t){var n=e.length,r=-1,i=jc.allocUnsafe(e.length);for(e=jc.concat([e,jc.from([t])]);++r<n;)i[r]=e[r]<<1|e[r+1]>>7;return i}Bc.encrypt=function(e,t,n){for(var r=t.length,i=jc.allocUnsafe(r),o=-1;++o<r;)i[o]=Uc(e,t[o],n);return i};var Fc={},qc=xc;function Wc(e){return e._prev=e._cipher.encryptBlock(e._prev),e._prev}Fc.encrypt=function(e,t){for(;e._cache.length<t.length;)e._cache=xn.concat([e._cache,Wc(e)]);var n=e._cache.slice(0,t.length);return e._cache=e._cache.slice(t.length),qc(t,n)};var Vc={},Kc=function(e){for(var t,n=e.length;n--;){if(255!==(t=e.readUInt8(n))){t++,e.writeUInt8(t,n);break}e.writeUInt8(0,n)}},Hc=xc,$c=$r.Buffer,Yc=Kc;function Gc(e){var t=e._cipher.encryptBlockRaw(e._prev);return Yc(e._prev),t}Vc.encrypt=function(e,t){var n=Math.ceil(t.length/16),r=e._cache.length;e._cache=$c.concat([e._cache,$c.allocUnsafe(16*n)]);for(var i=0;i<n;i++){var o=Gc(e),a=r+16*i;e._cache.writeUInt32BE(o[0],a+0),e._cache.writeUInt32BE(o[1],a+4),e._cache.writeUInt32BE(o[2],a+8),e._cache.writeUInt32BE(o[3],a+12)}var s=e._cache.slice(0,t.length);return e._cache=e._cache.slice(t.length),Hc(t,s)};var Qc={"aes-128-ecb":{cipher:"AES",key:128,iv:0,mode:"ECB",type:"block"},"aes-192-ecb":{cipher:"AES",key:192,iv:0,mode:"ECB",type:"block"},"aes-256-ecb":{cipher:"AES",key:256,iv:0,mode:"ECB",type:"block"},"aes-128-cbc":{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},"aes-192-cbc":{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},"aes-256-cbc":{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},aes128:{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},aes192:{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},aes256:{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},"aes-128-cfb":{cipher:"AES",key:128,iv:16,mode:"CFB",type:"stream"},"aes-192-cfb":{cipher:"AES",key:192,iv:16,mode:"CFB",type:"stream"},"aes-256-cfb":{cipher:"AES",key:256,iv:16,mode:"CFB",type:"stream"},"aes-128-cfb8":{cipher:"AES",key:128,iv:16,mode:"CFB8",type:"stream"},"aes-192-cfb8":{cipher:"AES",key:192,iv:16,mode:"CFB8",type:"stream"},"aes-256-cfb8":{cipher:"AES",key:256,iv:16,mode:"CFB8",type:"stream"},"aes-128-cfb1":{cipher:"AES",key:128,iv:16,mode:"CFB1",type:"stream"},"aes-192-cfb1":{cipher:"AES",key:192,iv:16,mode:"CFB1",type:"stream"},"aes-256-cfb1":{cipher:"AES",key:256,iv:16,mode:"CFB1",type:"stream"},"aes-128-ofb":{cipher:"AES",key:128,iv:16,mode:"OFB",type:"stream"},"aes-192-ofb":{cipher:"AES",key:192,iv:16,mode:"OFB",type:"stream"},"aes-256-ofb":{cipher:"AES",key:256,iv:16,mode:"OFB",type:"stream"},"aes-128-ctr":{cipher:"AES",key:128,iv:16,mode:"CTR",type:"stream"},"aes-192-ctr":{cipher:"AES",key:192,iv:16,mode:"CTR",type:"stream"},"aes-256-ctr":{cipher:"AES",key:256,iv:16,mode:"CTR",type:"stream"},"aes-128-gcm":{cipher:"AES",key:128,iv:12,mode:"GCM",type:"auth"},"aes-192-gcm":{cipher:"AES",key:192,iv:12,mode:"GCM",type:"auth"},"aes-256-gcm":{cipher:"AES",key:256,iv:12,mode:"GCM",type:"auth"}},Zc={ECB:{encrypt:function(e,t){return e._cipher.encryptBlock(t)},decrypt:function(e,t){return e._cipher.decryptBlock(t)}},CBC:Cc,CFB:Oc,CFB8:Ic,CFB1:Bc,OFB:Fc,CTR:Vc,GCM:Vc},Xc=Qc;for(var Jc in Xc)Xc[Jc].module=Zc[Xc[Jc].mode];var ed=Xc,td={},nd=$r.Buffer;function rd(e){nd.isBuffer(e)||(e=nd.from(e));for(var t=e.length/4|0,n=new Array(t),r=0;r<t;r++)n[r]=e.readUInt32BE(4*r);return n}function id(e){for(;0<e.length;e++)e[0]=0}function od(e,t,n,r,i){for(var o,a,s,u,l=n[0],c=n[1],d=n[2],f=n[3],h=e[0]^t[0],p=e[1]^t[1],m=e[2]^t[2],g=e[3]^t[3],v=4,y=1;y<i;y++)o=l[h>>>24]^c[p>>>16&255]^d[m>>>8&255]^f[255&g]^t[v++],a=l[p>>>24]^c[m>>>16&255]^d[g>>>8&255]^f[255&h]^t[v++],s=l[m>>>24]^c[g>>>16&255]^d[h>>>8&255]^f[255&p]^t[v++],u=l[g>>>24]^c[h>>>16&255]^d[p>>>8&255]^f[255&m]^t[v++],h=o,p=a,m=s,g=u;return o=(r[h>>>24]<<24|r[p>>>16&255]<<16|r[m>>>8&255]<<8|r[255&g])^t[v++],a=(r[p>>>24]<<24|r[m>>>16&255]<<16|r[g>>>8&255]<<8|r[255&h])^t[v++],s=(r[m>>>24]<<24|r[g>>>16&255]<<16|r[h>>>8&255]<<8|r[255&p])^t[v++],u=(r[g>>>24]<<24|r[h>>>16&255]<<16|r[p>>>8&255]<<8|r[255&m])^t[v++],[o>>>=0,a>>>=0,s>>>=0,u>>>=0]}var ad=[0,1,2,4,8,16,32,64,128,27,54],sd=function(){for(var e=new Array(256),t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;for(var n=[],r=[],i=[[],[],[],[]],o=[[],[],[],[]],a=0,s=0,u=0;u<256;++u){var l=s^s<<1^s<<2^s<<3^s<<4;l=l>>>8^255&l^99,n[a]=l,r[l]=a;var c=e[a],d=e[c],f=e[d],h=257*e[l]^16843008*l;i[0][a]=h<<24|h>>>8,i[1][a]=h<<16|h>>>16,i[2][a]=h<<8|h>>>24,i[3][a]=h,h=16843009*f^65537*d^257*c^16843008*a,o[0][l]=h<<24|h>>>8,o[1][l]=h<<16|h>>>16,o[2][l]=h<<8|h>>>24,o[3][l]=h,0===a?a=s=1:(a=c^e[e[e[f^c]]],s^=e[e[s]])}return{SBOX:n,INV_SBOX:r,SUB_MIX:i,INV_SUB_MIX:o}}();function ud(e){this._key=rd(e),this._reset()}ud.blockSize=16,ud.keySize=32,ud.prototype.blockSize=ud.blockSize,ud.prototype.keySize=ud.keySize,ud.prototype._reset=function(){for(var e=this._key,t=e.length,n=t+6,r=4*(n+1),i=[],o=0;o<t;o++)i[o]=e[o];for(o=t;o<r;o++){var a=i[o-1];o%t==0?(a=a<<8|a>>>24,a=sd.SBOX[a>>>24]<<24|sd.SBOX[a>>>16&255]<<16|sd.SBOX[a>>>8&255]<<8|sd.SBOX[255&a],a^=ad[o/t|0]<<24):t>6&&o%t==4&&(a=sd.SBOX[a>>>24]<<24|sd.SBOX[a>>>16&255]<<16|sd.SBOX[a>>>8&255]<<8|sd.SBOX[255&a]),i[o]=i[o-t]^a}for(var s=[],u=0;u<r;u++){var l=r-u,c=i[l-(u%4?0:4)];s[u]=u<4||l<=4?c:sd.INV_SUB_MIX[0][sd.SBOX[c>>>24]]^sd.INV_SUB_MIX[1][sd.SBOX[c>>>16&255]]^sd.INV_SUB_MIX[2][sd.SBOX[c>>>8&255]]^sd.INV_SUB_MIX[3][sd.SBOX[255&c]]}this._nRounds=n,this._keySchedule=i,this._invKeySchedule=s},ud.prototype.encryptBlockRaw=function(e){return od(e=rd(e),this._keySchedule,sd.SUB_MIX,sd.SBOX,this._nRounds)},ud.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),n=nd.allocUnsafe(16);return n.writeUInt32BE(t[0],0),n.writeUInt32BE(t[1],4),n.writeUInt32BE(t[2],8),n.writeUInt32BE(t[3],12),n},ud.prototype.decryptBlock=function(e){var t=(e=rd(e))[1];e[1]=e[3],e[3]=t;var n=od(e,this._invKeySchedule,sd.INV_SUB_MIX,sd.INV_SBOX,this._nRounds),r=nd.allocUnsafe(16);return r.writeUInt32BE(n[0],0),r.writeUInt32BE(n[3],4),r.writeUInt32BE(n[2],8),r.writeUInt32BE(n[1],12),r},ud.prototype.scrub=function(){id(this._keySchedule),id(this._invKeySchedule),id(this._key)},td.AES=ud;var ld=$r.Buffer,cd=ld.alloc(16,0);function dd(e){var t=ld.allocUnsafe(16);return t.writeUInt32BE(e[0]>>>0,0),t.writeUInt32BE(e[1]>>>0,4),t.writeUInt32BE(e[2]>>>0,8),t.writeUInt32BE(e[3]>>>0,12),t}function fd(e){this.h=e,this.state=ld.alloc(16,0),this.cache=ld.allocUnsafe(0)}fd.prototype.ghash=function(e){for(var t=-1;++t<e.length;)this.state[t]^=e[t];this._multiply()},fd.prototype._multiply=function(){for(var e,t,n,r=[(e=this.h).readUInt32BE(0),e.readUInt32BE(4),e.readUInt32BE(8),e.readUInt32BE(12)],i=[0,0,0,0],o=-1;++o<128;){for(0!=(this.state[~~(o/8)]&1<<7-o%8)&&(i[0]^=r[0],i[1]^=r[1],i[2]^=r[2],i[3]^=r[3]),n=0!=(1&r[3]),t=3;t>0;t--)r[t]=r[t]>>>1|(1&r[t-1])<<31;r[0]=r[0]>>>1,n&&(r[0]=r[0]^225<<24)}this.state=dd(i)},fd.prototype.update=function(e){var t;for(this.cache=ld.concat([this.cache,e]);this.cache.length>=16;)t=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(t)},fd.prototype.final=function(e,t){return this.cache.length&&this.ghash(ld.concat([this.cache,cd],16)),this.ghash(dd([0,e,0,t])),this.state};var hd=fd,pd=td,md=$r.Buffer,gd=Fu,vd=hd,yd=xc,bd=Kc;function wd(e,t,n,r){gd.call(this);var i=md.alloc(4,0);this._cipher=new pd.AES(t);var o=this._cipher.encryptBlock(i);this._ghash=new vd(o),n=function(e,t,n){if(12===t.length)return e._finID=md.concat([t,md.from([0,0,0,1])]),md.concat([t,md.from([0,0,0,2])]);var r=new vd(n),i=t.length,o=i%16;r.update(t),o&&(o=16-o,r.update(md.alloc(o,0))),r.update(md.alloc(8,0));var a=8*i,s=md.alloc(8);s.writeUIntBE(a,0,8),r.update(s),e._finID=r.state;var u=md.from(e._finID);return bd(u),u}(this,n,o),this._prev=md.from(n),this._cache=md.allocUnsafe(0),this._secCache=md.allocUnsafe(0),this._decrypt=r,this._alen=0,this._len=0,this._mode=e,this._authTag=null,this._called=!1}Jr(wd,gd),wd.prototype._update=function(e){if(!this._called&&this._alen){var t=16-this._alen%16;t<16&&(t=md.alloc(t,0),this._ghash.update(t))}this._called=!0;var n=this._mode.encrypt(this,e);return this._decrypt?this._ghash.update(e):this._ghash.update(n),this._len+=e.length,n},wd.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var e=yd(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(e,t){var n=0;e.length!==t.length&&n++;for(var r=Math.min(e.length,t.length),i=0;i<r;++i)n+=e[i]^t[i];return n}(e,this._authTag))throw new Error("Unsupported state or unable to authenticate data");this._authTag=e,this._cipher.scrub()},wd.prototype.getAuthTag=function(){if(this._decrypt||!md.isBuffer(this._authTag))throw new Error("Attempting to get auth tag in unsupported state");return this._authTag},wd.prototype.setAuthTag=function(e){if(!this._decrypt)throw new Error("Attempting to set auth tag in unsupported state");this._authTag=e},wd.prototype.setAAD=function(e){if(this._called)throw new Error("Attempting to set AAD in unsupported state");this._ghash.update(e),this._alen+=e.length};var Ad=wd,_d=td,Ed=$r.Buffer,Sd=Fu;function kd(e,t,n,r){Sd.call(this),this._cipher=new _d.AES(t),this._prev=Ed.from(n),this._cache=Ed.allocUnsafe(0),this._secCache=Ed.allocUnsafe(0),this._decrypt=r,this._mode=e}Jr(kd,Sd),kd.prototype._update=function(e){return this._mode.encrypt(this,e,this._decrypt)},kd.prototype._final=function(){this._cipher.scrub()};var Md=kd,Cd=$r.Buffer,xd=fa,Rd=function(e,t,n,r){if(Cd.isBuffer(e)||(e=Cd.from(e,"binary")),t&&(Cd.isBuffer(t)||(t=Cd.from(t,"binary")),8!==t.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var i=n/8,o=Cd.alloc(i),a=Cd.alloc(r||0),s=Cd.alloc(0);i>0||r>0;){var u=new xd;u.update(s),u.update(e),t&&u.update(t),s=u.digest();var l=0;if(i>0){var c=o.length-i;l=Math.min(i,s.length),s.copy(o,c,0,l),i-=l}if(l<s.length&&r>0){var d=a.length-r,f=Math.min(r,s.length-l);s.copy(a,d,l,l+f),r-=f}}return s.fill(0),{key:o,iv:a}},Od=ed,Td=Ad,Pd=$r.Buffer,Ld=Md,Id=Fu,Nd=td,Dd=Rd;function Bd(e,t,n){Id.call(this),this._cache=new Ud,this._cipher=new Nd.AES(t),this._prev=Pd.from(n),this._mode=e,this._autopadding=!0}Jr(Bd,Id),Bd.prototype._update=function(e){var t,n;this._cache.add(e);for(var r=[];t=this._cache.get();)n=this._mode.encrypt(this,t),r.push(n);return Pd.concat(r)};var jd=Pd.alloc(16,16);function Ud(){this.cache=Pd.allocUnsafe(0)}function zd(e,t,n){var r=Od[e.toLowerCase()];if(!r)throw new TypeError("invalid suite type");if("string"==typeof t&&(t=Pd.from(t)),t.length!==r.key/8)throw new TypeError("invalid key length "+t.length);if("string"==typeof n&&(n=Pd.from(n)),"GCM"!==r.mode&&n.length!==r.iv)throw new TypeError("invalid iv length "+n.length);return"stream"===r.type?new Ld(r.module,t,n):"auth"===r.type?new Td(r.module,t,n):new Bd(r.module,t,n)}Bd.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return e=this._mode.encrypt(this,e),this._cipher.scrub(),e;if(!e.equals(jd))throw this._cipher.scrub(),new Error("data not multiple of block length")},Bd.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},Ud.prototype.add=function(e){this.cache=Pd.concat([this.cache,e])},Ud.prototype.get=function(){if(this.cache.length>15){var e=this.cache.slice(0,16);return this.cache=this.cache.slice(16),e}return null},Ud.prototype.flush=function(){for(var e=16-this.cache.length,t=Pd.allocUnsafe(e),n=-1;++n<e;)t.writeUInt8(e,n);return Pd.concat([this.cache,t])},Mc.createCipheriv=zd,Mc.createCipher=function(e,t){var n=Od[e.toLowerCase()];if(!n)throw new TypeError("invalid suite type");var r=Dd(t,!1,n.key,n.iv);return zd(e,r.key,r.iv)};var Fd={},qd=Ad,Wd=$r.Buffer,Vd=ed,Kd=Md,Hd=Fu,$d=td,Yd=Rd;function Gd(e,t,n){Hd.call(this),this._cache=new Qd,this._last=void 0,this._cipher=new $d.AES(t),this._prev=Wd.from(n),this._mode=e,this._autopadding=!0}function Qd(){this.cache=Wd.allocUnsafe(0)}function Zd(e,t,n){var r=Vd[e.toLowerCase()];if(!r)throw new TypeError("invalid suite type");if("string"==typeof n&&(n=Wd.from(n)),"GCM"!==r.mode&&n.length!==r.iv)throw new TypeError("invalid iv length "+n.length);if("string"==typeof t&&(t=Wd.from(t)),t.length!==r.key/8)throw new TypeError("invalid key length "+t.length);return"stream"===r.type?new Kd(r.module,t,n,!0):"auth"===r.type?new qd(r.module,t,n,!0):new Gd(r.module,t,n)}Jr(Gd,Hd),Gd.prototype._update=function(e){var t,n;this._cache.add(e);for(var r=[];t=this._cache.get(this._autopadding);)n=this._mode.decrypt(this,t),r.push(n);return Wd.concat(r)},Gd.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return function(e){var t=e[15];if(t<1||t>16)throw new Error("unable to decrypt data");for(var n=-1;++n<t;)if(e[n+(16-t)]!==t)throw new Error("unable to decrypt data");if(16!==t)return e.slice(0,16-t)}(this._mode.decrypt(this,e));if(e)throw new Error("data not multiple of block length")},Gd.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},Qd.prototype.add=function(e){this.cache=Wd.concat([this.cache,e])},Qd.prototype.get=function(e){var t;if(e){if(this.cache.length>16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t}else if(this.cache.length>=16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t;return null},Qd.prototype.flush=function(){if(this.cache.length)return this.cache},Fd.createDecipher=function(e,t){var n=Vd[e.toLowerCase()];if(!n)throw new TypeError("invalid suite type");var r=Yd(t,!1,n.key,n.iv);return Zd(e,r.key,r.iv)},Fd.createDecipheriv=Zd;var Xd=Mc,Jd=Fd,ef=Qc;kc.createCipher=kc.Cipher=Xd.createCipher,kc.createCipheriv=kc.Cipheriv=Xd.createCipheriv,kc.createDecipher=kc.Decipher=Jd.createDecipher,kc.createDecipheriv=kc.Decipheriv=Jd.createDecipheriv,kc.listCiphers=kc.getCiphers=function(){return Object.keys(ef)};var tf={};!function(e){e["des-ecb"]={key:8,iv:0},e["des-cbc"]=e.des={key:8,iv:8},e["des-ede3-cbc"]=e.des3={key:24,iv:8},e["des-ede3"]={key:24,iv:0},e["des-ede-cbc"]={key:16,iv:8},e["des-ede"]={key:16,iv:0}}(tf);var nf=Ec,rf=kc,of=ed,af=tf,sf=Rd;function uf(e,t,n){if(e=e.toLowerCase(),of[e])return rf.createCipheriv(e,t,n);if(af[e])return new nf({key:t,iv:n,mode:e});throw new TypeError("invalid suite type")}function lf(e,t,n){if(e=e.toLowerCase(),of[e])return rf.createDecipheriv(e,t,n);if(af[e])return new nf({key:t,iv:n,mode:e,decrypt:!0});throw new TypeError("invalid suite type")}Wl.createCipher=Wl.Cipher=function(e,t){var n,r;if(e=e.toLowerCase(),of[e])n=of[e].key,r=of[e].iv;else{if(!af[e])throw new TypeError("invalid suite type");n=8*af[e].key,r=af[e].iv}var i=sf(t,!1,n,r);return uf(e,i.key,i.iv)},Wl.createCipheriv=Wl.Cipheriv=uf,Wl.createDecipher=Wl.Decipher=function(e,t){var n,r;if(e=e.toLowerCase(),of[e])n=of[e].key,r=of[e].iv;else{if(!af[e])throw new TypeError("invalid suite type");n=8*af[e].key,r=af[e].iv}var i=sf(t,!1,n,r);return lf(e,i.key,i.iv)},Wl.createDecipheriv=Wl.Decipheriv=lf,Wl.listCiphers=Wl.getCiphers=function(){return Object.keys(af).concat(rf.getCiphers())};var cf={},df={exports:{}};!function(e,t){function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function r(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function i(e,t,n){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}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:yr.Buffer}catch(e){}function a(e,t){var n=e.charCodeAt(t);return n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:n-48&15}function s(e,t,n){var r=a(e,n);return n-1>=t&&(r|=a(e,n-1)<<4),r}function u(e,t,n,r){for(var i=0,o=Math.min(e.length,n),a=t;a<o;a++){var s=e.charCodeAt(a)-48;i*=r,i+=s>=49?s-49+10:s>=17?s-17+10:s}return i}i.isBN=function(e){return e instanceof i||null!==e&&"object"==typeof e&&e.constructor.wordSize===i.wordSize&&Array.isArray(e.words)},i.max=function(e,t){return e.cmp(t)>0?e:t},i.min=function(e,t){return e.cmp(t)<0?e:t},i.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<e.length&&(16===t?this._parseHex(e,i,r):(this._parseBase(e,t,i),"le"===r&&this._initArray(this.toArray(),t,r)))},i.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(n(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},i.prototype._initArray=function(e,t,r){if(n("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===r)for(i=e.length-1,o=0;i>=0;i-=3)a=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i<e.length;i+=3)a=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},i.prototype._parseHex=function(e,t,n){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 i,o=0,a=0;if("be"===n)for(r=e.length-1;r>=t;r-=2)i=s(e,t,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(e.length-t)%2==0?t+1:t;r<e.length;r+=2)i=s(e,t,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this.strip()},i.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,a=o%r,s=Math.min(o,o-a)+n,l=0,c=n;c<s;c+=r)l=u(e,c,c+r,t),this.imuln(i),this.words[0]+l<67108864?this.words[0]+=l:this._iaddn(l);if(0!==a){var d=1;for(l=u(e,c,e.length,t),c=0;c<a;c++)d*=t;this.imuln(d),this.words[0]+l<67108864?this.words[0]+=l:this._iaddn(l)}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.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 l=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function f(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var l=1;l<r;l++){for(var c=u>>>26,d=67108863&u,f=Math.min(l,t.length-1),h=Math.max(0,l-e.length+1);h<=f;h++){var p=l-h|0;c+=(a=(i=0|e.words[p])*(o=0|t.words[h])+d)/67108864|0,d=67108863&a}n.words[l]=0|d,u=0|c}return 0!==u?n.words[l]=0|u:n.length--,n.strip()}i.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<i|o)).toString(16);r=0!=(o=s>>>24-i&16777215)||a!==this.length-1?l[6-u.length]+u+r:u+r,(i+=2)>=26&&(i-=26,a--)}for(0!==o&&(r=o.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var f=c[e],h=d[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(h).toString(e);r=(p=p.idivn(h)).isZero()?m+r:l[f-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(e,t){return n(void 0!==o),this.toArrayLike(o,e,t)},i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},i.prototype.toArrayLike=function(e,t,r){var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0"),this.strip();var a,s,u="le"===t,l=new e(o),c=this.clone();if(u){for(s=0;!c.isZero();s++)a=c.andln(255),c.iushrn(8),l[s]=a;for(;s<o;s++)l[s]=0}else{for(s=0;s<o-i;s++)l[s]=0;for(s=0;!c.isZero();s++)a=c.andln(255),c.iushrn(8),l[o-s-1]=a}return l},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var n=this._zeroBits(this.words[t]);if(e+=n,26!==n)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 n(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 n=0;n<t.length;n++)this.words[n]=this.words[n]&e.words[n];return this.length=t.length,this.strip()},i.prototype.iand=function(e){return n(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,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;r<n.length;r++)this.words[r]=t.words[r]^n.words[r];if(this!==t)for(;r<t.length;r++)this.words[r]=t.words[r];return this.length=t.length,this.strip()},i.prototype.ixor=function(e){return n(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){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i<t;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<<i:this.words[r]&~(1<<i),this.strip()},i.prototype.iadd=function(e){var t,n,r;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?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o<r.length;o++)t=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&t,i=t>>>26;for(;0!==i&&o<n.length;o++)t=(0|n.words[o])+i,this.words[o]=67108863&t,i=t>>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;o<n.length;o++)this.words[o]=n.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 n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,a=0;a<r.length;a++)o=(t=(0|n.words[a])-(0|r.words[a])+o)>>26,this.words[a]=67108863&t;for(;0!==o&&a<n.length;a++)o=(t=(0|n.words[a])+o)>>26,this.words[a]=67108863&t;if(0===o&&a<n.length&&n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this.length=Math.max(this.length,a),n!==this&&(this.negative=1),this.strip()},i.prototype.sub=function(e){return this.clone().isub(e)};var h=function(e,t,n){var r,i,o,a=e.words,s=t.words,u=n.words,l=0,c=0|a[0],d=8191&c,f=c>>>13,h=0|a[1],p=8191&h,m=h>>>13,g=0|a[2],v=8191&g,y=g>>>13,b=0|a[3],w=8191&b,A=b>>>13,_=0|a[4],E=8191&_,S=_>>>13,k=0|a[5],M=8191&k,C=k>>>13,x=0|a[6],R=8191&x,O=x>>>13,T=0|a[7],P=8191&T,L=T>>>13,I=0|a[8],N=8191&I,D=I>>>13,B=0|a[9],j=8191&B,U=B>>>13,z=0|s[0],F=8191&z,q=z>>>13,W=0|s[1],V=8191&W,K=W>>>13,H=0|s[2],$=8191&H,Y=H>>>13,G=0|s[3],Q=8191&G,Z=G>>>13,X=0|s[4],J=8191&X,ee=X>>>13,te=0|s[5],ne=8191&te,re=te>>>13,ie=0|s[6],oe=8191&ie,ae=ie>>>13,se=0|s[7],ue=8191&se,le=se>>>13,ce=0|s[8],de=8191&ce,fe=ce>>>13,he=0|s[9],pe=8191&he,me=he>>>13;n.negative=e.negative^t.negative,n.length=19;var ge=(l+(r=Math.imul(d,F))|0)+((8191&(i=(i=Math.imul(d,q))+Math.imul(f,F)|0))<<13)|0;l=((o=Math.imul(f,q))+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,r=Math.imul(p,F),i=(i=Math.imul(p,q))+Math.imul(m,F)|0,o=Math.imul(m,q);var ve=(l+(r=r+Math.imul(d,V)|0)|0)+((8191&(i=(i=i+Math.imul(d,K)|0)+Math.imul(f,V)|0))<<13)|0;l=((o=o+Math.imul(f,K)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,r=Math.imul(v,F),i=(i=Math.imul(v,q))+Math.imul(y,F)|0,o=Math.imul(y,q),r=r+Math.imul(p,V)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,K)|0;var ye=(l+(r=r+Math.imul(d,$)|0)|0)+((8191&(i=(i=i+Math.imul(d,Y)|0)+Math.imul(f,$)|0))<<13)|0;l=((o=o+Math.imul(f,Y)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,r=Math.imul(w,F),i=(i=Math.imul(w,q))+Math.imul(A,F)|0,o=Math.imul(A,q),r=r+Math.imul(v,V)|0,i=(i=i+Math.imul(v,K)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,K)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,Y)|0;var be=(l+(r=r+Math.imul(d,Q)|0)|0)+((8191&(i=(i=i+Math.imul(d,Z)|0)+Math.imul(f,Q)|0))<<13)|0;l=((o=o+Math.imul(f,Z)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(E,F),i=(i=Math.imul(E,q))+Math.imul(S,F)|0,o=Math.imul(S,q),r=r+Math.imul(w,V)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(A,V)|0,o=o+Math.imul(A,K)|0,r=r+Math.imul(v,$)|0,i=(i=i+Math.imul(v,Y)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,Y)|0,r=r+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,Z)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,Z)|0;var we=(l+(r=r+Math.imul(d,J)|0)|0)+((8191&(i=(i=i+Math.imul(d,ee)|0)+Math.imul(f,J)|0))<<13)|0;l=((o=o+Math.imul(f,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(M,F),i=(i=Math.imul(M,q))+Math.imul(C,F)|0,o=Math.imul(C,q),r=r+Math.imul(E,V)|0,i=(i=i+Math.imul(E,K)|0)+Math.imul(S,V)|0,o=o+Math.imul(S,K)|0,r=r+Math.imul(w,$)|0,i=(i=i+Math.imul(w,Y)|0)+Math.imul(A,$)|0,o=o+Math.imul(A,Y)|0,r=r+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,Z)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,Z)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,ee)|0;var Ae=(l+(r=r+Math.imul(d,ne)|0)|0)+((8191&(i=(i=i+Math.imul(d,re)|0)+Math.imul(f,ne)|0))<<13)|0;l=((o=o+Math.imul(f,re)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(R,F),i=(i=Math.imul(R,q))+Math.imul(O,F)|0,o=Math.imul(O,q),r=r+Math.imul(M,V)|0,i=(i=i+Math.imul(M,K)|0)+Math.imul(C,V)|0,o=o+Math.imul(C,K)|0,r=r+Math.imul(E,$)|0,i=(i=i+Math.imul(E,Y)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,Y)|0,r=r+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,Z)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,Z)|0,r=r+Math.imul(v,J)|0,i=(i=i+Math.imul(v,ee)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,ee)|0,r=r+Math.imul(p,ne)|0,i=(i=i+Math.imul(p,re)|0)+Math.imul(m,ne)|0,o=o+Math.imul(m,re)|0;var _e=(l+(r=r+Math.imul(d,oe)|0)|0)+((8191&(i=(i=i+Math.imul(d,ae)|0)+Math.imul(f,oe)|0))<<13)|0;l=((o=o+Math.imul(f,ae)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,r=Math.imul(P,F),i=(i=Math.imul(P,q))+Math.imul(L,F)|0,o=Math.imul(L,q),r=r+Math.imul(R,V)|0,i=(i=i+Math.imul(R,K)|0)+Math.imul(O,V)|0,o=o+Math.imul(O,K)|0,r=r+Math.imul(M,$)|0,i=(i=i+Math.imul(M,Y)|0)+Math.imul(C,$)|0,o=o+Math.imul(C,Y)|0,r=r+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,Z)|0)+Math.imul(S,Q)|0,o=o+Math.imul(S,Z)|0,r=r+Math.imul(w,J)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(A,J)|0,o=o+Math.imul(A,ee)|0,r=r+Math.imul(v,ne)|0,i=(i=i+Math.imul(v,re)|0)+Math.imul(y,ne)|0,o=o+Math.imul(y,re)|0,r=r+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,ae)|0)+Math.imul(m,oe)|0,o=o+Math.imul(m,ae)|0;var Ee=(l+(r=r+Math.imul(d,ue)|0)|0)+((8191&(i=(i=i+Math.imul(d,le)|0)+Math.imul(f,ue)|0))<<13)|0;l=((o=o+Math.imul(f,le)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(N,F),i=(i=Math.imul(N,q))+Math.imul(D,F)|0,o=Math.imul(D,q),r=r+Math.imul(P,V)|0,i=(i=i+Math.imul(P,K)|0)+Math.imul(L,V)|0,o=o+Math.imul(L,K)|0,r=r+Math.imul(R,$)|0,i=(i=i+Math.imul(R,Y)|0)+Math.imul(O,$)|0,o=o+Math.imul(O,Y)|0,r=r+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,Z)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,Z)|0,r=r+Math.imul(E,J)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(S,J)|0,o=o+Math.imul(S,ee)|0,r=r+Math.imul(w,ne)|0,i=(i=i+Math.imul(w,re)|0)+Math.imul(A,ne)|0,o=o+Math.imul(A,re)|0,r=r+Math.imul(v,oe)|0,i=(i=i+Math.imul(v,ae)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,ae)|0,r=r+Math.imul(p,ue)|0,i=(i=i+Math.imul(p,le)|0)+Math.imul(m,ue)|0,o=o+Math.imul(m,le)|0;var Se=(l+(r=r+Math.imul(d,de)|0)|0)+((8191&(i=(i=i+Math.imul(d,fe)|0)+Math.imul(f,de)|0))<<13)|0;l=((o=o+Math.imul(f,fe)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(j,F),i=(i=Math.imul(j,q))+Math.imul(U,F)|0,o=Math.imul(U,q),r=r+Math.imul(N,V)|0,i=(i=i+Math.imul(N,K)|0)+Math.imul(D,V)|0,o=o+Math.imul(D,K)|0,r=r+Math.imul(P,$)|0,i=(i=i+Math.imul(P,Y)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,Y)|0,r=r+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,Z)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,Z)|0,r=r+Math.imul(M,J)|0,i=(i=i+Math.imul(M,ee)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,ee)|0,r=r+Math.imul(E,ne)|0,i=(i=i+Math.imul(E,re)|0)+Math.imul(S,ne)|0,o=o+Math.imul(S,re)|0,r=r+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,ae)|0)+Math.imul(A,oe)|0,o=o+Math.imul(A,ae)|0,r=r+Math.imul(v,ue)|0,i=(i=i+Math.imul(v,le)|0)+Math.imul(y,ue)|0,o=o+Math.imul(y,le)|0,r=r+Math.imul(p,de)|0,i=(i=i+Math.imul(p,fe)|0)+Math.imul(m,de)|0,o=o+Math.imul(m,fe)|0;var ke=(l+(r=r+Math.imul(d,pe)|0)|0)+((8191&(i=(i=i+Math.imul(d,me)|0)+Math.imul(f,pe)|0))<<13)|0;l=((o=o+Math.imul(f,me)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(j,V),i=(i=Math.imul(j,K))+Math.imul(U,V)|0,o=Math.imul(U,K),r=r+Math.imul(N,$)|0,i=(i=i+Math.imul(N,Y)|0)+Math.imul(D,$)|0,o=o+Math.imul(D,Y)|0,r=r+Math.imul(P,Q)|0,i=(i=i+Math.imul(P,Z)|0)+Math.imul(L,Q)|0,o=o+Math.imul(L,Z)|0,r=r+Math.imul(R,J)|0,i=(i=i+Math.imul(R,ee)|0)+Math.imul(O,J)|0,o=o+Math.imul(O,ee)|0,r=r+Math.imul(M,ne)|0,i=(i=i+Math.imul(M,re)|0)+Math.imul(C,ne)|0,o=o+Math.imul(C,re)|0,r=r+Math.imul(E,oe)|0,i=(i=i+Math.imul(E,ae)|0)+Math.imul(S,oe)|0,o=o+Math.imul(S,ae)|0,r=r+Math.imul(w,ue)|0,i=(i=i+Math.imul(w,le)|0)+Math.imul(A,ue)|0,o=o+Math.imul(A,le)|0,r=r+Math.imul(v,de)|0,i=(i=i+Math.imul(v,fe)|0)+Math.imul(y,de)|0,o=o+Math.imul(y,fe)|0;var Me=(l+(r=r+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;l=((o=o+Math.imul(m,me)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,r=Math.imul(j,$),i=(i=Math.imul(j,Y))+Math.imul(U,$)|0,o=Math.imul(U,Y),r=r+Math.imul(N,Q)|0,i=(i=i+Math.imul(N,Z)|0)+Math.imul(D,Q)|0,o=o+Math.imul(D,Z)|0,r=r+Math.imul(P,J)|0,i=(i=i+Math.imul(P,ee)|0)+Math.imul(L,J)|0,o=o+Math.imul(L,ee)|0,r=r+Math.imul(R,ne)|0,i=(i=i+Math.imul(R,re)|0)+Math.imul(O,ne)|0,o=o+Math.imul(O,re)|0,r=r+Math.imul(M,oe)|0,i=(i=i+Math.imul(M,ae)|0)+Math.imul(C,oe)|0,o=o+Math.imul(C,ae)|0,r=r+Math.imul(E,ue)|0,i=(i=i+Math.imul(E,le)|0)+Math.imul(S,ue)|0,o=o+Math.imul(S,le)|0,r=r+Math.imul(w,de)|0,i=(i=i+Math.imul(w,fe)|0)+Math.imul(A,de)|0,o=o+Math.imul(A,fe)|0;var Ce=(l+(r=r+Math.imul(v,pe)|0)|0)+((8191&(i=(i=i+Math.imul(v,me)|0)+Math.imul(y,pe)|0))<<13)|0;l=((o=o+Math.imul(y,me)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,r=Math.imul(j,Q),i=(i=Math.imul(j,Z))+Math.imul(U,Q)|0,o=Math.imul(U,Z),r=r+Math.imul(N,J)|0,i=(i=i+Math.imul(N,ee)|0)+Math.imul(D,J)|0,o=o+Math.imul(D,ee)|0,r=r+Math.imul(P,ne)|0,i=(i=i+Math.imul(P,re)|0)+Math.imul(L,ne)|0,o=o+Math.imul(L,re)|0,r=r+Math.imul(R,oe)|0,i=(i=i+Math.imul(R,ae)|0)+Math.imul(O,oe)|0,o=o+Math.imul(O,ae)|0,r=r+Math.imul(M,ue)|0,i=(i=i+Math.imul(M,le)|0)+Math.imul(C,ue)|0,o=o+Math.imul(C,le)|0,r=r+Math.imul(E,de)|0,i=(i=i+Math.imul(E,fe)|0)+Math.imul(S,de)|0,o=o+Math.imul(S,fe)|0;var xe=(l+(r=r+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,me)|0)+Math.imul(A,pe)|0))<<13)|0;l=((o=o+Math.imul(A,me)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(j,J),i=(i=Math.imul(j,ee))+Math.imul(U,J)|0,o=Math.imul(U,ee),r=r+Math.imul(N,ne)|0,i=(i=i+Math.imul(N,re)|0)+Math.imul(D,ne)|0,o=o+Math.imul(D,re)|0,r=r+Math.imul(P,oe)|0,i=(i=i+Math.imul(P,ae)|0)+Math.imul(L,oe)|0,o=o+Math.imul(L,ae)|0,r=r+Math.imul(R,ue)|0,i=(i=i+Math.imul(R,le)|0)+Math.imul(O,ue)|0,o=o+Math.imul(O,le)|0,r=r+Math.imul(M,de)|0,i=(i=i+Math.imul(M,fe)|0)+Math.imul(C,de)|0,o=o+Math.imul(C,fe)|0;var Re=(l+(r=r+Math.imul(E,pe)|0)|0)+((8191&(i=(i=i+Math.imul(E,me)|0)+Math.imul(S,pe)|0))<<13)|0;l=((o=o+Math.imul(S,me)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,r=Math.imul(j,ne),i=(i=Math.imul(j,re))+Math.imul(U,ne)|0,o=Math.imul(U,re),r=r+Math.imul(N,oe)|0,i=(i=i+Math.imul(N,ae)|0)+Math.imul(D,oe)|0,o=o+Math.imul(D,ae)|0,r=r+Math.imul(P,ue)|0,i=(i=i+Math.imul(P,le)|0)+Math.imul(L,ue)|0,o=o+Math.imul(L,le)|0,r=r+Math.imul(R,de)|0,i=(i=i+Math.imul(R,fe)|0)+Math.imul(O,de)|0,o=o+Math.imul(O,fe)|0;var Oe=(l+(r=r+Math.imul(M,pe)|0)|0)+((8191&(i=(i=i+Math.imul(M,me)|0)+Math.imul(C,pe)|0))<<13)|0;l=((o=o+Math.imul(C,me)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,r=Math.imul(j,oe),i=(i=Math.imul(j,ae))+Math.imul(U,oe)|0,o=Math.imul(U,ae),r=r+Math.imul(N,ue)|0,i=(i=i+Math.imul(N,le)|0)+Math.imul(D,ue)|0,o=o+Math.imul(D,le)|0,r=r+Math.imul(P,de)|0,i=(i=i+Math.imul(P,fe)|0)+Math.imul(L,de)|0,o=o+Math.imul(L,fe)|0;var Te=(l+(r=r+Math.imul(R,pe)|0)|0)+((8191&(i=(i=i+Math.imul(R,me)|0)+Math.imul(O,pe)|0))<<13)|0;l=((o=o+Math.imul(O,me)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(j,ue),i=(i=Math.imul(j,le))+Math.imul(U,ue)|0,o=Math.imul(U,le),r=r+Math.imul(N,de)|0,i=(i=i+Math.imul(N,fe)|0)+Math.imul(D,de)|0,o=o+Math.imul(D,fe)|0;var Pe=(l+(r=r+Math.imul(P,pe)|0)|0)+((8191&(i=(i=i+Math.imul(P,me)|0)+Math.imul(L,pe)|0))<<13)|0;l=((o=o+Math.imul(L,me)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,r=Math.imul(j,de),i=(i=Math.imul(j,fe))+Math.imul(U,de)|0,o=Math.imul(U,fe);var Le=(l+(r=r+Math.imul(N,pe)|0)|0)+((8191&(i=(i=i+Math.imul(N,me)|0)+Math.imul(D,pe)|0))<<13)|0;l=((o=o+Math.imul(D,me)|0)+(i>>>13)|0)+(Le>>>26)|0,Le&=67108863;var Ie=(l+(r=Math.imul(j,pe))|0)+((8191&(i=(i=Math.imul(j,me))+Math.imul(U,pe)|0))<<13)|0;return l=((o=Math.imul(U,me))+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,u[0]=ge,u[1]=ve,u[2]=ye,u[3]=be,u[4]=we,u[5]=Ae,u[6]=_e,u[7]=Ee,u[8]=Se,u[9]=ke,u[10]=Me,u[11]=Ce,u[12]=xe,u[13]=Re,u[14]=Oe,u[15]=Te,u[16]=Pe,u[17]=Le,u[18]=Ie,0!==l&&(u[19]=l,n.length++),n};function p(e,t,n){return(new m).mulp(e,t,n)}function m(e,t){this.x=e,this.y=t}Math.imul||(h=f),i.prototype.mulTo=function(e,t){var n,r=this.length+e.length;return n=10===this.length&&10===e.length?h(this,e,t):r<63?f(this,e,t):r<1024?function(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o<n.length-1;o++){var a=i;i=0;for(var s=67108863&r,u=Math.min(o,t.length-1),l=Math.max(0,o-e.length+1);l<=u;l++){var c=o-l,d=(0|e.words[c])*(0|t.words[l]),f=67108863&d;s=67108863&(f=f+s|0),i+=(a=(a=a+(d/67108864|0)|0)+(f>>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,e,t):p(this,e,t),n},m.prototype.makeRBT=function(e){for(var t=new Array(e),n=i.prototype._countBits(e)-1,r=0;r<e;r++)t[r]=this.revBin(r,n,e);return t},m.prototype.revBin=function(e,t,n){if(0===e||e===n-1)return e;for(var r=0,i=0;i<t;i++)r|=(1&e)<<t-i-1,e>>=1;return r},m.prototype.permute=function(e,t,n,r,i,o){for(var a=0;a<o;a++)r[a]=t[e[a]],i[a]=n[e[a]]},m.prototype.transform=function(e,t,n,r,i,o){this.permute(o,e,t,n,r,i);for(var a=1;a<i;a<<=1)for(var s=a<<1,u=Math.cos(2*Math.PI/s),l=Math.sin(2*Math.PI/s),c=0;c<i;c+=s)for(var d=u,f=l,h=0;h<a;h++){var p=n[c+h],m=r[c+h],g=n[c+h+a],v=r[c+h+a],y=d*g-f*v;v=d*v+f*g,g=y,n[c+h]=p+g,r[c+h]=m+v,n[c+h+a]=p-g,r[c+h+a]=m-v,h!==s&&(y=u*d-l*f,f=u*f+l*d,d=y)}},m.prototype.guessLen13b=function(e,t){var n=1|Math.max(t,e),r=1&n,i=0;for(n=n/2|0;n;n>>>=1)i++;return 1<<i+1+r},m.prototype.conjugate=function(e,t,n){if(!(n<=1))for(var r=0;r<n/2;r++){var i=e[r];e[r]=e[n-r-1],e[n-r-1]=i,i=t[r],t[r]=-t[n-r-1],t[n-r-1]=-i}},m.prototype.normalize13b=function(e,t){for(var n=0,r=0;r<t/2;r++){var i=8192*Math.round(e[2*r+1]/t)+Math.round(e[2*r]/t)+n;e[r]=67108863&i,n=i<67108864?0:i/67108864|0}return e},m.prototype.convert13b=function(e,t,r,i){for(var o=0,a=0;a<t;a++)o+=0|e[a],r[2*a]=8191&o,o>>>=13,r[2*a+1]=8191&o,o>>>=13;for(a=2*t;a<i;++a)r[a]=0;n(0===o),n(0==(-8192&o))},m.prototype.stub=function(e){for(var t=new Array(e),n=0;n<e;n++)t[n]=0;return t},m.prototype.mulp=function(e,t,n){var r=2*this.guessLen13b(e.length,t.length),i=this.makeRBT(r),o=this.stub(r),a=new Array(r),s=new Array(r),u=new Array(r),l=new Array(r),c=new Array(r),d=new Array(r),f=n.words;f.length=r,this.convert13b(e.words,e.length,a,r),this.convert13b(t.words,t.length,l,r),this.transform(a,o,s,u,r,i),this.transform(l,o,c,d,r,i);for(var h=0;h<r;h++){var p=s[h]*c[h]-u[h]*d[h];u[h]=s[h]*d[h]+u[h]*c[h],s[h]=p}return this.conjugate(s,u,r),this.transform(s,u,f,o,r,i),this.conjugate(f,o,r),this.normalize13b(f,r),n.negative=e.negative^t.negative,n.length=e.length+t.length,n.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),p(this,e,t)},i.prototype.imul=function(e){return this.clone().mulTo(e,this)},i.prototype.imuln=function(e){n("number"==typeof e),n(e<67108864);for(var t=0,r=0;r<this.length;r++){var i=(0|this.words[r])*e,o=(67108863&i)+(67108863&t);t>>=26,t+=i/67108864|0,t+=o>>>26,this.words[r]=67108863&o}return 0!==t&&(this.words[r]=t,this.length++),this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n<t.length;n++){var r=n/26|0,i=n%26;t[n]=(e.words[r]&1<<i)>>>i}return t}(e);if(0===t.length)return new i(1);for(var n=this,r=0;r<t.length&&0===t[r];r++,n=n.sqr());if(++r<t.length)for(var o=n.sqr();r<t.length;r++,o=o.sqr())0!==t[r]&&(n=n.mul(o));return n},i.prototype.iushln=function(e){n("number"==typeof e&&e>=0);var t,r=e%26,i=(e-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(t=0;t<this.length;t++){var s=this.words[t]&o,u=(0|this.words[t])-s<<r;this.words[t]=u|a,a=s>>>26-r}a&&(this.words[t]=a,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this.strip()},i.prototype.ishln=function(e){return n(0===this.negative),this.iushln(e)},i.prototype.iushrn=function(e,t,r){var i;n("number"==typeof e&&e>=0),i=t?(t-t%26)/26:0;var o=e%26,a=Math.min((e-o)/26,this.length),s=67108863^67108863>>>o<<o,u=r;if(i-=a,i=Math.max(0,i),u){for(var l=0;l<a;l++)u.words[l]=this.words[l];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,l=0;l<this.length;l++)this.words[l]=this.words[l+a];else this.words[0]=0,this.length=1;var c=0;for(l=this.length-1;l>=0&&(0!==c||l>=i);l--){var d=0|this.words[l];this.words[l]=c<<26-o|d>>>o,c=d&s}return u&&0!==c&&(u.words[u.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,i=1<<t;return!(this.length<=r||!(this.words[r]&i))},i.prototype.imaskn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,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 n("number"==typeof e),n(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(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<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,r){var i,o,a=e.length+r;this._expand(a);var s=0;for(i=0;i<e.length;i++){o=(0|this.words[i+r])+s;var u=(0|e.words[i])*t;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)s=(o=(0|this.words[i+r])+s)>>26,this.words[i+r]=67108863&o;if(0===s)return this.strip();for(n(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},i.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),o=e,a=0|o.words[o.length-1];0!=(n=26-this._countBits(a))&&(o=o.ushln(n),r.iushln(n),a=0|o.words[o.length-1]);var s,u=r.length-o.length;if("mod"!==t){(s=new i(null)).length=u+1,s.words=new Array(s.length);for(var l=0;l<s.length;l++)s.words[l]=0}var c=r.clone()._ishlnsubmul(o,1,u);0===c.negative&&(r=c,s&&(s.words[u]=1));for(var d=u-1;d>=0;d--){var f=67108864*(0|r.words[o.length+d])+(0|r.words[o.length+d-1]);for(f=Math.min(f/a|0,67108863),r._ishlnsubmul(o,f,d);0!==r.negative;)f--,r.negative=0,r._ishlnsubmul(o,1,d),r.isZero()||(r.negative^=1);s&&(s.words[d]=f)}return s&&s.strip(),r.strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(o=s.div.neg()),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(e)),{div:o,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||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,a,s},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modn=function(e){n(e<=67108863);for(var t=(1<<26)%e,r=0,i=this.length-1;i>=0;i--)r=(t*r+(0|this.words[i]))%e;return r},i.prototype.idivn=function(e){n(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*t;this.words[r]=i/e|0,t=i%e}return this.strip()},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o=new i(1),a=new i(0),s=new i(0),u=new i(1),l=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++l;for(var c=r.clone(),d=t.clone();!t.isZero();){for(var f=0,h=1;0==(t.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(t.iushrn(f);f-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(c),a.isub(d)),o.iushrn(1),a.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(c),u.isub(d)),s.iushrn(1),u.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(s),a.isub(u)):(r.isub(t),s.isub(o),u.isub(a))}return{a:s,b:u,gcd:r.iushln(l)}},i.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o,a=new i(1),s=new i(0),u=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var l=0,c=1;0==(t.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(t.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var d=0,f=1;0==(r.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(r.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(s)):(r.isub(t),s.isub(a))}return(o=0===t.cmpn(1)?a:s).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(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var o=i,a=r;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0: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,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){r<i?t=-1:r>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 _(e)},i.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var g={k256:null,p224:null,p192:null,p25519:null};function v(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function A(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function _(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function E(e){_.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},v.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},v.prototype.split=function(e,t){e.iushrn(this.n,0,t)},v.prototype.imulK=function(e){return e.imul(this.k)},r(y,v),y.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i<r;i++)t.words[i]=e.words[i];if(t.length=r,e.length<=9)return e.words[0]=0,void(e.length=1);var o=e.words[9];for(t.words[t.length++]=o&n,i=10;i<e.length;i++){var a=0|e.words[i];e.words[i-10]=(a&n)<<4|o>>>22,o=a}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},y.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n<e.length;n++){var r=0|e.words[n];t+=977*r,e.words[n]=67108863&t,t=64*r+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},r(b,v),r(w,v),r(A,v),A.prototype.imulK=function(e){for(var t=0,n=0;n<e.length;n++){var r=19*(0|e.words[n])+t,i=67108863&r;r>>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(g[e])return g[e];var t;if("k256"===e)t=new y;else if("p224"===e)t=new b;else if("p192"===e)t=new w;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new A}return g[e]=t,t},_.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},_.prototype._verify2=function(e,t){n(0==(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},_.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},_.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},_.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},_.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},_.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},_.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},_.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},_.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},_.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},_.prototype.isqr=function(e){return this.imul(e,e.clone())},_.prototype.sqr=function(e){return this.mul(e,e)},_.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new i(1)).iushrn(2);return this.pow(e,r)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);n(!o.isZero());var s=new i(1).toRed(this),u=s.redNeg(),l=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new i(2*c*c).toRed(this);0!==this.pow(c,l).cmp(u);)c.redIAdd(u);for(var d=this.pow(c,o),f=this.pow(e,o.addn(1).iushrn(1)),h=this.pow(e,o),p=a;0!==h.cmp(s);){for(var m=h,g=0;0!==m.cmp(s);g++)m=m.redSqr();n(g<p);var v=this.pow(d,new i(1).iushln(p-g-1));f=f.redMul(v),d=v.redSqr(),h=h.redMul(d),p=g}return f},_.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},_.prototype.pow=function(e,t){if(t.isZero())return new i(1).toRed(this);if(0===t.cmpn(1))return e.clone();var n=new Array(16);n[0]=new i(1).toRed(this),n[1]=e;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],e);var o=n[0],a=0,s=0,u=t.bitLength()%26;for(0===u&&(u=26),r=t.length-1;r>=0;r--){for(var l=t.words[r],c=u-1;c>=0;c--){var d=l>>c&1;o!==n[0]&&(o=this.sqr(o)),0!==d||0!==a?(a<<=1,a|=d,(4==++s||0===r&&0===c)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}u=26}return o},_.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},_.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new E(e)},r(E,_),E.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},E.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},E.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):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 n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(r).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},E.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(df,hr);var ff,hf,pf,mf,gf,vf=df.exports,yf={exports:{}};function bf(){if(ff)return yf.exports;var e;function t(e){this.rand=e}if(ff=1,yf.exports=function(n){return e||(e=new t(null)),e.generate(n)},yf.exports.Rand=t,t.prototype.generate=function(e){return this._rand(e)},t.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),n=0;n<t.length;n++)t[n]=this.rand.getByte();return t},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?t.prototype._rand=function(e){var t=new Uint8Array(e);return self.crypto.getRandomValues(t),t}:self.msCrypto&&self.msCrypto.getRandomValues?t.prototype._rand=function(e){var t=new Uint8Array(e);return self.msCrypto.getRandomValues(t),t}:"object"==typeof window&&(t.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var n=zb();if("function"!=typeof n.randomBytes)throw new Error("Not supported");t.prototype._rand=function(e){return n.randomBytes(e)}}catch(e){}return yf.exports}function wf(){if(pf)return hf;pf=1;var e=vf,t=bf();function n(e){this.rand=e||new t.Rand}return hf=n,n.create=function(e){return new n(e)},n.prototype._randbelow=function(t){var n=t.bitLength(),r=Math.ceil(n/8);do{var i=new e(this.rand.generate(r))}while(i.cmp(t)>=0);return i},n.prototype._randrange=function(e,t){var n=t.sub(e);return e.add(this._randbelow(n))},n.prototype.test=function(t,n,r){var i=t.bitLength(),o=e.mont(t),a=new e(1).toRed(o);n||(n=Math.max(1,i/48|0));for(var s=t.subn(1),u=0;!s.testn(u);u++);for(var l=t.shrn(u),c=s.toRed(o);n>0;n--){var d=this._randrange(new e(2),s);r&&r(d);var f=d.toRed(o).redPow(l);if(0!==f.cmp(a)&&0!==f.cmp(c)){for(var h=1;h<u;h++){if(0===(f=f.redSqr()).cmp(a))return!1;if(0===f.cmp(c))break}if(h===u)return!1}}return!0},n.prototype.getDivisor=function(t,n){var r=t.bitLength(),i=e.mont(t),o=new e(1).toRed(i);n||(n=Math.max(1,r/48|0));for(var a=t.subn(1),s=0;!a.testn(s);s++);for(var u=t.shrn(s),l=a.toRed(i);n>0;n--){var c=this._randrange(new e(2),a),d=t.gcd(c);if(0!==d.cmpn(1))return d;var f=c.toRed(i).redPow(u);if(0!==f.cmp(o)&&0!==f.cmp(l)){for(var h=1;h<s;h++){if(0===(f=f.redSqr()).cmp(o))return f.fromRed().subn(1).gcd(t);if(0===f.cmp(l))break}if(h===s)return(f=f.redSqr()).fromRed().subn(1).gcd(t)}}return!1},hf}function Af(){if(gf)return mf;gf=1;var e=Zr;mf=p,p.simpleSieve=f,p.fermatTest=h;var t=vf,n=new t(24),r=new(wf()),i=new t(1),o=new t(2),a=new t(5);new t(16),new t(8);var s=new t(10),u=new t(3);new t(7);var l=new t(11),c=new t(4);new t(12);var d=null;function f(e){for(var t=function(){if(null!==d)return d;var e=[];e[0]=2;for(var t=1,n=3;n<1048576;n+=2){for(var r=Math.ceil(Math.sqrt(n)),i=0;i<t&&e[i]<=r&&n%e[i]!=0;i++);t!==i&&e[i]<=r||(e[t++]=n)}return d=e,e}(),n=0;n<t.length;n++)if(0===e.modn(t[n]))return 0===e.cmpn(t[n]);return!0}function h(e){var n=t.mont(e);return 0===o.toRed(n).redPow(e.subn(1)).fromRed().cmpn(1)}function p(d,p){if(d<16)return new t(2===p||5===p?[140,123]:[140,39]);var m,g;for(p=new t(p);;){for(m=new t(e(Math.ceil(d/8)));m.bitLength()>d;)m.ishrn(1);if(m.isEven()&&m.iadd(i),m.testn(1)||m.iadd(o),p.cmp(o)){if(!p.cmp(a))for(;m.mod(s).cmp(u);)m.iadd(c)}else for(;m.mod(n).cmp(l);)m.iadd(c);if(f(g=m.shrn(1))&&f(m)&&h(g)&&h(m)&&r.test(g)&&r.test(m))return m}}return mf}var _f,Ef,Sf,kf,Mf,Cf={modp1:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}},xf={exports:{}},Rf=ui.EventEmitter;function Of(e,t){Pf(e,t),Tf(e)}function Tf(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function Pf(e,t){e.emit("error",t)}var Lf={destroy:function(e,t){var n=this,r=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return r||i?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,Tr(Pf,this,e)):Tr(Pf,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?n._writableState?n._writableState.errorEmitted?Tr(Tf,n):(n._writableState.errorEmitted=!0,Tr(Of,n,e)):Tr(Of,n,e):t?(Tr(Tf,n),t(e)):Tr(Tf,n)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var n=e._readableState,r=e._writableState;n&&n.autoDestroy||r&&r.autoDestroy?e.destroy(t):e.emit("error",t)}},If={},Nf={};function Df(e,t,n){n||(n=Error);var r=function(e){var n,r;function i(n,r,i){return e.call(this,function(e,n,r){return"string"==typeof t?t:t(e,n,r)}(n,r,i))||this}return r=e,(n=i).prototype=Object.create(r.prototype),n.prototype.constructor=n,n.__proto__=r,i}(n);r.prototype.name=n.name,r.prototype.code=e,Nf[e]=r}function Bf(e,t){if(Array.isArray(e)){var n=e.length;return e=e.map((function(e){return String(e)})),n>2?"one of ".concat(t," ").concat(e.slice(0,n-1).join(", "),", or ")+e[n-1]:2===n?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}Df("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),Df("ERR_INVALID_ARG_TYPE",(function(e,t,n){var r,i,o;if("string"==typeof t&&(i="not ",t.substr(0,4)===i)?(r="must not be",t=t.replace(/^not /,"")):r="must be",function(e,t,n){return(void 0===n||n>e.length)&&(n=e.length),e.substring(n-9,n)===t}(e," argument"))o="The ".concat(e," ").concat(r," ").concat(Bf(t,"type"));else{var a=function(e,t,n){return"number"!=typeof n&&(n=0),!(n+1>e.length)&&-1!==e.indexOf(".",n)}(e)?"property":"argument";o='The "'.concat(e,'" ').concat(a," ").concat(r," ").concat(Bf(t,"type"))}return o+". Received type ".concat(typeof n)}),TypeError),Df("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),Df("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),Df("ERR_STREAM_PREMATURE_CLOSE","Premature close"),Df("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),Df("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),Df("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),Df("ERR_STREAM_WRITE_AFTER_END","write after end"),Df("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),Df("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),Df("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),If.codes=Nf;var jf,Uf,zf,Ff,qf=If.codes.ERR_INVALID_OPT_VALUE,Wf={getHighWaterMark:function(e,t,n,r){var i=function(e,t,n){return null!=e.highWaterMark?e.highWaterMark:t?e[n]:null}(t,r,n);if(null!=i){if(!isFinite(i)||Math.floor(i)!==i||i<0)throw new qf(r?n:"highWaterMark",i);return Math.floor(i)}return e.objectMode?16:16384}};function Vf(){if(Uf)return jf;function e(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,n){var r=e.entry;for(e.entry=null;r;){var i=r.callback;t.pendingcb--,i(void 0),r=r.next}t.corkedRequestsFree.next=e}(t,e)}}var t;Uf=1,jf=A,A.WritableState=w;var n,r={deprecate:fo()},i=Rf,o=yr.Buffer,a=(void 0!==hr?hr:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},s=Lf,u=Wf.getHighWaterMark,l=If.codes,c=l.ERR_INVALID_ARG_TYPE,d=l.ERR_METHOD_NOT_IMPLEMENTED,f=l.ERR_MULTIPLE_CALLBACK,h=l.ERR_STREAM_CANNOT_PIPE,p=l.ERR_STREAM_DESTROYED,m=l.ERR_STREAM_NULL_VALUES,g=l.ERR_STREAM_WRITE_AFTER_END,v=l.ERR_UNKNOWN_ENCODING,y=s.errorOrDestroy;function b(){}function w(n,r,i){t=t||Kf(),n=n||{},"boolean"!=typeof i&&(i=r instanceof t),this.objectMode=!!n.objectMode,i&&(this.objectMode=this.objectMode||!!n.writableObjectMode),this.highWaterMark=u(this,n,"writableHighWaterMark",i),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var o=!1===n.decodeStrings;this.decodeStrings=!o,this.defaultEncoding=n.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,i=n.writecb;if("function"!=typeof i)throw new f;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,i){--t.pendingcb,n?(Tr(i,r),Tr(C,e,t),e._writableState.errorEmitted=!0,y(e,r)):(i(r),e._writableState.errorEmitted=!0,y(e,r),C(e,t))}(e,n,r,t,i);else{var o=k(n)||e.destroyed;o||n.corked||n.bufferProcessing||!n.bufferedRequest||S(e,n),r?Tr(E,e,n,o,i):E(e,n,o,i)}}(r,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==n.emitClose,this.autoDestroy=!!n.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}function A(e){var r=this instanceof(t=t||Kf());if(!r&&!n.call(A,this))return new A(e);this._writableState=new w(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)),i.call(this)}function _(e,t,n,r,i,o,a){t.writelen=r,t.writecb=a,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new p("write")):n?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function E(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),C(e,t)}function S(t,n){n.bufferProcessing=!0;var r=n.bufferedRequest;if(t._writev&&r&&r.next){var i=n.bufferedRequestCount,o=new Array(i),a=n.corkedRequestsFree;a.entry=r;for(var s=0,u=!0;r;)o[s]=r,r.isBuf||(u=!1),r=r.next,s+=1;o.allBuffers=u,_(t,n,!0,n.length,o,"",a.finish),n.pendingcb++,n.lastBufferedRequest=null,a.next?(n.corkedRequestsFree=a.next,a.next=null):n.corkedRequestsFree=new e(n),n.bufferedRequestCount=0}else{for(;r;){var l=r.chunk,c=r.encoding,d=r.callback;if(_(t,n,!1,n.objectMode?1:l.length,l,c,d),r=r.next,n.bufferedRequestCount--,n.writing)break}null===r&&(n.lastBufferedRequest=null)}n.bufferedRequest=r,n.bufferProcessing=!1}function k(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function M(e,t){e._final((function(n){t.pendingcb--,n&&y(e,n),t.prefinished=!0,e.emit("prefinish"),C(e,t)}))}function C(e,t){var n=k(t);if(n&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,Tr(M,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var r=e._readableState;(!r||r.autoDestroy&&r.endEmitted)&&e.destroy()}return n}return Jr(A,i),w.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(w.prototype,"buffer",{get:r.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(n=Function.prototype[Symbol.hasInstance],Object.defineProperty(A,Symbol.hasInstance,{value:function(e){return!!n.call(this,e)||this===A&&e&&e._writableState instanceof w}})):n=function(e){return e instanceof this},A.prototype.pipe=function(){y(this,new h)},A.prototype.write=function(e,t,n){var r,i=this._writableState,s=!1,u=!i.objectMode&&(r=e,o.isBuffer(r)||r instanceof a);return u&&!o.isBuffer(e)&&(e=function(e){return o.from(e)}(e)),"function"==typeof t&&(n=t,t=null),u?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof n&&(n=b),i.ending?function(e,t){var n=new g;y(e,n),Tr(t,n)}(this,n):(u||function(e,t,n,r){var i;return null===n?i=new m:"string"==typeof n||t.objectMode||(i=new c("chunk",["string","Buffer"],n)),!i||(y(e,i),Tr(r,i),!1)}(this,i,e,n))&&(i.pendingcb++,s=function(e,t,n,r,i,a){if(!n){var s=function(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=o.from(t,n)),t}(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var u=t.objectMode?1:r.length;t.length+=u;var l=t.length<t.highWaterMark;if(l||(t.needDrain=!0),t.writing||t.corked){var c=t.lastBufferedRequest;t.lastBufferedRequest={chunk:r,encoding:i,isBuf:n,callback:a,next:null},c?c.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else _(e,t,!1,u,r,i,a);return l}(this,i,u,e,t,n)),s},A.prototype.cork=function(){this._writableState.corked++},A.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||S(this,e))},A.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 v(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(A.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(A.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),A.prototype._write=function(e,t,n){n(new d("_write()"))},A.prototype._writev=null,A.prototype.end=function(e,t,n){var r=this._writableState;return"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||function(e,t,n){t.ending=!0,C(e,t),n&&(t.finished?Tr(n):e.once("finish",n)),t.ended=!0,e.writable=!1}(this,r,n),this},Object.defineProperty(A.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(A.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),A.prototype.destroy=s.destroy,A.prototype._undestroy=s.undestroy,A.prototype._destroy=function(e,t){t(e)},jf}function Kf(){if(Ff)return zf;Ff=1;var e=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};zf=a;var t=ih(),n=Vf();Jr(a,t);for(var r=e(n.prototype),i=0;i<r.length;i++){var o=r[i];a.prototype[o]||(a.prototype[o]=n.prototype[o])}function a(e){if(!(this instanceof a))return new a(e);t.call(this,e),n.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",s)))}function s(){this._writableState.ended||Tr(u,this)}function u(e){e.end()}return Object.defineProperty(a.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(a.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(a.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(a.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._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)}}),zf}var Hf,$f={};function Yf(){if(Hf)return $f;Hf=1;var e=$r.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 n(n){var r;switch(this.encoding=function(n){var r=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}}(n);if("string"!=typeof r&&(e.isEncoding===t||!t(n)))throw new Error("Unknown encoding: "+n);return r||n}(n),this.encoding){case"utf16le":this.text=o,this.end=a,r=4;break;case"utf8":this.fillLast=i,r=4;break;case"base64":this.text=s,this.end=u,r=3;break;default:return this.write=l,void(this.end=c)}this.lastNeed=0,this.lastTotal=0,this.lastChar=e.allocUnsafe(r)}function r(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,n=function(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function o(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function a(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function s(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function u(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 c(e){return e&&e.length?this.write(e):""}return $f.StringDecoder=n,n.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||""},n.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},n.prototype.text=function(e,t){var n=function(e,t,n){var i=t.length-1;if(i<n)return 0;var o=r(t[i]);return o>=0?(o>0&&(e.lastNeed=o-1),o):--i<n||-2===o?0:(o=r(t[i]))>=0?(o>0&&(e.lastNeed=o-2),o):--i<n||-2===o?0:(o=r(t[i]))>=0?(o>0&&(2===o?o=0:e.lastNeed=o-3),o):0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var i=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,i),e.toString("utf8",t,i)},n.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length},$f}var Gf=If.codes.ERR_STREAM_PREMATURE_CLOSE;function Qf(){}var Zf,Xf,Jf,eh,th,nh,rh=function e(t,n,r){if("function"==typeof n)return e(t,null,n);n||(n={}),r=function(e){var t=!1;return function(){if(!t){t=!0;for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];e.apply(this,r)}}}(r||Qf);var i=n.readable||!1!==n.readable&&t.readable,o=n.writable||!1!==n.writable&&t.writable,a=function(){t.writable||u()},s=t._writableState&&t._writableState.finished,u=function(){o=!1,s=!0,i||r.call(t)},l=t._readableState&&t._readableState.endEmitted,c=function(){i=!1,l=!0,o||r.call(t)},d=function(e){r.call(t,e)},f=function(){var e;return i&&!l?(t._readableState&&t._readableState.ended||(e=new Gf),r.call(t,e)):o&&!s?(t._writableState&&t._writableState.ended||(e=new Gf),r.call(t,e)):void 0},h=function(){t.req.on("finish",u)};return function(e){return e.setHeader&&"function"==typeof e.abort}(t)?(t.on("complete",u),t.on("abort",f),t.req?h():t.on("request",h)):o&&!t._writableState&&(t.on("end",a),t.on("close",a)),t.on("end",c),t.on("finish",u),!1!==n.error&&t.on("error",d),t.on("close",f),function(){t.removeListener("complete",u),t.removeListener("abort",f),t.removeListener("request",h),t.req&&t.req.removeListener("finish",u),t.removeListener("end",a),t.removeListener("close",a),t.removeListener("finish",u),t.removeListener("end",c),t.removeListener("error",d),t.removeListener("close",f)}};function ih(){if(nh)return th;var e;nh=1,th=A,A.ReadableState=w,ui.EventEmitter;var t,n=function(e,t){return e.listeners(t).length},r=Rf,i=yr.Buffer,o=(void 0!==hr?hr:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},a=Yi;t=a&&a.debuglog?a.debuglog("stream"):function(){};var s,u,l,c=function(){if(Mf)return kf;function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function t(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?e(Object(i),!0).forEach((function(e){n(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 n(e,t,n){return(t=i(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,i(r.key),r)}}function i(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}Mf=1;var o=yr.Buffer,a=Yi.inspect,s=a&&a.custom||"inspect";return kf=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 n,i;return n=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,n=""+t.data;t=t.next;)n+=e+t.data;return n}},{key:"concat",value:function(e){if(0===this.length)return o.alloc(0);for(var t,n,r,i=o.allocUnsafe(e>>>0),a=this.head,s=0;a;)t=a.data,n=i,r=s,o.prototype.copy.call(t,n,r),s+=a.data.length,a=a.next;return i}},{key:"consume",value:function(e,t){var n;return e<this.head.data.length?(n=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):n=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),n}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,n=1,r=t.data;for(e-=r.length;t=t.next;){var i=t.data,o=e>i.length?i.length:e;if(o===i.length?r+=i:r+=i.slice(0,e),0==(e-=o)){o===i.length?(++n,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(e){var t=o.allocUnsafe(e),n=this.head,r=1;for(n.data.copy(t),e-=n.data.length;n=n.next;){var i=n.data,a=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,a),0==(e-=a)){a===i.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=i.slice(a));break}++r}return this.length-=r,t}},{key:s,value:function(e,n){return a(this,t(t({},n),{},{depth:0,customInspect:!1}))}}],i&&r(n.prototype,i),Object.defineProperty(n,"prototype",{writable:!1}),e}(),kf}(),d=Lf,f=Wf.getHighWaterMark,h=If.codes,p=h.ERR_INVALID_ARG_TYPE,m=h.ERR_STREAM_PUSH_AFTER_EOF,g=h.ERR_METHOD_NOT_IMPLEMENTED,v=h.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;Jr(A,r);var y=d.errorOrDestroy,b=["error","close","destroy","pause","resume"];function w(t,n,r){e=e||Kf(),t=t||{},"boolean"!=typeof r&&(r=n instanceof e),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=f(this,t,"readableHighWaterMark",r),this.buffer=new c,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&&(s||(s=Yf().StringDecoder),this.decoder=new s(t.encoding),this.encoding=t.encoding)}function A(t){if(e=e||Kf(),!(this instanceof A))return new A(t);var n=this instanceof e;this._readableState=new w(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 _(e,n,r,a,s){t("readableAddChunk",n);var u,l=e._readableState;if(null===n)l.reading=!1,function(e,n){if(t("onEofChunk"),!n.ended){if(n.decoder){var r=n.decoder.end();r&&r.length&&(n.buffer.push(r),n.length+=n.objectMode?1:r.length)}n.ended=!0,n.sync?M(e):(n.needReadable=!1,n.emittedReadable||(n.emittedReadable=!0,C(e)))}}(e,l);else if(s||(u=function(e,t){var n,r;return r=t,i.isBuffer(r)||r instanceof o||"string"==typeof t||void 0===t||e.objectMode||(n=new p("chunk",["string","Buffer","Uint8Array"],t)),n}(l,n)),u)y(e,u);else if(l.objectMode||n&&n.length>0)if("string"==typeof n||l.objectMode||Object.getPrototypeOf(n)===i.prototype||(n=function(e){return i.from(e)}(n)),a)l.endEmitted?y(e,new v):E(e,l,n,!0);else if(l.ended)y(e,new m);else{if(l.destroyed)return!1;l.reading=!1,l.decoder&&!r?(n=l.decoder.write(n),l.objectMode||0!==n.length?E(e,l,n,!1):x(e,l)):E(e,l,n,!1)}else a||(l.reading=!1,x(e,l));return!l.ended&&(l.length<l.highWaterMark||0===l.length)}function E(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",n)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&M(e)),x(e,t)}Object.defineProperty(A.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),A.prototype.destroy=d.destroy,A.prototype._undestroy=d.undestroy,A.prototype._destroy=function(e,t){t(e)},A.prototype.push=function(e,t){var n,r=this._readableState;return r.objectMode?n=!0:"string"==typeof e&&((t=t||r.defaultEncoding)!==r.encoding&&(e=i.from(e,t),t=""),n=!0),_(this,e,t,!1,n)},A.prototype.unshift=function(e){return _(this,e,null,!0,!1)},A.prototype.isPaused=function(){return!1===this._readableState.flowing},A.prototype.setEncoding=function(e){s||(s=Yf().StringDecoder);var t=new s(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,r="";null!==n;)r+=t.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==r&&this._readableState.buffer.push(r),this._readableState.length=r.length,this};var S=1073741824;function k(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>=S?e=S:(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 M(e){var n=e._readableState;t("emitReadable",n.needReadable,n.emittedReadable),n.needReadable=!1,n.emittedReadable||(t("emitReadable",n.flowing),n.emittedReadable=!0,Tr(C,e))}function C(e){var n=e._readableState;t("emitReadable_",n.destroyed,n.length,n.ended),n.destroyed||!n.length&&!n.ended||(e.emit("readable"),n.emittedReadable=!1),n.needReadable=!n.flowing&&!n.ended&&n.length<=n.highWaterMark,L(e)}function x(e,t){t.readingMore||(t.readingMore=!0,Tr(R,e,t))}function R(e,n){for(;!n.reading&&!n.ended&&(n.length<n.highWaterMark||n.flowing&&0===n.length);){var r=n.length;if(t("maybeReadMore read 0"),e.read(0),r===n.length)break}n.readingMore=!1}function O(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 T(e){t("readable nexttick read 0"),e.read(0)}function P(e,n){t("resume",n.reading),n.reading||e.read(0),n.resumeScheduled=!1,e.emit("resume"),L(e),n.flowing&&!n.reading&&e.read(0)}function L(e){var n=e._readableState;for(t("flow",n.flowing);n.flowing&&null!==e.read(););}function I(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n);var n}function N(e){var n=e._readableState;t("endReadable",n.endEmitted),n.endEmitted||(n.ended=!0,Tr(D,n,e))}function D(e,n){if(t("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,n.readable=!1,n.emit("end"),e.autoDestroy)){var r=n._writableState;(!r||r.autoDestroy&&r.finished)&&n.destroy()}}function B(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}return A.prototype.read=function(e){t("read",e),e=parseInt(e,10);var n=this._readableState,r=e;if(0!==e&&(n.emittedReadable=!1),0===e&&n.needReadable&&((0!==n.highWaterMark?n.length>=n.highWaterMark:n.length>0)||n.ended))return t("read: emitReadable",n.length,n.ended),0===n.length&&n.ended?N(this):M(this),null;if(0===(e=k(e,n))&&n.ended)return 0===n.length&&N(this),null;var i,o=n.needReadable;return t("need readable",o),(0===n.length||n.length-e<n.highWaterMark)&&t("length less than watermark",o=!0),n.ended||n.reading?t("reading or ended",o=!1):o&&(t("do read"),n.reading=!0,n.sync=!0,0===n.length&&(n.needReadable=!0),this._read(n.highWaterMark),n.sync=!1,n.reading||(e=k(r,n))),null===(i=e>0?I(e,n):null)?(n.needReadable=n.length<=n.highWaterMark,e=0):(n.length-=e,n.awaitDrain=0),0===n.length&&(n.ended||(n.needReadable=!0),r!==e&&n.ended&&N(this)),null!==i&&this.emit("data",i),i},A.prototype._read=function(e){y(this,new g("_read()"))},A.prototype.pipe=function(e,r){var i=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,t("pipe count=%d opts=%j",o.pipesCount,r);var a=r&&!1===r.end||e===Vr.stdout||e===Vr.stderr?p:s;function s(){t("onend"),e.end()}o.endEmitted?Tr(a):i.once("end",a),e.on("unpipe",(function n(r,a){t("onunpipe"),r===i&&a&&!1===a.hasUnpiped&&(a.hasUnpiped=!0,t("cleanup"),e.removeListener("close",f),e.removeListener("finish",h),e.removeListener("drain",u),e.removeListener("error",d),e.removeListener("unpipe",n),i.removeListener("end",s),i.removeListener("end",p),i.removeListener("data",c),l=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||u())}));var u=function(e){return function(){var r=e._readableState;t("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,0===r.awaitDrain&&n(e,"data")&&(r.flowing=!0,L(e))}}(i);e.on("drain",u);var l=!1;function c(n){t("ondata");var r=e.write(n);t("dest.write",r),!1===r&&((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==B(o.pipes,e))&&!l&&(t("false write response, pause",o.awaitDrain),o.awaitDrain++),i.pause())}function d(r){t("onerror",r),p(),e.removeListener("error",d),0===n(e,"error")&&y(e,r)}function f(){e.removeListener("finish",h),p()}function h(){t("onfinish"),e.removeListener("close",f),p()}function p(){t("unpipe"),i.unpipe(e)}return i.on("data",c),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",d),e.once("close",f),e.once("finish",h),e.emit("pipe",i),o.flowing||(t("pipe resume"),i.resume()),e},A.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n)),this;if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<i;o++)r[o].emit("unpipe",this,{hasUnpiped:!1});return this}var a=B(t.pipes,e);return-1===a||(t.pipes.splice(a,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,n)),this},A.prototype.on=function(e,n){var i=r.prototype.on.call(this,e,n),o=this._readableState;return"data"===e?(o.readableListening=this.listenerCount("readable")>0,!1!==o.flowing&&this.resume()):"readable"===e&&(o.endEmitted||o.readableListening||(o.readableListening=o.needReadable=!0,o.flowing=!1,o.emittedReadable=!1,t("on readable",o.length,o.reading),o.length?M(this):o.reading||Tr(T,this))),i},A.prototype.addListener=A.prototype.on,A.prototype.removeListener=function(e,t){var n=r.prototype.removeListener.call(this,e,t);return"readable"===e&&Tr(O,this),n},A.prototype.removeAllListeners=function(e){var t=r.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||Tr(O,this),t},A.prototype.resume=function(){var e=this._readableState;return e.flowing||(t("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,Tr(P,e,t))}(this,e)),e.paused=!1,this},A.prototype.pause=function(){return t("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(t("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},A.prototype.wrap=function(e){var n=this,r=this._readableState,i=!1;for(var o in e.on("end",(function(){if(t("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&n.push(e)}n.push(null)})),e.on("data",(function(o){t("wrapped data"),r.decoder&&(o=r.decoder.write(o)),r.objectMode&&null==o||(r.objectMode||o&&o.length)&&(n.push(o)||(i=!0,e.pause()))})),e)void 0===this[o]&&"function"==typeof e[o]&&(this[o]=function(t){return function(){return e[t].apply(e,arguments)}}(o));for(var a=0;a<b.length;a++)e.on(b[a],this.emit.bind(this,b[a]));return this._read=function(n){t("wrapped _read",n),i&&(i=!1,e.resume())},this},"function"==typeof Symbol&&(A.prototype[Symbol.asyncIterator]=function(){return void 0===u&&(u=function(){if(Xf)return Zf;var e;function t(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Xf=1;var n=rh,r=Symbol("lastResolve"),i=Symbol("lastReject"),o=Symbol("error"),a=Symbol("ended"),s=Symbol("lastPromise"),u=Symbol("handlePromise"),l=Symbol("stream");function c(e,t){return{value:e,done:t}}function d(e){var t=e[r];if(null!==t){var n=e[l].read();null!==n&&(e[s]=null,e[r]=null,e[i]=null,t(c(n,!1)))}}function f(e){Tr(d,e)}var h=Object.getPrototypeOf((function(){})),p=Object.setPrototypeOf((t(e={get stream(){return this[l]},next:function(){var e=this,t=this[o];if(null!==t)return Promise.reject(t);if(this[a])return Promise.resolve(c(void 0,!0));if(this[l].destroyed)return new Promise((function(t,n){Tr((function(){e[o]?n(e[o]):t(c(void 0,!0))}))}));var n,r=this[s];if(r)n=new Promise(function(e,t){return function(n,r){e.then((function(){t[a]?n(c(void 0,!0)):t[u](n,r)}),r)}}(r,this));else{var i=this[l].read();if(null!==i)return Promise.resolve(c(i,!1));n=new Promise(this[u])}return this[s]=n,n}},Symbol.asyncIterator,(function(){return this})),t(e,"return",(function(){var e=this;return new Promise((function(t,n){e[l].destroy(null,(function(e){e?n(e):t(c(void 0,!0))}))}))})),e),h);return Zf=function(e){var d,h=Object.create(p,(t(d={},l,{value:e,writable:!0}),t(d,r,{value:null,writable:!0}),t(d,i,{value:null,writable:!0}),t(d,o,{value:null,writable:!0}),t(d,a,{value:e._readableState.endEmitted,writable:!0}),t(d,u,{value:function(e,t){var n=h[l].read();n?(h[s]=null,h[r]=null,h[i]=null,e(c(n,!1))):(h[r]=e,h[i]=t)},writable:!0}),d));return h[s]=null,n(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=h[i];return null!==t&&(h[s]=null,h[r]=null,h[i]=null,t(e)),void(h[o]=e)}var n=h[r];null!==n&&(h[s]=null,h[r]=null,h[i]=null,n(c(void 0,!0))),h[a]=!0})),e.on("readable",f.bind(null,h)),h},Zf}()),u(this)}),Object.defineProperty(A.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(A.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(A.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),A._fromList=I,Object.defineProperty(A.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(A.from=function(e,t){return void 0===l&&(l=eh?Jf:(eh=1,Jf=function(){throw new Error("Readable.from is not available in the browser")})),l(A,e,t)}),th}var oh=hh,ah=If.codes,sh=ah.ERR_METHOD_NOT_IMPLEMENTED,uh=ah.ERR_MULTIPLE_CALLBACK,lh=ah.ERR_TRANSFORM_ALREADY_TRANSFORMING,ch=ah.ERR_TRANSFORM_WITH_LENGTH_0,dh=Kf();function fh(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(null===r)return this.emit("error",new uh);n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function hh(e){if(!(this instanceof hh))return new hh(e);dh.call(this,e),this._transformState={afterTransform:fh.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",ph)}function ph(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?mh(this,null,null):this._flush((function(t,n){mh(e,t,n)}))}function mh(e,t,n){if(t)return e.emit("error",t);if(null!=n&&e.push(n),e._writableState.length)throw new ch;if(e._transformState.transforming)throw new lh;return e.push(null)}Jr(hh,dh),hh.prototype.push=function(e,t){return this._transformState.needTransform=!1,dh.prototype.push.call(this,e,t)},hh.prototype._transform=function(e,t,n){n(new sh("_transform()"))},hh.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},hh.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))},hh.prototype._destroy=function(e,t){dh.prototype._destroy.call(this,e,(function(e){t(e)}))};var gh,vh=bh,yh=oh;function bh(e){if(!(this instanceof bh))return new bh(e);yh.call(this,e)}Jr(bh,yh),bh.prototype._transform=function(e,t,n){n(null,e)};var wh=If.codes,Ah=wh.ERR_MISSING_ARGS,_h=wh.ERR_STREAM_DESTROYED;function Eh(e){if(e)throw e}function Sh(e){e()}function kh(e,t){return e.pipe(t)}var Mh=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r,i=function(e){return e.length?"function"!=typeof e[e.length-1]?Eh:e.pop():Eh}(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new Ah("streams");var o=t.map((function(e,n){var a=n<t.length-1;return function(e,t,n,r){r=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(r);var i=!1;e.on("close",(function(){i=!0})),void 0===gh&&(gh=rh),gh(e,{readable:t,writable:n},(function(e){if(e)return r(e);i=!0,r()}));var o=!1;return function(t){if(!i&&!o)return o=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void r(t||new _h("pipe"))}}(e,a,n>0,(function(e){r||(r=e),e&&o.forEach(Sh),a||(o.forEach(Sh),i(r))}))}));return t.reduce(kh)};!function(e,t){(t=xf.exports=ih()).Stream=t,t.Readable=t,t.Writable=Vf(),t.Duplex=Kf(),t.Transform=oh,t.PassThrough=vh,t.finished=rh,t.pipeline=Mh}(0,xf.exports);var Ch=xf.exports,xh={exports:{}},Rh={exports:{}};!function(e,t){function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function r(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function i(e,t,n){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}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:yr.Buffer}catch(e){}function a(e,t){var r=e.charCodeAt(t);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+e)}function s(e,t,n){var r=a(e,n);return n-1>=t&&(r|=a(e,n-1)<<4),r}function u(e,t,r,i){for(var o=0,a=0,s=Math.min(e.length,r),u=t;u<s;u++){var l=e.charCodeAt(u)-48;o*=i,a=l>=49?l-49+10:l>=17?l-17+10:l,n(l>=0&&a<i,"Invalid character"),o+=a}return o}function l(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,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<e.length&&(16===t?this._parseHex(e,i,r):(this._parseBase(e,t,i),"le"===r&&this._initArray(this.toArray(),t,r)))},i.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(n(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},i.prototype._initArray=function(e,t,r){if(n("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===r)for(i=e.length-1,o=0;i>=0;i-=3)a=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i<e.length;i+=3)a=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},i.prototype._parseHex=function(e,t,n){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 i,o=0,a=0;if("be"===n)for(r=e.length-1;r>=t;r-=2)i=s(e,t,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(e.length-t)%2==0?t+1:t;r<e.length;r+=2)i=s(e,t,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,a=o%r,s=Math.min(o,o-a)+n,l=0,c=n;c<s;c+=r)l=u(e,c,c+r,t),this.imuln(i),this.words[0]+l<67108864?this.words[0]+=l:this._iaddn(l);if(0!==a){var d=1;for(l=u(e,c,e.length,t),c=0;c<a;c++)d*=t;this.imuln(d),this.words[0]+l<67108864?this.words[0]+=l:this._iaddn(l)}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){l(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")]=c}catch(e){i.prototype.inspect=c}else i.prototype.inspect=c;function c(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function p(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var l=1;l<r;l++){for(var c=u>>>26,d=67108863&u,f=Math.min(l,t.length-1),h=Math.max(0,l-e.length+1);h<=f;h++){var p=l-h|0;c+=(a=(i=0|e.words[p])*(o=0|t.words[h])+d)/67108864|0,d=67108863&a}n.words[l]=0|d,u=0|c}return 0!==u?n.words[l]=0|u:n.length--,n._strip()}i.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<i|o)).toString(16);o=s>>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),r=0!==o||a!==this.length-1?d[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=f[e],c=h[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modrn(c).toString(e);r=(p=p.idivn(c)).isZero()?m+r:d[l-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16,2)},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,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var a=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,o);return this["_toArrayLike"+("le"===t?"LE":"BE")](a,i),a},i.prototype._toArrayLikeLE=function(e,t){for(var n=0,r=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|r;e[n++]=255&a,n<e.length&&(e[n++]=a>>8&255),n<e.length&&(e[n++]=a>>16&255),6===o?(n<e.length&&(e[n++]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n<e.length)for(e[n++]=r;n<e.length;)e[n++]=0},i.prototype._toArrayLikeBE=function(e,t){for(var n=e.length-1,r=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|r;e[n--]=255&a,n>=0&&(e[n--]=a>>8&255),n>=0&&(e[n--]=a>>16&255),6===o?(n>=0&&(e[n--]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n>=0)for(e[n--]=r;n>=0;)e[n--]=0},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var n=this._zeroBits(this.words[t]);if(e+=n,26!==n)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 n(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 n=0;n<t.length;n++)this.words[n]=this.words[n]&e.words[n];return this.length=t.length,this._strip()},i.prototype.iand=function(e){return n(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,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;r<n.length;r++)this.words[r]=t.words[r]^n.words[r];if(this!==t)for(;r<t.length;r++)this.words[r]=t.words[r];return this.length=t.length,this._strip()},i.prototype.ixor=function(e){return n(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){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i<t;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<<i:this.words[r]&~(1<<i),this._strip()},i.prototype.iadd=function(e){var t,n,r;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?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o<r.length;o++)t=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&t,i=t>>>26;for(;0!==i&&o<n.length;o++)t=(0|n.words[o])+i,this.words[o]=67108863&t,i=t>>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;o<n.length;o++)this.words[o]=n.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 n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,a=0;a<r.length;a++)o=(t=(0|n.words[a])-(0|r.words[a])+o)>>26,this.words[a]=67108863&t;for(;0!==o&&a<n.length;a++)o=(t=(0|n.words[a])+o)>>26,this.words[a]=67108863&t;if(0===o&&a<n.length&&n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this.length=Math.max(this.length,a),n!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(e){return this.clone().isub(e)};var m=function(e,t,n){var r,i,o,a=e.words,s=t.words,u=n.words,l=0,c=0|a[0],d=8191&c,f=c>>>13,h=0|a[1],p=8191&h,m=h>>>13,g=0|a[2],v=8191&g,y=g>>>13,b=0|a[3],w=8191&b,A=b>>>13,_=0|a[4],E=8191&_,S=_>>>13,k=0|a[5],M=8191&k,C=k>>>13,x=0|a[6],R=8191&x,O=x>>>13,T=0|a[7],P=8191&T,L=T>>>13,I=0|a[8],N=8191&I,D=I>>>13,B=0|a[9],j=8191&B,U=B>>>13,z=0|s[0],F=8191&z,q=z>>>13,W=0|s[1],V=8191&W,K=W>>>13,H=0|s[2],$=8191&H,Y=H>>>13,G=0|s[3],Q=8191&G,Z=G>>>13,X=0|s[4],J=8191&X,ee=X>>>13,te=0|s[5],ne=8191&te,re=te>>>13,ie=0|s[6],oe=8191&ie,ae=ie>>>13,se=0|s[7],ue=8191&se,le=se>>>13,ce=0|s[8],de=8191&ce,fe=ce>>>13,he=0|s[9],pe=8191&he,me=he>>>13;n.negative=e.negative^t.negative,n.length=19;var ge=(l+(r=Math.imul(d,F))|0)+((8191&(i=(i=Math.imul(d,q))+Math.imul(f,F)|0))<<13)|0;l=((o=Math.imul(f,q))+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,r=Math.imul(p,F),i=(i=Math.imul(p,q))+Math.imul(m,F)|0,o=Math.imul(m,q);var ve=(l+(r=r+Math.imul(d,V)|0)|0)+((8191&(i=(i=i+Math.imul(d,K)|0)+Math.imul(f,V)|0))<<13)|0;l=((o=o+Math.imul(f,K)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,r=Math.imul(v,F),i=(i=Math.imul(v,q))+Math.imul(y,F)|0,o=Math.imul(y,q),r=r+Math.imul(p,V)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,K)|0;var ye=(l+(r=r+Math.imul(d,$)|0)|0)+((8191&(i=(i=i+Math.imul(d,Y)|0)+Math.imul(f,$)|0))<<13)|0;l=((o=o+Math.imul(f,Y)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,r=Math.imul(w,F),i=(i=Math.imul(w,q))+Math.imul(A,F)|0,o=Math.imul(A,q),r=r+Math.imul(v,V)|0,i=(i=i+Math.imul(v,K)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,K)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,Y)|0;var be=(l+(r=r+Math.imul(d,Q)|0)|0)+((8191&(i=(i=i+Math.imul(d,Z)|0)+Math.imul(f,Q)|0))<<13)|0;l=((o=o+Math.imul(f,Z)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(E,F),i=(i=Math.imul(E,q))+Math.imul(S,F)|0,o=Math.imul(S,q),r=r+Math.imul(w,V)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(A,V)|0,o=o+Math.imul(A,K)|0,r=r+Math.imul(v,$)|0,i=(i=i+Math.imul(v,Y)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,Y)|0,r=r+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,Z)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,Z)|0;var we=(l+(r=r+Math.imul(d,J)|0)|0)+((8191&(i=(i=i+Math.imul(d,ee)|0)+Math.imul(f,J)|0))<<13)|0;l=((o=o+Math.imul(f,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(M,F),i=(i=Math.imul(M,q))+Math.imul(C,F)|0,o=Math.imul(C,q),r=r+Math.imul(E,V)|0,i=(i=i+Math.imul(E,K)|0)+Math.imul(S,V)|0,o=o+Math.imul(S,K)|0,r=r+Math.imul(w,$)|0,i=(i=i+Math.imul(w,Y)|0)+Math.imul(A,$)|0,o=o+Math.imul(A,Y)|0,r=r+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,Z)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,Z)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,ee)|0;var Ae=(l+(r=r+Math.imul(d,ne)|0)|0)+((8191&(i=(i=i+Math.imul(d,re)|0)+Math.imul(f,ne)|0))<<13)|0;l=((o=o+Math.imul(f,re)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(R,F),i=(i=Math.imul(R,q))+Math.imul(O,F)|0,o=Math.imul(O,q),r=r+Math.imul(M,V)|0,i=(i=i+Math.imul(M,K)|0)+Math.imul(C,V)|0,o=o+Math.imul(C,K)|0,r=r+Math.imul(E,$)|0,i=(i=i+Math.imul(E,Y)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,Y)|0,r=r+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,Z)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,Z)|0,r=r+Math.imul(v,J)|0,i=(i=i+Math.imul(v,ee)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,ee)|0,r=r+Math.imul(p,ne)|0,i=(i=i+Math.imul(p,re)|0)+Math.imul(m,ne)|0,o=o+Math.imul(m,re)|0;var _e=(l+(r=r+Math.imul(d,oe)|0)|0)+((8191&(i=(i=i+Math.imul(d,ae)|0)+Math.imul(f,oe)|0))<<13)|0;l=((o=o+Math.imul(f,ae)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,r=Math.imul(P,F),i=(i=Math.imul(P,q))+Math.imul(L,F)|0,o=Math.imul(L,q),r=r+Math.imul(R,V)|0,i=(i=i+Math.imul(R,K)|0)+Math.imul(O,V)|0,o=o+Math.imul(O,K)|0,r=r+Math.imul(M,$)|0,i=(i=i+Math.imul(M,Y)|0)+Math.imul(C,$)|0,o=o+Math.imul(C,Y)|0,r=r+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,Z)|0)+Math.imul(S,Q)|0,o=o+Math.imul(S,Z)|0,r=r+Math.imul(w,J)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(A,J)|0,o=o+Math.imul(A,ee)|0,r=r+Math.imul(v,ne)|0,i=(i=i+Math.imul(v,re)|0)+Math.imul(y,ne)|0,o=o+Math.imul(y,re)|0,r=r+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,ae)|0)+Math.imul(m,oe)|0,o=o+Math.imul(m,ae)|0;var Ee=(l+(r=r+Math.imul(d,ue)|0)|0)+((8191&(i=(i=i+Math.imul(d,le)|0)+Math.imul(f,ue)|0))<<13)|0;l=((o=o+Math.imul(f,le)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(N,F),i=(i=Math.imul(N,q))+Math.imul(D,F)|0,o=Math.imul(D,q),r=r+Math.imul(P,V)|0,i=(i=i+Math.imul(P,K)|0)+Math.imul(L,V)|0,o=o+Math.imul(L,K)|0,r=r+Math.imul(R,$)|0,i=(i=i+Math.imul(R,Y)|0)+Math.imul(O,$)|0,o=o+Math.imul(O,Y)|0,r=r+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,Z)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,Z)|0,r=r+Math.imul(E,J)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(S,J)|0,o=o+Math.imul(S,ee)|0,r=r+Math.imul(w,ne)|0,i=(i=i+Math.imul(w,re)|0)+Math.imul(A,ne)|0,o=o+Math.imul(A,re)|0,r=r+Math.imul(v,oe)|0,i=(i=i+Math.imul(v,ae)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,ae)|0,r=r+Math.imul(p,ue)|0,i=(i=i+Math.imul(p,le)|0)+Math.imul(m,ue)|0,o=o+Math.imul(m,le)|0;var Se=(l+(r=r+Math.imul(d,de)|0)|0)+((8191&(i=(i=i+Math.imul(d,fe)|0)+Math.imul(f,de)|0))<<13)|0;l=((o=o+Math.imul(f,fe)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(j,F),i=(i=Math.imul(j,q))+Math.imul(U,F)|0,o=Math.imul(U,q),r=r+Math.imul(N,V)|0,i=(i=i+Math.imul(N,K)|0)+Math.imul(D,V)|0,o=o+Math.imul(D,K)|0,r=r+Math.imul(P,$)|0,i=(i=i+Math.imul(P,Y)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,Y)|0,r=r+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,Z)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,Z)|0,r=r+Math.imul(M,J)|0,i=(i=i+Math.imul(M,ee)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,ee)|0,r=r+Math.imul(E,ne)|0,i=(i=i+Math.imul(E,re)|0)+Math.imul(S,ne)|0,o=o+Math.imul(S,re)|0,r=r+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,ae)|0)+Math.imul(A,oe)|0,o=o+Math.imul(A,ae)|0,r=r+Math.imul(v,ue)|0,i=(i=i+Math.imul(v,le)|0)+Math.imul(y,ue)|0,o=o+Math.imul(y,le)|0,r=r+Math.imul(p,de)|0,i=(i=i+Math.imul(p,fe)|0)+Math.imul(m,de)|0,o=o+Math.imul(m,fe)|0;var ke=(l+(r=r+Math.imul(d,pe)|0)|0)+((8191&(i=(i=i+Math.imul(d,me)|0)+Math.imul(f,pe)|0))<<13)|0;l=((o=o+Math.imul(f,me)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(j,V),i=(i=Math.imul(j,K))+Math.imul(U,V)|0,o=Math.imul(U,K),r=r+Math.imul(N,$)|0,i=(i=i+Math.imul(N,Y)|0)+Math.imul(D,$)|0,o=o+Math.imul(D,Y)|0,r=r+Math.imul(P,Q)|0,i=(i=i+Math.imul(P,Z)|0)+Math.imul(L,Q)|0,o=o+Math.imul(L,Z)|0,r=r+Math.imul(R,J)|0,i=(i=i+Math.imul(R,ee)|0)+Math.imul(O,J)|0,o=o+Math.imul(O,ee)|0,r=r+Math.imul(M,ne)|0,i=(i=i+Math.imul(M,re)|0)+Math.imul(C,ne)|0,o=o+Math.imul(C,re)|0,r=r+Math.imul(E,oe)|0,i=(i=i+Math.imul(E,ae)|0)+Math.imul(S,oe)|0,o=o+Math.imul(S,ae)|0,r=r+Math.imul(w,ue)|0,i=(i=i+Math.imul(w,le)|0)+Math.imul(A,ue)|0,o=o+Math.imul(A,le)|0,r=r+Math.imul(v,de)|0,i=(i=i+Math.imul(v,fe)|0)+Math.imul(y,de)|0,o=o+Math.imul(y,fe)|0;var Me=(l+(r=r+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;l=((o=o+Math.imul(m,me)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,r=Math.imul(j,$),i=(i=Math.imul(j,Y))+Math.imul(U,$)|0,o=Math.imul(U,Y),r=r+Math.imul(N,Q)|0,i=(i=i+Math.imul(N,Z)|0)+Math.imul(D,Q)|0,o=o+Math.imul(D,Z)|0,r=r+Math.imul(P,J)|0,i=(i=i+Math.imul(P,ee)|0)+Math.imul(L,J)|0,o=o+Math.imul(L,ee)|0,r=r+Math.imul(R,ne)|0,i=(i=i+Math.imul(R,re)|0)+Math.imul(O,ne)|0,o=o+Math.imul(O,re)|0,r=r+Math.imul(M,oe)|0,i=(i=i+Math.imul(M,ae)|0)+Math.imul(C,oe)|0,o=o+Math.imul(C,ae)|0,r=r+Math.imul(E,ue)|0,i=(i=i+Math.imul(E,le)|0)+Math.imul(S,ue)|0,o=o+Math.imul(S,le)|0,r=r+Math.imul(w,de)|0,i=(i=i+Math.imul(w,fe)|0)+Math.imul(A,de)|0,o=o+Math.imul(A,fe)|0;var Ce=(l+(r=r+Math.imul(v,pe)|0)|0)+((8191&(i=(i=i+Math.imul(v,me)|0)+Math.imul(y,pe)|0))<<13)|0;l=((o=o+Math.imul(y,me)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,r=Math.imul(j,Q),i=(i=Math.imul(j,Z))+Math.imul(U,Q)|0,o=Math.imul(U,Z),r=r+Math.imul(N,J)|0,i=(i=i+Math.imul(N,ee)|0)+Math.imul(D,J)|0,o=o+Math.imul(D,ee)|0,r=r+Math.imul(P,ne)|0,i=(i=i+Math.imul(P,re)|0)+Math.imul(L,ne)|0,o=o+Math.imul(L,re)|0,r=r+Math.imul(R,oe)|0,i=(i=i+Math.imul(R,ae)|0)+Math.imul(O,oe)|0,o=o+Math.imul(O,ae)|0,r=r+Math.imul(M,ue)|0,i=(i=i+Math.imul(M,le)|0)+Math.imul(C,ue)|0,o=o+Math.imul(C,le)|0,r=r+Math.imul(E,de)|0,i=(i=i+Math.imul(E,fe)|0)+Math.imul(S,de)|0,o=o+Math.imul(S,fe)|0;var xe=(l+(r=r+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,me)|0)+Math.imul(A,pe)|0))<<13)|0;l=((o=o+Math.imul(A,me)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(j,J),i=(i=Math.imul(j,ee))+Math.imul(U,J)|0,o=Math.imul(U,ee),r=r+Math.imul(N,ne)|0,i=(i=i+Math.imul(N,re)|0)+Math.imul(D,ne)|0,o=o+Math.imul(D,re)|0,r=r+Math.imul(P,oe)|0,i=(i=i+Math.imul(P,ae)|0)+Math.imul(L,oe)|0,o=o+Math.imul(L,ae)|0,r=r+Math.imul(R,ue)|0,i=(i=i+Math.imul(R,le)|0)+Math.imul(O,ue)|0,o=o+Math.imul(O,le)|0,r=r+Math.imul(M,de)|0,i=(i=i+Math.imul(M,fe)|0)+Math.imul(C,de)|0,o=o+Math.imul(C,fe)|0;var Re=(l+(r=r+Math.imul(E,pe)|0)|0)+((8191&(i=(i=i+Math.imul(E,me)|0)+Math.imul(S,pe)|0))<<13)|0;l=((o=o+Math.imul(S,me)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,r=Math.imul(j,ne),i=(i=Math.imul(j,re))+Math.imul(U,ne)|0,o=Math.imul(U,re),r=r+Math.imul(N,oe)|0,i=(i=i+Math.imul(N,ae)|0)+Math.imul(D,oe)|0,o=o+Math.imul(D,ae)|0,r=r+Math.imul(P,ue)|0,i=(i=i+Math.imul(P,le)|0)+Math.imul(L,ue)|0,o=o+Math.imul(L,le)|0,r=r+Math.imul(R,de)|0,i=(i=i+Math.imul(R,fe)|0)+Math.imul(O,de)|0,o=o+Math.imul(O,fe)|0;var Oe=(l+(r=r+Math.imul(M,pe)|0)|0)+((8191&(i=(i=i+Math.imul(M,me)|0)+Math.imul(C,pe)|0))<<13)|0;l=((o=o+Math.imul(C,me)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,r=Math.imul(j,oe),i=(i=Math.imul(j,ae))+Math.imul(U,oe)|0,o=Math.imul(U,ae),r=r+Math.imul(N,ue)|0,i=(i=i+Math.imul(N,le)|0)+Math.imul(D,ue)|0,o=o+Math.imul(D,le)|0,r=r+Math.imul(P,de)|0,i=(i=i+Math.imul(P,fe)|0)+Math.imul(L,de)|0,o=o+Math.imul(L,fe)|0;var Te=(l+(r=r+Math.imul(R,pe)|0)|0)+((8191&(i=(i=i+Math.imul(R,me)|0)+Math.imul(O,pe)|0))<<13)|0;l=((o=o+Math.imul(O,me)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(j,ue),i=(i=Math.imul(j,le))+Math.imul(U,ue)|0,o=Math.imul(U,le),r=r+Math.imul(N,de)|0,i=(i=i+Math.imul(N,fe)|0)+Math.imul(D,de)|0,o=o+Math.imul(D,fe)|0;var Pe=(l+(r=r+Math.imul(P,pe)|0)|0)+((8191&(i=(i=i+Math.imul(P,me)|0)+Math.imul(L,pe)|0))<<13)|0;l=((o=o+Math.imul(L,me)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,r=Math.imul(j,de),i=(i=Math.imul(j,fe))+Math.imul(U,de)|0,o=Math.imul(U,fe);var Le=(l+(r=r+Math.imul(N,pe)|0)|0)+((8191&(i=(i=i+Math.imul(N,me)|0)+Math.imul(D,pe)|0))<<13)|0;l=((o=o+Math.imul(D,me)|0)+(i>>>13)|0)+(Le>>>26)|0,Le&=67108863;var Ie=(l+(r=Math.imul(j,pe))|0)+((8191&(i=(i=Math.imul(j,me))+Math.imul(U,pe)|0))<<13)|0;return l=((o=Math.imul(U,me))+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,u[0]=ge,u[1]=ve,u[2]=ye,u[3]=be,u[4]=we,u[5]=Ae,u[6]=_e,u[7]=Ee,u[8]=Se,u[9]=ke,u[10]=Me,u[11]=Ce,u[12]=xe,u[13]=Re,u[14]=Oe,u[15]=Te,u[16]=Pe,u[17]=Le,u[18]=Ie,0!==l&&(u[19]=l,n.length++),n};function g(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o<n.length-1;o++){var a=i;i=0;for(var s=67108863&r,u=Math.min(o,t.length-1),l=Math.max(0,o-e.length+1);l<=u;l++){var c=o-l,d=(0|e.words[c])*(0|t.words[l]),f=67108863&d;s=67108863&(f=f+s|0),i+=(a=(a=a+(d/67108864|0)|0)+(f>>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function v(e,t,n){return g(e,t,n)}Math.imul||(m=p),i.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?m(this,e,t):n<63?p(this,e,t):n<1024?g(this,e,t):v(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),v(this,e,t)},i.prototype.imul=function(e){return this.clone().mulTo(e,this)},i.prototype.imuln=function(e){var t=e<0;t&&(e=-e),n("number"==typeof e),n(e<67108864);for(var r=0,i=0;i<this.length;i++){var o=(0|this.words[i])*e,a=(67108863&o)+(67108863&r);r>>=26,r+=o/67108864|0,r+=a>>>26,this.words[i]=67108863&a}return 0!==r&&(this.words[i]=r,this.length++),t?this.ineg():this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n<t.length;n++){var r=n/26|0,i=n%26;t[n]=e.words[r]>>>i&1}return t}(e);if(0===t.length)return new i(1);for(var n=this,r=0;r<t.length&&0===t[r];r++,n=n.sqr());if(++r<t.length)for(var o=n.sqr();r<t.length;r++,o=o.sqr())0!==t[r]&&(n=n.mul(o));return n},i.prototype.iushln=function(e){n("number"==typeof e&&e>=0);var t,r=e%26,i=(e-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(t=0;t<this.length;t++){var s=this.words[t]&o,u=(0|this.words[t])-s<<r;this.words[t]=u|a,a=s>>>26-r}a&&(this.words[t]=a,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this._strip()},i.prototype.ishln=function(e){return n(0===this.negative),this.iushln(e)},i.prototype.iushrn=function(e,t,r){var i;n("number"==typeof e&&e>=0),i=t?(t-t%26)/26:0;var o=e%26,a=Math.min((e-o)/26,this.length),s=67108863^67108863>>>o<<o,u=r;if(i-=a,i=Math.max(0,i),u){for(var l=0;l<a;l++)u.words[l]=this.words[l];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,l=0;l<this.length;l++)this.words[l]=this.words[l+a];else this.words[0]=0,this.length=1;var c=0;for(l=this.length-1;l>=0&&(0!==c||l>=i);l--){var d=0|this.words[l];this.words[l]=c<<26-o|d>>>o,c=d&s}return u&&0!==c&&(u.words[u.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,i=1<<t;return!(this.length<=r||!(this.words[r]&i))},i.prototype.imaskn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,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 n("number"==typeof e),n(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(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<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,r){var i,o,a=e.length+r;this._expand(a);var s=0;for(i=0;i<e.length;i++){o=(0|this.words[i+r])+s;var u=(0|e.words[i])*t;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)s=(o=(0|this.words[i+r])+s)>>26,this.words[i+r]=67108863&o;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),o=e,a=0|o.words[o.length-1];0!=(n=26-this._countBits(a))&&(o=o.ushln(n),r.iushln(n),a=0|o.words[o.length-1]);var s,u=r.length-o.length;if("mod"!==t){(s=new i(null)).length=u+1,s.words=new Array(s.length);for(var l=0;l<s.length;l++)s.words[l]=0}var c=r.clone()._ishlnsubmul(o,1,u);0===c.negative&&(r=c,s&&(s.words[u]=1));for(var d=u-1;d>=0;d--){var f=67108864*(0|r.words[o.length+d])+(0|r.words[o.length+d-1]);for(f=Math.min(f/a|0,67108863),r._ishlnsubmul(o,f,d);0!==r.negative;)f--,r.negative=0,r._ishlnsubmul(o,1,d),r.isZero()||(r.negative^=1);s&&(s.words[d]=f)}return s&&s._strip(),r._strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(o=s.div.neg()),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(e)),{div:o,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||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,a,s},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modrn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=(1<<26)%e,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%e;return t?-i:i},i.prototype.modn=function(e){return this.modrn(e)},i.prototype.idivn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/e|0,r=o%e}return this._strip(),t?this.ineg():this},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o=new i(1),a=new i(0),s=new i(0),u=new i(1),l=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++l;for(var c=r.clone(),d=t.clone();!t.isZero();){for(var f=0,h=1;0==(t.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(t.iushrn(f);f-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(c),a.isub(d)),o.iushrn(1),a.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(c),u.isub(d)),s.iushrn(1),u.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(s),a.isub(u)):(r.isub(t),s.isub(o),u.isub(a))}return{a:s,b:u,gcd:r.iushln(l)}},i.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o,a=new i(1),s=new i(0),u=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var l=0,c=1;0==(t.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(t.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var d=0,f=1;0==(r.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(r.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(s)):(r.isub(t),s.isub(a))}return(o=0===t.cmpn(1)?a:s).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(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var o=i,a=r;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0: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,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){r<i?t=-1:r>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 n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var y={k256:null,p224:null,p192:null,p25519:null};function b(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function A(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){b.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 n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function k(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)}b.prototype._tmp=function(){var e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},b.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},b.prototype.split=function(e,t){e.iushrn(this.n,0,t)},b.prototype.imulK=function(e){return e.imul(this.k)},r(w,b),w.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i<r;i++)t.words[i]=e.words[i];if(t.length=r,e.length<=9)return e.words[0]=0,void(e.length=1);var o=e.words[9];for(t.words[t.length++]=o&n,i=10;i<e.length;i++){var a=0|e.words[i];e.words[i-10]=(a&n)<<4|o>>>22,o=a}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,n=0;n<e.length;n++){var r=0|e.words[n];t+=977*r,e.words[n]=67108863&t,t=64*r+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},r(A,b),r(_,b),r(E,b),E.prototype.imulK=function(e){for(var t=0,n=0;n<e.length;n++){var r=19*(0|e.words[n])+t,i=67108863&r;r>>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(y[e])return y[e];var t;if("k256"===e)t=new w;else if("p224"===e)t=new A;else if("p192"===e)t=new _;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new E}return y[e]=t,t},S.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},S.prototype._verify2=function(e,t){n(0==(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},S.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(l(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 n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},S.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},S.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},S.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},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(n(t%2==1),3===t){var r=this.m.add(new i(1)).iushrn(2);return this.pow(e,r)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);n(!o.isZero());var s=new i(1).toRed(this),u=s.redNeg(),l=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new i(2*c*c).toRed(this);0!==this.pow(c,l).cmp(u);)c.redIAdd(u);for(var d=this.pow(c,o),f=this.pow(e,o.addn(1).iushrn(1)),h=this.pow(e,o),p=a;0!==h.cmp(s);){for(var m=h,g=0;0!==m.cmp(s);g++)m=m.redSqr();n(g<p);var v=this.pow(d,new i(1).iushln(p-g-1));f=f.redMul(v),d=v.redSqr(),h=h.redMul(d),p=g}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 n=new Array(16);n[0]=new i(1).toRed(this),n[1]=e;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],e);var o=n[0],a=0,s=0,u=t.bitLength()%26;for(0===u&&(u=26),r=t.length-1;r>=0;r--){for(var l=t.words[r],c=u-1;c>=0;c--){var d=l>>c&1;o!==n[0]&&(o=this.sqr(o)),0!==d||0!==a?(a<<=1,a|=d,(4==++s||0===r&&0===c)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}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 k(e)},r(k,S),k.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},k.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},k.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},k.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(r).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},k.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(Rh,hr);var Oh=Rh.exports,Th=Zr;function Ph(e){var t,n=e.modulus.byteLength();do{t=new Oh(Th(n))}while(t.cmp(e.modulus)>=0||!t.umod(e.prime1)||!t.umod(e.prime2));return t}function Lh(e,t){var n=function(e){var t=Ph(e);return{blinder:t.toRed(Oh.mont(e.modulus)).redPow(new Oh(e.publicExponent)).fromRed(),unblinder:t.invm(e.modulus)}}(t),r=t.modulus.byteLength(),i=new Oh(e).mul(n.blinder).umod(t.modulus),o=i.toRed(Oh.mont(t.prime1)),a=i.toRed(Oh.mont(t.prime2)),s=t.coefficient,u=t.prime1,l=t.prime2,c=o.redPow(t.exponent1).fromRed(),d=a.redPow(t.exponent2).fromRed(),f=c.isub(d).imul(s).umod(u).imul(l);return d.iadd(f).imul(n.unblinder).umod(t.modulus).toArrayLike(xn,"be",r)}Lh.getr=Ph;var Ih=Lh,Nh={},Dh={name:"elliptic",version:"6.5.4",description:"EC cryptography",main:"lib/elliptic.js",files:["lib"],scripts:{lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository:{type:"git",url:"git@github.com:indutny/elliptic"},keywords:["EC","Elliptic","curve","Cryptography"],author:"Fedor Indutny <fedor@indutny.com>",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}},Bh={},jh={};!function(e){var t=jh;function n(e){return 1===e.length?"0"+e:e}function r(e){for(var t="",r=0;r<e.length;r++)t+=n(e[r].toString(16));return t}t.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if("string"!=typeof e){for(var r=0;r<e.length;r++)n[r]=0|e[r];return n}if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),r=0;r<e.length;r+=2)n.push(parseInt(e[r]+e[r+1],16));else for(r=0;r<e.length;r++){var i=e.charCodeAt(r),o=i>>8,a=255&i;o?n.push(o,a):n.push(a)}return n},t.zero2=n,t.toHex=r,t.encode=function(e,t){return"hex"===t?r(e):e}}(),function(e){var t=Bh,n=vf,r=Gl,i=jh;t.assert=r,t.toArray=i.toArray,t.zero2=i.zero2,t.toHex=i.toHex,t.encode=i.encode,t.getNAF=function(e,t,n){var r=new Array(Math.max(e.bitLength(),n)+1);r.fill(0);for(var i=1<<t+1,o=e.clone(),a=0;a<r.length;a++){var s,u=o.andln(i-1);o.isOdd()?(s=u>(i>>1)-1?(i>>1)-u:u,o.isubn(s)):s=0,r[a]=s,o.iushrn(1)}return r},t.getJSF=function(e,t){var n=[[],[]];e=e.clone(),t=t.clone();for(var r,i=0,o=0;e.cmpn(-i)>0||t.cmpn(-o)>0;){var a,s,u=e.andln(3)+i&3,l=t.andln(3)+o&3;3===u&&(u=-1),3===l&&(l=-1),a=0==(1&u)?0:3!=(r=e.andln(7)+i&7)&&5!==r||2!==l?u:-u,n[0].push(a),s=0==(1&l)?0:3!=(r=t.andln(7)+o&7)&&5!==r||2!==u?l:-l,n[1].push(s),2*i===a+1&&(i=1-i),2*o===s+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return n},t.cachedProperty=function(e,t,n){var r="_"+t;e.prototype[t]=function(){return void 0!==this[r]?this[r]:this[r]=n.call(this)}},t.parseBytes=function(e){return"string"==typeof e?t.toArray(e,"hex"):e},t.intFromLE=function(e){return new n(e,"hex","le")}}();var Uh={},zh=vf,Fh=Bh,qh=Fh.getNAF,Wh=Fh.getJSF,Vh=Fh.assert;function Kh(e,t){this.type=e,this.p=new zh(t.p,16),this.red=t.prime?zh.red(t.prime):zh.mont(this.p),this.zero=new zh(0).toRed(this.red),this.one=new zh(1).toRed(this.red),this.two=new zh(2).toRed(this.red),this.n=t.n&&new zh(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Hh=Kh;function $h(e,t){this.curve=e,this.type=t,this.precomputed=null}Kh.prototype.point=function(){throw new Error("Not implemented")},Kh.prototype.validate=function(){throw new Error("Not implemented")},Kh.prototype._fixedNafMul=function(e,t){Vh(e.precomputed);var n=e._getDoubles(),r=qh(t,1,this._bitLength),i=(1<<n.step+1)-(n.step%2==0?2:1);i/=3;var o,a,s=[];for(o=0;o<r.length;o+=n.step){a=0;for(var u=o+n.step-1;u>=o;u--)a=(a<<1)+r[u];s.push(a)}for(var l=this.jpoint(null,null,null),c=this.jpoint(null,null,null),d=i;d>0;d--){for(o=0;o<s.length;o++)(a=s[o])===d?c=c.mixedAdd(n.points[o]):a===-d&&(c=c.mixedAdd(n.points[o].neg()));l=l.add(c)}return l.toP()},Kh.prototype._wnafMul=function(e,t){var n=4,r=e._getNAFPoints(n);n=r.wnd;for(var i=r.points,o=qh(t,n,this._bitLength),a=this.jpoint(null,null,null),s=o.length-1;s>=0;s--){for(var u=0;s>=0&&0===o[s];s--)u++;if(s>=0&&u++,a=a.dblp(u),s<0)break;var l=o[s];Vh(0!==l),a="affine"===e.type?l>0?a.mixedAdd(i[l-1>>1]):a.mixedAdd(i[-l-1>>1].neg()):l>0?a.add(i[l-1>>1]):a.add(i[-l-1>>1].neg())}return"affine"===e.type?a.toP():a},Kh.prototype._wnafMulAdd=function(e,t,n,r,i){var o,a,s,u=this._wnafT1,l=this._wnafT2,c=this._wnafT3,d=0;for(o=0;o<r;o++){var f=(s=t[o])._getNAFPoints(e);u[o]=f.wnd,l[o]=f.points}for(o=r-1;o>=1;o-=2){var h=o-1,p=o;if(1===u[h]&&1===u[p]){var m=[t[h],null,null,t[p]];0===t[h].y.cmp(t[p].y)?(m[1]=t[h].add(t[p]),m[2]=t[h].toJ().mixedAdd(t[p].neg())):0===t[h].y.cmp(t[p].y.redNeg())?(m[1]=t[h].toJ().mixedAdd(t[p]),m[2]=t[h].add(t[p].neg())):(m[1]=t[h].toJ().mixedAdd(t[p]),m[2]=t[h].toJ().mixedAdd(t[p].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],v=Wh(n[h],n[p]);for(d=Math.max(v[0].length,d),c[h]=new Array(d),c[p]=new Array(d),a=0;a<d;a++){var y=0|v[0][a],b=0|v[1][a];c[h][a]=g[3*(y+1)+(b+1)],c[p][a]=0,l[h]=m}}else c[h]=qh(n[h],u[h],this._bitLength),c[p]=qh(n[p],u[p],this._bitLength),d=Math.max(c[h].length,d),d=Math.max(c[p].length,d)}var w=this.jpoint(null,null,null),A=this._wnafT4;for(o=d;o>=0;o--){for(var _=0;o>=0;){var E=!0;for(a=0;a<r;a++)A[a]=0|c[a][o],0!==A[a]&&(E=!1);if(!E)break;_++,o--}if(o>=0&&_++,w=w.dblp(_),o<0)break;for(a=0;a<r;a++){var S=A[a];0!==S&&(S>0?s=l[a][S-1>>1]:S<0&&(s=l[a][-S-1>>1].neg()),w="affine"===s.type?w.mixedAdd(s):w.add(s))}}for(o=0;o<r;o++)l[o]=null;return i?w:w.toP()},Kh.BasePoint=$h,$h.prototype.eq=function(){throw new Error("Not implemented")},$h.prototype.validate=function(){return this.curve.validate(this)},Kh.prototype.decodePoint=function(e,t){e=Fh.toArray(e,t);var n=this.p.byteLength();if((4===e[0]||6===e[0]||7===e[0])&&e.length-1==2*n)return 6===e[0]?Vh(e[e.length-1]%2==0):7===e[0]&&Vh(e[e.length-1]%2==1),this.point(e.slice(1,1+n),e.slice(1+n,1+2*n));if((2===e[0]||3===e[0])&&e.length-1===n)return this.pointFromX(e.slice(1,1+n),3===e[0]);throw new Error("Unknown point format")},$h.prototype.encodeCompressed=function(e){return this.encode(e,!0)},$h.prototype._encode=function(e){var t=this.curve.p.byteLength(),n=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray("be",t))},$h.prototype.encode=function(e,t){return Fh.encode(this._encode(t),e)},$h.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},$h.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)},$h.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i<t;i+=e){for(var o=0;o<e;o++)r=r.dbl();n.push(r)}return{step:e,points:n}},$h.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],n=(1<<e)-1,r=1===n?null:this.dbl(),i=1;i<n;i++)t[i]=t[i-1].add(r);return{wnd:e,points:t}},$h.prototype._getBeta=function(){return null},$h.prototype.dblp=function(e){for(var t=this,n=0;n<e;n++)t=t.dbl();return t};var Yh=vf,Gh=Jr,Qh=Hh,Zh=Bh.assert;function Xh(e){Qh.call(this,"short",e),this.a=new Yh(e.a,16).toRed(this.red),this.b=new Yh(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}Gh(Xh,Qh);var Jh=Xh;function ep(e,t,n,r){Qh.BasePoint.call(this,e,"affine"),null===t&&null===n?(this.x=null,this.y=null,this.inf=!0):(this.x=new Yh(t,16),this.y=new Yh(n,16),r&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function tp(e,t,n,r){Qh.BasePoint.call(this,e,"jacobian"),null===t&&null===n&&null===r?(this.x=this.curve.one,this.y=this.curve.one,this.z=new Yh(0)):(this.x=new Yh(t,16),this.y=new Yh(n,16),this.z=new Yh(r,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Xh.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,n;if(e.beta)t=new Yh(e.beta,16).toRed(this.red);else{var r=this._getEndoRoots(this.p);t=(t=r[0].cmp(r[1])<0?r[0]:r[1]).toRed(this.red)}if(e.lambda)n=new Yh(e.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(t))?n=i[0]:(n=i[1],Zh(0===this.g.mul(n).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:n,basis:e.basis?e.basis.map((function(e){return{a:new Yh(e.a,16),b:new Yh(e.b,16)}})):this._getEndoBasis(n)}}},Xh.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:Yh.mont(e),n=new Yh(2).toRed(t).redInvm(),r=n.redNeg(),i=new Yh(3).toRed(t).redNeg().redSqrt().redMul(n);return[r.redAdd(i).fromRed(),r.redSub(i).fromRed()]},Xh.prototype._getEndoBasis=function(e){for(var t,n,r,i,o,a,s,u,l,c=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=e,f=this.n.clone(),h=new Yh(1),p=new Yh(0),m=new Yh(0),g=new Yh(1),v=0;0!==d.cmpn(0);){var y=f.div(d);u=f.sub(y.mul(d)),l=m.sub(y.mul(h));var b=g.sub(y.mul(p));if(!r&&u.cmp(c)<0)t=s.neg(),n=h,r=u.neg(),i=l;else if(r&&2==++v)break;s=u,f=d,d=u,m=h,h=l,g=p,p=b}o=u.neg(),a=l;var w=r.sqr().add(i.sqr());return o.sqr().add(a.sqr()).cmp(w)>=0&&(o=t,a=n),r.negative&&(r=r.neg(),i=i.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:r,b:i},{a:o,b:a}]},Xh.prototype._endoSplit=function(e){var t=this.endo.basis,n=t[0],r=t[1],i=r.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=i.mul(n.a),s=o.mul(r.a),u=i.mul(n.b),l=o.mul(r.b);return{k1:e.sub(a).sub(s),k2:u.add(l).neg()}},Xh.prototype.pointFromX=function(e,t){(e=new Yh(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),r=n.redSqrt();if(0!==r.redSqr().redSub(n).cmp(this.zero))throw new Error("invalid point");var i=r.fromRed().isOdd();return(t&&!i||!t&&i)&&(r=r.redNeg()),this.point(e,r)},Xh.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,n=e.y,r=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(r).redIAdd(this.b);return 0===n.redSqr().redISub(i).cmpn(0)},Xh.prototype._endoWnafMulAdd=function(e,t,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,o=0;o<e.length;o++){var a=this._endoSplit(t[o]),s=e[o],u=s._getBeta();a.k1.negative&&(a.k1.ineg(),s=s.neg(!0)),a.k2.negative&&(a.k2.ineg(),u=u.neg(!0)),r[2*o]=s,r[2*o+1]=u,i[2*o]=a.k1,i[2*o+1]=a.k2}for(var l=this._wnafMulAdd(1,r,i,2*o,n),c=0;c<2*o;c++)r[c]=null,i[c]=null;return l},Gh(ep,Qh.BasePoint),Xh.prototype.point=function(e,t,n){return new ep(this,e,t,n)},Xh.prototype.pointFromJSON=function(e,t){return ep.fromJSON(this,e,t)},ep.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var n=this.curve,r=function(e){return n.point(e.x.redMul(n.endo.beta),e.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(r)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(r)}}}return t}},ep.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},ep.fromJSON=function(e,t,n){"string"==typeof t&&(t=JSON.parse(t));var r=e.point(t[0],t[1],n);if(!t[2])return r;function i(t){return e.point(t[0],t[1],n)}var o=t[2];return r.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[r].concat(o.doubles.points.map(i))},naf:o.naf&&{wnd:o.naf.wnd,points:[r].concat(o.naf.points.map(i))}},r},ep.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},ep.prototype.isInfinity=function(){return this.inf},ep.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var n=t.redSqr().redISub(this.x).redISub(e.x),r=t.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},ep.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,n=this.x.redSqr(),r=e.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(t).redMul(r),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},ep.prototype.getX=function(){return this.x.fromRed()},ep.prototype.getY=function(){return this.y.fromRed()},ep.prototype.mul=function(e){return e=new Yh(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},ep.prototype.mulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},ep.prototype.jmulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},ep.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},ep.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,r=function(e){return e.neg()};t.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return t},ep.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},Gh(tp,Qh.BasePoint),Xh.prototype.jpoint=function(e,t,n){return new tp(this,e,t,n)},tp.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),n=this.x.redMul(t),r=this.y.redMul(t).redMul(e);return this.curve.point(n,r)},tp.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},tp.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(t),i=e.x.redMul(n),o=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),s=r.redSub(i),u=o.redSub(a);if(0===s.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var l=s.redSqr(),c=l.redMul(s),d=r.redMul(l),f=u.redSqr().redIAdd(c).redISub(d).redISub(d),h=u.redMul(d.redISub(f)).redISub(o.redMul(c)),p=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(f,h,p)},tp.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),n=this.x,r=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z),a=n.redSub(r),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),l=u.redMul(a),c=n.redMul(u),d=s.redSqr().redIAdd(l).redISub(c).redISub(c),f=s.redMul(c.redISub(d)).redISub(i.redMul(l)),h=this.z.redMul(a);return this.curve.jpoint(d,f,h)},tp.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var n=this;for(t=0;t<e;t++)n=n.dbl();return n}var r=this.curve.a,i=this.curve.tinv,o=this.x,a=this.y,s=this.z,u=s.redSqr().redSqr(),l=a.redAdd(a);for(t=0;t<e;t++){var c=o.redSqr(),d=l.redSqr(),f=d.redSqr(),h=c.redAdd(c).redIAdd(c).redIAdd(r.redMul(u)),p=o.redMul(d),m=h.redSqr().redISub(p.redAdd(p)),g=p.redISub(m),v=h.redMul(g);v=v.redIAdd(v).redISub(f);var y=l.redMul(s);t+1<e&&(u=u.redMul(f)),o=m,s=y,l=v}return this.curve.jpoint(o,l.redMul(i),s)},tp.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},tp.prototype._zeroDbl=function(){var e,t,n;if(this.zOne){var r=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),a=this.x.redAdd(i).redSqr().redISub(r).redISub(o);a=a.redIAdd(a);var s=r.redAdd(r).redIAdd(r),u=s.redSqr().redISub(a).redISub(a),l=o.redIAdd(o);l=(l=l.redIAdd(l)).redIAdd(l),e=u,t=s.redMul(a.redISub(u)).redISub(l),n=this.y.redAdd(this.y)}else{var c=this.x.redSqr(),d=this.y.redSqr(),f=d.redSqr(),h=this.x.redAdd(d).redSqr().redISub(c).redISub(f);h=h.redIAdd(h);var p=c.redAdd(c).redIAdd(c),m=p.redSqr(),g=f.redIAdd(f);g=(g=g.redIAdd(g)).redIAdd(g),e=m.redISub(h).redISub(h),t=p.redMul(h.redISub(e)).redISub(g),n=(n=this.y.redMul(this.z)).redIAdd(n)}return this.curve.jpoint(e,t,n)},tp.prototype._threeDbl=function(){var e,t,n;if(this.zOne){var r=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),a=this.x.redAdd(i).redSqr().redISub(r).redISub(o);a=a.redIAdd(a);var s=r.redAdd(r).redIAdd(r).redIAdd(this.curve.a),u=s.redSqr().redISub(a).redISub(a);e=u;var l=o.redIAdd(o);l=(l=l.redIAdd(l)).redIAdd(l),t=s.redMul(a.redISub(u)).redISub(l),n=this.y.redAdd(this.y)}else{var c=this.z.redSqr(),d=this.y.redSqr(),f=this.x.redMul(d),h=this.x.redSub(c).redMul(this.x.redAdd(c));h=h.redAdd(h).redIAdd(h);var p=f.redIAdd(f),m=(p=p.redIAdd(p)).redAdd(p);e=h.redSqr().redISub(m),n=this.y.redAdd(this.z).redSqr().redISub(d).redISub(c);var g=d.redSqr();g=(g=(g=g.redIAdd(g)).redIAdd(g)).redIAdd(g),t=h.redMul(p.redISub(e)).redISub(g)}return this.curve.jpoint(e,t,n)},tp.prototype._dbl=function(){var e=this.curve.a,t=this.x,n=this.y,r=this.z,i=r.redSqr().redSqr(),o=t.redSqr(),a=n.redSqr(),s=o.redAdd(o).redIAdd(o).redIAdd(e.redMul(i)),u=t.redAdd(t),l=(u=u.redIAdd(u)).redMul(a),c=s.redSqr().redISub(l.redAdd(l)),d=l.redISub(c),f=a.redSqr();f=(f=(f=f.redIAdd(f)).redIAdd(f)).redIAdd(f);var h=s.redMul(d).redISub(f),p=n.redAdd(n).redMul(r);return this.curve.jpoint(c,h,p)},tp.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr(),r=t.redSqr(),i=e.redAdd(e).redIAdd(e),o=i.redSqr(),a=this.x.redAdd(t).redSqr().redISub(e).redISub(r),s=(a=(a=(a=a.redIAdd(a)).redAdd(a).redIAdd(a)).redISub(o)).redSqr(),u=r.redIAdd(r);u=(u=(u=u.redIAdd(u)).redIAdd(u)).redIAdd(u);var l=i.redIAdd(a).redSqr().redISub(o).redISub(s).redISub(u),c=t.redMul(l);c=(c=c.redIAdd(c)).redIAdd(c);var d=this.x.redMul(s).redISub(c);d=(d=d.redIAdd(d)).redIAdd(d);var f=this.y.redMul(l.redMul(u.redISub(l)).redISub(a.redMul(s)));f=(f=(f=f.redIAdd(f)).redIAdd(f)).redIAdd(f);var h=this.z.redAdd(a).redSqr().redISub(n).redISub(s);return this.curve.jpoint(d,f,h)},tp.prototype.mul=function(e,t){return e=new Yh(e,t),this.curve._wnafMul(this,e)},tp.prototype.eq=function(e){if("affine"===e.type)return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),n=e.z.redSqr();if(0!==this.x.redMul(n).redISub(e.x.redMul(t)).cmpn(0))return!1;var r=t.redMul(this.z),i=n.redMul(e.z);return 0===this.y.redMul(i).redISub(e.y.redMul(r)).cmpn(0)},tp.prototype.eqXToP=function(e){var t=this.z.redSqr(),n=e.toRed(this.curve.red).redMul(t);if(0===this.x.cmp(n))return!0;for(var r=e.clone(),i=this.curve.redN.redMul(t);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(n.redIAdd(i),0===this.x.cmp(n))return!0}},tp.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},tp.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var np=vf,rp=Jr,ip=Hh,op=Bh;function ap(e){ip.call(this,"mont",e),this.a=new np(e.a,16).toRed(this.red),this.b=new np(e.b,16).toRed(this.red),this.i4=new np(4).toRed(this.red).redInvm(),this.two=new np(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}rp(ap,ip);var sp=ap;function up(e,t,n){ip.BasePoint.call(this,e,"projective"),null===t&&null===n?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new np(t,16),this.z=new np(n,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}ap.prototype.validate=function(e){var t=e.normalize().x,n=t.redSqr(),r=n.redMul(t).redAdd(n.redMul(this.a)).redAdd(t);return 0===r.redSqrt().redSqr().cmp(r)},rp(up,ip.BasePoint),ap.prototype.decodePoint=function(e,t){return this.point(op.toArray(e,t),1)},ap.prototype.point=function(e,t){return new up(this,e,t)},ap.prototype.pointFromJSON=function(e){return up.fromJSON(this,e)},up.prototype.precompute=function(){},up.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},up.fromJSON=function(e,t){return new up(e,t[0],t[1]||e.one)},up.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},up.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},up.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),n=e.redSub(t),r=e.redMul(t),i=n.redMul(t.redAdd(this.curve.a24.redMul(n)));return this.curve.point(r,i)},up.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},up.prototype.diffAdd=function(e,t){var n=this.x.redAdd(this.z),r=this.x.redSub(this.z),i=e.x.redAdd(e.z),o=e.x.redSub(e.z).redMul(n),a=i.redMul(r),s=t.z.redMul(o.redAdd(a).redSqr()),u=t.x.redMul(o.redISub(a).redSqr());return this.curve.point(s,u)},up.prototype.mul=function(e){for(var t=e.clone(),n=this,r=this.curve.point(null,null),i=[];0!==t.cmpn(0);t.iushrn(1))i.push(t.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(n=n.diffAdd(r,this),r=r.dbl()):(r=n.diffAdd(r,this),n=n.dbl());return r},up.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},up.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},up.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},up.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},up.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var lp=vf,cp=Jr,dp=Hh,fp=Bh.assert;function hp(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,dp.call(this,"edwards",e),this.a=new lp(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new lp(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new lp(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),fp(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}cp(hp,dp);var pp=hp;function mp(e,t,n,r,i){dp.BasePoint.call(this,e,"projective"),null===t&&null===n&&null===r?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new lp(t,16),this.y=new lp(n,16),this.z=r?new lp(r,16):this.curve.one,this.t=i&&new lp(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}hp.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},hp.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},hp.prototype.jpoint=function(e,t,n,r){return this.point(e,t,n,r)},hp.prototype.pointFromX=function(e,t){(e=new lp(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr(),r=this.c2.redSub(this.a.redMul(n)),i=this.one.redSub(this.c2.redMul(this.d).redMul(n)),o=r.redMul(i.redInvm()),a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");var s=a.fromRed().isOdd();return(t&&!s||!t&&s)&&(a=a.redNeg()),this.point(e,a)},hp.prototype.pointFromY=function(e,t){(e=new lp(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr(),r=n.redSub(this.c2),i=n.redMul(this.d).redMul(this.c2).redSub(this.a),o=r.redMul(i.redInvm());if(0===o.cmp(this.zero)){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");return a.fromRed().isOdd()!==t&&(a=a.redNeg()),this.point(a,e)},hp.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),n=e.y.redSqr(),r=t.redMul(this.a).redAdd(n),i=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(n)));return 0===r.cmp(i)},cp(mp,dp.BasePoint),hp.prototype.pointFromJSON=function(e){return mp.fromJSON(this,e)},hp.prototype.point=function(e,t,n,r){return new mp(this,e,t,n,r)},mp.fromJSON=function(e,t){return new mp(e,t[0],t[1],t[2])},mp.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},mp.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},mp.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var r=this.curve._mulA(e),i=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),o=r.redAdd(t),a=o.redSub(n),s=r.redSub(t),u=i.redMul(a),l=o.redMul(s),c=i.redMul(s),d=a.redMul(o);return this.curve.point(u,l,d,c)},mp.prototype._projDbl=function(){var e,t,n,r,i,o,a=this.x.redAdd(this.y).redSqr(),s=this.x.redSqr(),u=this.y.redSqr();if(this.curve.twisted){var l=(r=this.curve._mulA(s)).redAdd(u);this.zOne?(e=a.redSub(s).redSub(u).redMul(l.redSub(this.curve.two)),t=l.redMul(r.redSub(u)),n=l.redSqr().redSub(l).redSub(l)):(i=this.z.redSqr(),o=l.redSub(i).redISub(i),e=a.redSub(s).redISub(u).redMul(o),t=l.redMul(r.redSub(u)),n=l.redMul(o))}else r=s.redAdd(u),i=this.curve._mulC(this.z).redSqr(),o=r.redSub(i).redSub(i),e=this.curve._mulC(a.redISub(r)).redMul(o),t=this.curve._mulC(r).redMul(s.redISub(u)),n=r.redMul(o);return this.curve.point(e,t,n)},mp.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},mp.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),r=this.t.redMul(this.curve.dd).redMul(e.t),i=this.z.redMul(e.z.redAdd(e.z)),o=n.redSub(t),a=i.redSub(r),s=i.redAdd(r),u=n.redAdd(t),l=o.redMul(a),c=s.redMul(u),d=o.redMul(u),f=a.redMul(s);return this.curve.point(l,c,f,d)},mp.prototype._projAdd=function(e){var t,n,r=this.z.redMul(e.z),i=r.redSqr(),o=this.x.redMul(e.x),a=this.y.redMul(e.y),s=this.curve.d.redMul(o).redMul(a),u=i.redSub(s),l=i.redAdd(s),c=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(o).redISub(a),d=r.redMul(u).redMul(c);return this.curve.twisted?(t=r.redMul(l).redMul(a.redSub(this.curve._mulA(o))),n=u.redMul(l)):(t=r.redMul(l).redMul(a.redSub(o)),n=this.curve._mulC(u).redMul(l)),this.curve.point(d,t,n)},mp.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},mp.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},mp.prototype.mulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!1)},mp.prototype.jmulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!0)},mp.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},mp.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},mp.prototype.getX=function(){return this.normalize(),this.x.fromRed()},mp.prototype.getY=function(){return this.normalize(),this.y.fromRed()},mp.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},mp.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var n=e.clone(),r=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(r),0===this.x.cmp(t))return!0}},mp.prototype.toP=mp.prototype.normalize,mp.prototype.mixedAdd=mp.prototype.add,function(e){var t=e;t.base=Hh,t.short=Jh,t.mont=sp,t.edwards=pp}(Uh);var gp={},vp={},yp={},bp=Gl,wp=Jr;function Ap(e,t){return 55296==(64512&e.charCodeAt(t))&&!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1))}function _p(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function Ep(e){return 1===e.length?"0"+e:e}function Sp(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}yp.inherits=wp,yp.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),i=0;i<e.length;i+=2)n.push(parseInt(e[i]+e[i+1],16))}else for(var r=0,i=0;i<e.length;i++){var o=e.charCodeAt(i);o<128?n[r++]=o:o<2048?(n[r++]=o>>6|192,n[r++]=63&o|128):Ap(e,i)?(o=65536+((1023&o)<<10)+(1023&e.charCodeAt(++i)),n[r++]=o>>18|240,n[r++]=o>>12&63|128,n[r++]=o>>6&63|128,n[r++]=63&o|128):(n[r++]=o>>12|224,n[r++]=o>>6&63|128,n[r++]=63&o|128)}else for(i=0;i<e.length;i++)n[i]=0|e[i];return n},yp.toHex=function(e){for(var t="",n=0;n<e.length;n++)t+=Ep(e[n].toString(16));return t},yp.htonl=_p,yp.toHex32=function(e,t){for(var n="",r=0;r<e.length;r++){var i=e[r];"little"===t&&(i=_p(i)),n+=Sp(i.toString(16))}return n},yp.zero2=Ep,yp.zero8=Sp,yp.join32=function(e,t,n,r){var i=n-t;bp(i%4==0);for(var o=new Array(i/4),a=0,s=t;a<o.length;a++,s+=4){var u;u="big"===r?e[s]<<24|e[s+1]<<16|e[s+2]<<8|e[s+3]:e[s+3]<<24|e[s+2]<<16|e[s+1]<<8|e[s],o[a]=u>>>0}return o},yp.split32=function(e,t){for(var n=new Array(4*e.length),r=0,i=0;r<e.length;r++,i+=4){var o=e[r];"big"===t?(n[i]=o>>>24,n[i+1]=o>>>16&255,n[i+2]=o>>>8&255,n[i+3]=255&o):(n[i+3]=o>>>24,n[i+2]=o>>>16&255,n[i+1]=o>>>8&255,n[i]=255&o)}return n},yp.rotr32=function(e,t){return e>>>t|e<<32-t},yp.rotl32=function(e,t){return e<<t|e>>>32-t},yp.sum32=function(e,t){return e+t>>>0},yp.sum32_3=function(e,t,n){return e+t+n>>>0},yp.sum32_4=function(e,t,n,r){return e+t+n+r>>>0},yp.sum32_5=function(e,t,n,r,i){return e+t+n+r+i>>>0},yp.sum64=function(e,t,n,r){var i=e[t],o=r+e[t+1]>>>0,a=(o<r?1:0)+n+i;e[t]=a>>>0,e[t+1]=o},yp.sum64_hi=function(e,t,n,r){return(t+r>>>0<t?1:0)+e+n>>>0},yp.sum64_lo=function(e,t,n,r){return t+r>>>0},yp.sum64_4_hi=function(e,t,n,r,i,o,a,s){var u=0,l=t;return u+=(l=l+r>>>0)<t?1:0,u+=(l=l+o>>>0)<o?1:0,e+n+i+a+(u+=(l=l+s>>>0)<s?1:0)>>>0},yp.sum64_4_lo=function(e,t,n,r,i,o,a,s){return t+r+o+s>>>0},yp.sum64_5_hi=function(e,t,n,r,i,o,a,s,u,l){var c=0,d=t;return c+=(d=d+r>>>0)<t?1:0,c+=(d=d+o>>>0)<o?1:0,c+=(d=d+s>>>0)<s?1:0,e+n+i+a+u+(c+=(d=d+l>>>0)<l?1:0)>>>0},yp.sum64_5_lo=function(e,t,n,r,i,o,a,s,u,l){return t+r+o+s+l>>>0},yp.rotr64_hi=function(e,t,n){return(t<<32-n|e>>>n)>>>0},yp.rotr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0},yp.shr64_hi=function(e,t,n){return e>>>n},yp.shr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0};var kp={},Mp=yp,Cp=Gl;function xp(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}kp.BlockHash=xp,xp.prototype.update=function(e,t){if(e=Mp.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var n=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-n,e.length),0===this.pending.length&&(this.pending=null),e=Mp.join32(e,0,e.length-n,this.endian);for(var r=0;r<e.length;r+=this._delta32)this._update(e,r,r+this._delta32)}return this},xp.prototype.digest=function(e){return this.update(this._pad()),Cp(null===this.pending),this._digest(e)},xp.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,n=t-(e+this.padLength)%t,r=new Array(n+this.padLength);r[0]=128;for(var i=1;i<n;i++)r[i]=0;if(e<<=3,"big"===this.endian){for(var o=8;o<this.padLength;o++)r[i++]=0;r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=e>>>24&255,r[i++]=e>>>16&255,r[i++]=e>>>8&255,r[i++]=255&e}else for(r[i++]=255&e,r[i++]=e>>>8&255,r[i++]=e>>>16&255,r[i++]=e>>>24&255,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,o=8;o<this.padLength;o++)r[i++]=0;return r};var Rp={},Op={},Tp=yp.rotr32;function Pp(e,t,n){return e&t^~e&n}function Lp(e,t,n){return e&t^e&n^t&n}function Ip(e,t,n){return e^t^n}Op.ft_1=function(e,t,n,r){return 0===e?Pp(t,n,r):1===e||3===e?Ip(t,n,r):2===e?Lp(t,n,r):void 0},Op.ch32=Pp,Op.maj32=Lp,Op.p32=Ip,Op.s0_256=function(e){return Tp(e,2)^Tp(e,13)^Tp(e,22)},Op.s1_256=function(e){return Tp(e,6)^Tp(e,11)^Tp(e,25)},Op.g0_256=function(e){return Tp(e,7)^Tp(e,18)^e>>>3},Op.g1_256=function(e){return Tp(e,17)^Tp(e,19)^e>>>10};var Np=yp,Dp=kp,Bp=Op,jp=Np.rotl32,Up=Np.sum32,zp=Np.sum32_5,Fp=Bp.ft_1,qp=Dp.BlockHash,Wp=[1518500249,1859775393,2400959708,3395469782];function Vp(){if(!(this instanceof Vp))return new Vp;qp.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}Np.inherits(Vp,qp);var Kp=Vp;Vp.blockSize=512,Vp.outSize=160,Vp.hmacStrength=80,Vp.padLength=64,Vp.prototype._update=function(e,t){for(var n=this.W,r=0;r<16;r++)n[r]=e[t+r];for(;r<n.length;r++)n[r]=jp(n[r-3]^n[r-8]^n[r-14]^n[r-16],1);var i=this.h[0],o=this.h[1],a=this.h[2],s=this.h[3],u=this.h[4];for(r=0;r<n.length;r++){var l=~~(r/20),c=zp(jp(i,5),Fp(l,o,a,s),u,n[r],Wp[l]);u=s,s=a,a=jp(o,30),o=i,i=c}this.h[0]=Up(this.h[0],i),this.h[1]=Up(this.h[1],o),this.h[2]=Up(this.h[2],a),this.h[3]=Up(this.h[3],s),this.h[4]=Up(this.h[4],u)},Vp.prototype._digest=function(e){return"hex"===e?Np.toHex32(this.h,"big"):Np.split32(this.h,"big")};var Hp=yp,$p=kp,Yp=Op,Gp=Gl,Qp=Hp.sum32,Zp=Hp.sum32_4,Xp=Hp.sum32_5,Jp=Yp.ch32,em=Yp.maj32,tm=Yp.s0_256,nm=Yp.s1_256,rm=Yp.g0_256,im=Yp.g1_256,om=$p.BlockHash,am=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function sm(){if(!(this instanceof sm))return new sm;om.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=am,this.W=new Array(64)}Hp.inherits(sm,om);var um=sm;sm.blockSize=512,sm.outSize=256,sm.hmacStrength=192,sm.padLength=64,sm.prototype._update=function(e,t){for(var n=this.W,r=0;r<16;r++)n[r]=e[t+r];for(;r<n.length;r++)n[r]=Zp(im(n[r-2]),n[r-7],rm(n[r-15]),n[r-16]);var i=this.h[0],o=this.h[1],a=this.h[2],s=this.h[3],u=this.h[4],l=this.h[5],c=this.h[6],d=this.h[7];for(Gp(this.k.length===n.length),r=0;r<n.length;r++){var f=Xp(d,nm(u),Jp(u,l,c),this.k[r],n[r]),h=Qp(tm(i),em(i,o,a));d=c,c=l,l=u,u=Qp(s,f),s=a,a=o,o=i,i=Qp(f,h)}this.h[0]=Qp(this.h[0],i),this.h[1]=Qp(this.h[1],o),this.h[2]=Qp(this.h[2],a),this.h[3]=Qp(this.h[3],s),this.h[4]=Qp(this.h[4],u),this.h[5]=Qp(this.h[5],l),this.h[6]=Qp(this.h[6],c),this.h[7]=Qp(this.h[7],d)},sm.prototype._digest=function(e){return"hex"===e?Hp.toHex32(this.h,"big"):Hp.split32(this.h,"big")};var lm=yp,cm=um;function dm(){if(!(this instanceof dm))return new dm;cm.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}lm.inherits(dm,cm);var fm=dm;dm.blockSize=512,dm.outSize=224,dm.hmacStrength=192,dm.padLength=64,dm.prototype._digest=function(e){return"hex"===e?lm.toHex32(this.h.slice(0,7),"big"):lm.split32(this.h.slice(0,7),"big")};var hm=yp,pm=kp,mm=Gl,gm=hm.rotr64_hi,vm=hm.rotr64_lo,ym=hm.shr64_hi,bm=hm.shr64_lo,wm=hm.sum64,Am=hm.sum64_hi,_m=hm.sum64_lo,Em=hm.sum64_4_hi,Sm=hm.sum64_4_lo,km=hm.sum64_5_hi,Mm=hm.sum64_5_lo,Cm=pm.BlockHash,xm=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Rm(){if(!(this instanceof Rm))return new Rm;Cm.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=xm,this.W=new Array(160)}hm.inherits(Rm,Cm);var Om=Rm;function Tm(e,t,n,r,i){var o=e&n^~e&i;return o<0&&(o+=4294967296),o}function Pm(e,t,n,r,i,o){var a=t&r^~t&o;return a<0&&(a+=4294967296),a}function Lm(e,t,n,r,i){var o=e&n^e&i^n&i;return o<0&&(o+=4294967296),o}function Im(e,t,n,r,i,o){var a=t&r^t&o^r&o;return a<0&&(a+=4294967296),a}function Nm(e,t){var n=gm(e,t,28)^gm(t,e,2)^gm(t,e,7);return n<0&&(n+=4294967296),n}function Dm(e,t){var n=vm(e,t,28)^vm(t,e,2)^vm(t,e,7);return n<0&&(n+=4294967296),n}function Bm(e,t){var n=gm(e,t,14)^gm(e,t,18)^gm(t,e,9);return n<0&&(n+=4294967296),n}function jm(e,t){var n=vm(e,t,14)^vm(e,t,18)^vm(t,e,9);return n<0&&(n+=4294967296),n}function Um(e,t){var n=gm(e,t,1)^gm(e,t,8)^ym(e,t,7);return n<0&&(n+=4294967296),n}function zm(e,t){var n=vm(e,t,1)^vm(e,t,8)^bm(e,t,7);return n<0&&(n+=4294967296),n}function Fm(e,t){var n=gm(e,t,19)^gm(t,e,29)^ym(e,t,6);return n<0&&(n+=4294967296),n}function qm(e,t){var n=vm(e,t,19)^vm(t,e,29)^bm(e,t,6);return n<0&&(n+=4294967296),n}Rm.blockSize=1024,Rm.outSize=512,Rm.hmacStrength=192,Rm.padLength=128,Rm.prototype._prepareBlock=function(e,t){for(var n=this.W,r=0;r<32;r++)n[r]=e[t+r];for(;r<n.length;r+=2){var i=Fm(n[r-4],n[r-3]),o=qm(n[r-4],n[r-3]),a=n[r-14],s=n[r-13],u=Um(n[r-30],n[r-29]),l=zm(n[r-30],n[r-29]),c=n[r-32],d=n[r-31];n[r]=Em(i,o,a,s,u,l,c,d),n[r+1]=Sm(i,o,a,s,u,l,c,d)}},Rm.prototype._update=function(e,t){this._prepareBlock(e,t);var n=this.W,r=this.h[0],i=this.h[1],o=this.h[2],a=this.h[3],s=this.h[4],u=this.h[5],l=this.h[6],c=this.h[7],d=this.h[8],f=this.h[9],h=this.h[10],p=this.h[11],m=this.h[12],g=this.h[13],v=this.h[14],y=this.h[15];mm(this.k.length===n.length);for(var b=0;b<n.length;b+=2){var w=v,A=y,_=Bm(d,f),E=jm(d,f),S=Tm(d,0,h,0,m),k=Pm(0,f,0,p,0,g),M=this.k[b],C=this.k[b+1],x=n[b],R=n[b+1],O=km(w,A,_,E,S,k,M,C,x,R),T=Mm(w,A,_,E,S,k,M,C,x,R);w=Nm(r,i),A=Dm(r,i),_=Lm(r,0,o,0,s),E=Im(0,i,0,a,0,u);var P=Am(w,A,_,E),L=_m(w,A,_,E);v=m,y=g,m=h,g=p,h=d,p=f,d=Am(l,c,O,T),f=_m(c,c,O,T),l=s,c=u,s=o,u=a,o=r,a=i,r=Am(O,T,P,L),i=_m(O,T,P,L)}wm(this.h,0,r,i),wm(this.h,2,o,a),wm(this.h,4,s,u),wm(this.h,6,l,c),wm(this.h,8,d,f),wm(this.h,10,h,p),wm(this.h,12,m,g),wm(this.h,14,v,y)},Rm.prototype._digest=function(e){return"hex"===e?hm.toHex32(this.h,"big"):hm.split32(this.h,"big")};var Wm=yp,Vm=Om;function Km(){if(!(this instanceof Km))return new Km;Vm.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}Wm.inherits(Km,Vm);var Hm=Km;Km.blockSize=1024,Km.outSize=384,Km.hmacStrength=192,Km.padLength=128,Km.prototype._digest=function(e){return"hex"===e?Wm.toHex32(this.h.slice(0,12),"big"):Wm.split32(this.h.slice(0,12),"big")},Rp.sha1=Kp,Rp.sha224=fm,Rp.sha256=um,Rp.sha384=Hm,Rp.sha512=Om;var $m={},Ym=yp,Gm=kp,Qm=Ym.rotl32,Zm=Ym.sum32,Xm=Ym.sum32_3,Jm=Ym.sum32_4,eg=Gm.BlockHash;function tg(){if(!(this instanceof tg))return new tg;eg.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function ng(e,t,n,r){return e<=15?t^n^r:e<=31?t&n|~t&r:e<=47?(t|~n)^r:e<=63?t&r|n&~r:t^(n|~r)}function rg(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function ig(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}Ym.inherits(tg,eg),$m.ripemd160=tg,tg.blockSize=512,tg.outSize=160,tg.hmacStrength=192,tg.padLength=64,tg.prototype._update=function(e,t){for(var n=this.h[0],r=this.h[1],i=this.h[2],o=this.h[3],a=this.h[4],s=n,u=r,l=i,c=o,d=a,f=0;f<80;f++){var h=Zm(Qm(Jm(n,ng(f,r,i,o),e[og[f]+t],rg(f)),sg[f]),a);n=a,a=o,o=Qm(i,10),i=r,r=h,h=Zm(Qm(Jm(s,ng(79-f,u,l,c),e[ag[f]+t],ig(f)),ug[f]),d),s=d,d=c,c=Qm(l,10),l=u,u=h}h=Xm(this.h[1],i,c),this.h[1]=Xm(this.h[2],o,d),this.h[2]=Xm(this.h[3],a,s),this.h[3]=Xm(this.h[4],n,u),this.h[4]=Xm(this.h[0],r,l),this.h[0]=h},tg.prototype._digest=function(e){return"hex"===e?Ym.toHex32(this.h,"little"):Ym.split32(this.h,"little")};var og=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],ag=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],sg=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],ug=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],lg=yp,cg=Gl;function dg(e,t,n){if(!(this instanceof dg))return new dg(e,t,n);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(lg.toArray(t,n))}var fg,hg,pg=dg;dg.prototype._init=function(e){e.length>this.blockSize&&(e=(new this.Hash).update(e).digest()),cg(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=(new this.Hash).update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=(new this.Hash).update(e)},dg.prototype.update=function(e,t){return this.inner.update(e,t),this},dg.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)},function(e){var t=vp;t.utils=yp,t.common=kp,t.sha=Rp,t.ripemd=$m,t.hmac=pg,t.sha1=t.sha.sha1,t.sha256=t.sha.sha256,t.sha224=t.sha.sha224,t.sha384=t.sha.sha384,t.sha512=t.sha.sha512,t.ripemd160=t.ripemd.ripemd160}(),function(e){var t,n=gp,r=vp,i=Uh,o=Bh.assert;function a(e){"short"===e.type?this.curve=new i.short(e):"edwards"===e.type?this.curve=new i.edwards(e):this.curve=new i.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,o(this.g.validate(),"Invalid curve"),o(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function s(e,t){Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:function(){var r=new a(t);return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=a,s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:r.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:r.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:r.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:r.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:r.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{t=hg?fg:(hg=1,fg={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}})}catch(e){t=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:r.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",t]})}();var mg=vp,gg=jh,vg=Gl;function yg(e){if(!(this instanceof yg))return new yg(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=gg.toArray(e.entropy,e.entropyEnc||"hex"),n=gg.toArray(e.nonce,e.nonceEnc||"hex"),r=gg.toArray(e.pers,e.persEnc||"hex");vg(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,n,r)}var bg=yg;yg.prototype._init=function(e,t,n){var r=e.concat(t).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i<this.V.length;i++)this.K[i]=0,this.V[i]=1;this._update(r),this._reseed=1,this.reseedInterval=281474976710656},yg.prototype._hmac=function(){return new mg.hmac(this.hash,this.K)},yg.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},yg.prototype.reseed=function(e,t,n,r){"string"!=typeof t&&(r=n,n=t,t=null),e=gg.toArray(e,t),n=gg.toArray(n,r),vg(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},yg.prototype.generate=function(e,t,n,r){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(r=n,n=t,t=null),n&&(n=gg.toArray(n,r||"hex"),this._update(n));for(var i=[];i.length<e;)this.V=this._hmac().update(this.V).digest(),i=i.concat(this.V);var o=i.slice(0,e);return this._update(n),this._reseed++,gg.encode(o,t)};var wg=vf,Ag=Bh.assert;function _g(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}var Eg=_g;_g.fromPublic=function(e,t,n){return t instanceof _g?t:new _g(e,{pub:t,pubEnc:n})},_g.fromPrivate=function(e,t,n){return t instanceof _g?t:new _g(e,{priv:t,privEnc:n})},_g.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},_g.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},_g.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},_g.prototype._importPrivate=function(e,t){this.priv=new wg(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},_g.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?Ag(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||Ag(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},_g.prototype.derive=function(e){return e.validate()||Ag(e.validate(),"public point not validated"),e.mul(this.priv).getX()},_g.prototype.sign=function(e,t,n){return this.ec.sign(e,this,t,n)},_g.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},_g.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var Sg=vf,kg=Bh,Mg=kg.assert;function Cg(e,t){if(e instanceof Cg)return e;this._importDER(e,t)||(Mg(e.r&&e.s,"Signature without r or s"),this.r=new Sg(e.r,16),this.s=new Sg(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var xg,Rg,Og=Cg;function Tg(){this.place=0}function Pg(e,t){var n=e[t.place++];if(!(128&n))return n;var r=15&n;if(0===r||r>4)return!1;for(var i=0,o=0,a=t.place;o<r;o++,a++)i<<=8,i|=e[a],i>>>=0;return!(i<=127)&&(t.place=a,i)}function Lg(e){for(var t=0,n=e.length-1;!e[t]&&!(128&e[t+1])&&t<n;)t++;return 0===t?e:e.slice(t)}function Ig(e,t){if(t<128)e.push(t);else{var n=1+(Math.log(t)/Math.LN2>>>3);for(e.push(128|n);--n;)e.push(t>>>(n<<3)&255);e.push(t)}}Cg.prototype._importDER=function(e,t){e=kg.toArray(e,t);var n=new Tg;if(48!==e[n.place++])return!1;var r=Pg(e,n);if(!1===r)return!1;if(r+n.place!==e.length)return!1;if(2!==e[n.place++])return!1;var i=Pg(e,n);if(!1===i)return!1;var o=e.slice(n.place,i+n.place);if(n.place+=i,2!==e[n.place++])return!1;var a=Pg(e,n);if(!1===a)return!1;if(e.length!==a+n.place)return!1;var s=e.slice(n.place,a+n.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}return this.r=new Sg(o),this.s=new Sg(s),this.recoveryParam=null,!0},Cg.prototype.toDER=function(e){var t=this.r.toArray(),n=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&n[0]&&(n=[0].concat(n)),t=Lg(t),n=Lg(n);!(n[0]||128&n[1]);)n=n.slice(1);var r=[2];Ig(r,t.length),(r=r.concat(t)).push(2),Ig(r,n.length);var i=r.concat(n),o=[48];return Ig(o,i.length),o=o.concat(i),kg.encode(o,e)};var Ng=Bh,Dg=Ng.assert,Bg=Ng.parseBytes,jg=Ng.cachedProperty;function Ug(e,t){this.eddsa=e,this._secret=Bg(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=Bg(t.pub)}Ug.fromPublic=function(e,t){return t instanceof Ug?t:new Ug(e,{pub:t})},Ug.fromSecret=function(e,t){return t instanceof Ug?t:new Ug(e,{secret:t})},Ug.prototype.secret=function(){return this._secret},jg(Ug,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),jg(Ug,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),jg(Ug,"privBytes",(function(){var e=this.eddsa,t=this.hash(),n=e.encodingLength-1,r=t.slice(0,e.encodingLength);return r[0]&=248,r[n]&=127,r[n]|=64,r})),jg(Ug,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),jg(Ug,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),jg(Ug,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),Ug.prototype.sign=function(e){return Dg(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},Ug.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},Ug.prototype.getSecret=function(e){return Dg(this._secret,"KeyPair is public only"),Ng.encode(this.secret(),e)},Ug.prototype.getPublic=function(e){return Ng.encode(this.pubBytes(),e)};var zg=Ug,Fg=vf,qg=Bh,Wg=qg.assert,Vg=qg.cachedProperty,Kg=qg.parseBytes;function Hg(e,t){this.eddsa=e,"object"!=typeof t&&(t=Kg(t)),Array.isArray(t)&&(t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),Wg(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof Fg&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}Vg(Hg,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),Vg(Hg,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),Vg(Hg,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),Vg(Hg,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),Hg.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},Hg.prototype.toHex=function(){return qg.encode(this.toBytes(),"hex").toUpperCase()};var $g=Hg,Yg=vp,Gg=gp,Qg=Bh,Zg=Qg.assert,Xg=Qg.parseBytes,Jg=zg,ev=$g;function tv(e){if(Zg("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof tv))return new tv(e);e=Gg[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=Yg.sha512}var nv,rv=tv;function iv(){return nv||(nv=1,function(e){var t=Nh;t.version=Dh.version,t.utils=Bh,t.rand=bf(),t.curve=Uh,t.curves=gp,t.ec=function(){if(Rg)return xg;Rg=1;var e=vf,t=bg,n=Bh,r=gp,i=bf(),o=n.assert,a=Eg,s=Og;function u(e){if(!(this instanceof u))return new u(e);"string"==typeof e&&(o(Object.prototype.hasOwnProperty.call(r,e),"Unknown curve "+e),e=r[e]),e instanceof r.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}return xg=u,u.prototype.keyPair=function(e){return new a(this,e)},u.prototype.keyFromPrivate=function(e,t){return a.fromPrivate(this,e,t)},u.prototype.keyFromPublic=function(e,t){return a.fromPublic(this,e,t)},u.prototype.genKeyPair=function(n){n||(n={});for(var r=new t({hash:this.hash,pers:n.pers,persEnc:n.persEnc||"utf8",entropy:n.entropy||i(this.hash.hmacStrength),entropyEnc:n.entropy&&n.entropyEnc||"utf8",nonce:this.n.toArray()}),o=this.n.byteLength(),a=this.n.sub(new e(2));;){var s=new e(r.generate(o));if(!(s.cmp(a)>0))return s.iaddn(1),this.keyFromPrivate(s)}},u.prototype._truncateToN=function(e,t){var n=8*e.byteLength()-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},u.prototype.sign=function(n,r,i,o){"object"==typeof i&&(o=i,i=null),o||(o={}),r=this.keyFromPrivate(r,i),n=this._truncateToN(new e(n,16));for(var a=this.n.byteLength(),u=r.getPrivate().toArray("be",a),l=n.toArray("be",a),c=new t({hash:this.hash,entropy:u,nonce:l,pers:o.pers,persEnc:o.persEnc||"utf8"}),d=this.n.sub(new e(1)),f=0;;f++){var h=o.k?o.k(f):new e(c.generate(this.n.byteLength()));if(!((h=this._truncateToN(h,!0)).cmpn(1)<=0||h.cmp(d)>=0)){var p=this.g.mul(h);if(!p.isInfinity()){var m=p.getX(),g=m.umod(this.n);if(0!==g.cmpn(0)){var v=h.invm(this.n).mul(g.mul(r.getPrivate()).iadd(n));if(0!==(v=v.umod(this.n)).cmpn(0)){var y=(p.getY().isOdd()?1:0)|(0!==m.cmp(g)?2:0);return o.canonical&&v.cmp(this.nh)>0&&(v=this.n.sub(v),y^=1),new s({r:g,s:v,recoveryParam:y})}}}}}},u.prototype.verify=function(t,n,r,i){t=this._truncateToN(new e(t,16)),r=this.keyFromPublic(r,i);var o=(n=new s(n,"hex")).r,a=n.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var u,l=a.invm(this.n),c=l.mul(t).umod(this.n),d=l.mul(o).umod(this.n);return this.curve._maxwellTrick?!(u=this.g.jmulAdd(c,r.getPublic(),d)).isInfinity()&&u.eqXToP(o):!(u=this.g.mulAdd(c,r.getPublic(),d)).isInfinity()&&0===u.getX().umod(this.n).cmp(o)},u.prototype.recoverPubKey=function(t,n,r,i){o((3&r)===r,"The recovery param is more than two bits"),n=new s(n,i);var a=this.n,u=new e(t),l=n.r,c=n.s,d=1&r,f=r>>1;if(l.cmp(this.curve.p.umod(this.curve.n))>=0&&f)throw new Error("Unable to find sencond key candinate");l=f?this.curve.pointFromX(l.add(this.curve.n),d):this.curve.pointFromX(l,d);var h=n.r.invm(a),p=a.sub(u).mul(h).umod(a),m=c.mul(h).umod(a);return this.g.mulAdd(p,l,m)},u.prototype.getKeyRecoveryParam=function(e,t,n,r){if(null!==(t=new s(t,r)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(e,t,i)}catch(e){continue}if(o.eq(n))return i}throw new Error("Unable to find valid recovery factor")},xg}(),t.eddsa=rv}()),Nh}tv.prototype.sign=function(e,t){e=Xg(e);var n=this.keyFromSecret(t),r=this.hashInt(n.messagePrefix(),e),i=this.g.mul(r),o=this.encodePoint(i),a=this.hashInt(o,n.pubBytes(),e).mul(n.priv()),s=r.add(a).umod(this.curve.n);return this.makeSignature({R:i,S:s,Rencoded:o})},tv.prototype.verify=function(e,t,n){e=Xg(e),t=this.makeSignature(t);var r=this.keyFromPublic(n),i=this.hashInt(t.Rencoded(),r.pubBytes(),e),o=this.g.mul(t.S());return t.R().add(r.pub().mul(i)).eq(o)},tv.prototype.hashInt=function(){for(var e=this.hash(),t=0;t<arguments.length;t++)e.update(arguments[t]);return Qg.intFromLE(e.digest()).umod(this.curve.n)},tv.prototype.keyFromPublic=function(e){return Jg.fromPublic(this,e)},tv.prototype.keyFromSecret=function(e){return Jg.fromSecret(this,e)},tv.prototype.makeSignature=function(e){return e instanceof ev?e:new ev(this,e)},tv.prototype.encodePoint=function(e){var t=e.getY().toArray("le",this.encodingLength);return t[this.encodingLength-1]|=e.getX().isOdd()?128:0,t},tv.prototype.decodePoint=function(e){var t=(e=Qg.parseBytes(e)).length-1,n=e.slice(0,t).concat(-129&e[t]),r=0!=(128&e[t]),i=Qg.intFromLE(n);return this.curve.pointFromY(i,r)},tv.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)},tv.prototype.decodeInt=function(e){return Qg.intFromLE(e)},tv.prototype.isPoint=function(e){return e instanceof this.pointClass};var ov={exports:{}};!function(e,t){function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function r(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function i(e,t,n){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}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:yr.Buffer}catch(e){}function a(e,t){var r=e.charCodeAt(t);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+e)}function s(e,t,n){var r=a(e,n);return n-1>=t&&(r|=a(e,n-1)<<4),r}function u(e,t,r,i){for(var o=0,a=0,s=Math.min(e.length,r),u=t;u<s;u++){var l=e.charCodeAt(u)-48;o*=i,a=l>=49?l-49+10:l>=17?l-17+10:l,n(l>=0&&a<i,"Invalid character"),o+=a}return o}function l(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,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<e.length&&(16===t?this._parseHex(e,i,r):(this._parseBase(e,t,i),"le"===r&&this._initArray(this.toArray(),t,r)))},i.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(n(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},i.prototype._initArray=function(e,t,r){if(n("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===r)for(i=e.length-1,o=0;i>=0;i-=3)a=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i<e.length;i+=3)a=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},i.prototype._parseHex=function(e,t,n){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 i,o=0,a=0;if("be"===n)for(r=e.length-1;r>=t;r-=2)i=s(e,t,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(e.length-t)%2==0?t+1:t;r<e.length;r+=2)i=s(e,t,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,a=o%r,s=Math.min(o,o-a)+n,l=0,c=n;c<s;c+=r)l=u(e,c,c+r,t),this.imuln(i),this.words[0]+l<67108864?this.words[0]+=l:this._iaddn(l);if(0!==a){var d=1;for(l=u(e,c,e.length,t),c=0;c<a;c++)d*=t;this.imuln(d),this.words[0]+l<67108864?this.words[0]+=l:this._iaddn(l)}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){l(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")]=c}catch(e){i.prototype.inspect=c}else i.prototype.inspect=c;function c(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function p(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var l=1;l<r;l++){for(var c=u>>>26,d=67108863&u,f=Math.min(l,t.length-1),h=Math.max(0,l-e.length+1);h<=f;h++){var p=l-h|0;c+=(a=(i=0|e.words[p])*(o=0|t.words[h])+d)/67108864|0,d=67108863&a}n.words[l]=0|d,u=0|c}return 0!==u?n.words[l]=0|u:n.length--,n._strip()}i.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<i|o)).toString(16);o=s>>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),r=0!==o||a!==this.length-1?d[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=f[e],c=h[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modrn(c).toString(e);r=(p=p.idivn(c)).isZero()?m+r:d[l-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16,2)},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,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var a=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,o);return this["_toArrayLike"+("le"===t?"LE":"BE")](a,i),a},i.prototype._toArrayLikeLE=function(e,t){for(var n=0,r=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|r;e[n++]=255&a,n<e.length&&(e[n++]=a>>8&255),n<e.length&&(e[n++]=a>>16&255),6===o?(n<e.length&&(e[n++]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n<e.length)for(e[n++]=r;n<e.length;)e[n++]=0},i.prototype._toArrayLikeBE=function(e,t){for(var n=e.length-1,r=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|r;e[n--]=255&a,n>=0&&(e[n--]=a>>8&255),n>=0&&(e[n--]=a>>16&255),6===o?(n>=0&&(e[n--]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n>=0)for(e[n--]=r;n>=0;)e[n--]=0},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var n=this._zeroBits(this.words[t]);if(e+=n,26!==n)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 n(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 n=0;n<t.length;n++)this.words[n]=this.words[n]&e.words[n];return this.length=t.length,this._strip()},i.prototype.iand=function(e){return n(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,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;r<n.length;r++)this.words[r]=t.words[r]^n.words[r];if(this!==t)for(;r<t.length;r++)this.words[r]=t.words[r];return this.length=t.length,this._strip()},i.prototype.ixor=function(e){return n(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){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i<t;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<<i:this.words[r]&~(1<<i),this._strip()},i.prototype.iadd=function(e){var t,n,r;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?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o<r.length;o++)t=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&t,i=t>>>26;for(;0!==i&&o<n.length;o++)t=(0|n.words[o])+i,this.words[o]=67108863&t,i=t>>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;o<n.length;o++)this.words[o]=n.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 n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,a=0;a<r.length;a++)o=(t=(0|n.words[a])-(0|r.words[a])+o)>>26,this.words[a]=67108863&t;for(;0!==o&&a<n.length;a++)o=(t=(0|n.words[a])+o)>>26,this.words[a]=67108863&t;if(0===o&&a<n.length&&n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this.length=Math.max(this.length,a),n!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(e){return this.clone().isub(e)};var m=function(e,t,n){var r,i,o,a=e.words,s=t.words,u=n.words,l=0,c=0|a[0],d=8191&c,f=c>>>13,h=0|a[1],p=8191&h,m=h>>>13,g=0|a[2],v=8191&g,y=g>>>13,b=0|a[3],w=8191&b,A=b>>>13,_=0|a[4],E=8191&_,S=_>>>13,k=0|a[5],M=8191&k,C=k>>>13,x=0|a[6],R=8191&x,O=x>>>13,T=0|a[7],P=8191&T,L=T>>>13,I=0|a[8],N=8191&I,D=I>>>13,B=0|a[9],j=8191&B,U=B>>>13,z=0|s[0],F=8191&z,q=z>>>13,W=0|s[1],V=8191&W,K=W>>>13,H=0|s[2],$=8191&H,Y=H>>>13,G=0|s[3],Q=8191&G,Z=G>>>13,X=0|s[4],J=8191&X,ee=X>>>13,te=0|s[5],ne=8191&te,re=te>>>13,ie=0|s[6],oe=8191&ie,ae=ie>>>13,se=0|s[7],ue=8191&se,le=se>>>13,ce=0|s[8],de=8191&ce,fe=ce>>>13,he=0|s[9],pe=8191&he,me=he>>>13;n.negative=e.negative^t.negative,n.length=19;var ge=(l+(r=Math.imul(d,F))|0)+((8191&(i=(i=Math.imul(d,q))+Math.imul(f,F)|0))<<13)|0;l=((o=Math.imul(f,q))+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,r=Math.imul(p,F),i=(i=Math.imul(p,q))+Math.imul(m,F)|0,o=Math.imul(m,q);var ve=(l+(r=r+Math.imul(d,V)|0)|0)+((8191&(i=(i=i+Math.imul(d,K)|0)+Math.imul(f,V)|0))<<13)|0;l=((o=o+Math.imul(f,K)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,r=Math.imul(v,F),i=(i=Math.imul(v,q))+Math.imul(y,F)|0,o=Math.imul(y,q),r=r+Math.imul(p,V)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,K)|0;var ye=(l+(r=r+Math.imul(d,$)|0)|0)+((8191&(i=(i=i+Math.imul(d,Y)|0)+Math.imul(f,$)|0))<<13)|0;l=((o=o+Math.imul(f,Y)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,r=Math.imul(w,F),i=(i=Math.imul(w,q))+Math.imul(A,F)|0,o=Math.imul(A,q),r=r+Math.imul(v,V)|0,i=(i=i+Math.imul(v,K)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,K)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,Y)|0;var be=(l+(r=r+Math.imul(d,Q)|0)|0)+((8191&(i=(i=i+Math.imul(d,Z)|0)+Math.imul(f,Q)|0))<<13)|0;l=((o=o+Math.imul(f,Z)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(E,F),i=(i=Math.imul(E,q))+Math.imul(S,F)|0,o=Math.imul(S,q),r=r+Math.imul(w,V)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(A,V)|0,o=o+Math.imul(A,K)|0,r=r+Math.imul(v,$)|0,i=(i=i+Math.imul(v,Y)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,Y)|0,r=r+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,Z)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,Z)|0;var we=(l+(r=r+Math.imul(d,J)|0)|0)+((8191&(i=(i=i+Math.imul(d,ee)|0)+Math.imul(f,J)|0))<<13)|0;l=((o=o+Math.imul(f,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(M,F),i=(i=Math.imul(M,q))+Math.imul(C,F)|0,o=Math.imul(C,q),r=r+Math.imul(E,V)|0,i=(i=i+Math.imul(E,K)|0)+Math.imul(S,V)|0,o=o+Math.imul(S,K)|0,r=r+Math.imul(w,$)|0,i=(i=i+Math.imul(w,Y)|0)+Math.imul(A,$)|0,o=o+Math.imul(A,Y)|0,r=r+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,Z)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,Z)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,ee)|0;var Ae=(l+(r=r+Math.imul(d,ne)|0)|0)+((8191&(i=(i=i+Math.imul(d,re)|0)+Math.imul(f,ne)|0))<<13)|0;l=((o=o+Math.imul(f,re)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(R,F),i=(i=Math.imul(R,q))+Math.imul(O,F)|0,o=Math.imul(O,q),r=r+Math.imul(M,V)|0,i=(i=i+Math.imul(M,K)|0)+Math.imul(C,V)|0,o=o+Math.imul(C,K)|0,r=r+Math.imul(E,$)|0,i=(i=i+Math.imul(E,Y)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,Y)|0,r=r+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,Z)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,Z)|0,r=r+Math.imul(v,J)|0,i=(i=i+Math.imul(v,ee)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,ee)|0,r=r+Math.imul(p,ne)|0,i=(i=i+Math.imul(p,re)|0)+Math.imul(m,ne)|0,o=o+Math.imul(m,re)|0;var _e=(l+(r=r+Math.imul(d,oe)|0)|0)+((8191&(i=(i=i+Math.imul(d,ae)|0)+Math.imul(f,oe)|0))<<13)|0;l=((o=o+Math.imul(f,ae)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,r=Math.imul(P,F),i=(i=Math.imul(P,q))+Math.imul(L,F)|0,o=Math.imul(L,q),r=r+Math.imul(R,V)|0,i=(i=i+Math.imul(R,K)|0)+Math.imul(O,V)|0,o=o+Math.imul(O,K)|0,r=r+Math.imul(M,$)|0,i=(i=i+Math.imul(M,Y)|0)+Math.imul(C,$)|0,o=o+Math.imul(C,Y)|0,r=r+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,Z)|0)+Math.imul(S,Q)|0,o=o+Math.imul(S,Z)|0,r=r+Math.imul(w,J)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(A,J)|0,o=o+Math.imul(A,ee)|0,r=r+Math.imul(v,ne)|0,i=(i=i+Math.imul(v,re)|0)+Math.imul(y,ne)|0,o=o+Math.imul(y,re)|0,r=r+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,ae)|0)+Math.imul(m,oe)|0,o=o+Math.imul(m,ae)|0;var Ee=(l+(r=r+Math.imul(d,ue)|0)|0)+((8191&(i=(i=i+Math.imul(d,le)|0)+Math.imul(f,ue)|0))<<13)|0;l=((o=o+Math.imul(f,le)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(N,F),i=(i=Math.imul(N,q))+Math.imul(D,F)|0,o=Math.imul(D,q),r=r+Math.imul(P,V)|0,i=(i=i+Math.imul(P,K)|0)+Math.imul(L,V)|0,o=o+Math.imul(L,K)|0,r=r+Math.imul(R,$)|0,i=(i=i+Math.imul(R,Y)|0)+Math.imul(O,$)|0,o=o+Math.imul(O,Y)|0,r=r+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,Z)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,Z)|0,r=r+Math.imul(E,J)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(S,J)|0,o=o+Math.imul(S,ee)|0,r=r+Math.imul(w,ne)|0,i=(i=i+Math.imul(w,re)|0)+Math.imul(A,ne)|0,o=o+Math.imul(A,re)|0,r=r+Math.imul(v,oe)|0,i=(i=i+Math.imul(v,ae)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,ae)|0,r=r+Math.imul(p,ue)|0,i=(i=i+Math.imul(p,le)|0)+Math.imul(m,ue)|0,o=o+Math.imul(m,le)|0;var Se=(l+(r=r+Math.imul(d,de)|0)|0)+((8191&(i=(i=i+Math.imul(d,fe)|0)+Math.imul(f,de)|0))<<13)|0;l=((o=o+Math.imul(f,fe)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(j,F),i=(i=Math.imul(j,q))+Math.imul(U,F)|0,o=Math.imul(U,q),r=r+Math.imul(N,V)|0,i=(i=i+Math.imul(N,K)|0)+Math.imul(D,V)|0,o=o+Math.imul(D,K)|0,r=r+Math.imul(P,$)|0,i=(i=i+Math.imul(P,Y)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,Y)|0,r=r+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,Z)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,Z)|0,r=r+Math.imul(M,J)|0,i=(i=i+Math.imul(M,ee)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,ee)|0,r=r+Math.imul(E,ne)|0,i=(i=i+Math.imul(E,re)|0)+Math.imul(S,ne)|0,o=o+Math.imul(S,re)|0,r=r+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,ae)|0)+Math.imul(A,oe)|0,o=o+Math.imul(A,ae)|0,r=r+Math.imul(v,ue)|0,i=(i=i+Math.imul(v,le)|0)+Math.imul(y,ue)|0,o=o+Math.imul(y,le)|0,r=r+Math.imul(p,de)|0,i=(i=i+Math.imul(p,fe)|0)+Math.imul(m,de)|0,o=o+Math.imul(m,fe)|0;var ke=(l+(r=r+Math.imul(d,pe)|0)|0)+((8191&(i=(i=i+Math.imul(d,me)|0)+Math.imul(f,pe)|0))<<13)|0;l=((o=o+Math.imul(f,me)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(j,V),i=(i=Math.imul(j,K))+Math.imul(U,V)|0,o=Math.imul(U,K),r=r+Math.imul(N,$)|0,i=(i=i+Math.imul(N,Y)|0)+Math.imul(D,$)|0,o=o+Math.imul(D,Y)|0,r=r+Math.imul(P,Q)|0,i=(i=i+Math.imul(P,Z)|0)+Math.imul(L,Q)|0,o=o+Math.imul(L,Z)|0,r=r+Math.imul(R,J)|0,i=(i=i+Math.imul(R,ee)|0)+Math.imul(O,J)|0,o=o+Math.imul(O,ee)|0,r=r+Math.imul(M,ne)|0,i=(i=i+Math.imul(M,re)|0)+Math.imul(C,ne)|0,o=o+Math.imul(C,re)|0,r=r+Math.imul(E,oe)|0,i=(i=i+Math.imul(E,ae)|0)+Math.imul(S,oe)|0,o=o+Math.imul(S,ae)|0,r=r+Math.imul(w,ue)|0,i=(i=i+Math.imul(w,le)|0)+Math.imul(A,ue)|0,o=o+Math.imul(A,le)|0,r=r+Math.imul(v,de)|0,i=(i=i+Math.imul(v,fe)|0)+Math.imul(y,de)|0,o=o+Math.imul(y,fe)|0;var Me=(l+(r=r+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;l=((o=o+Math.imul(m,me)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,r=Math.imul(j,$),i=(i=Math.imul(j,Y))+Math.imul(U,$)|0,o=Math.imul(U,Y),r=r+Math.imul(N,Q)|0,i=(i=i+Math.imul(N,Z)|0)+Math.imul(D,Q)|0,o=o+Math.imul(D,Z)|0,r=r+Math.imul(P,J)|0,i=(i=i+Math.imul(P,ee)|0)+Math.imul(L,J)|0,o=o+Math.imul(L,ee)|0,r=r+Math.imul(R,ne)|0,i=(i=i+Math.imul(R,re)|0)+Math.imul(O,ne)|0,o=o+Math.imul(O,re)|0,r=r+Math.imul(M,oe)|0,i=(i=i+Math.imul(M,ae)|0)+Math.imul(C,oe)|0,o=o+Math.imul(C,ae)|0,r=r+Math.imul(E,ue)|0,i=(i=i+Math.imul(E,le)|0)+Math.imul(S,ue)|0,o=o+Math.imul(S,le)|0,r=r+Math.imul(w,de)|0,i=(i=i+Math.imul(w,fe)|0)+Math.imul(A,de)|0,o=o+Math.imul(A,fe)|0;var Ce=(l+(r=r+Math.imul(v,pe)|0)|0)+((8191&(i=(i=i+Math.imul(v,me)|0)+Math.imul(y,pe)|0))<<13)|0;l=((o=o+Math.imul(y,me)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,r=Math.imul(j,Q),i=(i=Math.imul(j,Z))+Math.imul(U,Q)|0,o=Math.imul(U,Z),r=r+Math.imul(N,J)|0,i=(i=i+Math.imul(N,ee)|0)+Math.imul(D,J)|0,o=o+Math.imul(D,ee)|0,r=r+Math.imul(P,ne)|0,i=(i=i+Math.imul(P,re)|0)+Math.imul(L,ne)|0,o=o+Math.imul(L,re)|0,r=r+Math.imul(R,oe)|0,i=(i=i+Math.imul(R,ae)|0)+Math.imul(O,oe)|0,o=o+Math.imul(O,ae)|0,r=r+Math.imul(M,ue)|0,i=(i=i+Math.imul(M,le)|0)+Math.imul(C,ue)|0,o=o+Math.imul(C,le)|0,r=r+Math.imul(E,de)|0,i=(i=i+Math.imul(E,fe)|0)+Math.imul(S,de)|0,o=o+Math.imul(S,fe)|0;var xe=(l+(r=r+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,me)|0)+Math.imul(A,pe)|0))<<13)|0;l=((o=o+Math.imul(A,me)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(j,J),i=(i=Math.imul(j,ee))+Math.imul(U,J)|0,o=Math.imul(U,ee),r=r+Math.imul(N,ne)|0,i=(i=i+Math.imul(N,re)|0)+Math.imul(D,ne)|0,o=o+Math.imul(D,re)|0,r=r+Math.imul(P,oe)|0,i=(i=i+Math.imul(P,ae)|0)+Math.imul(L,oe)|0,o=o+Math.imul(L,ae)|0,r=r+Math.imul(R,ue)|0,i=(i=i+Math.imul(R,le)|0)+Math.imul(O,ue)|0,o=o+Math.imul(O,le)|0,r=r+Math.imul(M,de)|0,i=(i=i+Math.imul(M,fe)|0)+Math.imul(C,de)|0,o=o+Math.imul(C,fe)|0;var Re=(l+(r=r+Math.imul(E,pe)|0)|0)+((8191&(i=(i=i+Math.imul(E,me)|0)+Math.imul(S,pe)|0))<<13)|0;l=((o=o+Math.imul(S,me)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,r=Math.imul(j,ne),i=(i=Math.imul(j,re))+Math.imul(U,ne)|0,o=Math.imul(U,re),r=r+Math.imul(N,oe)|0,i=(i=i+Math.imul(N,ae)|0)+Math.imul(D,oe)|0,o=o+Math.imul(D,ae)|0,r=r+Math.imul(P,ue)|0,i=(i=i+Math.imul(P,le)|0)+Math.imul(L,ue)|0,o=o+Math.imul(L,le)|0,r=r+Math.imul(R,de)|0,i=(i=i+Math.imul(R,fe)|0)+Math.imul(O,de)|0,o=o+Math.imul(O,fe)|0;var Oe=(l+(r=r+Math.imul(M,pe)|0)|0)+((8191&(i=(i=i+Math.imul(M,me)|0)+Math.imul(C,pe)|0))<<13)|0;l=((o=o+Math.imul(C,me)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,r=Math.imul(j,oe),i=(i=Math.imul(j,ae))+Math.imul(U,oe)|0,o=Math.imul(U,ae),r=r+Math.imul(N,ue)|0,i=(i=i+Math.imul(N,le)|0)+Math.imul(D,ue)|0,o=o+Math.imul(D,le)|0,r=r+Math.imul(P,de)|0,i=(i=i+Math.imul(P,fe)|0)+Math.imul(L,de)|0,o=o+Math.imul(L,fe)|0;var Te=(l+(r=r+Math.imul(R,pe)|0)|0)+((8191&(i=(i=i+Math.imul(R,me)|0)+Math.imul(O,pe)|0))<<13)|0;l=((o=o+Math.imul(O,me)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(j,ue),i=(i=Math.imul(j,le))+Math.imul(U,ue)|0,o=Math.imul(U,le),r=r+Math.imul(N,de)|0,i=(i=i+Math.imul(N,fe)|0)+Math.imul(D,de)|0,o=o+Math.imul(D,fe)|0;var Pe=(l+(r=r+Math.imul(P,pe)|0)|0)+((8191&(i=(i=i+Math.imul(P,me)|0)+Math.imul(L,pe)|0))<<13)|0;l=((o=o+Math.imul(L,me)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,r=Math.imul(j,de),i=(i=Math.imul(j,fe))+Math.imul(U,de)|0,o=Math.imul(U,fe);var Le=(l+(r=r+Math.imul(N,pe)|0)|0)+((8191&(i=(i=i+Math.imul(N,me)|0)+Math.imul(D,pe)|0))<<13)|0;l=((o=o+Math.imul(D,me)|0)+(i>>>13)|0)+(Le>>>26)|0,Le&=67108863;var Ie=(l+(r=Math.imul(j,pe))|0)+((8191&(i=(i=Math.imul(j,me))+Math.imul(U,pe)|0))<<13)|0;return l=((o=Math.imul(U,me))+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,u[0]=ge,u[1]=ve,u[2]=ye,u[3]=be,u[4]=we,u[5]=Ae,u[6]=_e,u[7]=Ee,u[8]=Se,u[9]=ke,u[10]=Me,u[11]=Ce,u[12]=xe,u[13]=Re,u[14]=Oe,u[15]=Te,u[16]=Pe,u[17]=Le,u[18]=Ie,0!==l&&(u[19]=l,n.length++),n};function g(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o<n.length-1;o++){var a=i;i=0;for(var s=67108863&r,u=Math.min(o,t.length-1),l=Math.max(0,o-e.length+1);l<=u;l++){var c=o-l,d=(0|e.words[c])*(0|t.words[l]),f=67108863&d;s=67108863&(f=f+s|0),i+=(a=(a=a+(d/67108864|0)|0)+(f>>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function v(e,t,n){return g(e,t,n)}Math.imul||(m=p),i.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?m(this,e,t):n<63?p(this,e,t):n<1024?g(this,e,t):v(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),v(this,e,t)},i.prototype.imul=function(e){return this.clone().mulTo(e,this)},i.prototype.imuln=function(e){var t=e<0;t&&(e=-e),n("number"==typeof e),n(e<67108864);for(var r=0,i=0;i<this.length;i++){var o=(0|this.words[i])*e,a=(67108863&o)+(67108863&r);r>>=26,r+=o/67108864|0,r+=a>>>26,this.words[i]=67108863&a}return 0!==r&&(this.words[i]=r,this.length++),t?this.ineg():this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n<t.length;n++){var r=n/26|0,i=n%26;t[n]=e.words[r]>>>i&1}return t}(e);if(0===t.length)return new i(1);for(var n=this,r=0;r<t.length&&0===t[r];r++,n=n.sqr());if(++r<t.length)for(var o=n.sqr();r<t.length;r++,o=o.sqr())0!==t[r]&&(n=n.mul(o));return n},i.prototype.iushln=function(e){n("number"==typeof e&&e>=0);var t,r=e%26,i=(e-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(t=0;t<this.length;t++){var s=this.words[t]&o,u=(0|this.words[t])-s<<r;this.words[t]=u|a,a=s>>>26-r}a&&(this.words[t]=a,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this._strip()},i.prototype.ishln=function(e){return n(0===this.negative),this.iushln(e)},i.prototype.iushrn=function(e,t,r){var i;n("number"==typeof e&&e>=0),i=t?(t-t%26)/26:0;var o=e%26,a=Math.min((e-o)/26,this.length),s=67108863^67108863>>>o<<o,u=r;if(i-=a,i=Math.max(0,i),u){for(var l=0;l<a;l++)u.words[l]=this.words[l];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,l=0;l<this.length;l++)this.words[l]=this.words[l+a];else this.words[0]=0,this.length=1;var c=0;for(l=this.length-1;l>=0&&(0!==c||l>=i);l--){var d=0|this.words[l];this.words[l]=c<<26-o|d>>>o,c=d&s}return u&&0!==c&&(u.words[u.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,i=1<<t;return!(this.length<=r||!(this.words[r]&i))},i.prototype.imaskn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,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 n("number"==typeof e),n(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(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<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,r){var i,o,a=e.length+r;this._expand(a);var s=0;for(i=0;i<e.length;i++){o=(0|this.words[i+r])+s;var u=(0|e.words[i])*t;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)s=(o=(0|this.words[i+r])+s)>>26,this.words[i+r]=67108863&o;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),o=e,a=0|o.words[o.length-1];0!=(n=26-this._countBits(a))&&(o=o.ushln(n),r.iushln(n),a=0|o.words[o.length-1]);var s,u=r.length-o.length;if("mod"!==t){(s=new i(null)).length=u+1,s.words=new Array(s.length);for(var l=0;l<s.length;l++)s.words[l]=0}var c=r.clone()._ishlnsubmul(o,1,u);0===c.negative&&(r=c,s&&(s.words[u]=1));for(var d=u-1;d>=0;d--){var f=67108864*(0|r.words[o.length+d])+(0|r.words[o.length+d-1]);for(f=Math.min(f/a|0,67108863),r._ishlnsubmul(o,f,d);0!==r.negative;)f--,r.negative=0,r._ishlnsubmul(o,1,d),r.isZero()||(r.negative^=1);s&&(s.words[d]=f)}return s&&s._strip(),r._strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(o=s.div.neg()),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(e)),{div:o,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||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,a,s},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modrn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=(1<<26)%e,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%e;return t?-i:i},i.prototype.modn=function(e){return this.modrn(e)},i.prototype.idivn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/e|0,r=o%e}return this._strip(),t?this.ineg():this},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o=new i(1),a=new i(0),s=new i(0),u=new i(1),l=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++l;for(var c=r.clone(),d=t.clone();!t.isZero();){for(var f=0,h=1;0==(t.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(t.iushrn(f);f-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(c),a.isub(d)),o.iushrn(1),a.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(c),u.isub(d)),s.iushrn(1),u.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(s),a.isub(u)):(r.isub(t),s.isub(o),u.isub(a))}return{a:s,b:u,gcd:r.iushln(l)}},i.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o,a=new i(1),s=new i(0),u=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var l=0,c=1;0==(t.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(t.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var d=0,f=1;0==(r.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(r.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(s)):(r.isub(t),s.isub(a))}return(o=0===t.cmpn(1)?a:s).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(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var o=i,a=r;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0: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,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){r<i?t=-1:r>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 n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var y={k256:null,p224:null,p192:null,p25519:null};function b(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function A(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){b.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 n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function k(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)}b.prototype._tmp=function(){var e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},b.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},b.prototype.split=function(e,t){e.iushrn(this.n,0,t)},b.prototype.imulK=function(e){return e.imul(this.k)},r(w,b),w.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i<r;i++)t.words[i]=e.words[i];if(t.length=r,e.length<=9)return e.words[0]=0,void(e.length=1);var o=e.words[9];for(t.words[t.length++]=o&n,i=10;i<e.length;i++){var a=0|e.words[i];e.words[i-10]=(a&n)<<4|o>>>22,o=a}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,n=0;n<e.length;n++){var r=0|e.words[n];t+=977*r,e.words[n]=67108863&t,t=64*r+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},r(A,b),r(_,b),r(E,b),E.prototype.imulK=function(e){for(var t=0,n=0;n<e.length;n++){var r=19*(0|e.words[n])+t,i=67108863&r;r>>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(y[e])return y[e];var t;if("k256"===e)t=new w;else if("p224"===e)t=new A;else if("p192"===e)t=new _;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new E}return y[e]=t,t},S.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},S.prototype._verify2=function(e,t){n(0==(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},S.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(l(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 n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},S.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},S.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},S.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},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(n(t%2==1),3===t){var r=this.m.add(new i(1)).iushrn(2);return this.pow(e,r)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);n(!o.isZero());var s=new i(1).toRed(this),u=s.redNeg(),l=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new i(2*c*c).toRed(this);0!==this.pow(c,l).cmp(u);)c.redIAdd(u);for(var d=this.pow(c,o),f=this.pow(e,o.addn(1).iushrn(1)),h=this.pow(e,o),p=a;0!==h.cmp(s);){for(var m=h,g=0;0!==m.cmp(s);g++)m=m.redSqr();n(g<p);var v=this.pow(d,new i(1).iushln(p-g-1));f=f.redMul(v),d=v.redSqr(),h=h.redMul(d),p=g}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 n=new Array(16);n[0]=new i(1).toRed(this),n[1]=e;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],e);var o=n[0],a=0,s=0,u=t.bitLength()%26;for(0===u&&(u=26),r=t.length-1;r>=0;r--){for(var l=t.words[r],c=u-1;c>=0;c--){var d=l>>c&1;o!==n[0]&&(o=this.sqr(o)),0!==d||0!==a?(a<<=1,a|=d,(4==++s||0===r&&0===c)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}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 k(e)},r(k,S),k.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},k.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},k.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},k.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(r).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},k.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(ov,hr);var av,sv=ov.exports,uv={},lv={},cv={},dv={},fv=yr,hv=fv.Buffer,pv={};for(av in fv)fv.hasOwnProperty(av)&&"SlowBuffer"!==av&&"Buffer"!==av&&(pv[av]=fv[av]);var mv=pv.Buffer={};for(av in hv)hv.hasOwnProperty(av)&&"allocUnsafe"!==av&&"allocUnsafeSlow"!==av&&(mv[av]=hv[av]);if(pv.Buffer.prototype=hv.prototype,mv.from&&mv.from!==Uint8Array.from||(mv.from=function(e,t,n){if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type '+typeof e);if(e&&void 0===e.length)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);return hv(e,t,n)}),mv.alloc||(mv.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError('The "size" argument must be of type number. Received type '+typeof e);if(e<0||e>=2*(1<<30))throw new RangeError('The value "'+e+'" is invalid for option "size"');var r=hv(e);return t&&0!==t.length?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r}),!pv.kStringMaxLength)try{pv.kStringMaxLength=Vr.binding("buffer").kStringMaxLength}catch(s){}pv.constants||(pv.constants={MAX_LENGTH:pv.kMaxLength},pv.kStringMaxLength&&(pv.constants.MAX_STRING_LENGTH=pv.kStringMaxLength));var gv=pv,vv={};const yv=Jr;function bv(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}function wv(e,t){this.path=e,this.rethrow(t)}vv.Reporter=bv,bv.prototype.isError=function(e){return e instanceof wv},bv.prototype.save=function(){const e=this._reporterState;return{obj:e.obj,pathLen:e.path.length}},bv.prototype.restore=function(e){const t=this._reporterState;t.obj=e.obj,t.path=t.path.slice(0,e.pathLen)},bv.prototype.enterKey=function(e){return this._reporterState.path.push(e)},bv.prototype.exitKey=function(e){const t=this._reporterState;t.path=t.path.slice(0,e-1)},bv.prototype.leaveKey=function(e,t,n){const r=this._reporterState;this.exitKey(e),null!==r.obj&&(r.obj[t]=n)},bv.prototype.path=function(){return this._reporterState.path.join("/")},bv.prototype.enterObject=function(){const e=this._reporterState,t=e.obj;return e.obj={},t},bv.prototype.leaveObject=function(e){const t=this._reporterState,n=t.obj;return t.obj=e,n},bv.prototype.error=function(e){let t;const n=this._reporterState,r=e instanceof wv;if(t=r?e:new wv(n.path.map((function(e){return"["+JSON.stringify(e)+"]"})).join(""),e.message||e,e.stack),!n.options.partial)throw t;return r||n.errors.push(t),t},bv.prototype.wrapResult=function(e){const t=this._reporterState;return t.options.partial?{result:this.isError(e)?null:e,errors:t.errors}:e},yv(wv,Error),wv.prototype.rethrow=function(e){if(this.message=e+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,wv),!this.stack)try{throw new Error(this.message)}catch(e){this.stack=e.stack}return this};var Av={};const _v=Jr,Ev=vv.Reporter,Sv=gv.Buffer;function kv(e,t){Ev.call(this,t),Sv.isBuffer(e)?(this.base=e,this.offset=0,this.length=e.length):this.error("Input not Buffer")}function Mv(e,t){if(Array.isArray(e))this.length=0,this.value=e.map((function(e){return Mv.isEncoderBuffer(e)||(e=new Mv(e,t)),this.length+=e.length,e}),this);else if("number"==typeof e){if(!(0<=e&&e<=255))return t.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if("string"==typeof e)this.value=e,this.length=Sv.byteLength(e);else{if(!Sv.isBuffer(e))return t.error("Unsupported type: "+typeof e);this.value=e,this.length=e.length}}_v(kv,Ev),Av.DecoderBuffer=kv,kv.isDecoderBuffer=function(e){return e instanceof kv||"object"==typeof e&&Sv.isBuffer(e.base)&&"DecoderBuffer"===e.constructor.name&&"number"==typeof e.offset&&"number"==typeof e.length&&"function"==typeof e.save&&"function"==typeof e.restore&&"function"==typeof e.isEmpty&&"function"==typeof e.readUInt8&&"function"==typeof e.skip&&"function"==typeof e.raw},kv.prototype.save=function(){return{offset:this.offset,reporter:Ev.prototype.save.call(this)}},kv.prototype.restore=function(e){const t=new kv(this.base);return t.offset=e.offset,t.length=this.offset,this.offset=e.offset,Ev.prototype.restore.call(this,e.reporter),t},kv.prototype.isEmpty=function(){return this.offset===this.length},kv.prototype.readUInt8=function(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||"DecoderBuffer overrun")},kv.prototype.skip=function(e,t){if(!(this.offset+e<=this.length))return this.error(t||"DecoderBuffer overrun");const n=new kv(this.base);return n._reporterState=this._reporterState,n.offset=this.offset,n.length=this.offset+e,this.offset+=e,n},kv.prototype.raw=function(e){return this.base.slice(e?e.offset:this.offset,this.length)},Av.EncoderBuffer=Mv,Mv.isEncoderBuffer=function(e){return e instanceof Mv||"object"==typeof e&&"EncoderBuffer"===e.constructor.name&&"number"==typeof e.length&&"function"==typeof e.join},Mv.prototype.join=function(e,t){return e||(e=Sv.alloc(this.length)),t||(t=0),0===this.length||(Array.isArray(this.value)?this.value.forEach((function(n){n.join(e,t),t+=n.length})):("number"==typeof this.value?e[t]=this.value:"string"==typeof this.value?e.write(this.value,t):Sv.isBuffer(this.value)&&this.value.copy(e,t),t+=this.length)),e};const Cv=vv.Reporter,xv=Av.EncoderBuffer,Rv=Av.DecoderBuffer,Ov=Gl,Tv=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],Pv=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(Tv);function Lv(e,t,n){const r={};this._baseState=r,r.name=n,r.enc=e,r.parent=t||null,r.children=null,r.tag=null,r.args=null,r.reverseArgs=null,r.choice=null,r.optional=!1,r.any=!1,r.obj=!1,r.use=null,r.useDecoder=null,r.key=null,r.default=null,r.explicit=null,r.implicit=null,r.contains=null,r.parent||(r.children=[],this._wrap())}var Iv=Lv;const Nv=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];Lv.prototype.clone=function(){const e=this._baseState,t={};Nv.forEach((function(n){t[n]=e[n]}));const n=new this.constructor(t.parent);return n._baseState=t,n},Lv.prototype._wrap=function(){const e=this._baseState;Pv.forEach((function(t){this[t]=function(){const n=new this.constructor(this);return e.children.push(n),n[t].apply(n,arguments)}}),this)},Lv.prototype._init=function(e){const t=this._baseState;Ov(null===t.parent),e.call(this),t.children=t.children.filter((function(e){return e._baseState.parent===this}),this),Ov.equal(t.children.length,1,"Root node can have only one child")},Lv.prototype._useArgs=function(e){const t=this._baseState,n=e.filter((function(e){return e instanceof this.constructor}),this);e=e.filter((function(e){return!(e instanceof this.constructor)}),this),0!==n.length&&(Ov(null===t.children),t.children=n,n.forEach((function(e){e._baseState.parent=this}),this)),0!==e.length&&(Ov(null===t.args),t.args=e,t.reverseArgs=e.map((function(e){if("object"!=typeof e||e.constructor!==Object)return e;const t={};return Object.keys(e).forEach((function(n){n==(0|n)&&(n|=0);const r=e[n];t[r]=n})),t})))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach((function(e){Lv.prototype[e]=function(){const t=this._baseState;throw new Error(e+" not implemented for encoding: "+t.enc)}})),Tv.forEach((function(e){Lv.prototype[e]=function(){const t=this._baseState,n=Array.prototype.slice.call(arguments);return Ov(null===t.tag),t.tag=e,this._useArgs(n),this}})),Lv.prototype.use=function(e){Ov(e);const t=this._baseState;return Ov(null===t.use),t.use=e,this},Lv.prototype.optional=function(){return this._baseState.optional=!0,this},Lv.prototype.def=function(e){const t=this._baseState;return Ov(null===t.default),t.default=e,t.optional=!0,this},Lv.prototype.explicit=function(e){const t=this._baseState;return Ov(null===t.explicit&&null===t.implicit),t.explicit=e,this},Lv.prototype.implicit=function(e){const t=this._baseState;return Ov(null===t.explicit&&null===t.implicit),t.implicit=e,this},Lv.prototype.obj=function(){const e=this._baseState,t=Array.prototype.slice.call(arguments);return e.obj=!0,0!==t.length&&this._useArgs(t),this},Lv.prototype.key=function(e){const t=this._baseState;return Ov(null===t.key),t.key=e,this},Lv.prototype.any=function(){return this._baseState.any=!0,this},Lv.prototype.choice=function(e){const t=this._baseState;return Ov(null===t.choice),t.choice=e,this._useArgs(Object.keys(e).map((function(t){return e[t]}))),this},Lv.prototype.contains=function(e){const t=this._baseState;return Ov(null===t.use),t.contains=e,this},Lv.prototype._decode=function(e,t){const n=this._baseState;if(null===n.parent)return e.wrapResult(n.children[0]._decode(e,t));let r,i=n.default,o=!0,a=null;if(null!==n.key&&(a=e.enterKey(n.key)),n.optional){let r=null;if(null!==n.explicit?r=n.explicit:null!==n.implicit?r=n.implicit:null!==n.tag&&(r=n.tag),null!==r||n.any){if(o=this._peekTag(e,r,n.any),e.isError(o))return o}else{const r=e.save();try{null===n.choice?this._decodeGeneric(n.tag,e,t):this._decodeChoice(e,t),o=!0}catch(e){o=!1}e.restore(r)}}if(n.obj&&o&&(r=e.enterObject()),o){if(null!==n.explicit){const t=this._decodeTag(e,n.explicit);if(e.isError(t))return t;e=t}const r=e.offset;if(null===n.use&&null===n.choice){let t;n.any&&(t=e.save());const r=this._decodeTag(e,null!==n.implicit?n.implicit:n.tag,n.any);if(e.isError(r))return r;n.any?i=e.raw(t):e=r}if(t&&t.track&&null!==n.tag&&t.track(e.path(),r,e.length,"tagged"),t&&t.track&&null!==n.tag&&t.track(e.path(),e.offset,e.length,"content"),n.any||(i=null===n.choice?this._decodeGeneric(n.tag,e,t):this._decodeChoice(e,t)),e.isError(i))return i;if(n.any||null!==n.choice||null===n.children||n.children.forEach((function(n){n._decode(e,t)})),n.contains&&("octstr"===n.tag||"bitstr"===n.tag)){const r=new Rv(i);i=this._getUse(n.contains,e._reporterState.obj)._decode(r,t)}}return n.obj&&o&&(i=e.leaveObject(r)),null===n.key||null===i&&!0!==o?null!==a&&e.exitKey(a):e.leaveKey(a,n.key,i),i},Lv.prototype._decodeGeneric=function(e,t,n){const r=this._baseState;return"seq"===e||"set"===e?null:"seqof"===e||"setof"===e?this._decodeList(t,e,r.args[0],n):/str$/.test(e)?this._decodeStr(t,e,n):"objid"===e&&r.args?this._decodeObjid(t,r.args[0],r.args[1],n):"objid"===e?this._decodeObjid(t,null,null,n):"gentime"===e||"utctime"===e?this._decodeTime(t,e,n):"null_"===e?this._decodeNull(t,n):"bool"===e?this._decodeBool(t,n):"objDesc"===e?this._decodeStr(t,e,n):"int"===e||"enum"===e?this._decodeInt(t,r.args&&r.args[0],n):null!==r.use?this._getUse(r.use,t._reporterState.obj)._decode(t,n):t.error("unknown tag: "+e)},Lv.prototype._getUse=function(e,t){const n=this._baseState;return n.useDecoder=this._use(e,t),Ov(null===n.useDecoder._baseState.parent),n.useDecoder=n.useDecoder._baseState.children[0],n.implicit!==n.useDecoder._baseState.implicit&&(n.useDecoder=n.useDecoder.clone(),n.useDecoder._baseState.implicit=n.implicit),n.useDecoder},Lv.prototype._decodeChoice=function(e,t){const n=this._baseState;let r=null,i=!1;return Object.keys(n.choice).some((function(o){const a=e.save(),s=n.choice[o];try{const n=s._decode(e,t);if(e.isError(n))return!1;r={type:o,value:n},i=!0}catch(t){return e.restore(a),!1}return!0}),this),i?r:e.error("Choice not matched")},Lv.prototype._createEncoderBuffer=function(e){return new xv(e,this.reporter)},Lv.prototype._encode=function(e,t,n){const r=this._baseState;if(null!==r.default&&r.default===e)return;const i=this._encodeValue(e,t,n);return void 0===i||this._skipDefault(i,t,n)?void 0:i},Lv.prototype._encodeValue=function(e,t,n){const r=this._baseState;if(null===r.parent)return r.children[0]._encode(e,t||new Cv);let i=null;if(this.reporter=t,r.optional&&void 0===e){if(null===r.default)return;e=r.default}let o=null,a=!1;if(r.any)i=this._createEncoderBuffer(e);else if(r.choice)i=this._encodeChoice(e,t);else if(r.contains)o=this._getUse(r.contains,n)._encode(e,t),a=!0;else if(r.children)o=r.children.map((function(n){if("null_"===n._baseState.tag)return n._encode(null,t,e);if(null===n._baseState.key)return t.error("Child should have a key");const r=t.enterKey(n._baseState.key);if("object"!=typeof e)return t.error("Child expected, but input is not object");const i=n._encode(e[n._baseState.key],t,e);return t.leaveKey(r),i}),this).filter((function(e){return e})),o=this._createEncoderBuffer(o);else if("seqof"===r.tag||"setof"===r.tag){if(!r.args||1!==r.args.length)return t.error("Too many args for : "+r.tag);if(!Array.isArray(e))return t.error("seqof/setof, but data is not Array");const n=this.clone();n._baseState.implicit=null,o=this._createEncoderBuffer(e.map((function(n){const r=this._baseState;return this._getUse(r.args[0],e)._encode(n,t)}),n))}else null!==r.use?i=this._getUse(r.use,n)._encode(e,t):(o=this._encodePrimitive(r.tag,e),a=!0);if(!r.any&&null===r.choice){const e=null!==r.implicit?r.implicit:r.tag,n=null===r.implicit?"universal":"context";null===e?null===r.use&&t.error("Tag could be omitted only for .use()"):null===r.use&&(i=this._encodeComposite(e,a,n,o))}return null!==r.explicit&&(i=this._encodeComposite(r.explicit,!1,"context",i)),i},Lv.prototype._encodeChoice=function(e,t){const n=this._baseState,r=n.choice[e.type];return r||Ov(!1,e.type+" not found in "+JSON.stringify(Object.keys(n.choice))),r._encode(e.value,t)},Lv.prototype._encodePrimitive=function(e,t){const n=this._baseState;if(/str$/.test(e))return this._encodeStr(t,e);if("objid"===e&&n.args)return this._encodeObjid(t,n.reverseArgs[0],n.args[1]);if("objid"===e)return this._encodeObjid(t,null,null);if("gentime"===e||"utctime"===e)return this._encodeTime(t,e);if("null_"===e)return this._encodeNull();if("int"===e||"enum"===e)return this._encodeInt(t,n.args&&n.reverseArgs[0]);if("bool"===e)return this._encodeBool(t);if("objDesc"===e)return this._encodeStr(t,e);throw new Error("Unsupported tag: "+e)},Lv.prototype._isNumstr=function(e){return/^[0-9 ]*$/.test(e)},Lv.prototype._isPrintstr=function(e){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(e)};var Dv={};!function(e){function t(e){const t={};return Object.keys(e).forEach((function(n){(0|n)==n&&(n|=0);const r=e[n];t[r]=n})),t}e.tagClass={0:"universal",1:"application",2:"context",3:"private"},e.tagClassByName=t(e.tagClass),e.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},e.tagByName=t(e.tag)}(Dv);const Bv=Jr,jv=gv.Buffer,Uv=Iv,zv=Dv;function Fv(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new Wv,this.tree._init(e.body)}var qv=Fv;function Wv(e){Uv.call(this,"der",e)}function Vv(e){return e<10?"0"+e:e}Fv.prototype.encode=function(e,t){return this.tree._encode(e,t).join()},Bv(Wv,Uv),Wv.prototype._encodeComposite=function(e,t,n,r){const i=function(e,t,n,r){let i;if("seqof"===e?e="seq":"setof"===e&&(e="set"),zv.tagByName.hasOwnProperty(e))i=zv.tagByName[e];else{if("number"!=typeof e||(0|e)!==e)return r.error("Unknown tag: "+e);i=e}return i>=31?r.error("Multi-octet tag encoding unsupported"):(t||(i|=32),i|=zv.tagClassByName[n||"universal"]<<6,i)}(e,t,n,this.reporter);if(r.length<128){const e=jv.alloc(2);return e[0]=i,e[1]=r.length,this._createEncoderBuffer([e,r])}let o=1;for(let e=r.length;e>=256;e>>=8)o++;const a=jv.alloc(2+o);a[0]=i,a[1]=128|o;for(let e=1+o,t=r.length;t>0;e--,t>>=8)a[e]=255&t;return this._createEncoderBuffer([a,r])},Wv.prototype._encodeStr=function(e,t){if("bitstr"===t)return this._createEncoderBuffer([0|e.unused,e.data]);if("bmpstr"===t){const t=jv.alloc(2*e.length);for(let n=0;n<e.length;n++)t.writeUInt16BE(e.charCodeAt(n),2*n);return this._createEncoderBuffer(t)}return"numstr"===t?this._isNumstr(e)?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: numstr supports only digits and space"):"printstr"===t?this._isPrintstr(e)?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark"):/str$/.test(t)||"objDesc"===t?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: "+t+" unsupported")},Wv.prototype._encodeObjid=function(e,t,n){if("string"==typeof e){if(!t)return this.reporter.error("string objid given, but no values map found");if(!t.hasOwnProperty(e))return this.reporter.error("objid not found in values map");e=t[e].split(/[\s.]+/g);for(let t=0;t<e.length;t++)e[t]|=0}else if(Array.isArray(e)){e=e.slice();for(let t=0;t<e.length;t++)e[t]|=0}if(!Array.isArray(e))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(e));if(!n){if(e[1]>=40)return this.reporter.error("Second objid identifier OOB");e.splice(0,2,40*e[0]+e[1])}let r=0;for(let t=0;t<e.length;t++){let n=e[t];for(r++;n>=128;n>>=7)r++}const i=jv.alloc(r);let o=i.length-1;for(let t=e.length-1;t>=0;t--){let n=e[t];for(i[o--]=127&n;(n>>=7)>0;)i[o--]=128|127&n}return this._createEncoderBuffer(i)},Wv.prototype._encodeTime=function(e,t){let n;const r=new Date(e);return"gentime"===t?n=[Vv(r.getUTCFullYear()),Vv(r.getUTCMonth()+1),Vv(r.getUTCDate()),Vv(r.getUTCHours()),Vv(r.getUTCMinutes()),Vv(r.getUTCSeconds()),"Z"].join(""):"utctime"===t?n=[Vv(r.getUTCFullYear()%100),Vv(r.getUTCMonth()+1),Vv(r.getUTCDate()),Vv(r.getUTCHours()),Vv(r.getUTCMinutes()),Vv(r.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+t+" time is not supported yet"),this._encodeStr(n,"octstr")},Wv.prototype._encodeNull=function(){return this._createEncoderBuffer("")},Wv.prototype._encodeInt=function(e,t){if("string"==typeof e){if(!t)return this.reporter.error("String int or enum given, but no values map");if(!t.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=t[e]}if("number"!=typeof e&&!jv.isBuffer(e)){const t=e.toArray();!e.sign&&128&t[0]&&t.unshift(0),e=jv.from(t)}if(jv.isBuffer(e)){let t=e.length;0===e.length&&t++;const n=jv.alloc(t);return e.copy(n),0===e.length&&(n[0]=0),this._createEncoderBuffer(n)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);let n=1;for(let t=e;t>=256;t>>=8)n++;const r=new Array(n);for(let t=r.length-1;t>=0;t--)r[t]=255&e,e>>=8;return 128&r[0]&&r.unshift(0),this._createEncoderBuffer(jv.from(r))},Wv.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},Wv.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getEncoder("der").tree},Wv.prototype._skipDefault=function(e,t,n){const r=this._baseState;let i;if(null===r.default)return!1;const o=e.join();if(void 0===r.defaultBuffer&&(r.defaultBuffer=this._encodeValue(r.default,t,n).join()),o.length!==r.defaultBuffer.length)return!1;for(i=0;i<o.length;i++)if(o[i]!==r.defaultBuffer[i])return!1;return!0};const Kv=qv;function Hv(e){Kv.call(this,e),this.enc="pem"}Jr(Hv,Kv);var $v=Hv;Hv.prototype.encode=function(e,t){const n=Kv.prototype.encode.call(this,e).toString("base64"),r=["-----BEGIN "+t.label+"-----"];for(let e=0;e<n.length;e+=64)r.push(n.slice(e,e+64));return r.push("-----END "+t.label+"-----"),r.join("\n")},function(e){const t=e;t.der=qv,t.pem=$v}(dv);var Yv={};const Gv=Jr,Qv=vf,Zv=Av.DecoderBuffer,Xv=Iv,Jv=Dv;function ey(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new ny,this.tree._init(e.body)}var ty=ey;function ny(e){Xv.call(this,"der",e)}function ry(e,t){let n=e.readUInt8(t);if(e.isError(n))return n;const r=Jv.tagClass[n>>6],i=0==(32&n);if(31==(31&n)){let r=n;for(n=0;128==(128&r);){if(r=e.readUInt8(t),e.isError(r))return r;n<<=7,n|=127&r}}else n&=31;return{cls:r,primitive:i,tag:n,tagStr:Jv.tag[n]}}function iy(e,t,n){let r=e.readUInt8(n);if(e.isError(r))return r;if(!t&&128===r)return null;if(0==(128&r))return r;const i=127&r;if(i>4)return e.error("length octect is too long");r=0;for(let t=0;t<i;t++){r<<=8;const t=e.readUInt8(n);if(e.isError(t))return t;r|=t}return r}ey.prototype.decode=function(e,t){return Zv.isDecoderBuffer(e)||(e=new Zv(e,t)),this.tree._decode(e,t)},Gv(ny,Xv),ny.prototype._peekTag=function(e,t,n){if(e.isEmpty())return!1;const r=e.save(),i=ry(e,'Failed to peek tag: "'+t+'"');return e.isError(i)?i:(e.restore(r),i.tag===t||i.tagStr===t||i.tagStr+"of"===t||n)},ny.prototype._decodeTag=function(e,t,n){const r=ry(e,'Failed to decode tag of "'+t+'"');if(e.isError(r))return r;let i=iy(e,r.primitive,'Failed to get length of "'+t+'"');if(e.isError(i))return i;if(!n&&r.tag!==t&&r.tagStr!==t&&r.tagStr+"of"!==t)return e.error('Failed to match tag: "'+t+'"');if(r.primitive||null!==i)return e.skip(i,'Failed to match body of: "'+t+'"');const o=e.save(),a=this._skipUntilEnd(e,'Failed to skip indefinite length body: "'+this.tag+'"');return e.isError(a)?a:(i=e.offset-o.offset,e.restore(o),e.skip(i,'Failed to match body of: "'+t+'"'))},ny.prototype._skipUntilEnd=function(e,t){for(;;){const n=ry(e,t);if(e.isError(n))return n;const r=iy(e,n.primitive,t);if(e.isError(r))return r;let i;if(i=n.primitive||null!==r?e.skip(r):this._skipUntilEnd(e,t),e.isError(i))return i;if("end"===n.tagStr)break}},ny.prototype._decodeList=function(e,t,n,r){const i=[];for(;!e.isEmpty();){const t=this._peekTag(e,"end");if(e.isError(t))return t;const o=n.decode(e,"der",r);if(e.isError(o)&&t)break;i.push(o)}return i},ny.prototype._decodeStr=function(e,t){if("bitstr"===t){const t=e.readUInt8();return e.isError(t)?t:{unused:t,data:e.raw()}}if("bmpstr"===t){const t=e.raw();if(t.length%2==1)return e.error("Decoding of string type: bmpstr length mismatch");let n="";for(let e=0;e<t.length/2;e++)n+=String.fromCharCode(t.readUInt16BE(2*e));return n}if("numstr"===t){const t=e.raw().toString("ascii");return this._isNumstr(t)?t:e.error("Decoding of string type: numstr unsupported characters")}if("octstr"===t)return e.raw();if("objDesc"===t)return e.raw();if("printstr"===t){const t=e.raw().toString("ascii");return this._isPrintstr(t)?t:e.error("Decoding of string type: printstr unsupported characters")}return/str$/.test(t)?e.raw().toString():e.error("Decoding of string type: "+t+" unsupported")},ny.prototype._decodeObjid=function(e,t,n){let r;const i=[];let o=0,a=0;for(;!e.isEmpty();)a=e.readUInt8(),o<<=7,o|=127&a,0==(128&a)&&(i.push(o),o=0);128&a&&i.push(o);const s=i[0]/40|0,u=i[0]%40;if(r=n?i:[s,u].concat(i.slice(1)),t){let e=t[r.join(" ")];void 0===e&&(e=t[r.join(".")]),void 0!==e&&(r=e)}return r},ny.prototype._decodeTime=function(e,t){const n=e.raw().toString();let r,i,o,a,s,u;if("gentime"===t)r=0|n.slice(0,4),i=0|n.slice(4,6),o=0|n.slice(6,8),a=0|n.slice(8,10),s=0|n.slice(10,12),u=0|n.slice(12,14);else{if("utctime"!==t)return e.error("Decoding "+t+" time is not supported yet");r=0|n.slice(0,2),i=0|n.slice(2,4),o=0|n.slice(4,6),a=0|n.slice(6,8),s=0|n.slice(8,10),u=0|n.slice(10,12),r=r<70?2e3+r:1900+r}return Date.UTC(r,i-1,o,a,s,u,0)},ny.prototype._decodeNull=function(){return null},ny.prototype._decodeBool=function(e){const t=e.readUInt8();return e.isError(t)?t:0!==t},ny.prototype._decodeInt=function(e,t){const n=e.raw();let r=new Qv(n);return t&&(r=t[r.toString(10)]||r),r},ny.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getDecoder("der").tree};const oy=Jr,ay=gv.Buffer,sy=ty;function uy(e){sy.call(this,e),this.enc="pem"}oy(uy,sy);var ly=uy;uy.prototype.decode=function(e,t){const n=e.toString().split(/[\r\n]+/g),r=t.label.toUpperCase(),i=/^-----(BEGIN|END) ([^-]+)-----$/;let o=-1,a=-1;for(let e=0;e<n.length;e++){const t=n[e].match(i);if(null!==t&&t[2]===r){if(-1!==o){if("END"!==t[1])break;a=e;break}if("BEGIN"!==t[1])break;o=e}}if(-1===o||-1===a)throw new Error("PEM section not found for: "+r);const s=n.slice(o+1,a).join("");s.replace(/[^a-z0-9+/=]+/gi,"");const u=ay.from(s,"base64");return sy.prototype.decode.call(this,u,t)},function(e){const t=e;t.der=ty,t.pem=ly}(Yv),function(e){const t=dv,n=Yv,r=Jr;function i(e,t){this.name=e,this.body=t,this.decoders={},this.encoders={}}e.define=function(e,t){return new i(e,t)},i.prototype._createNamed=function(e){const t=this.name;function n(e){this._initNamed(e,t)}return r(n,e),n.prototype._initNamed=function(t,n){e.call(this,t,n)},new n(this)},i.prototype._getDecoder=function(e){return e=e||"der",this.decoders.hasOwnProperty(e)||(this.decoders[e]=this._createNamed(n[e])),this.decoders[e]},i.prototype.decode=function(e,t,n){return this._getDecoder(t).decode(e,n)},i.prototype._getEncoder=function(e){return e=e||"der",this.encoders.hasOwnProperty(e)||(this.encoders[e]=this._createNamed(t[e])),this.encoders[e]},i.prototype.encode=function(e,t,n){return this._getEncoder(t).encode(e,n)}}(cv);var cy={};!function(e){const t=e;t.Reporter=vv.Reporter,t.DecoderBuffer=Av.DecoderBuffer,t.EncoderBuffer=Av.EncoderBuffer,t.Node=Iv}(cy);var dy={};!function(e){const t=e;t._reverse=function(e){const t={};return Object.keys(e).forEach((function(n){(0|n)==n&&(n|=0);const r=e[n];t[r]=n})),t},t.der=Dv}(dy),function(e){const t=lv;t.bignum=vf,t.define=cv.define,t.base=cy,t.constants=dy,t.decoders=Yv,t.encoders=dv}();var fy=lv,hy=fy.define("Time",(function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})})),py=fy.define("AttributeTypeValue",(function(){this.seq().obj(this.key("type").objid(),this.key("value").any())})),my=fy.define("AlgorithmIdentifier",(function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional(),this.key("curve").objid().optional())})),gy=fy.define("SubjectPublicKeyInfo",(function(){this.seq().obj(this.key("algorithm").use(my),this.key("subjectPublicKey").bitstr())})),vy=fy.define("RelativeDistinguishedName",(function(){this.setof(py)})),yy=fy.define("RDNSequence",(function(){this.seqof(vy)})),by=fy.define("Name",(function(){this.choice({rdnSequence:this.use(yy)})})),wy=fy.define("Validity",(function(){this.seq().obj(this.key("notBefore").use(hy),this.key("notAfter").use(hy))})),Ay=fy.define("Extension",(function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())})),_y=fy.define("TBSCertificate",(function(){this.seq().obj(this.key("version").explicit(0).int().optional(),this.key("serialNumber").int(),this.key("signature").use(my),this.key("issuer").use(by),this.key("validity").use(wy),this.key("subject").use(by),this.key("subjectPublicKeyInfo").use(gy),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(Ay).optional())})),Ey=fy.define("X509Certificate",(function(){this.seq().obj(this.key("tbsCertificate").use(_y),this.key("signatureAlgorithm").use(my),this.key("signatureValue").bitstr())})),Sy=lv;uv.certificate=Ey;var ky=Sy.define("RSAPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())}));uv.RSAPrivateKey=ky;var My=Sy.define("RSAPublicKey",(function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())}));uv.RSAPublicKey=My;var Cy=Sy.define("SubjectPublicKeyInfo",(function(){this.seq().obj(this.key("algorithm").use(xy),this.key("subjectPublicKey").bitstr())}));uv.PublicKey=Cy;var xy=Sy.define("AlgorithmIdentifier",(function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())})),Ry=Sy.define("PrivateKeyInfo",(function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(xy),this.key("subjectPrivateKey").octstr())}));uv.PrivateKey=Ry;var Oy=Sy.define("EncryptedPrivateKeyInfo",(function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())}));uv.EncryptedPrivateKey=Oy;var Ty=Sy.define("DSAPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())}));uv.DSAPrivateKey=Ty,uv.DSAparam=Sy.define("DSAparam",(function(){this.int()}));var Py=Sy.define("ECPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(Ly),this.key("publicKey").optional().explicit(1).bitstr())}));uv.ECPrivateKey=Py;var Ly=Sy.define("ECParameters",(function(){this.choice({namedCurve:this.objid()})}));uv.signature=Sy.define("signature",(function(){this.seq().obj(this.key("r").int(),this.key("s").int())}));var Iy=/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r+/=]+)[\n\r]+/m,Ny=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,Dy=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,By=Rd,jy=kc,Uy=$r.Buffer,zy=uv,Fy={"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"},qy=kc,Wy=pl,Vy=$r.Buffer,Ky=Hy;function Hy(e){var t;"object"!=typeof e||Vy.isBuffer(e)||(t=e.passphrase,e=e.key),"string"==typeof e&&(e=Vy.from(e));var n,r,i=function(e,t){var n,r=e.toString(),i=r.match(Iy);if(i){var o="aes"+i[1],a=Uy.from(i[2],"hex"),s=Uy.from(i[3].replace(/[\r\n]/g,""),"base64"),u=By(t,a.slice(0,8),parseInt(i[1],10)).key,l=[],c=jy.createDecipheriv(o,u,a);l.push(c.update(s)),l.push(c.final()),n=Uy.concat(l)}else{var d=r.match(Dy);n=Uy.from(d[2].replace(/[\r\n]/g,""),"base64")}return{tag:r.match(Ny)[1],data:n}}(e,t),o=i.tag,a=i.data;switch(o){case"CERTIFICATE":r=zy.certificate.decode(a,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(r||(r=zy.PublicKey.decode(a,"der")),n=r.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return zy.RSAPublicKey.decode(r.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return r.subjectPrivateKey=r.subjectPublicKey,{type:"ec",data:r};case"1.2.840.10040.4.1":return r.algorithm.params.pub_key=zy.DSAparam.decode(r.subjectPublicKey.data,"der"),{type:"dsa",data:r.algorithm.params};default:throw new Error("unknown key id "+n)}case"ENCRYPTED PRIVATE KEY":a=function(e,t){var n=e.algorithm.decrypt.kde.kdeparams.salt,r=parseInt(e.algorithm.decrypt.kde.kdeparams.iters.toString(),10),i=Fy[e.algorithm.decrypt.cipher.algo.join(".")],o=e.algorithm.decrypt.cipher.iv,a=e.subjectPrivateKey,s=parseInt(i.split("-")[1],10)/8,u=Wy.pbkdf2Sync(t,n,r,s,"sha1"),l=qy.createDecipheriv(i,u,o),c=[];return c.push(l.update(a)),c.push(l.final()),Vy.concat(c)}(a=zy.EncryptedPrivateKey.decode(a,"der"),t);case"PRIVATE KEY":switch(n=(r=zy.PrivateKey.decode(a,"der")).algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return zy.RSAPrivateKey.decode(r.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:r.algorithm.curve,privateKey:zy.ECPrivateKey.decode(r.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return r.algorithm.params.priv_key=zy.DSAparam.decode(r.subjectPrivateKey,"der"),{type:"dsa",params:r.algorithm.params};default:throw new Error("unknown key id "+n)}case"RSA PUBLIC KEY":return zy.RSAPublicKey.decode(a,"der");case"RSA PRIVATE KEY":return zy.RSAPrivateKey.decode(a,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:zy.DSAPrivateKey.decode(a,"der")};case"EC PRIVATE KEY":return{curve:(a=zy.ECPrivateKey.decode(a,"der")).parameters.value,privateKey:a.privateKey};default:throw new Error("unknown key type "+o)}}Hy.signature=zy.signature;var $y,Yy,Gy,Qy,Zy,Xy,Jy,eb={"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"},tb={},nb=$u,rb=$r.Buffer,ib=function(e,t){for(var n,r=rb.alloc(0),i=0;r.length<t;)n=ob(i++),r=rb.concat([r,nb("sha1").update(e).update(n).digest()]);return r.slice(0,t)};function ob(e){var t=rb.allocUnsafe(4);return t.writeUInt32BE(e,0),t}var ab=function(e,t){for(var n=e.length,r=-1;++r<n;)e[r]^=t[r];return e},sb=vf,ub=$r.Buffer,lb=function(e,t){return ub.from(e.toRed(sb.mont(t.modulus)).redPow(new sb(t.publicExponent)).fromRed().toArray())},cb=Ky,db=Zr,fb=$u,hb=ib,pb=ab,mb=vf,gb=lb,vb=Ih,yb=$r.Buffer,bb=function(e,t,n){var r;r=e.padding?e.padding:n?1:4;var i,o=cb(e);if(4===r)i=function(e,t){var n=e.modulus.byteLength(),r=t.length,i=fb("sha1").update(yb.alloc(0)).digest(),o=i.length,a=2*o;if(r>n-a-2)throw new Error("message too long");var s=yb.alloc(n-r-a-2),u=n-o-1,l=db(o),c=pb(yb.concat([i,s,yb.alloc(1,1),t],u),hb(l,u)),d=pb(l,hb(c,o));return new mb(yb.concat([yb.alloc(1),d,c],n))}(o,t);else if(1===r)i=function(e,t,n){var r,i=t.length,o=e.modulus.byteLength();if(i>o-11)throw new Error("message too long");return r=n?yb.alloc(o-i-3,255):function(e){for(var t,n=yb.allocUnsafe(e),r=0,i=db(2*e),o=0;r<e;)o===i.length&&(i=db(2*e),o=0),(t=i[o++])&&(n[r++]=t);return n}(o-i-3),new mb(yb.concat([yb.from([0,n?1:2]),r,yb.alloc(1),t],o))}(o,t,n);else{if(3!==r)throw new Error("unknown padding");if((i=new mb(t)).cmp(o.modulus)>=0)throw new Error("data too long for modulus")}return n?vb(i,o):gb(i,o)},wb=Ky,Ab=ib,_b=ab,Eb=vf,Sb=Ih,kb=$u,Mb=lb,Cb=$r.Buffer,xb=function(e,t,n){var r;r=e.padding?e.padding:n?1:4;var i,o=wb(e),a=o.modulus.byteLength();if(t.length>a||new Eb(t).cmp(o.modulus)>=0)throw new Error("decryption error");i=n?Mb(new Eb(t),o):Sb(t,o);var s=Cb.alloc(a-i.length);if(i=Cb.concat([s,i],a),4===r)return function(e,t){var n=e.modulus.byteLength(),r=kb("sha1").update(Cb.alloc(0)).digest(),i=r.length;if(0!==t[0])throw new Error("decryption error");var o=t.slice(1,i+1),a=t.slice(i+1),s=_b(o,Ab(a,i)),u=_b(a,Ab(s,n-i-1));if(function(e,t){e=Cb.from(e),t=Cb.from(t);var n=0,r=e.length;e.length!==t.length&&(n++,r=Math.min(e.length,t.length));for(var i=-1;++i<r;)n+=e[i]^t[i];return n}(r,u.slice(0,i)))throw new Error("decryption error");for(var l=i;0===u[l];)l++;if(1!==u[l++])throw new Error("decryption error");return u.slice(l)}(o,i);if(1===r)return function(e,t,n){for(var r=t.slice(0,2),i=2,o=0;0!==t[i++];)if(i>=t.length){o++;break}var a=t.slice(2,i-1);if(("0002"!==r.toString("hex")&&!n||"0001"!==r.toString("hex")&&n)&&o++,a.length<8&&o++,o)throw new Error("decryption error");return t.slice(i)}(0,i,n);if(3===r)return i;throw new Error("unknown padding")};!function(e){e.publicEncrypt=bb,e.privateDecrypt=xb,e.privateEncrypt=function(t,n){return e.publicEncrypt(t,n,!0)},e.publicDecrypt=function(t,n){return e.privateDecrypt(t,n,!0)}}(tb);var Rb={};function Ob(){throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}var Tb,Pb=$r,Lb=Pb.Buffer,Ib=Pb.kMaxLength,Nb=hr.crypto||hr.msCrypto,Db=Math.pow(2,32)-1;function Bb(e,t){if("number"!=typeof e||e!=e)throw new TypeError("offset must be a number");if(e>Db||e<0)throw new TypeError("offset must be a uint32");if(e>Ib||e>t)throw new RangeError("offset out of range")}function jb(e,t,n){if("number"!=typeof e||e!=e)throw new TypeError("size must be a number");if(e>Db||e<0)throw new TypeError("size must be a uint32");if(e+t>n||e>Ib)throw new RangeError("buffer too small")}function Ub(e,t,n,r){var i=e.buffer,o=new Uint8Array(i,t,n);return Nb.getRandomValues(o),r?void Tr((function(){r(null,e)})):e}function zb(){if(Tb)return br;Tb=1,br.randomBytes=br.rng=br.pseudoRandomBytes=br.prng=Zr,br.createHash=br.Hash=$u,br.createHmac=br.Hmac=dl;var e=hl,t=Object.keys(e),n=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(t);br.getHashes=function(){return n};var r=pl;br.pbkdf2=r.pbkdf2,br.pbkdf2Sync=r.pbkdf2Sync;var i=Wl;br.Cipher=i.Cipher,br.createCipher=i.createCipher,br.Cipheriv=i.Cipheriv,br.createCipheriv=i.createCipheriv,br.Decipher=i.Decipher,br.createDecipher=i.createDecipher,br.Decipheriv=i.Decipheriv,br.createDecipheriv=i.createDecipheriv,br.getCiphers=i.getCiphers,br.listCiphers=i.listCiphers;var o=function(){if(Sf)return cf;Sf=1;var e=Af(),t=Cf,n=function(){if(Ef)return _f;Ef=1;var e=vf,t=new(wf()),n=new e(24),r=new e(11),i=new e(10),o=new e(3),a=new e(7),s=Af(),u=Zr;function l(t,n){return n=n||"utf8",dr(t)||(t=new xn(t,n)),this._pub=new e(t),this}function c(t,n){return n=n||"utf8",dr(t)||(t=new xn(t,n)),this._priv=new e(t),this}_f=f;var d={};function f(t,n,r){this.setGenerator(n),this.__prime=new e(t),this._prime=e.mont(this.__prime),this._primeLen=t.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,r?(this.setPublicKey=l,this.setPrivateKey=c):this._primeCode=8}function h(e,t){var n=new xn(e.toArray());return t?n.toString(t):n}return Object.defineProperty(f.prototype,"verifyError",{enumerable:!0,get:function(){return"number"!=typeof this._primeCode&&(this._primeCode=function(e,u){var l=u.toString("hex"),c=[l,e.toString(16)].join("_");if(c in d)return d[c];var f,h=0;if(e.isEven()||!s.simpleSieve||!s.fermatTest(e)||!t.test(e))return h+=1,h+="02"===l||"05"===l?8:4,d[c]=h,h;switch(t.test(e.shrn(1))||(h+=2),l){case"02":e.mod(n).cmp(r)&&(h+=8);break;case"05":(f=e.mod(i)).cmp(o)&&f.cmp(a)&&(h+=8);break;default:h+=4}return d[c]=h,h}(this.__prime,this.__gen)),this._primeCode}}),f.prototype.generateKeys=function(){return this._priv||(this._priv=new e(u(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},f.prototype.computeSecret=function(t){var n=new xn((t=(t=new e(t)).toRed(this._prime)).redPow(this._priv).fromRed().toArray()),r=this.getPrime();if(n.length<r.length){var i=new xn(r.length-n.length);i.fill(0),n=xn.concat([i,n])}return n},f.prototype.getPublicKey=function(e){return h(this._pub,e)},f.prototype.getPrivateKey=function(e){return h(this._priv,e)},f.prototype.getPrime=function(e){return h(this.__prime,e)},f.prototype.getGenerator=function(e){return h(this._gen,e)},f.prototype.setGenerator=function(t,n){return n=n||"utf8",dr(t)||(t=new xn(t,n)),this.__gen=t,this._gen=new e(t),this},_f}(),r={binary:!0,hex:!0,base64:!0};return cf.DiffieHellmanGroup=cf.createDiffieHellmanGroup=cf.getDiffieHellman=function(e){var r=new xn(t[e].prime,"hex"),i=new xn(t[e].gen,"hex");return new n(r,i)},cf.createDiffieHellman=cf.DiffieHellman=function t(i,o,a,s){return dr(o)||void 0===r[o]?t(i,"binary",o,a):(o=o||"binary",s=s||"binary",dr(a=a||new xn([2]))||(a=new xn(a,s)),"number"==typeof i?new n(e(i,a),a,!0):(dr(i)||(i=new xn(i,o)),new n(i,a,!0)))},cf}();br.DiffieHellmanGroup=o.DiffieHellmanGroup,br.createDiffieHellmanGroup=o.createDiffieHellmanGroup,br.getDiffieHellman=o.getDiffieHellman,br.createDiffieHellman=o.createDiffieHellman,br.DiffieHellman=o.DiffieHellman;var a=function(){if(Zy)return Qy;Zy=1;var e=$r.Buffer,t=$u,n=Ch,r=Jr,i=function(){if($y)return xh.exports;$y=1;var e=$r.Buffer,t=dl,n=Ih,r=iv().ec,i=sv,o=Ky,a=eb;function s(n,r,i,o){if((n=e.from(n.toArray())).length<r.byteLength()){var a=e.alloc(r.byteLength()-n.length);n=e.concat([a,n])}var s=i.length,l=function(t,n){t=(t=u(t,n)).mod(n);var r=e.from(t.toArray());if(r.length<n.byteLength()){var i=e.alloc(n.byteLength()-r.length);r=e.concat([i,r])}return r}(i,r),c=e.alloc(s);c.fill(1);var d=e.alloc(s);return d=t(o,d).update(c).update(e.from([0])).update(n).update(l).digest(),c=t(o,d).update(c).digest(),{k:d=t(o,d).update(c).update(e.from([1])).update(n).update(l).digest(),v:c=t(o,d).update(c).digest()}}function u(e,t){var n=new i(e),r=(e.length<<3)-t.bitLength();return r>0&&n.ishrn(r),n}function l(n,r,i){var o,a;do{for(o=e.alloc(0);8*o.length<n.bitLength();)r.v=t(i,r.k).update(r.v).digest(),o=e.concat([o,r.v]);a=u(o,n),r.k=t(i,r.k).update(r.v).update(e.from([0])).digest(),r.v=t(i,r.k).update(r.v).digest()}while(-1!==a.cmp(n));return a}function c(e,t,n,r){return e.toRed(i.mont(n)).redPow(t).fromRed().mod(r)}return xh.exports=function(t,d,f,h,p){var m=o(d);if(m.curve){if("ecdsa"!==h&&"ecdsa/rsa"!==h)throw new Error("wrong private key type");return function(t,n){var i=a[n.curve.join(".")];if(!i)throw new Error("unknown curve "+n.curve.join("."));var o=new r(i).keyFromPrivate(n.privateKey).sign(t);return e.from(o.toDER())}(t,m)}if("dsa"===m.type){if("dsa"!==h)throw new Error("wrong private key type");return function(t,n,r){for(var o,a=n.params.priv_key,d=n.params.p,f=n.params.q,h=n.params.g,p=new i(0),m=u(t,f).mod(f),g=!1,v=s(a,f,t,r);!1===g;)p=c(h,o=l(f,v,r),d,f),0===(g=o.invm(f).imul(m.add(a.mul(p))).mod(f)).cmpn(0)&&(g=!1,p=new i(0));return function(t,n){t=t.toArray(),n=n.toArray(),128&t[0]&&(t=[0].concat(t)),128&n[0]&&(n=[0].concat(n));var r=[48,t.length+n.length+4,2,t.length];return r=r.concat(t,[2,n.length],n),e.from(r)}(p,g)}(t,m,f)}if("rsa"!==h&&"ecdsa/rsa"!==h)throw new Error("wrong private key type");t=e.concat([p,t]);for(var g=m.modulus.byteLength(),v=[0,1];t.length+v.length+1<g;)v.push(255);v.push(0);for(var y=-1;++y<t.length;)v.push(t[y]);return n(v,m)},xh.exports.getKey=s,xh.exports.makeKey=l,xh.exports}(),o=function(){if(Gy)return Yy;Gy=1;var e=$r.Buffer,t=sv,n=iv().ec,r=Ky,i=eb;function o(e,t){if(e.cmpn(0)<=0)throw new Error("invalid sig");if(e.cmp(t)>=t)throw new Error("invalid sig")}return Yy=function(a,s,u,l,c){var d=r(u);if("ec"===d.type){if("ecdsa"!==l&&"ecdsa/rsa"!==l)throw new Error("wrong public key type");return function(e,t,r){var o=i[r.data.algorithm.curve.join(".")];if(!o)throw new Error("unknown curve "+r.data.algorithm.curve.join("."));var a=new n(o),s=r.data.subjectPrivateKey.data;return a.verify(t,e,s)}(a,s,d)}if("dsa"===d.type){if("dsa"!==l)throw new Error("wrong public key type");return function(e,n,i){var a=i.data.p,s=i.data.q,u=i.data.g,l=i.data.pub_key,c=r.signature.decode(e,"der"),d=c.s,f=c.r;o(d,s),o(f,s);var h=t.mont(a),p=d.invm(s);return 0===u.toRed(h).redPow(new t(n).mul(p).mod(s)).fromRed().mul(l.toRed(h).redPow(f.mul(p).mod(s)).fromRed()).mod(a).mod(s).cmp(f)}(a,s,d)}if("rsa"!==l&&"ecdsa/rsa"!==l)throw new Error("wrong public key type");s=e.concat([c,s]);for(var f=d.modulus.byteLength(),h=[1],p=0;s.length+h.length+2<f;)h.push(255),p++;h.push(0);for(var m=-1;++m<s.length;)h.push(s[m]);h=e.from(h);var g=t.mont(d.modulus);a=(a=new t(a).toRed(g)).redPow(new t(d.publicExponent)),a=e.from(a.fromRed().toArray());var v=p<8?1:0;for(f=Math.min(a.length,h.length),a.length!==h.length&&(v=1),m=-1;++m<f;)v|=a[m]^h[m];return 0===v},Yy}(),a=fl;function s(e){n.Writable.call(this);var r=a[e];if(!r)throw new Error("Unknown message digest");this._hashType=r.hash,this._hash=t(r.hash),this._tag=r.id,this._signType=r.sign}function u(e){n.Writable.call(this);var r=a[e];if(!r)throw new Error("Unknown message digest");this._hash=t(r.hash),this._tag=r.id,this._signType=r.sign}function l(e){return new s(e)}function c(e){return new u(e)}return Object.keys(a).forEach((function(t){a[t].id=e.from(a[t].id,"hex"),a[t.toLowerCase()]=a[t]})),r(s,n.Writable),s.prototype._write=function(e,t,n){this._hash.update(e),n()},s.prototype.update=function(t,n){return"string"==typeof t&&(t=e.from(t,n)),this._hash.update(t),this},s.prototype.sign=function(e,t){this.end();var n=this._hash.digest(),r=i(n,e,this._hashType,this._signType,this._tag);return t?r.toString(t):r},r(u,n.Writable),u.prototype._write=function(e,t,n){this._hash.update(e),n()},u.prototype.update=function(t,n){return"string"==typeof t&&(t=e.from(t,n)),this._hash.update(t),this},u.prototype.verify=function(t,n,r){"string"==typeof n&&(n=e.from(n,r)),this.end();var i=this._hash.digest();return o(n,i,t,this._signType,this._tag)},Qy={Sign:l,Verify:c,createSign:l,createVerify:c}}();br.createSign=a.createSign,br.Sign=a.Sign,br.createVerify=a.createVerify,br.Verify=a.Verify,br.createECDH=function(){if(Jy)return Xy;Jy=1;var e=iv(),t=vf;Xy=function(e){return new r(e)};var n={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};function r(t){this.curveType=n[t],this.curveType||(this.curveType={name:t}),this.curve=new e.ec(this.curveType.name),this.keys=void 0}function i(e,t,n){Array.isArray(e)||(e=e.toArray());var r=new xn(e);if(n&&r.length<n){var i=new xn(n-r.length);i.fill(0),r=xn.concat([i,r])}return t?r.toString(t):r}return n.p224=n.secp224r1,n.p256=n.secp256r1=n.prime256v1,n.p192=n.secp192r1=n.prime192v1,n.p384=n.secp384r1,n.p521=n.secp521r1,r.prototype.generateKeys=function(e,t){return this.keys=this.curve.genKeyPair(),this.getPublicKey(e,t)},r.prototype.computeSecret=function(e,t,n){return t=t||"utf8",dr(e)||(e=new xn(e,t)),i(this.curve.keyFromPublic(e).getPublic().mul(this.keys.getPrivate()).getX(),n,this.curveType.byteLength)},r.prototype.getPublicKey=function(e,t){var n=this.keys.getPublic("compressed"===t,!0);return"hybrid"===t&&(n[n.length-1]%2?n[0]=7:n[0]=6),i(n,e)},r.prototype.getPrivateKey=function(e){return i(this.keys.getPrivate(),e)},r.prototype.setPublicKey=function(e,t){return t=t||"utf8",dr(e)||(e=new xn(e,t)),this.keys._importPublic(e),this},r.prototype.setPrivateKey=function(e,n){n=n||"utf8",dr(e)||(e=new xn(e,n));var r=new t(e);return r=r.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(r),this},Xy}();var s=tb;br.publicEncrypt=s.publicEncrypt,br.privateEncrypt=s.privateEncrypt,br.publicDecrypt=s.publicDecrypt,br.privateDecrypt=s.privateDecrypt;var u=Rb;return br.randomFill=u.randomFill,br.randomFillSync=u.randomFillSync,br.createCredentials=function(){throw new Error(["sorry, createCredentials is not implemented yet","we accept pull requests","https://github.com/crypto-browserify/crypto-browserify"].join("\n"))},br.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6},br}Nb&&Nb.getRandomValues?(Rb.randomFill=function(e,t,n,r){if(!(Lb.isBuffer(e)||e instanceof hr.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if("function"==typeof t)r=t,t=0,n=e.length;else if("function"==typeof n)r=n,n=e.length-t;else if("function"!=typeof r)throw new TypeError('"cb" argument must be a function');return Bb(t,e.length),jb(n,t,e.length),Ub(e,t,n,r)},Rb.randomFillSync=function(e,t,n){if(void 0===t&&(t=0),!(Lb.isBuffer(e)||e instanceof hr.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return Bb(t,e.length),void 0===n&&(n=e.length-t),jb(n,t,e.length),Ub(e,t,n)}):(Rb.randomFill=Ob,Rb.randomFillSync=Ob);const{Buffer:Fb}=yr,{createHash:qb,createHmac:Wb}=zb(),Vb={},Kb=e=>{switch(e){case"sha256":case"sha3-256":case"blake2s256":return 32;case"sha512":case"sha3-512":case"blake2b512":return 64;case"sha224":case"sha3-224":return 28;case"sha384":case"sha3-384":return 48;case"sha1":return 20;case"md5":return 16;default:{let t=Vb[e];return void 0===t&&(t=qb(e).digest().length,Vb[e]=t),t}}},Hb=(e,t,n,r)=>{const i=Fb.isBuffer(n)?n:Fb.from(n),o=r&&r.length?Fb.from(r):Fb.alloc(t,0);return Wb(e,o).update(i).digest()},$b=(e,t,n,r,i)=>{const o=Fb.isBuffer(i)?i:Fb.from(i||""),a=o.length,s=Math.ceil(r/t);if(s>255)throw new Error(`OKM length ${r} is too long for ${e} hash`);const u=Fb.alloc(t*s+a+1);for(let r=1,i=0,l=0;r<=s;++r)o.copy(u,l),u[l+a]=r,Wb(e,n).update(u.slice(i,l+a+1)).digest().copy(u,l),i=l,l+=t;return u.slice(0,r)};function Yb(e,t,{salt:n="",info:r="",hash:i="SHA-256"}={}){i=i.toLowerCase().replace("-","");const o=Kb(i),a=Hb(i,o,e,n);return $b(i,o,a,t,r)}Object.defineProperties(Yb,{hash_length:{configurable:!1,enumerable:!1,writable:!1,value:Kb},extract:{configurable:!1,enumerable:!1,writable:!1,value:Hb},expand:{configurable:!1,enumerable:!1,writable:!1,value:$b}});var Gb=Yb;const Qb="Impossible case. Please create issue.",Zb="The tweak was out of range or the resulted private key is invalid",Xb="The tweak was out of range or equal to zero",Jb="Public Key could not be parsed",ew="Public Key serialization error",tw="Signature could not be parsed";function nw(e,t){if(!e)throw new Error(t)}function rw(e,t,n){if(nw(t instanceof Uint8Array,`Expected ${e} to be an Uint8Array`),void 0!==n)if(Array.isArray(n)){const r=`Expected ${e} to be an Uint8Array with length [${n.join(", ")}]`;nw(n.includes(t.length),r)}else{const r=`Expected ${e} to be an Uint8Array with length ${n}`;nw(t.length===n,r)}}function iw(e){nw("Boolean"===aw(e),"Expected compressed to be a Boolean")}function ow(e=(e=>new Uint8Array(e)),t){return"function"==typeof e&&(e=e(t)),rw("output",e,t),e}function aw(e){return Object.prototype.toString.call(e).slice(8,-1)}const sw=new(iv().ec)("secp256k1"),uw=sw.curve,lw=uw.n.constructor;function cw(e){const t=e[0];switch(t){case 2:case 3:return 33!==e.length?null:function(e,t){let n=new lw(t);if(n.cmp(uw.p)>=0)return null;n=n.toRed(uw.red);let r=n.redSqr().redIMul(n).redIAdd(uw.b).redSqrt();return 3===e!==r.isOdd()&&(r=r.redNeg()),sw.keyPair({pub:{x:n,y:r}})}(t,e.subarray(1,33));case 4:case 6:case 7:return 65!==e.length?null:function(e,t,n){let r=new lw(t),i=new lw(n);if(r.cmp(uw.p)>=0||i.cmp(uw.p)>=0)return null;if(r=r.toRed(uw.red),i=i.toRed(uw.red),(6===e||7===e)&&i.isOdd()!==(7===e))return null;const o=r.redSqr().redIMul(r);return i.redSqr().redISub(o.redIAdd(uw.b)).isZero()?sw.keyPair({pub:{x:r,y:i}}):null}(t,e.subarray(1,33),e.subarray(33,65));default:return null}}function dw(e,t){const n=t.encode(null,33===e.length);for(let t=0;t<e.length;++t)e[t]=n[t]}var fw={contextRandomize:()=>0,privateKeyVerify(e){const t=new lw(e);return t.cmp(uw.n)<0&&!t.isZero()?0:1},privateKeyNegate(e){const t=new lw(e),n=uw.n.sub(t).umod(uw.n).toArrayLike(Uint8Array,"be",32);return e.set(n),0},privateKeyTweakAdd(e,t){const n=new lw(t);if(n.cmp(uw.n)>=0)return 1;if(n.iadd(new lw(e)),n.cmp(uw.n)>=0&&n.isub(uw.n),n.isZero())return 1;const r=n.toArrayLike(Uint8Array,"be",32);return e.set(r),0},privateKeyTweakMul(e,t){let n=new lw(t);if(n.cmp(uw.n)>=0||n.isZero())return 1;n.imul(new lw(e)),n.cmp(uw.n)>=0&&(n=n.umod(uw.n));const r=n.toArrayLike(Uint8Array,"be",32);return e.set(r),0},publicKeyVerify:e=>null===cw(e)?1:0,publicKeyCreate(e,t){const n=new lw(t);return n.cmp(uw.n)>=0||n.isZero()?1:(dw(e,sw.keyFromPrivate(t).getPublic()),0)},publicKeyConvert(e,t){const n=cw(t);return null===n?1:(dw(e,n.getPublic()),0)},publicKeyNegate(e,t){const n=cw(t);if(null===n)return 1;const r=n.getPublic();return r.y=r.y.redNeg(),dw(e,r),0},publicKeyCombine(e,t){const n=new Array(t.length);for(let e=0;e<t.length;++e)if(n[e]=cw(t[e]),null===n[e])return 1;let r=n[0].getPublic();for(let e=1;e<n.length;++e)r=r.add(n[e].pub);return r.isInfinity()?2:(dw(e,r),0)},publicKeyTweakAdd(e,t,n){const r=cw(t);if(null===r)return 1;if((n=new lw(n)).cmp(uw.n)>=0)return 2;const i=r.getPublic().add(uw.g.mul(n));return i.isInfinity()?2:(dw(e,i),0)},publicKeyTweakMul(e,t,n){const r=cw(t);return null===r?1:(n=new lw(n)).cmp(uw.n)>=0||n.isZero()?2:(dw(e,r.getPublic().mul(n)),0)},signatureNormalize(e){const t=new lw(e.subarray(0,32)),n=new lw(e.subarray(32,64));return t.cmp(uw.n)>=0||n.cmp(uw.n)>=0?1:(1===n.cmp(sw.nh)&&e.set(uw.n.sub(n).toArrayLike(Uint8Array,"be",32),32),0)},signatureExport(e,t){const n=t.subarray(0,32),r=t.subarray(32,64);if(new lw(n).cmp(uw.n)>=0)return 1;if(new lw(r).cmp(uw.n)>=0)return 1;const{output:i}=e;let o=i.subarray(4,37);o[0]=0,o.set(n,1);let a=33,s=0;for(;a>1&&0===o[s]&&!(128&o[s+1]);--a,++s);if(o=o.subarray(s),128&o[0])return 1;if(a>1&&0===o[0]&&!(128&o[1]))return 1;let u=i.subarray(39,72);u[0]=0,u.set(r,1);let l=33,c=0;for(;l>1&&0===u[c]&&!(128&u[c+1]);--l,++c);return u=u.subarray(c),128&u[0]||l>1&&0===u[0]&&!(128&u[1])?1:(e.outputlen=6+a+l,i[0]=48,i[1]=e.outputlen-2,i[2]=2,i[3]=o.length,i.set(o,4),i[4+a]=2,i[5+a]=u.length,i.set(u,6+a),0)},signatureImport(e,t){if(t.length<8)return 1;if(t.length>72)return 1;if(48!==t[0])return 1;if(t[1]!==t.length-2)return 1;if(2!==t[2])return 1;const n=t[3];if(0===n)return 1;if(5+n>=t.length)return 1;if(2!==t[4+n])return 1;const r=t[5+n];if(0===r)return 1;if(6+n+r!==t.length)return 1;if(128&t[4])return 1;if(n>1&&0===t[4]&&!(128&t[5]))return 1;if(128&t[n+6])return 1;if(r>1&&0===t[n+6]&&!(128&t[n+7]))return 1;let i=t.subarray(4,4+n);if(33===i.length&&0===i[0]&&(i=i.subarray(1)),i.length>32)return 1;let o=t.subarray(6+n);if(33===o.length&&0===o[0]&&(o=o.slice(1)),o.length>32)throw new Error("S length is too long");let a=new lw(i);a.cmp(uw.n)>=0&&(a=new lw(0));let s=new lw(t.subarray(6+n));return s.cmp(uw.n)>=0&&(s=new lw(0)),e.set(a.toArrayLike(Uint8Array,"be",32),0),e.set(s.toArrayLike(Uint8Array,"be",32),32),0},ecdsaSign(e,t,n,r,i){if(i){const e=i;i=i=>{const o=e(t,n,null,r,i);if(!(o instanceof Uint8Array&&32===o.length))throw new Error("This is the way");return new lw(o)}}const o=new lw(n);if(o.cmp(uw.n)>=0||o.isZero())return 1;let a;try{a=sw.sign(t,n,{canonical:!0,k:i,pers:r})}catch(e){return 1}return e.signature.set(a.r.toArrayLike(Uint8Array,"be",32),0),e.signature.set(a.s.toArrayLike(Uint8Array,"be",32),32),e.recid=a.recoveryParam,0},ecdsaVerify(e,t,n){const r={r:e.subarray(0,32),s:e.subarray(32,64)},i=new lw(r.r),o=new lw(r.s);if(i.cmp(uw.n)>=0||o.cmp(uw.n)>=0)return 1;if(1===o.cmp(sw.nh)||i.isZero()||o.isZero())return 3;const a=cw(n);if(null===a)return 2;const s=a.getPublic();return sw.verify(t,r,s)?0:3},ecdsaRecover(e,t,n,r){const i={r:t.slice(0,32),s:t.slice(32,64)},o=new lw(i.r),a=new lw(i.s);if(o.cmp(uw.n)>=0||a.cmp(uw.n)>=0)return 1;if(o.isZero()||a.isZero())return 2;let s;try{s=sw.recoverPubKey(r,i,n)}catch(e){return 2}return dw(e,s),0},ecdh(e,t,n,r,i,o,a){const s=cw(t);if(null===s)return 1;const u=new lw(n);if(u.cmp(uw.n)>=0||u.isZero())return 2;const l=s.getPublic().mul(u);if(void 0===i){const t=l.encode(null,!0),n=sw.hash().update(t).digest();for(let t=0;t<32;++t)e[t]=n[t]}else{o||(o=new Uint8Array(32));const t=l.getX().toArray("be",32);for(let e=0;e<32;++e)o[e]=t[e];a||(a=new Uint8Array(32));const n=l.getY().toArray("be",32);for(let e=0;e<32;++e)a[e]=n[e];const s=i(o,a,r);if(!(s instanceof Uint8Array&&s.length===e.length))return 2;e.set(s)}return 0}},hw=(e=>({contextRandomize(t){if(nw(null===t||t instanceof Uint8Array,"Expected seed to be an Uint8Array or null"),null!==t&&rw("seed",t,32),1===e.contextRandomize(t))throw new Error("Unknow error on context randomization")},privateKeyVerify:t=>(rw("private key",t,32),0===e.privateKeyVerify(t)),privateKeyNegate(t){switch(rw("private key",t,32),e.privateKeyNegate(t)){case 0:return t;case 1:throw new Error(Qb)}},privateKeyTweakAdd(t,n){switch(rw("private key",t,32),rw("tweak",n,32),e.privateKeyTweakAdd(t,n)){case 0:return t;case 1:throw new Error(Zb)}},privateKeyTweakMul(t,n){switch(rw("private key",t,32),rw("tweak",n,32),e.privateKeyTweakMul(t,n)){case 0:return t;case 1:throw new Error(Xb)}},publicKeyVerify:t=>(rw("public key",t,[33,65]),0===e.publicKeyVerify(t)),publicKeyCreate(t,n=!0,r){switch(rw("private key",t,32),iw(n),r=ow(r,n?33:65),e.publicKeyCreate(r,t)){case 0:return r;case 1:throw new Error("Private Key is invalid");case 2:throw new Error(ew)}},publicKeyConvert(t,n=!0,r){switch(rw("public key",t,[33,65]),iw(n),r=ow(r,n?33:65),e.publicKeyConvert(r,t)){case 0:return r;case 1:throw new Error(Jb);case 2:throw new Error(ew)}},publicKeyNegate(t,n=!0,r){switch(rw("public key",t,[33,65]),iw(n),r=ow(r,n?33:65),e.publicKeyNegate(r,t)){case 0:return r;case 1:throw new Error(Jb);case 2:throw new Error(Qb);case 3:throw new Error(ew)}},publicKeyCombine(t,n=!0,r){nw(Array.isArray(t),"Expected public keys to be an Array"),nw(t.length>0,"Expected public keys array will have more than zero items");for(const e of t)rw("public key",e,[33,65]);switch(iw(n),r=ow(r,n?33:65),e.publicKeyCombine(r,t)){case 0:return r;case 1:throw new Error(Jb);case 2:throw new Error("The sum of the public keys is not valid");case 3:throw new Error(ew)}},publicKeyTweakAdd(t,n,r=!0,i){switch(rw("public key",t,[33,65]),rw("tweak",n,32),iw(r),i=ow(i,r?33:65),e.publicKeyTweakAdd(i,t,n)){case 0:return i;case 1:throw new Error(Jb);case 2:throw new Error(Zb)}},publicKeyTweakMul(t,n,r=!0,i){switch(rw("public key",t,[33,65]),rw("tweak",n,32),iw(r),i=ow(i,r?33:65),e.publicKeyTweakMul(i,t,n)){case 0:return i;case 1:throw new Error(Jb);case 2:throw new Error(Xb)}},signatureNormalize(t){switch(rw("signature",t,64),e.signatureNormalize(t)){case 0:return t;case 1:throw new Error(tw)}},signatureExport(t,n){rw("signature",t,64);const r={output:n=ow(n,72),outputlen:72};switch(e.signatureExport(r,t)){case 0:return n.slice(0,r.outputlen);case 1:throw new Error(tw);case 2:throw new Error(Qb)}},signatureImport(t,n){switch(rw("signature",t),n=ow(n,64),e.signatureImport(n,t)){case 0:return n;case 1:throw new Error(tw);case 2:throw new Error(Qb)}},ecdsaSign(t,n,r={},i){rw("message",t,32),rw("private key",n,32),nw("Object"===aw(r),"Expected options to be an Object"),void 0!==r.data&&rw("options.data",r.data),void 0!==r.noncefn&&nw("Function"===aw(r.noncefn),"Expected options.noncefn to be a Function");const o={signature:i=ow(i,64),recid:null};switch(e.ecdsaSign(o,t,n,r.data,r.noncefn)){case 0:return o;case 1:throw new Error("The nonce generation function failed, or the private key was invalid");case 2:throw new Error(Qb)}},ecdsaVerify(t,n,r){switch(rw("signature",t,64),rw("message",n,32),rw("public key",r,[33,65]),e.ecdsaVerify(t,n,r)){case 0:return!0;case 3:return!1;case 1:throw new Error(tw);case 2:throw new Error(Jb)}},ecdsaRecover(t,n,r,i=!0,o){switch(rw("signature",t,64),nw("Number"===aw(n)&&n>=0&&n<=3,"Expected recovery id to be a Number within interval [0, 3]"),rw("message",r,32),iw(i),o=ow(o,i?33:65),e.ecdsaRecover(o,t,n,r)){case 0:return o;case 1:throw new Error(tw);case 2:throw new Error("Public key could not be recover");case 3:throw new Error(Qb)}},ecdh(t,n,r={},i){switch(rw("public key",t,[33,65]),rw("private key",n,32),nw("Object"===aw(r),"Expected options to be an Object"),void 0!==r.data&&rw("options.data",r.data),void 0!==r.hashfn?(nw("Function"===aw(r.hashfn),"Expected options.hashfn to be a Function"),void 0!==r.xbuf&&rw("options.xbuf",r.xbuf,32),void 0!==r.ybuf&&rw("options.ybuf",r.ybuf,32),rw("output",i)):i=ow(i,32),e.ecdh(i,t,n,r.data,r.hashfn,r.xbuf,r.ybuf)){case 0:return i;case 1:throw new Error(Jb);case 2:throw new Error("Scalar was invalid (zero or overflow)")}}}))(fw),pw={},mw={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SECRET_KEY_LENGTH=e.AES_IV_PLUS_TAG_LENGTH=e.AES_TAG_LENGTH=e.AES_IV_LENGTH=e.UNCOMPRESSED_PUBLIC_KEY_SIZE=void 0,e.UNCOMPRESSED_PUBLIC_KEY_SIZE=65,e.AES_IV_LENGTH=16,e.AES_TAG_LENGTH=16,e.AES_IV_PLUS_TAG_LENGTH=e.AES_IV_LENGTH+e.AES_TAG_LENGTH,e.SECRET_KEY_LENGTH=32}(mw);var gw=hr&&hr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(pw,"__esModule",{value:!0}),pw.aesDecrypt=pw.aesEncrypt=pw.getValidSecret=pw.decodeHex=pw.remove0x=void 0;var vw=zb(),yw=gw(hw),bw=mw;function ww(e){return e.startsWith("0x")||e.startsWith("0X")?e.slice(2):e}pw.remove0x=ww,pw.decodeHex=function(e){return xn.from(ww(e),"hex")},pw.getValidSecret=function(){var e;do{e=(0,vw.randomBytes)(bw.SECRET_KEY_LENGTH)}while(!yw.default.privateKeyVerify(e));return e},pw.aesEncrypt=function(e,t){var n=(0,vw.randomBytes)(bw.AES_IV_LENGTH),r=(0,vw.createCipheriv)("aes-256-gcm",e,n),i=xn.concat([r.update(t),r.final()]),o=r.getAuthTag();return xn.concat([n,o,i])},pw.aesDecrypt=function(e,t){var n=t.slice(0,bw.AES_IV_LENGTH),r=t.slice(bw.AES_IV_LENGTH,bw.AES_IV_PLUS_TAG_LENGTH),i=t.slice(bw.AES_IV_PLUS_TAG_LENGTH),o=(0,vw.createDecipheriv)("aes-256-gcm",e,n);return o.setAuthTag(r),xn.concat([o.update(i),o.final()])};var Aw={},_w=hr&&hr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Aw,"__esModule",{value:!0});var Ew=_w(Gb),Sw=_w(hw),kw=pw,Mw=mw,Cw=function(){function e(e){this.uncompressed=xn.from(Sw.default.publicKeyConvert(e,!1)),this.compressed=xn.from(Sw.default.publicKeyConvert(e,!0))}return e.fromHex=function(t){var n=(0,kw.decodeHex)(t);if(n.length===Mw.UNCOMPRESSED_PUBLIC_KEY_SIZE-1){var r=xn.from([4]);return new e(xn.concat([r,n]))}return new e(n)},e.prototype.toHex=function(e){return void 0===e&&(e=!0),e?this.compressed.toString("hex"):this.uncompressed.toString("hex")},e.prototype.decapsulate=function(e){var t=xn.concat([this.uncompressed,e.multiply(this)]);return(0,Ew.default)(t,32,{hash:"SHA-256"})},e.prototype.equals=function(e){return this.uncompressed.equals(e.uncompressed)},e}();Aw.default=Cw;var xw=hr&&hr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(vr,"__esModule",{value:!0});var Rw=xw(Gb),Ow=xw(hw),Tw=pw,Pw=xw(Aw),Lw=function(){function e(e){if(this.secret=e||(0,Tw.getValidSecret)(),!Ow.default.privateKeyVerify(this.secret))throw new Error("Invalid private key");this.publicKey=new Pw.default(xn.from(Ow.default.publicKeyCreate(this.secret)))}return e.fromHex=function(t){return new e((0,Tw.decodeHex)(t))},e.prototype.toHex=function(){return"0x".concat(this.secret.toString("hex"))},e.prototype.encapsulate=function(e){var t=xn.concat([this.publicKey.uncompressed,this.multiply(e)]);return(0,Rw.default)(t,32,{hash:"SHA-256"})},e.prototype.multiply=function(e){return xn.from(Ow.default.publicKeyTweakMul(e.compressed,this.secret,!1))},e.prototype.equals=function(e){return this.secret.equals(e.secret)},e}();vr.default=Lw,function(e){var t=hr&&hr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.PublicKey=e.PrivateKey=void 0;var n=vr;Object.defineProperty(e,"PrivateKey",{enumerable:!0,get:function(){return t(n).default}});var r=Aw;Object.defineProperty(e,"PublicKey",{enumerable:!0,get:function(){return t(r).default}})}(gr),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.utils=e.PublicKey=e.PrivateKey=e.decrypt=e.encrypt=void 0;var t=gr,n=pw,r=mw;e.encrypt=function(e,r){var i=new t.PrivateKey,o=e instanceof xn?new t.PublicKey(e):t.PublicKey.fromHex(e),a=i.encapsulate(o),s=(0,n.aesEncrypt)(a,r);return xn.concat([i.publicKey.uncompressed,s])},e.decrypt=function(e,i){var o=e instanceof xn?new t.PrivateKey(e):t.PrivateKey.fromHex(e),a=new t.PublicKey(i.slice(0,r.UNCOMPRESSED_PUBLIC_KEY_SIZE)),s=i.slice(r.UNCOMPRESSED_PUBLIC_KEY_SIZE),u=a.decapsulate(o);return(0,n.aesDecrypt)(u,s)};var i=gr;Object.defineProperty(e,"PrivateKey",{enumerable:!0,get:function(){return i.PrivateKey}}),Object.defineProperty(e,"PublicKey",{enumerable:!0,get:function(){return i.PublicKey}}),e.utils={aesDecrypt:n.aesDecrypt,aesEncrypt:n.aesEncrypt,decodeHex:n.decodeHex,getValidSecret:n.getValidSecret,remove0x:n.remove0x}}(mr);class Iw{constructor(e){this.enabled=!0,this.debug=!1,(null==e?void 0:e.debug)&&(this.debug=e.debug),(null==e?void 0:e.pkey)?this.ecies=mr.PrivateKey.fromHex(e.pkey):this.ecies=new mr.PrivateKey,this.debug&&(console.info("[ECIES] initialized secret: ",this.ecies.toHex()),console.info("[ECIES] initialized public: ",this.ecies.publicKey.toHex()),console.info("[ECIES] init with",this))}generateECIES(){this.ecies=new mr.PrivateKey}getPublicKey(){return this.ecies.publicKey.toHex()}encrypt(e,t){let n=e;if(this.enabled)try{this.debug&&console.debug("ECIES::encrypt() using otherPublicKey",t);const r=xn.from(e),i=mr.encrypt(t,r);n=xn.from(i).toString("base64")}catch(n){throw this.debug&&(console.error("error encrypt:",n),console.error("private: ",this.ecies.toHex()),console.error("data: ",e),console.error("otherkey: ",t)),n}return n}decrypt(e){let t=e;if(this.enabled)try{this.debug&&console.debug("ECIES::decrypt() using privateKey",this.ecies.toHex());const n=xn.from(e.toString(),"base64");t=mr.decrypt(this.ecies.toHex(),n).toString()}catch(t){throw this.debug&&(console.error("error decrypt",t),console.error("private: ",this.ecies.toHex()),console.error("encryptedData: ",e)),t}return t}getKeyInfo(){return{private:this.ecies.toHex(),public:this.ecies.publicKey.toHex()}}toString(){console.debug("ECIES::toString()",this.getKeyInfo())}}var Nw="0.14.1";const Dw="https://metamask-sdk-socket.metafi.codefi.network/",Bw=["polling","websocket"],jw=6048e5,Uw={METAMASK_GETPROVIDERSTATE:"metamask_getProviderState",ETH_REQUESTACCOUNTS:"eth_requestAccounts"};function zw(e){const{debug:t,context:n}=e;t&&console.debug(`RemoteCommunication::${n}::clean()`),e.channelConfig=void 0,e.ready=!1,e.originatorConnectStarted=!1}var Fw,qw;t.ConnectionStatus=void 0,t.EventType=void 0,t.MessageType=void 0,function(e){e.DISCONNECTED="disconnected",e.WAITING="waiting",e.TIMEOUT="timeout",e.LINKED="linked",e.PAUSED="paused",e.TERMINATED="terminated"}(t.ConnectionStatus||(t.ConnectionStatus={})),function(e){e.KEY_INFO="key_info",e.SERVICE_STATUS="service_status",e.PROVIDER_UPDATE="provider_update",e.RPC_UPDATE="rpc_update",e.KEYS_EXCHANGED="keys_exchanged",e.JOIN_CHANNEL="join_channel",e.CHANNEL_CREATED="channel_created",e.CLIENTS_CONNECTED="clients_connected",e.CLIENTS_DISCONNECTED="clients_disconnected",e.CLIENTS_WAITING="clients_waiting",e.CLIENTS_READY="clients_ready",e.SOCKET_DISCONNECTED="socket_disconnected",e.SOCKET_RECONNECT="socket_reconnect",e.OTP="otp",e.SDK_RPC_CALL="sdk_rpc_call",e.AUTHORIZED="authorized",e.CONNECTION_STATUS="connection_status",e.MESSAGE="message",e.TERMINATE="terminate"}(t.EventType||(t.EventType={})),function(e){e.KEY_EXCHANGE="key_exchange"}(Fw||(Fw={})),function(e){e.KEY_HANDSHAKE_START="key_handshake_start",e.KEY_HANDSHAKE_CHECK="key_handshake_check",e.KEY_HANDSHAKE_SYN="key_handshake_SYN",e.KEY_HANDSHAKE_SYNACK="key_handshake_SYNACK",e.KEY_HANDSHAKE_ACK="key_handshake_ACK",e.KEY_HANDSHAKE_NONE="none"}(qw||(qw={}));class Ww extends N.EventEmitter2{constructor({communicationLayer:e,otherPublicKey:t,context:n,ecies:r,logging:i}){super(),this.keysExchanged=!1,this.step=qw.KEY_HANDSHAKE_NONE,this.debug=!1,this.context=n,this.myECIES=new Iw(Object.assign(Object.assign({},r),{debug:null==i?void 0:i.eciesLayer})),this.communicationLayer=e,this.myPublicKey=this.myECIES.getPublicKey(),this.debug=!0===(null==i?void 0:i.keyExchangeLayer),t&&this.setOtherPublicKey(t),this.communicationLayer.on(Fw.KEY_EXCHANGE,this.onKeyExchangeMessage.bind(this))}onKeyExchangeMessage(e){this.debug&&console.debug(`KeyExchange::${this.context}::onKeyExchangeMessage() keysExchanged=${this.keysExchanged}`,e);const{message:n}=e;this.keysExchanged&&this.debug&&console.log(`KeyExchange::${this.context}::onKeyExchangeMessage received handshake while already exchanged. step=${this.step} otherPubKey=${this.otherPublicKey}`),this.emit(t.EventType.KEY_INFO,n.type),n.type===qw.KEY_HANDSHAKE_SYN?(this.checkStep([qw.KEY_HANDSHAKE_NONE,qw.KEY_HANDSHAKE_ACK]),this.debug&&console.debug("KeyExchange::KEY_HANDSHAKE_SYN",n),n.pubkey&&this.setOtherPublicKey(n.pubkey),this.communicationLayer.sendMessage({type:qw.KEY_HANDSHAKE_SYNACK,pubkey:this.myPublicKey}),this.setStep(qw.KEY_HANDSHAKE_ACK)):n.type===qw.KEY_HANDSHAKE_SYNACK?(this.checkStep([qw.KEY_HANDSHAKE_SYNACK,qw.KEY_HANDSHAKE_ACK,qw.KEY_HANDSHAKE_NONE]),this.debug&&console.debug("KeyExchange::KEY_HANDSHAKE_SYNACK"),n.pubkey&&this.setOtherPublicKey(n.pubkey),this.communicationLayer.sendMessage({type:qw.KEY_HANDSHAKE_ACK}),this.keysExchanged=!0,this.setStep(qw.KEY_HANDSHAKE_ACK),this.emit(t.EventType.KEYS_EXCHANGED)):n.type===qw.KEY_HANDSHAKE_ACK&&(this.debug&&console.debug("KeyExchange::KEY_HANDSHAKE_ACK set keysExchanged to true!"),this.checkStep([qw.KEY_HANDSHAKE_ACK,qw.KEY_HANDSHAKE_NONE]),this.keysExchanged=!0,this.setStep(qw.KEY_HANDSHAKE_ACK),this.emit(t.EventType.KEYS_EXCHANGED))}resetKeys(e){this.clean(),this.myECIES=new Iw(e)}clean(){this.debug&&console.debug(`KeyExchange::${this.context}::clean reset handshake state`),this.setStep(qw.KEY_HANDSHAKE_NONE),this.emit(t.EventType.KEY_INFO,this.step),this.keysExchanged=!1}start({isOriginator:e,force:t}){this.debug&&console.debug(`KeyExchange::${this.context}::start isOriginator=${e} step=${this.step} force=${t} keysExchanged=${this.keysExchanged}`),e?!(this.keysExchanged||this.step!==qw.KEY_HANDSHAKE_NONE&&this.step!==qw.KEY_HANDSHAKE_SYNACK)||t?(this.debug&&console.debug(`KeyExchange::${this.context}::start -- start key exchange (force=${t}) -- step=${this.step}`,this.step),this.clean(),this.setStep(qw.KEY_HANDSHAKE_SYNACK),this.communicationLayer.sendMessage({type:qw.KEY_HANDSHAKE_SYN,pubkey:this.myPublicKey})):this.debug&&console.debug(`KeyExchange::${this.context}::start -- key exchange already ${this.keysExchanged?"done":"in progress"} -- aborted.`,this.step):this.keysExchanged&&!0!==t?this.debug&&console.debug("KeyExchange::start don't send KEY_HANDSHAKE_START -- exchange already done."):(this.communicationLayer.sendMessage({type:qw.KEY_HANDSHAKE_START}),this.clean())}setStep(e){this.step=e,this.emit(t.EventType.KEY_INFO,e)}checkStep(e){e.length>0&&-1===e.indexOf(this.step.toString())&&console.warn(`[KeyExchange] Wrong Step "${this.step}" not within ${e}`)}setKeysExchanged(e){this.keysExchanged=e}areKeysExchanged(){return this.keysExchanged}getMyPublicKey(){return this.myPublicKey}getOtherPublicKey(){return this.otherPublicKey}setOtherPublicKey(e){this.debug&&console.debug("KeyExchange::setOtherPubKey()",e),this.otherPublicKey=e}encryptMessage(e){if(!this.otherPublicKey)throw new Error("encryptMessage: Keys not exchanged - missing otherPubKey");return this.myECIES.encrypt(e,this.otherPublicKey)}decryptMessage(e){if(!this.otherPublicKey)throw new Error("decryptMessage: Keys not exchanged - missing otherPubKey");return this.myECIES.decrypt(e)}getKeyInfo(){return{ecies:Object.assign(Object.assign({},this.myECIES.getKeyInfo()),{otherPubKey:this.otherPublicKey}),step:this.step,keysExchanged:this.areKeysExchanged()}}toString(){const e={keyInfo:this.getKeyInfo(),keysExchanged:this.keysExchanged,step:this.step};return JSON.stringify(e)}}!function(e){e.TERMINATE="terminate",e.ANSWER="answer",e.OFFER="offer",e.CANDIDATE="candidate",e.JSONRPC="jsonrpc",e.WALLET_INFO="wallet_info",e.ORIGINATOR_INFO="originator_info",e.PAUSE="pause",e.OTP="otp",e.AUTHORIZED="authorized",e.PING="ping",e.READY="ready"}(t.MessageType||(t.MessageType={}));const Vw=e=>new Promise((t=>{setTimeout(t,e)})),Kw=(e,t,n=200)=>dn(void 0,void 0,void 0,(function*(){let r;const i=Date.now();let o=!1;for(;!o;){if(o=Date.now()-i>3e5,r=t[e],void 0!==r.elapsedTime)return r;yield Vw(n)}throw new Error(`RPC ${e} timed out`)})),Hw=e=>dn(void 0,void 0,void 0,(function*(){var n,r,i,o,a;return e.state.debug&&console.debug(`SocketService::connectAgain instance.state.socket?.connected=${null===(n=e.state.socket)||void 0===n?void 0:n.connected} trying to reconnect after socketio disconnection`,e),yield Vw(200),(null===(r=e.state.socket)||void 0===r?void 0:r.connected)||(e.state.resumed=!0,null===(i=e.state.socket)||void 0===i||i.connect(),e.emit(t.EventType.SOCKET_RECONNECT),null===(o=e.state.socket)||void 0===o||o.emit(t.EventType.JOIN_CHANNEL,e.state.channelId,`${e.state.context}connect_again`)),yield Vw(100),null===(a=e.state.socket)||void 0===a?void 0:a.connected})),$w=[{event:"clients_connected",handler:function(e,n){return r=>dn(this,void 0,void 0,(function*(){var r,i,o,a,s,u,l,c;e.state.debug&&console.debug(`SocketService::${e.state.context}::setupChannelListener::on 'clients_connected-${n}' resumed=${e.state.resumed} clientsPaused=${e.state.clientsPaused} keysExchanged=${null===(r=e.state.keyExchange)||void 0===r?void 0:r.areKeysExchanged()} isOriginator=${e.state.isOriginator}`),e.emit(t.EventType.CLIENTS_CONNECTED,{isOriginator:e.state.isOriginator,keysExchanged:null===(i=e.state.keyExchange)||void 0===i?void 0:i.areKeysExchanged(),context:e.state.context}),e.state.resumed?(e.state.isOriginator||(e.state.debug&&console.debug(`SocketService::${e.state.context}::on 'clients_connected' / keysExchanged=${null===(o=e.state.keyExchange)||void 0===o?void 0:o.areKeysExchanged()} -- backward compatibility`),null===(a=e.state.keyExchange)||void 0===a||a.start({isOriginator:null!==(s=e.state.isOriginator)&&void 0!==s&&s})),e.state.resumed=!1):e.state.clientsPaused?console.debug("SocketService::on 'clients_connected' skip sending originatorInfo on pause"):e.state.isOriginator||(e.state.debug&&console.debug(`SocketService::${e.state.context}::on 'clients_connected' / keysExchanged=${null===(u=e.state.keyExchange)||void 0===u?void 0:u.areKeysExchanged()} -- backward compatibility`),null===(l=e.state.keyExchange)||void 0===l||l.start({isOriginator:null!==(c=e.state.isOriginator)&&void 0!==c&&c,force:!0})),e.state.clientsConnected=!0,e.state.clientsPaused=!1}))}},{event:"channel_created",handler:function(e,n){return r=>{e.state.debug&&console.debug(`SocketService::${e.state.context}::setupChannelListener::on 'channel_created-${n}'`,r),e.emit(t.EventType.CHANNEL_CREATED,r)}}},{event:"clients_disconnected",handler:function(e,n){return()=>{var r;e.state.clientsConnected=!1,e.state.debug&&console.debug(`SocketService::${e.state.context}::setupChannelListener::on 'clients_disconnected-${n}'`),e.state.isOriginator&&!e.state.clientsPaused&&(null===(r=e.state.keyExchange)||void 0===r||r.clean()),e.emit(t.EventType.CLIENTS_DISCONNECTED,n)}}},{event:"message",handler:function(e,n){return({id:r,message:i,error:o})=>{var a,s,u,l,c,d,f,h,p,m,g,v,y,b,w;if(e.state.debug&&console.debug(`SocketService::${e.state.context}::on 'message' ${n} keysExchanged=${null===(a=e.state.keyExchange)||void 0===a?void 0:a.areKeysExchanged()}`,i),o)throw e.state.debug&&console.debug(`\n SocketService::${e.state.context}::on 'message' error=${o}`),new Error(o);try{!function(e,t){if(t!==e.channelId)throw e.debug&&console.error(`Wrong id ${t} - should be ${e.channelId}`),new Error("Wrong id")}(e.state,r)}catch(e){return void console.error("ignore message --- wrong id ",i)}if(e.state.isOriginator&&(null==i?void 0:i.type)===qw.KEY_HANDSHAKE_START)return e.state.debug&&console.debug(`SocketService::${e.state.context}::on 'message' received HANDSHAKE_START isOriginator=${e.state.isOriginator}`,i),void(null===(s=e.state.keyExchange)||void 0===s||s.start({isOriginator:null!==(u=e.state.isOriginator)&&void 0!==u&&u,force:!0}));if((null==i?void 0:i.type)===t.MessageType.PING)return e.state.debug&&console.debug(`SocketService::${e.state.context}::on 'message' ping `),void e.emit(t.EventType.MESSAGE,{message:{type:"ping"}});if(e.state.debug&&console.debug(`SocketService::${e.state.context}::on 'message' originator=${e.state.isOriginator}, type=${null==i?void 0:i.type}, keysExchanged=${null===(l=e.state.keyExchange)||void 0===l?void 0:l.areKeysExchanged()}`),null===(c=null==i?void 0:i.type)||void 0===c?void 0:c.startsWith("key_handshake"))return e.state.debug&&console.debug(`SocketService::${e.state.context}::on 'message' emit KEY_EXCHANGE`,i),void e.emit(Fw.KEY_EXCHANGE,{message:i,context:e.state.context});if(null===(d=e.state.keyExchange)||void 0===d?void 0:d.areKeysExchanged()){if(-1!==i.toString().indexOf("type"))return console.warn("SocketService::on 'message' received non encrypted unkwown message"),void e.emit(t.EventType.MESSAGE,i)}else{let t=!1;try{null===(f=e.state.keyExchange)||void 0===f||f.decryptMessage(i),t=!0}catch(e){}if(!t)return e.state.isOriginator?null===(p=e.state.keyExchange)||void 0===p||p.start({isOriginator:null!==(m=e.state.isOriginator)&&void 0!==m&&m}):e.sendMessage({type:qw.KEY_HANDSHAKE_START}),void console.warn(`Message ignored because invalid key exchange status. step=${null===(g=e.state.keyExchange)||void 0===g?void 0:g.getKeyInfo().step}`,null===(v=e.state.keyExchange)||void 0===v?void 0:v.getKeyInfo(),i);console.warn("Invalid key exchange status detected --- updating it."),null===(h=e.state.keyExchange)||void 0===h||h.setKeysExchanged(!0)}const A=null===(y=e.state.keyExchange)||void 0===y?void 0:y.decryptMessage(i),_=JSON.parse(null!=A?A:"{}");if((null==_?void 0:_.type)===t.MessageType.PAUSE?e.state.clientsPaused=!0:e.state.clientsPaused=!1,e.state.isOriginator&&_.data){const n=_.data,r=e.state.rpcMethodTracker[n.id];if(r){const i=Date.now()-r.timestamp;e.state.debug&&console.debug(`SocketService::${e.state.context}::on 'message' received answer for id=${n.id} method=${r.method} responseTime=${i}`,_);const o=Object.assign(Object.assign({},r),{result:n.result,error:n.error?{code:null===(b=n.error)||void 0===b?void 0:b.code,message:null===(w=n.error)||void 0===w?void 0:w.message}:void 0,elapsedTime:i});e.state.rpcMethodTracker[n.id]=o,e.emit(t.EventType.RPC_UPDATE,o),e.state.debug&&console.debug("HACK (wallet <7.3) update rpcMethodTracker",o),e.emit(t.EventType.AUTHORIZED)}}e.emit(t.EventType.MESSAGE,{message:_})}}},{event:"clients_waiting_to_join",handler:function(e,n){return r=>{e.state.debug&&console.debug(`SocketService::${e.state.context}::setupChannelListener::on 'clients_waiting_to_join-${n}'`,r),e.emit(t.EventType.CLIENTS_WAITING,r)}}}],Yw=[{event:t.EventType.KEY_INFO,handler:function(e){return n=>{e.state.debug&&console.debug("SocketService::on 'KEY_INFO'",n),e.emit(t.EventType.KEY_INFO,n)}}},{event:t.EventType.KEYS_EXCHANGED,handler:function(e){return()=>{var n,r;e.state.debug&&console.debug(`SocketService::on 'keys_exchanged' keyschanged=${null===(n=e.state.keyExchange)||void 0===n?void 0:n.areKeysExchanged()}`),e.emit(t.EventType.KEYS_EXCHANGED,{keysExchanged:null===(r=e.state.keyExchange)||void 0===r?void 0:r.areKeysExchanged(),isOriginator:e.state.isOriginator});const i={keyInfo:e.getKeyInfo()};e.emit(t.EventType.SERVICE_STATUS,i)}}}];function Gw(e,n){e.state.debug&&console.debug(`SocketService::${e.state.context}::setupChannelListener setting socket listeners for channel ${n}...`);const{socket:r}=e.state,{keyExchange:i}=e.state;e.state.setupChannelListeners&&console.warn(`SocketService::${e.state.context}::setupChannelListener socket listeners already set up for channel ${n}`),r&&e.state.isOriginator&&(e.state.debug&&(null==r||r.io.on("error",(t=>{console.debug(`SocketService::${e.state.context}::setupChannelListener socket event=error`,t)})),null==r||r.io.on("reconnect",(t=>{console.debug(`SocketService::${e.state.context}::setupChannelListener socket event=reconnect`,t)})),null==r||r.io.on("reconnect_error",(t=>{console.debug(`SocketService::${e.state.context}::setupChannelListener socket event=reconnect_error`,t)})),null==r||r.io.on("reconnect_failed",(()=>{console.debug(`SocketService::${e.state.context}::setupChannelListener socket event=reconnect_failed`)})),null==r||r.io.on("ping",(()=>{console.debug(`SocketService::${e.state.context}::setupChannelListener socket event=ping`)}))),null==r||r.on("disconnect",(n=>(console.log(`MetaMaskSDK socket disconnected '${n}' begin recovery...`),function(e){return n=>{e.state.debug&&console.debug(`SocketService::on 'disconnect' manualDisconnect=${e.state.manualDisconnect}`,n),e.state.manualDisconnect||(e.emit(t.EventType.SOCKET_DISCONNECTED),function(e){"undefined"!=typeof window&&"undefined"!=typeof document&&(e.state.debug&&console.debug(`SocketService::checkFocus hasFocus=${document.hasFocus()}`,e),document.hasFocus()?Hw(e).then((t=>{e.state.debug&&console.debug(`SocketService::checkFocus reconnectSocket success=${t}`,e)})).catch((e=>{console.error("SocketService::checkFocus Error reconnecting socket",e)})):window.addEventListener("focus",(()=>{Hw(e).catch((e=>{console.error("SocketService::checkFocus Error reconnecting socket",e)}))}),{once:!0}))}(e))}}(e)(n))))),$w.forEach((({event:t,handler:i})=>{const o=`${t}-${n}`;null==r||r.on(o,i(e,n))})),Yw.forEach((({event:t,handler:n})=>{null==i||i.on(t,n(e))})),e.state.setupChannelListeners=!0}var Qw,Zw,Xw;function Jw(e,n){var r,i;if(!e.state.channelId)throw new Error("Create a channel first");e.state.debug&&console.debug(`SocketService::${e.state.context}::sendMessage() areKeysExchanged=${null===(r=e.state.keyExchange)||void 0===r?void 0:r.areKeysExchanged()}`,n),(null===(i=null==n?void 0:n.type)||void 0===i?void 0:i.startsWith("key_handshake"))?function(e,n){var r;e.state.debug&&console.debug(`SocketService::${e.state.context}::sendMessage()`,n),null===(r=e.state.socket)||void 0===r||r.emit(t.EventType.MESSAGE,{id:e.state.channelId,context:e.state.context,message:n})}(e,n):(function(e,t){var n;if(!(null===(n=e.state.keyExchange)||void 0===n?void 0:n.areKeysExchanged()))throw e.state.debug&&console.debug(`SocketService::${e.state.context}::sendMessage() ERROR keys not exchanged`,t),new Error("Keys not exchanged BBB")}(e,n),function(e,n){var r;const i=null!==(r=null==n?void 0:n.method)&&void 0!==r?r:"",o=null==n?void 0:n.id;e.state.isOriginator&&o&&(e.state.rpcMethodTracker[o]={id:o,timestamp:Date.now(),method:i},e.emit(t.EventType.RPC_UPDATE,e.state.rpcMethodTracker[o]))}(e,n),function(e,n){var r,i;const o=null===(r=e.state.keyExchange)||void 0===r?void 0:r.encryptMessage(JSON.stringify(n)),a={id:e.state.channelId,context:e.state.context,message:o,plaintext:e.state.hasPlaintext?JSON.stringify(n):void 0};e.state.debug&&console.debug(`SocketService::${e.state.context}::sendMessage()`,a),n.type===t.MessageType.TERMINATE&&(e.state.manualDisconnect=!0),null===(i=e.state.socket)||void 0===i||i.emit(t.EventType.MESSAGE,a)}(e,n),function(e,n){var r;return dn(this,void 0,void 0,(function*(){const i=null==n?void 0:n.id,o=null!==(r=null==n?void 0:n.method)&&void 0!==r?r:"";if(e.state.isOriginator&&i)try{const r=Kw(i,e.state.rpcMethodTracker,200).then((e=>({type:Qw.RPC_CHECK,result:e}))),a=(()=>dn(this,void 0,void 0,(function*(){const t=yield(({rpcId:e,instance:t})=>dn(void 0,void 0,void 0,(function*(){for(;t.state.lastRpcId===e||void 0===t.state.lastRpcId;)yield Vw(200);return t.state.lastRpcId})))({instance:e,rpcId:i}),n=yield Kw(t,e.state.rpcMethodTracker,200);return{type:Qw.SKIPPED_RPC,result:n}})))(),s=yield Promise.race([r,a]);if(s.type===Qw.RPC_CHECK){const t=s.result;e.state.debug&&console.debug(`SocketService::waitForRpc id=${n.id} ${o} ( ${t.elapsedTime} ms)`,t.result)}else{if(s.type!==Qw.SKIPPED_RPC)throw new Error(`Error handling RPC replies for ${i}`);{const{result:n}=s;console.warn(`[handleRpcReplies] RPC METHOD HAS BEEN SKIPPED rpcid=${i} method=${o}`,n);const r=Object.assign(Object.assign({},e.state.rpcMethodTracker[i]),{error:new Error("SDK_CONNECTION_ISSUE")});e.emit(t.EventType.RPC_UPDATE,r);const a={data:Object.assign(Object.assign({},r),{jsonrpc:"2.0"}),name:"metamask-provider"};e.emit(t.EventType.MESSAGE,{message:a})}}}catch(e){throw console.warn(`[handleRpcReplies] Error rpcId=${n.id} ${o}`,e),e}}))}(e,n).catch((e=>{console.warn("Error handleRpcReplies",e)})))}t.CommunicationLayerPreference=void 0,t.PlatformType=void 0,function(e){e.RPC_CHECK="rpcCheck",e.SKIPPED_RPC="skippedRpc"}(Qw||(Qw={}));class eA extends N.EventEmitter2{constructor({otherPublicKey:e,reconnect:t,communicationLayerPreference:n,transports:r,communicationServerUrl:i,context:o,ecies:a,logging:s}){super(),this.state={clientsConnected:!1,clientsPaused:!1,manualDisconnect:!1,lastRpcId:void 0,rpcMethodTracker:{},hasPlaintext:!1,communicationServerUrl:""},this.state.resumed=t,this.state.context=o,this.state.communicationLayerPreference=n,this.state.debug=!0===(null==s?void 0:s.serviceLayer),this.state.communicationServerUrl=i,this.state.hasPlaintext=this.state.communicationServerUrl!==Dw&&!0===(null==s?void 0:s.plaintext);const u={autoConnect:!1,transports:Bw};r&&(u.transports=r),this.state.debug&&console.debug(`SocketService::constructor() Socket IO url: ${this.state.communicationServerUrl}`),this.state.socket=cn(i,u);const l={communicationLayer:this,otherPublicKey:e,sendPublicKey:!1,context:this.state.context,ecies:a,logging:s};this.state.keyExchange=new Ww(l)}resetKeys(){return this.state.debug&&console.debug("SocketService::resetKeys()"),void(null===(e=this.state.keyExchange)||void 0===e||e.resetKeys());var e}createChannel(){return function(e){var n,r,i,o;e.state.debug&&console.debug(`SocketService::${e.state.context}::createChannel()`),(null===(n=e.state.socket)||void 0===n?void 0:n.connected)||null===(r=e.state.socket)||void 0===r||r.connect(),e.state.manualDisconnect=!1,e.state.isOriginator=!0;const a=q();return e.state.channelId=a,Gw(e,a),null===(i=e.state.socket)||void 0===i||i.emit(t.EventType.JOIN_CHANNEL,a,`${e.state.context}createChannel`),{channelId:a,pubKey:(null===(o=e.state.keyExchange)||void 0===o?void 0:o.getMyPublicKey())||""}}(this)}connectToChannel({channelId:e,isOriginator:n=!1,withKeyExchange:r=!1}){return function({options:e,instance:n}){var r,i,o,a;const{channelId:s,withKeyExchange:u,isOriginator:l}=e;if(n.state.debug&&console.debug(`SocketService::${n.state.context}::connectToChannel() channelId=${s} isOriginator=${l}`,null===(r=n.state.keyExchange)||void 0===r?void 0:r.toString()),null===(i=n.state.socket)||void 0===i?void 0:i.connected)throw new Error("socket already connected");n.state.manualDisconnect=!1,null===(o=n.state.socket)||void 0===o||o.connect(),n.state.withKeyExchange=u,n.state.isOriginator=l,n.state.channelId=s,Gw(n,s),null===(a=n.state.socket)||void 0===a||a.emit(t.EventType.JOIN_CHANNEL,s,`${n.state.context}_connectToChannel`)}({options:{channelId:e,isOriginator:n,withKeyExchange:r},instance:this})}getKeyInfo(){return this.state.keyExchange.getKeyInfo()}keyCheck(){var e,n;null===(n=(e=this).state.socket)||void 0===n||n.emit(t.EventType.MESSAGE,{id:e.state.channelId,context:e.state.context,message:{type:qw.KEY_HANDSHAKE_CHECK,pubkey:e.getKeyInfo().ecies.otherPubKey}})}getKeyExchange(){return this.state.keyExchange}sendMessage(e){return Jw(this,e)}ping(){return(e=this).state.debug&&console.debug(`SocketService::${e.state.context}::ping() originator=${e.state.isOriginator} keysExchanged=${null===(n=e.state.keyExchange)||void 0===n?void 0:n.areKeysExchanged()}`),e.state.isOriginator&&((null===(r=e.state.keyExchange)||void 0===r?void 0:r.areKeysExchanged())?(console.warn(`SocketService::${e.state.context}::ping() sending READY message`),e.sendMessage({type:t.MessageType.READY})):(console.warn(`SocketService::${e.state.context}::ping() starting key exchange`),null===(i=e.state.keyExchange)||void 0===i||i.start({isOriginator:null!==(o=e.state.isOriginator)&&void 0!==o&&o}))),void(null===(a=e.state.socket)||void 0===a||a.emit(t.EventType.MESSAGE,{id:e.state.channelId,context:e.state.context,message:{type:t.MessageType.PING}}));var e,n,r,i,o,a}pause(){return(e=this).state.debug&&console.debug(`SocketService::${e.state.context}::pause()`),e.state.manualDisconnect=!0,(null===(n=e.state.keyExchange)||void 0===n?void 0:n.areKeysExchanged())&&e.sendMessage({type:t.MessageType.PAUSE}),void(null===(r=e.state.socket)||void 0===r||r.disconnect());var e,n,r}isConnected(){var e;return null===(e=this.state.socket)||void 0===e?void 0:e.connected}resume(){return(e=this).state.debug&&console.debug(`SocketService::${e.state.context}::resume() connected=${null===(n=e.state.socket)||void 0===n?void 0:n.connected} manualDisconnect=${e.state.manualDisconnect} resumed=${e.state.resumed} keysExchanged=${null===(r=e.state.keyExchange)||void 0===r?void 0:r.areKeysExchanged()}`),(null===(i=e.state.socket)||void 0===i?void 0:i.connected)?e.state.debug&&console.debug("SocketService::resume() already connected."):(null===(o=e.state.socket)||void 0===o||o.connect(),e.state.debug&&console.debug(`SocketService::resume() after connecting socket --\x3e connected=${null===(a=e.state.socket)||void 0===a?void 0:a.connected}`),null===(s=e.state.socket)||void 0===s||s.emit(t.EventType.JOIN_CHANNEL,e.state.channelId,`${e.state.context}_resume`)),(null===(u=e.state.keyExchange)||void 0===u?void 0:u.areKeysExchanged())?e.state.isOriginator||e.sendMessage({type:t.MessageType.READY}):e.state.isOriginator||null===(l=e.state.keyExchange)||void 0===l||l.start({isOriginator:null!==(c=e.state.isOriginator)&&void 0!==c&&c}),e.state.manualDisconnect=!1,void(e.state.resumed=!0);var e,n,r,i,o,a,s,u,l,c}getRPCMethodTracker(){return this.state.rpcMethodTracker}disconnect(e){return function(e,t){var n,r;e.state.debug&&console.debug(`SocketService::${e.state.context}::disconnect()`,t),(null==t?void 0:t.terminate)&&(e.state.channelId=t.channelId,null===(n=e.state.keyExchange)||void 0===n||n.clean()),e.state.rpcMethodTracker={},e.state.manualDisconnect=!0,null===(r=e.state.socket)||void 0===r||r.disconnect()}(this,e)}}function tA(e){return()=>dn(this,void 0,void 0,(function*(){var n,r,i;const{state:o}=e;if(o.authorized)return;yield(()=>dn(this,void 0,void 0,(function*(){for(;!o.walletInfo;)yield Vw(500)})))();const a="7.3".localeCompare((null===(n=o.walletInfo)||void 0===n?void 0:n.version)||"");if(o.debug&&console.debug(`RemoteCommunication HACK 'authorized' version=${null===(r=o.walletInfo)||void 0===r?void 0:r.version} compareValue=${a}`),1!==a)return;const s=o.platformType===t.PlatformType.MobileWeb||o.platformType===t.PlatformType.ReactNative||o.platformType===t.PlatformType.MetaMaskMobileWebview;o.debug&&console.debug(`RemoteCommunication HACK 'authorized' platform=${o.platformType} secure=${s} channel=${o.channelId} walletVersion=${null===(i=o.walletInfo)||void 0===i?void 0:i.version}`),s&&(o.authorized=!0,e.emit(t.EventType.AUTHORIZED))}))}function nA(e){return n=>{const{state:r}=e;r.debug&&console.debug(`RemoteCommunication::${r.context}::on 'channel_created' channelId=${n}`),e.emit(t.EventType.CHANNEL_CREATED,n)}}function rA(e,n){return()=>{var r,i,o,a;const{state:s}=e;if(s.debug&&console.debug(`RemoteCommunication::on 'clients_connected' channel=${s.channelId} keysExchanged=${null===(i=null===(r=s.communicationLayer)||void 0===r?void 0:r.getKeyInfo())||void 0===i?void 0:i.keysExchanged}`),s.analytics){const e=s.isOriginator?Zw.REQUEST:Zw.REQUEST_MOBILE;fn(Object.assign(Object.assign({id:null!==(o=s.channelId)&&void 0!==o?o:"",event:s.reconnection?Zw.RECONNECT:e},s.originatorInfo),{commLayer:n,sdkVersion:s.sdkVersion,walletVersion:null===(a=s.walletInfo)||void 0===a?void 0:a.version,commLayerVersion:Nw}),s.communicationServerUrl).catch((e=>{console.error("Cannot send analytics",e)}))}s.clientsConnected=!0,s.originatorInfoSent=!1,e.emit(t.EventType.CLIENTS_CONNECTED)}}function iA(e,n){return r=>{var i;const{state:o}=e;o.debug&&console.debug(`RemoteCommunication::${o.context}]::on 'clients_disconnected' channelId=${r}`),o.clientsConnected=!1,e.emit(t.EventType.CLIENTS_DISCONNECTED,o.channelId),e.setConnectionStatus(t.ConnectionStatus.DISCONNECTED),o.ready=!1,o.authorized=!1,o.analytics&&o.channelId&&fn({id:o.channelId,event:Zw.DISCONNECTED,sdkVersion:o.sdkVersion,commLayer:n,commLayerVersion:Nw,walletVersion:null===(i=o.walletInfo)||void 0===i?void 0:i.version},o.communicationServerUrl).catch((e=>{console.error("Cannot send analytics",e)}))}}function oA(e){return n=>{var r;const{state:i}=e;if(i.debug&&console.debug(`RemoteCommunication::${i.context}::on 'clients_waiting' numberUsers=${n} ready=${i.ready} autoStarted=${i.originatorConnectStarted}`),e.setConnectionStatus(t.ConnectionStatus.WAITING),e.emit(t.EventType.CLIENTS_WAITING,n),i.originatorConnectStarted){i.debug&&console.debug(`RemoteCommunication::on 'clients_waiting' watch autoStarted=${i.originatorConnectStarted} timeout`,i.autoConnectOptions);const n=(null===(r=i.autoConnectOptions)||void 0===r?void 0:r.timeout)||3e3,o=setTimeout((()=>{i.debug&&console.debug(`RemoteCommunication::on setTimeout(${n}) terminate channelConfig`,i.autoConnectOptions),i.originatorConnectStarted=!1,i.ready||e.setConnectionStatus(t.ConnectionStatus.TIMEOUT),clearTimeout(o)}),n)}}}function aA(e,n){return r=>{var i,o,a,s,u;const{state:l}=e;l.debug&&console.debug(`RemoteCommunication::${l.context}::on commLayer.'keys_exchanged' channel=${l.channelId}`,r),(null===(o=null===(i=l.communicationLayer)||void 0===i?void 0:i.getKeyInfo())||void 0===o?void 0:o.keysExchanged)&&e.setConnectionStatus(t.ConnectionStatus.LINKED),function(e,t){var n,r,i,o;const{state:a}=e;a.debug&&console.debug(`RemoteCommunication::setLastActiveDate() channel=${a.channelId}`,t);const s={channelId:null!==(n=a.channelId)&&void 0!==n?n:"",validUntil:null!==(i=null===(r=a.channelConfig)||void 0===r?void 0:r.validUntil)&&void 0!==i?i:0,lastActive:t.getTime()};null===(o=a.storageManager)||void 0===o||o.persistChannelConfig(s)}(e,new Date),l.analytics&&l.channelId&&fn({id:l.channelId,event:r.isOriginator?Zw.CONNECTED:Zw.CONNECTED_MOBILE,sdkVersion:l.sdkVersion,commLayer:n,commLayerVersion:Nw,walletVersion:null===(a=l.walletInfo)||void 0===a?void 0:a.version},l.communicationServerUrl).catch((e=>{console.error("Cannot send analytics",e)})),l.isOriginator=r.isOriginator,r.isOriginator||(null===(s=l.communicationLayer)||void 0===s||s.sendMessage({type:t.MessageType.READY}),l.ready=!0,l.paused=!1),r.isOriginator&&!l.originatorInfoSent&&(null===(u=l.communicationLayer)||void 0===u||u.sendMessage({type:t.MessageType.ORIGINATOR_INFO,originatorInfo:l.originatorInfo,originator:l.originatorInfo}),l.originatorInfoSent=!0)}}function sA(e){return n=>{let r=n;n.message&&(r=r.message),function(e,n){const{state:r}=n;if(r.debug&&console.debug(`RemoteCommunication::${r.context}::on 'message' typeof=${typeof e}`,e),n.state.ready=!0,r.isOriginator||e.type!==t.MessageType.ORIGINATOR_INFO)if(r.isOriginator&&e.type===t.MessageType.WALLET_INFO)!function(e,t){const{state:n}=e;n.walletInfo=t.walletInfo,n.paused=!1}(n,e);else{if(e.type===t.MessageType.TERMINATE)!function(e){const{state:n}=e;n.isOriginator&&(cA({options:{terminate:!0,sendMessage:!1},instance:e}),console.debug(),e.emit(t.EventType.TERMINATE))}(n);else if(e.type===t.MessageType.PAUSE)!function(e){const{state:n}=e;n.paused=!0,e.setConnectionStatus(t.ConnectionStatus.PAUSED)}(n);else if(e.type===t.MessageType.READY&&r.isOriginator)!function(e){const{state:n}=e;e.setConnectionStatus(t.ConnectionStatus.LINKED);const r=n.paused;n.paused=!1,e.emit(t.EventType.CLIENTS_READY,{isOriginator:n.isOriginator,walletInfo:n.walletInfo}),r&&(n.authorized=!0,e.emit(t.EventType.AUTHORIZED))}(n);else{if(e.type===t.MessageType.OTP&&r.isOriginator)return void function(e,n){var r;const{state:i}=e;e.emit(t.EventType.OTP,n.otpAnswer),1==="6.6".localeCompare((null===(r=i.walletInfo)||void 0===r?void 0:r.version)||"")&&(console.warn("RemoteCommunication::on 'otp' -- backward compatibility <6.6 -- triger eth_requestAccounts"),e.emit(t.EventType.SDK_RPC_CALL,{method:Uw.ETH_REQUESTACCOUNTS,params:[]}))}(n,e);e.type===t.MessageType.AUTHORIZED&&r.isOriginator&&function(e){const{state:n}=e;n.authorized=!0,e.emit(t.EventType.AUTHORIZED)}(n)}n.emit(t.EventType.MESSAGE,e)}else!function(e,n){var r;const{state:i}=e;null===(r=i.communicationLayer)||void 0===r||r.sendMessage({type:t.MessageType.WALLET_INFO,walletInfo:i.walletInfo}),i.originatorInfo=n.originatorInfo||n.originator,e.emit(t.EventType.CLIENTS_READY,{isOriginator:i.isOriginator,originatorInfo:i.originatorInfo}),i.paused=!1}(n,e)}(r,e)}}function uA(e){return()=>{const{state:t}=e;t.debug&&console.debug("RemoteCommunication::on 'socket_reconnect' -- reset key exchange status / set ready to false"),t.ready=!1,t.authorized=!1,zw(t),e.emitServiceStatusEvent()}}function lA(e){return()=>{const{state:t}=e;t.debug&&console.debug("RemoteCommunication::on 'socket_Disconnected' set ready to false"),t.ready=!1}}function cA({options:e,instance:n}){var r,i,o,a,s,u;const{state:l}=n;l.debug&&console.debug(`RemoteCommunication::disconnect() channel=${l.channelId}`,e),l.ready=!1,l.paused=!1,(null==e?void 0:e.terminate)?(null===(r=l.storageManager)||void 0===r||r.terminate(null!==(i=l.channelId)&&void 0!==i?i:""),(null===(o=l.communicationLayer)||void 0===o?void 0:o.getKeyInfo().keysExchanged)&&(null==e?void 0:e.sendMessage)&&(null===(a=l.communicationLayer)||void 0===a||a.sendMessage({type:t.MessageType.TERMINATE})),l.channelId=q(),e.channelId=l.channelId,l.channelConfig=void 0,l.originatorConnectStarted=!1,null===(s=l.communicationLayer)||void 0===s||s.disconnect(e),n.setConnectionStatus(t.ConnectionStatus.TERMINATED)):(null===(u=l.communicationLayer)||void 0===u||u.disconnect(e),n.setConnectionStatus(t.ConnectionStatus.DISCONNECTED))}!function(e){e.SOCKET="socket"}(t.CommunicationLayerPreference||(t.CommunicationLayerPreference={})),function(e){e.NonBrowser="nodejs",e.MetaMaskMobileWebview="in-app-browser",e.DesktopWeb="web-desktop",e.MobileWeb="web-mobile",e.ReactNative="react-native"}(t.PlatformType||(t.PlatformType={})),function(e){e.REQUEST="sdk_connect_request_started",e.REQUEST_MOBILE="sdk_connect_request_started_mobile",e.RECONNECT="sdk_reconnect_request_started",e.CONNECTED="sdk_connection_established",e.CONNECTED_MOBILE="sdk_connection_established_mobile",e.AUTHORIZED="sdk_connection_authorized",e.REJECTED="sdk_connection_rejected",e.TERMINATED="sdk_connection_terminated",e.DISCONNECTED="sdk_disconnected",e.SDK_USE_EXTENSION="sdk_use_extension",e.SDK_EXTENSION_UTILIZED="sdk_extension_utilized",e.SDK_USE_INAPP_BROWSER="sdk_use_inapp_browser"}(Zw||(Zw={}));class dA extends N.EventEmitter2{constructor({platformType:e,communicationLayerPreference:n,otherPublicKey:r,reconnect:i,walletInfo:o,dappMetadata:a,transports:s,context:u,ecies:l,analytics:c=!1,storage:d,sdkVersion:f,communicationServerUrl:h=Dw,logging:p,autoConnect:m={timeout:3e3}}){super(),this.state={ready:!1,authorized:!1,isOriginator:!1,paused:!1,platformType:"metamask-mobile",analytics:!1,reconnection:!1,originatorInfoSent:!1,communicationServerUrl:Dw,context:"",clientsConnected:!1,sessionDuration:jw,originatorConnectStarted:!1,debug:!1,_connectionStatus:t.ConnectionStatus.DISCONNECTED},this.state.otherPublicKey=r,this.state.dappMetadata=a,this.state.walletInfo=o,this.state.transports=s,this.state.platformType=e,this.state.analytics=c,this.state.isOriginator=!r,this.state.communicationServerUrl=h,this.state.context=u,this.state.sdkVersion=f,this.setMaxListeners(50),this.setConnectionStatus(t.ConnectionStatus.DISCONNECTED),(null==d?void 0:d.duration)&&(this.state.sessionDuration=jw),this.state.storageOptions=d,this.state.autoConnectOptions=m,this.state.debug=!0===(null==p?void 0:p.remoteLayer),this.state.logging=p,(null==d?void 0:d.storageManager)&&(this.state.storageManager=d.storageManager),this.initCommunicationLayer({communicationLayerPreference:n,otherPublicKey:r,reconnect:i,ecies:l,communicationServerUrl:h}),this.emitServiceStatusEvent()}initCommunicationLayer({communicationLayerPreference:e,otherPublicKey:n,reconnect:r,ecies:i,communicationServerUrl:o=Dw}){return function({communicationLayerPreference:e,otherPublicKey:n,reconnect:r,ecies:i,communicationServerUrl:o=Dw,instance:a}){var s,u,l,c,d;const{state:f}=a;if(e!==t.CommunicationLayerPreference.SOCKET)throw new Error("Invalid communication protocol");f.communicationLayer=new eA({communicationLayerPreference:e,otherPublicKey:n,reconnect:r,transports:f.transports,communicationServerUrl:o,context:f.context,ecies:i,logging:f.logging});let h="undefined"!=typeof document&&document.URL||"",p="undefined"!=typeof document&&document.title||"";(null===(s=f.dappMetadata)||void 0===s?void 0:s.url)&&(h=f.dappMetadata.url),(null===(u=f.dappMetadata)||void 0===u?void 0:u.name)&&(p=f.dappMetadata.name);const m={url:h,title:p,source:null===(l=f.dappMetadata)||void 0===l?void 0:l.source,icon:(null===(c=f.dappMetadata)||void 0===c?void 0:c.iconUrl)||(null===(d=f.dappMetadata)||void 0===d?void 0:d.base64Icon),platform:f.platformType,apiVersion:Nw};f.originatorInfo=m;const g={[t.EventType.AUTHORIZED]:tA(a),[t.EventType.MESSAGE]:sA(a),[t.EventType.CLIENTS_CONNECTED]:rA(a,e),[t.EventType.KEYS_EXCHANGED]:aA(a,e),[t.EventType.SOCKET_DISCONNECTED]:lA(a),[t.EventType.SOCKET_RECONNECT]:uA(a),[t.EventType.CLIENTS_DISCONNECTED]:iA(a,e),[t.EventType.KEY_INFO]:()=>{a.emitServiceStatusEvent()},[t.EventType.CHANNEL_CREATED]:nA(a),[t.EventType.CLIENTS_WAITING]:oA(a),[t.EventType.RPC_UPDATE]:e=>{a.emit(t.EventType.RPC_UPDATE,e)}};for(const[e,t]of Object.entries(g))try{f.communicationLayer.on(e,t)}catch(n){console.error(`Error registering handler for ${e}:`,n)}}({communicationLayerPreference:e,otherPublicKey:n,reconnect:r,ecies:i,communicationServerUrl:o,instance:this})}originatorSessionConnect(){return dn(this,void 0,void 0,(function*(){const e=yield function(e){var t,n,r;return dn(this,void 0,void 0,(function*(){const{state:i}=e;if(!i.storageManager)return void(i.debug&&console.debug("RemoteCommunication::connect() no storage manager defined - skip"));const o=yield i.storageManager.getPersistedChannelConfig(null!==(t=i.channelId)&&void 0!==t?t:"");if(i.debug&&console.debug(`RemoteCommunication::connect() autoStarted=${i.originatorConnectStarted} channelConfig`,o),null===(n=i.communicationLayer)||void 0===n?void 0:n.isConnected())return i.debug&&console.debug("RemoteCommunication::connect() socket already connected - skip"),o;if(o){if(o.validUntil>Date.now())return i.channelConfig=o,i.originatorConnectStarted=!0,i.channelId=null==o?void 0:o.channelId,i.reconnection=!0,null===(r=i.communicationLayer)||void 0===r||r.connectToChannel({channelId:o.channelId,isOriginator:!0}),o;i.debug&&console.log("RemoteCommunication::autoConnect Session has expired")}i.originatorConnectStarted=!1}))}(this);return e}))}generateChannelIdConnect(){return dn(this,void 0,void 0,(function*(){return function(e){var t,n,r,i,o;if(!e.communicationLayer)throw new Error("communication layer not initialized");if(e.ready)throw new Error("Channel already connected");if(e.channelId&&(null===(t=e.communicationLayer)||void 0===t?void 0:t.isConnected()))return console.warn("Channel already exists -- interrupt generateChannelId",e.channelConfig),e.channelConfig={channelId:e.channelId,validUntil:Date.now()+e.sessionDuration},null===(n=e.storageManager)||void 0===n||n.persistChannelConfig(e.channelConfig),{channelId:e.channelId,pubKey:null===(i=null===(r=e.communicationLayer)||void 0===r?void 0:r.getKeyInfo())||void 0===i?void 0:i.ecies.public};e.debug&&console.debug("RemoteCommunication::generateChannelId()"),zw(e);const a=e.communicationLayer.createChannel();e.debug&&console.debug("RemoteCommunication::generateChannelId() channel created",a);const s={channelId:a.channelId,validUntil:Date.now()+e.sessionDuration};return e.channelId=a.channelId,e.channelConfig=s,null===(o=e.storageManager)||void 0===o||o.persistChannelConfig(s),{channelId:e.channelId,pubKey:a.pubKey}}(this.state)}))}clean(){return zw(this.state)}connectToChannel(e,t){return function({channelId:e,withKeyExchange:t,state:n}){var r,i,o;if(!U(e))throw console.debug(`RemoteCommunication::${n.context}::connectToChannel() invalid channel channelId=${e}`),new Error(`Invalid channel ${e}`);if(n.debug&&console.debug(`RemoteCommunication::${n.context}::connectToChannel() channelId=${e}`),null===(r=n.communicationLayer)||void 0===r?void 0:r.isConnected())return void console.debug(`RemoteCommunication::${n.context}::connectToChannel() already connected - interrup connection.`);n.channelId=e,null===(i=n.communicationLayer)||void 0===i||i.connectToChannel({channelId:e,withKeyExchange:t});const a={channelId:e,validUntil:Date.now()+n.sessionDuration};n.channelConfig=a,null===(o=n.storageManager)||void 0===o||o.persistChannelConfig(a)}({channelId:e,withKeyExchange:t,state:this.state})}sendMessage(e){return function(e,n){var r,i;return dn(this,void 0,void 0,(function*(){const{state:o}=e;o.debug&&console.log(`RemoteCommunication::${o.context}::sendMessage paused=${o.paused} ready=${o.ready} authorized=${o.authorized} socket=${null===(r=o.communicationLayer)||void 0===r?void 0:r.isConnected()} clientsConnected=${o.clientsConnected} status=${o._connectionStatus}`,n),!o.paused&&o.ready&&(null===(i=o.communicationLayer)||void 0===i?void 0:i.isConnected())&&o.clientsConnected||(o.debug&&console.log(`RemoteCommunication::${o.context}::sendMessage SKIP message waiting for MM mobile readiness.`),yield new Promise((n=>{e.once(t.EventType.CLIENTS_READY,n)})),o.debug&&console.log(`RemoteCommunication::${o.context}::sendMessage AFTER SKIP / READY -- sending pending message`));try{yield function(e,n){return dn(this,void 0,void 0,(function*(){return new Promise((r=>{var i,o,a,s;const{state:u}=e;if(u.debug&&console.log(`RemoteCommunication::${u.context}::sendMessage::handleAuthorization ready=${u.ready} authorized=${u.authorized} method=${n.method}`),1==="7.3".localeCompare((null===(i=u.walletInfo)||void 0===i?void 0:i.version)||""))return u.debug&&console.debug(`compatibility hack wallet version > ${null===(o=u.walletInfo)||void 0===o?void 0:o.version}`),null===(a=u.communicationLayer)||void 0===a||a.sendMessage(n),void r();!u.isOriginator||u.authorized?(null===(s=u.communicationLayer)||void 0===s||s.sendMessage(n),r()):e.once(t.EventType.AUTHORIZED,(()=>{var e;u.debug&&console.log(`RemoteCommunication::${u.context}::sendMessage AFTER SKIP / AUTHORIZED -- sending pending message`),null===(e=u.communicationLayer)||void 0===e||e.sendMessage(n),r()}))}))}))}(e,n)}catch(e){throw console.error(`RemoteCommunication::${o.context}::sendMessage ERROR`,e),e}}))}(this,e)}testStorage(){return dn(this,void 0,void 0,(function*(){return function(e){var t,n;return dn(this,void 0,void 0,(function*(){const r=yield null===(t=e.storageManager)||void 0===t?void 0:t.getPersistedChannelConfig(null!==(n=e.channelId)&&void 0!==n?n:"");console.debug("RemoteCommunication.testStorage() res",r)}))}(this.state)}))}getChannelConfig(){return this.state.channelConfig}isReady(){return this.state.ready}isConnected(){var e;return null===(e=this.state.communicationLayer)||void 0===e?void 0:e.isConnected()}isAuthorized(){return this.state.authorized}isPaused(){return this.state.paused}getCommunicationLayer(){return this.state.communicationLayer}ping(){var e;this.state.debug&&console.debug(`RemoteCommunication::ping() channel=${this.state.channelId}`),null===(e=this.state.communicationLayer)||void 0===e||e.ping()}keyCheck(){var e;this.state.debug&&console.debug(`RemoteCommunication::keyCheck() channel=${this.state.channelId}`),null===(e=this.state.communicationLayer)||void 0===e||e.keyCheck()}setConnectionStatus(e){this.state._connectionStatus!==e&&(this.state._connectionStatus=e,this.emit(t.EventType.CONNECTION_STATUS,e),this.emitServiceStatusEvent())}emitServiceStatusEvent(){this.emit(t.EventType.SERVICE_STATUS,this.getServiceStatus())}getConnectionStatus(){return this.state._connectionStatus}getServiceStatus(){return{originatorInfo:this.state.originatorInfo,keyInfo:this.getKeyInfo(),connectionStatus:this.state._connectionStatus,channelConfig:this.state.channelConfig,channelId:this.state.channelId}}getKeyInfo(){var e;return null===(e=this.state.communicationLayer)||void 0===e?void 0:e.getKeyInfo()}resetKeys(){var e;null===(e=this.state.communicationLayer)||void 0===e||e.resetKeys()}setOtherPublicKey(e){var t;const n=null===(t=this.state.communicationLayer)||void 0===t?void 0:t.getKeyExchange();if(!n)throw new Error("KeyExchange is not initialized.");n.getOtherPublicKey()!==e&&n.setOtherPublicKey(e)}pause(){var e;this.state.debug&&console.debug(`RemoteCommunication::pause() channel=${this.state.channelId}`),null===(e=this.state.communicationLayer)||void 0===e||e.pause(),this.setConnectionStatus(t.ConnectionStatus.PAUSED)}getVersion(){return Nw}resume(){return function(e){var n;const{state:r}=e;r.debug&&console.debug(`RemoteCommunication::resume() channel=${r.channelId}`),null===(n=r.communicationLayer)||void 0===n||n.resume(),e.setConnectionStatus(t.ConnectionStatus.LINKED)}(this)}getChannelId(){return this.state.channelId}getRPCMethodTracker(){var e;return null===(e=this.state.communicationLayer)||void 0===e?void 0:e.getRPCMethodTracker()}disconnect(e){return cA({options:e,instance:this})}}function fA(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(a,s)}u((r=r.apply(e,t||[])).next())}))}function hA(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}function pA(e,t,n,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(e,n):i?i.value=n:t.set(e,n),n}!function(e){e.RENEW="renew",e.LINK="link"}(Xw||(Xw={})),"function"==typeof SuppressedError&&SuppressedError;var mA={},gA={},vA={};function yA(){}function bA(){bA.init.call(this)}function wA(e){return void 0===e._maxListeners?bA.defaultMaxListeners:e._maxListeners}function AA(e,t,n,r){var i,o,a;if("function"!=typeof n)throw new TypeError('"listener" argument must be a function');if((o=e._events)?(o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),a=o[t]):(o=e._events=new yA,e._eventsCount=0),a){if("function"==typeof a?a=o[t]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),!a.warned&&(i=wA(e))&&i>0&&a.length>i){a.warned=!0;var s=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");s.name="MaxListenersExceededWarning",s.emitter=e,s.type=t,s.count=a.length,function(e){"function"==typeof console.warn?console.warn(e):console.log(e)}(s)}}else a=o[t]=n,++e._eventsCount;return e}function _A(e,t,n){var r=!1;function i(){e.removeListener(t,i),r||(r=!0,n.apply(e,arguments))}return i.listener=n,i}function EA(e){var t=this._events;if(t){var n=t[e];if("function"==typeof n)return 1;if(n)return n.length}return 0}function SA(e,t){for(var n=new Array(t);t--;)n[t]=e[t];return n}yA.prototype=Object.create(null),bA.EventEmitter=bA,bA.usingDomains=!1,bA.prototype.domain=void 0,bA.prototype._events=void 0,bA.prototype._maxListeners=void 0,bA.defaultMaxListeners=10,bA.init=function(){this.domain=null,bA.usingDomains&&(void 0).active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new yA,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},bA.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},bA.prototype.getMaxListeners=function(){return wA(this)},bA.prototype.emit=function(e){var t,n,r,i,o,a,s,u="error"===e;if(a=this._events)u=u&&null==a.error;else if(!u)return!1;if(s=this.domain,u){if(t=arguments[1],!s){if(t instanceof Error)throw t;var l=new Error('Uncaught, unspecified "error" event. ('+t+")");throw l.context=t,l}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=s,t.domainThrown=!1,s.emit("error",t),!1}if(!(n=a[e]))return!1;var c="function"==typeof n;switch(r=arguments.length){case 1:!function(e,t,n){if(t)e.call(n);else for(var r=e.length,i=SA(e,r),o=0;o<r;++o)i[o].call(n)}(n,c,this);break;case 2:!function(e,t,n,r){if(t)e.call(n,r);else for(var i=e.length,o=SA(e,i),a=0;a<i;++a)o[a].call(n,r)}(n,c,this,arguments[1]);break;case 3:!function(e,t,n,r,i){if(t)e.call(n,r,i);else for(var o=e.length,a=SA(e,o),s=0;s<o;++s)a[s].call(n,r,i)}(n,c,this,arguments[1],arguments[2]);break;case 4:!function(e,t,n,r,i,o){if(t)e.call(n,r,i,o);else for(var a=e.length,s=SA(e,a),u=0;u<a;++u)s[u].call(n,r,i,o)}(n,c,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(r-1),o=1;o<r;o++)i[o-1]=arguments[o];!function(e,t,n,r){if(t)e.apply(n,r);else for(var i=e.length,o=SA(e,i),a=0;a<i;++a)o[a].apply(n,r)}(n,c,this,i)}return!0},bA.prototype.addListener=function(e,t){return AA(this,e,t,!1)},bA.prototype.on=bA.prototype.addListener,bA.prototype.prependListener=function(e,t){return AA(this,e,t,!0)},bA.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,_A(this,e,t)),this},bA.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,_A(this,e,t)),this},bA.prototype.removeListener=function(e,t){var n,r,i,o,a;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(r=this._events))return this;if(!(n=r[e]))return this;if(n===t||n.listener&&n.listener===t)0==--this._eventsCount?this._events=new yA:(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,o=n.length;o-- >0;)if(n[o]===t||n[o].listener&&n[o].listener===t){a=n[o].listener,i=o;break}if(i<0)return this;if(1===n.length){if(n[0]=void 0,0==--this._eventsCount)return this._events=new yA,this;delete r[e]}else!function(e,t){for(var n=t,r=n+1,i=e.length;r<i;n+=1,r+=1)e[n]=e[r];e.pop()}(n,i);r.removeListener&&this.emit("removeListener",e,a||t)}return this},bA.prototype.removeAllListeners=function(e){var t,n;if(!(n=this._events))return this;if(!n.removeListener)return 0===arguments.length?(this._events=new yA,this._eventsCount=0):n[e]&&(0==--this._eventsCount?this._events=new yA:delete n[e]),this;if(0===arguments.length){for(var r,i=Object.keys(n),o=0;o<i.length;++o)"removeListener"!==(r=i[o])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=new yA,this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(t)do{this.removeListener(e,t[t.length-1])}while(t[0]);return this},bA.prototype.listeners=function(e){var t,n,r=this._events;return n=r&&(t=r[e])?"function"==typeof t?[t.listener||t]:function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(t):[],n},bA.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):EA.call(e,t)},bA.prototype.listenerCount=EA,bA.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};var kA=o(Object.freeze({__proto__:null,EventEmitter:bA,default:bA}));Object.defineProperty(vA,"__esModule",{value:!0});const MA=kA;function CA(e,t,n){try{Reflect.apply(e,t,n)}catch(e){setTimeout((()=>{throw e}))}}let xA=class extends MA.EventEmitter{emit(e,...t){let n="error"===e;const r=this._events;if(void 0!==r)n=n&&void 0===r.error;else if(!n)return!1;if(n){let e;if(t.length>0&&([e]=t),e instanceof Error)throw e;const n=new Error("Unhandled error."+(e?` (${e.message})`:""));throw n.context=e,n}const i=r[e];if(void 0===i)return!1;if("function"==typeof i)CA(i,this,t);else{const e=i.length,n=function(e){const t=e.length,n=new Array(t);for(let r=0;r<t;r+=1)n[r]=e[r];return n}(i);for(let r=0;r<e;r+=1)CA(n[r],this,t)}return!0}};vA.default=xA;var RA={},OA={},TA=BA;BA.default=BA,BA.stable=FA,BA.stableStringify=FA;var PA="[...]",LA="[Circular]",IA=[],NA=[];function DA(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function BA(e,t,n,r){var i;void 0===r&&(r=DA()),UA(e,"",0,[],void 0,0,r);try{i=0===NA.length?JSON.stringify(e,t,n):JSON.stringify(e,WA(t),n)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==IA.length;){var o=IA.pop();4===o.length?Object.defineProperty(o[0],o[1],o[3]):o[0][o[1]]=o[2]}}return i}function jA(e,t,n,r){var i=Object.getOwnPropertyDescriptor(r,n);void 0!==i.get?i.configurable?(Object.defineProperty(r,n,{value:e}),IA.push([r,n,t,i])):NA.push([t,n,e]):(r[n]=e,IA.push([r,n,t]))}function UA(e,t,n,r,i,o,a){var s;if(o+=1,"object"==typeof e&&null!==e){for(s=0;s<r.length;s++)if(r[s]===e)return void jA(LA,e,t,i);if(void 0!==a.depthLimit&&o>a.depthLimit)return void jA(PA,e,t,i);if(void 0!==a.edgesLimit&&n+1>a.edgesLimit)return void jA(PA,e,t,i);if(r.push(e),Array.isArray(e))for(s=0;s<e.length;s++)UA(e[s],s,s,r,e,o,a);else{var u=Object.keys(e);for(s=0;s<u.length;s++){var l=u[s];UA(e[l],l,s,r,e,o,a)}}r.pop()}}function zA(e,t){return e<t?-1:e>t?1:0}function FA(e,t,n,r){void 0===r&&(r=DA());var i,o=qA(e,"",0,[],void 0,0,r)||e;try{i=0===NA.length?JSON.stringify(o,t,n):JSON.stringify(o,WA(t),n)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==IA.length;){var a=IA.pop();4===a.length?Object.defineProperty(a[0],a[1],a[3]):a[0][a[1]]=a[2]}}return i}function qA(e,t,n,r,i,o,a){var s;if(o+=1,"object"==typeof e&&null!==e){for(s=0;s<r.length;s++)if(r[s]===e)return void jA(LA,e,t,i);try{if("function"==typeof e.toJSON)return}catch(e){return}if(void 0!==a.depthLimit&&o>a.depthLimit)return void jA(PA,e,t,i);if(void 0!==a.edgesLimit&&n+1>a.edgesLimit)return void jA(PA,e,t,i);if(r.push(e),Array.isArray(e))for(s=0;s<e.length;s++)qA(e[s],s,s,r,e,o,a);else{var u={},l=Object.keys(e).sort(zA);for(s=0;s<l.length;s++){var c=l[s];qA(e[c],c,s,r,e,o,a),u[c]=e[c]}if(void 0===i)return u;IA.push([i,t,e]),i[t]=u}r.pop()}}function WA(e){return e=void 0!==e?e:function(e,t){return t},function(t,n){if(NA.length>0)for(var r=0;r<NA.length;r++){var i=NA[r];if(i[1]===t&&i[0]===n){n=i[2],NA.splice(r,1);break}}return e.call(this,t,n)}}Object.defineProperty(OA,"__esModule",{value:!0}),OA.EthereumProviderError=OA.EthereumRpcError=void 0;const VA=TA;class KA extends Error{constructor(e,t,n){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!t||"string"!=typeof t)throw new Error('"message" must be a nonempty string.');super(t),this.code=e,void 0!==n&&(this.data=n)}serialize(){const e={code:this.code,message:this.message};return void 0!==this.data&&(e.data=this.data),this.stack&&(e.stack=this.stack),e}toString(){return VA.default(this.serialize(),HA,2)}}function HA(e,t){if("[Circular]"!==t)return t}OA.EthereumRpcError=KA,OA.EthereumProviderError=class extends KA{constructor(e,t,n){if(!function(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,t,n)}};var $A={},YA={};Object.defineProperty(YA,"__esModule",{value:!0}),YA.errorValues=YA.errorCodes=void 0,YA.errorCodes={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901}},YA.errorValues={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.serializeError=e.isValidCode=e.getMessageFromCode=e.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const t=YA,n=OA,r=t.errorCodes.rpc.internal,i="Unspecified error message. This is a bug, please report it.",o={code:r,message:a(r)};function a(n,r=i){if(Number.isInteger(n)){const r=n.toString();if(c(t.errorValues,r))return t.errorValues[r].message;if(u(n))return e.JSON_RPC_SERVER_ERROR_MESSAGE}return r}function s(e){if(!Number.isInteger(e))return!1;const n=e.toString();return!!t.errorValues[n]||!!u(e)}function u(e){return e>=-32099&&e<=-32e3}function l(e){return e&&"object"==typeof e&&!Array.isArray(e)?Object.assign({},e):e}function c(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.",e.getMessageFromCode=a,e.isValidCode=s,e.serializeError=function(e,{fallbackError:t=o,shouldIncludeStack:r=!1}={}){var i,u;if(!t||!Number.isInteger(t.code)||"string"!=typeof t.message)throw new Error("Must provide fallback error with integer number code and string message.");if(e instanceof n.EthereumRpcError)return e.serialize();const d={};if(e&&"object"==typeof e&&!Array.isArray(e)&&c(e,"code")&&s(e.code)){const t=e;d.code=t.code,t.message&&"string"==typeof t.message?(d.message=t.message,c(t,"data")&&(d.data=t.data)):(d.message=a(d.code),d.data={originalError:l(e)})}else{d.code=t.code;const n=null===(i=e)||void 0===i?void 0:i.message;d.message=n&&"string"==typeof n?n:t.message,d.data={originalError:l(e)}}const f=null===(u=e)||void 0===u?void 0:u.stack;return r&&e&&f&&"string"==typeof f&&(d.stack=f),d}}($A);var GA={};Object.defineProperty(GA,"__esModule",{value:!0}),GA.ethErrors=void 0;const QA=OA,ZA=$A,XA=YA;function JA(e,t){const[n,r]=t_(t);return new QA.EthereumRpcError(e,n||ZA.getMessageFromCode(e),r)}function e_(e,t){const[n,r]=t_(t);return new QA.EthereumProviderError(e,n||ZA.getMessageFromCode(e),r)}function t_(e){if(e){if("string"==typeof e)return[e];if("object"==typeof e&&!Array.isArray(e)){const{message:t,data:n}=e;if(t&&"string"!=typeof t)throw new Error("Must specify string message.");return[t||void 0,n]}}return[]}GA.ethErrors={rpc:{parse:e=>JA(XA.errorCodes.rpc.parse,e),invalidRequest:e=>JA(XA.errorCodes.rpc.invalidRequest,e),invalidParams:e=>JA(XA.errorCodes.rpc.invalidParams,e),methodNotFound:e=>JA(XA.errorCodes.rpc.methodNotFound,e),internal:e=>JA(XA.errorCodes.rpc.internal,e),server:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return JA(t,e)},invalidInput:e=>JA(XA.errorCodes.rpc.invalidInput,e),resourceNotFound:e=>JA(XA.errorCodes.rpc.resourceNotFound,e),resourceUnavailable:e=>JA(XA.errorCodes.rpc.resourceUnavailable,e),transactionRejected:e=>JA(XA.errorCodes.rpc.transactionRejected,e),methodNotSupported:e=>JA(XA.errorCodes.rpc.methodNotSupported,e),limitExceeded:e=>JA(XA.errorCodes.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>e_(XA.errorCodes.provider.userRejectedRequest,e),unauthorized:e=>e_(XA.errorCodes.provider.unauthorized,e),unsupportedMethod:e=>e_(XA.errorCodes.provider.unsupportedMethod,e),disconnected:e=>e_(XA.errorCodes.provider.disconnected,e),chainDisconnected:e=>e_(XA.errorCodes.provider.chainDisconnected,e),custom:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:t,message:n,data:r}=e;if(!n||"string"!=typeof n)throw new Error('"message" must be a nonempty string');return new QA.EthereumProviderError(t,n,r)}}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getMessageFromCode=e.serializeError=e.EthereumProviderError=e.EthereumRpcError=e.ethErrors=e.errorCodes=void 0;const t=OA;Object.defineProperty(e,"EthereumRpcError",{enumerable:!0,get:function(){return t.EthereumRpcError}}),Object.defineProperty(e,"EthereumProviderError",{enumerable:!0,get:function(){return t.EthereumProviderError}});const n=$A;Object.defineProperty(e,"serializeError",{enumerable:!0,get:function(){return n.serializeError}}),Object.defineProperty(e,"getMessageFromCode",{enumerable:!0,get:function(){return n.getMessageFromCode}});const r=GA;Object.defineProperty(e,"ethErrors",{enumerable:!0,get:function(){return r.ethErrors}});const i=YA;Object.defineProperty(e,"errorCodes",{enumerable:!0,get:function(){return i.errorCodes}})}(RA);var n_=Array.isArray,r_=Object.keys,i_=Object.prototype.hasOwnProperty,o_={},a_={},s_={};Object.defineProperty(s_,"__esModule",{value:!0}),s_.getUniqueId=void 0;const u_=4294967295;let l_=Math.floor(Math.random()*u_);s_.getUniqueId=function(){return l_=(l_+1)%u_,l_},Object.defineProperty(a_,"__esModule",{value:!0}),a_.createIdRemapMiddleware=void 0;const c_=s_;a_.createIdRemapMiddleware=function(){return(e,t,n,r)=>{const i=e.id,o=c_.getUniqueId();e.id=o,t.id=o,n((n=>{e.id=i,t.id=i,n()}))}};var d_={};Object.defineProperty(d_,"__esModule",{value:!0}),d_.createAsyncMiddleware=void 0,d_.createAsyncMiddleware=function(e){return async(t,n,r,i)=>{let o;const a=new Promise((e=>{o=e}));let s=null,u=!1;const l=async()=>{u=!0,r((e=>{s=e,o()})),await a};try{await e(t,n,l),u?(await a,s(null)):i(null)}catch(e){s?s(e):i(e)}}};var f_={};Object.defineProperty(f_,"__esModule",{value:!0}),f_.createScaffoldMiddleware=void 0,f_.createScaffoldMiddleware=function(e){return(t,n,r,i)=>{const o=e[t.method];return void 0===o?r():"function"==typeof o?o(t,n,r,i):(n.result=o,i())}};var h_={},p_=r&&r.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(h_,"__esModule",{value:!0}),h_.JsonRpcEngine=void 0;const m_=p_(vA),g_=RA;class v_ extends m_.default{constructor(){super(),this._middleware=[]}push(e){this._middleware.push(e)}handle(e,t){if(t&&"function"!=typeof t)throw new Error('"callback" must be a function if provided.');return Array.isArray(e)?t?this._handleBatch(e,t):this._handleBatch(e):t?this._handle(e,t):this._promiseHandle(e)}asMiddleware(){return async(e,t,n,r)=>{try{const[i,o,a]=await v_._runAllMiddleware(e,t,this._middleware);return o?(await v_._runReturnHandlers(a),r(i)):n((async e=>{try{await v_._runReturnHandlers(a)}catch(t){return e(t)}return e()}))}catch(e){return r(e)}}}async _handleBatch(e,t){try{const n=await Promise.all(e.map(this._promiseHandle.bind(this)));return t?t(null,n):n}catch(e){if(t)return t(e);throw e}}_promiseHandle(e){return new Promise((t=>{this._handle(e,((e,n)=>{t(n)}))}))}async _handle(e,t){if(!e||Array.isArray(e)||"object"!=typeof e){const n=new g_.EthereumRpcError(g_.errorCodes.rpc.invalidRequest,"Requests must be plain objects. Received: "+typeof e,{request:e});return t(n,{id:void 0,jsonrpc:"2.0",error:n})}if("string"!=typeof e.method){const n=new g_.EthereumRpcError(g_.errorCodes.rpc.invalidRequest,"Must specify a string method. Received: "+typeof e.method,{request:e});return t(n,{id:e.id,jsonrpc:"2.0",error:n})}const n=Object.assign({},e),r={id:n.id,jsonrpc:n.jsonrpc};let i=null;try{await this._processRequest(n,r)}catch(e){i=e}return i&&(delete r.result,r.error||(r.error=g_.serializeError(i))),t(i,r)}async _processRequest(e,t){const[n,r,i]=await v_._runAllMiddleware(e,t,this._middleware);if(v_._checkForCompletion(e,t,r),await v_._runReturnHandlers(i),n)throw n}static async _runAllMiddleware(e,t,n){const r=[];let i=null,o=!1;for(const a of n)if([i,o]=await v_._runMiddleware(e,t,a,r),o)break;return[i,o,r.reverse()]}static _runMiddleware(e,t,n,r){return new Promise((i=>{const o=e=>{const n=e||t.error;n&&(t.error=g_.serializeError(n)),i([n,!0])},a=n=>{t.error?o(t.error):(n&&("function"!=typeof n&&o(new g_.EthereumRpcError(g_.errorCodes.rpc.internal,`JsonRpcEngine: "next" return handlers must be functions. Received "${typeof n}" for request:\n${y_(e)}`,{request:e})),r.push(n)),i([null,!1]))};try{n(e,t,a,o)}catch(e){o(e)}}))}static async _runReturnHandlers(e){for(const t of e)await new Promise(((e,n)=>{t((t=>t?n(t):e()))}))}static _checkForCompletion(e,t,n){if(!("result"in t)&&!("error"in t))throw new g_.EthereumRpcError(g_.errorCodes.rpc.internal,`JsonRpcEngine: Response has no error or result for request:\n${y_(e)}`,{request:e});if(!n)throw new g_.EthereumRpcError(g_.errorCodes.rpc.internal,`JsonRpcEngine: Nothing ended request:\n${y_(e)}`,{request:e})}}function y_(e){return JSON.stringify(e,null,2)}h_.JsonRpcEngine=v_;var b_={};Object.defineProperty(b_,"__esModule",{value:!0}),b_.mergeMiddleware=void 0;const w_=h_;b_.mergeMiddleware=function(e){const t=new w_.JsonRpcEngine;return e.forEach((e=>t.push(e))),t.asMiddleware()},function(e){var t=r&&r.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),n=r&&r.__exportStar||function(e,n){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(n,r)||t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),n(a_,e),n(d_,e),n(f_,e),n(s_,e),n(h_,e),n(b_,e)}(o_);var A_={};Object.defineProperty(A_,"__esModule",{value:!0});const __={errors:{disconnected:()=>"MetaMask: Disconnected from chain. Attempting to connect.",permanentlyDisconnected:()=>"MetaMask: Disconnected from MetaMask background. Page reload required.",sendSiteMetadata:()=>"MetaMask: Failed to send site metadata. This is an internal error, please report this bug.",unsupportedSync:e=>`MetaMask: The MetaMask Ethereum provider does not support synchronous methods like ${e} without a callback parameter.`,invalidDuplexStream:()=>"Must provide a Node.js-style duplex stream.",invalidNetworkParams:()=>"MetaMask: Received invalid network parameters. Please report this bug.",invalidRequestArgs:()=>"Expected a single, non-array, object argument.",invalidRequestMethod:()=>"'args.method' must be a non-empty string.",invalidRequestParams:()=>"'args.params' must be an object or array if provided.",invalidLoggerObject:()=>"'args.logger' must be an object if provided.",invalidLoggerMethod:e=>`'args.logger' must include required method '${e}'.`},info:{connected:e=>`MetaMask: Connected to chain with ID "${e}".`},warnings:{enableDeprecation:"MetaMask: 'ethereum.enable()' is deprecated and may be removed in the future. Please use the 'eth_requestAccounts' RPC method instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1102",sendDeprecation:"MetaMask: 'ethereum.send(...)' is deprecated and may be removed in the future. Please use 'ethereum.sendAsync(...)' or 'ethereum.request(...)' instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1193",events:{close:"MetaMask: The event 'close' is deprecated and may be removed in the future. Please use 'disconnect' instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1193#disconnect",data:"MetaMask: The event 'data' is deprecated and will be removed in the future. Use 'message' instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1193#message",networkChanged:"MetaMask: The event 'networkChanged' is deprecated and may be removed in the future. Use 'chainChanged' instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1193#chainchanged",notification:"MetaMask: The event 'notification' is deprecated and may be removed in the future. Use 'message' instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1193#message"},rpc:{ethDecryptDeprecation:"MetaMask: The RPC method 'eth_decrypt' is deprecated and may be removed in the future.\nFor more information, see: https://medium.com/metamask/metamask-api-method-deprecation-2b0564a84686",ethGetEncryptionPublicKeyDeprecation:"MetaMask: The RPC method 'eth_getEncryptionPublicKey' is deprecated and may be removed in the future.\nFor more information, see: https://medium.com/metamask/metamask-api-method-deprecation-2b0564a84686"},experimentalMethods:"MetaMask: 'ethereum._metamask' exposes non-standard, experimental methods. They may be removed or changed without warning."}};A_.default=__;var E_={},S_={},k_=r&&r.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(S_,"__esModule",{value:!0}),S_.createRpcWarningMiddleware=void 0;const M_=k_(A_);S_.createRpcWarningMiddleware=function(e){const t={ethDecryptDeprecation:!1,ethGetEncryptionPublicKeyDeprecation:!1};return(n,r,i)=>{!1===t.ethDecryptDeprecation&&"eth_decrypt"===n.method?(e.warn(M_.default.warnings.rpc.ethDecryptDeprecation),t.ethDecryptDeprecation=!0):!1===t.ethGetEncryptionPublicKeyDeprecation&&"eth_getEncryptionPublicKey"===n.method&&(e.warn(M_.default.warnings.rpc.ethGetEncryptionPublicKeyDeprecation),t.ethGetEncryptionPublicKeyDeprecation=!0),i()}},Object.defineProperty(E_,"__esModule",{value:!0}),E_.NOOP=E_.isValidNetworkVersion=E_.isValidChainId=E_.getRpcPromiseCallback=E_.getDefaultExternalMiddleware=E_.EMITTED_NOTIFICATIONS=void 0;const C_=o_,x_=RA,R_=S_;function O_(e){return(t,n,r)=>{"string"==typeof t.method&&t.method||(n.error=x_.ethErrors.rpc.invalidRequest({message:"The request 'method' must be a non-empty string.",data:t})),r((t=>{const{error:r}=n;return r?(e.error(`MetaMask - RPC Error: ${r.message}`,r),t()):t()}))}}E_.EMITTED_NOTIFICATIONS=Object.freeze(["eth_subscription"]),E_.getDefaultExternalMiddleware=(e=console)=>[C_.createIdRemapMiddleware(),O_(e),R_.createRpcWarningMiddleware(e)],E_.getRpcPromiseCallback=(e,t,n=!0)=>(r,i)=>{r||i.error?t(r||i.error):!n||Array.isArray(i)?e(i):e(i.result)},E_.isValidChainId=e=>Boolean(e)&&"string"==typeof e&&e.startsWith("0x"),E_.isValidNetworkVersion=e=>Boolean(e)&&"string"==typeof e,E_.NOOP=()=>{};var T_=r&&r.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(gA,"__esModule",{value:!0}),gA.BaseProvider=void 0;const P_=T_(vA),L_=RA,I_=T_((function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){var r,i,o,a=n_(t),s=n_(n);if(a&&s){if((i=t.length)!=n.length)return!1;for(r=i;0!=r--;)if(!e(t[r],n[r]))return!1;return!0}if(a!=s)return!1;var u=t instanceof Date,l=n instanceof Date;if(u!=l)return!1;if(u&&l)return t.getTime()==n.getTime();var c=t instanceof RegExp,d=n instanceof RegExp;if(c!=d)return!1;if(c&&d)return t.toString()==n.toString();var f=r_(t);if((i=f.length)!==r_(n).length)return!1;for(r=i;0!=r--;)if(!i_.call(n,f[r]))return!1;for(r=i;0!=r--;)if(!e(t[o=f[r]],n[o]))return!1;return!0}return t!=t&&n!=n})),N_=o_,D_=T_(A_),B_=E_;class j_ extends P_.default{constructor({logger:e=console,maxEventListeners:t=100,rpcMiddleware:n=[]}={}){super(),this._log=e,this.setMaxListeners(t),this._state=Object.assign({},j_._defaultState),this.selectedAddress=null,this.chainId=null,this._handleAccountsChanged=this._handleAccountsChanged.bind(this),this._handleConnect=this._handleConnect.bind(this),this._handleChainChanged=this._handleChainChanged.bind(this),this._handleDisconnect=this._handleDisconnect.bind(this),this._handleUnlockStateChanged=this._handleUnlockStateChanged.bind(this),this._rpcRequest=this._rpcRequest.bind(this),this.request=this.request.bind(this);const r=new N_.JsonRpcEngine;n.forEach((e=>r.push(e))),this._rpcEngine=r}isConnected(){return this._state.isConnected}async request(e){if(!e||"object"!=typeof e||Array.isArray(e))throw L_.ethErrors.rpc.invalidRequest({message:D_.default.errors.invalidRequestArgs(),data:e});const{method:t,params:n}=e;if("string"!=typeof t||0===t.length)throw L_.ethErrors.rpc.invalidRequest({message:D_.default.errors.invalidRequestMethod(),data:e});if(void 0!==n&&!Array.isArray(n)&&("object"!=typeof n||null===n))throw L_.ethErrors.rpc.invalidRequest({message:D_.default.errors.invalidRequestParams(),data:e});return new Promise(((e,r)=>{this._rpcRequest({method:t,params:n},B_.getRpcPromiseCallback(e,r))}))}_initializeState(e){if(!0===this._state.initialized)throw new Error("Provider already initialized.");if(e){const{accounts:t,chainId:n,isUnlocked:r,networkVersion:i}=e;this._handleConnect(n),this._handleChainChanged({chainId:n,networkVersion:i}),this._handleUnlockStateChanged({accounts:t,isUnlocked:r}),this._handleAccountsChanged(t)}this._state.initialized=!0,this.emit("_initialized")}_rpcRequest(e,t){let n=t;return Array.isArray(e)||(e.jsonrpc||(e.jsonrpc="2.0"),"eth_accounts"!==e.method&&"eth_requestAccounts"!==e.method||(n=(n,r)=>{this._handleAccountsChanged(r.result||[],"eth_accounts"===e.method),t(n,r)})),this._rpcEngine.handle(e,n)}_handleConnect(e){this._state.isConnected||(this._state.isConnected=!0,this.emit("connect",{chainId:e}),this._log.debug(D_.default.info.connected(e)))}_handleDisconnect(e,t){if(this._state.isConnected||!this._state.isPermanentlyDisconnected&&!e){let n;this._state.isConnected=!1,e?(n=new L_.EthereumRpcError(1013,t||D_.default.errors.disconnected()),this._log.debug(n)):(n=new L_.EthereumRpcError(1011,t||D_.default.errors.permanentlyDisconnected()),this._log.error(n),this.chainId=null,this._state.accounts=null,this.selectedAddress=null,this._state.isUnlocked=!1,this._state.isPermanentlyDisconnected=!0),this.emit("disconnect",n)}}_handleChainChanged({chainId:e}={}){B_.isValidChainId(e)?(this._handleConnect(e),e!==this.chainId&&(this.chainId=e,this._state.initialized&&this.emit("chainChanged",this.chainId))):this._log.error(D_.default.errors.invalidNetworkParams(),{chainId:e})}_handleAccountsChanged(e,t=!1){let n=e;Array.isArray(e)||(this._log.error("MetaMask: Received invalid accounts parameter. Please report this bug.",e),n=[]);for(const t of e)if("string"!=typeof t){this._log.error("MetaMask: Received non-string account. Please report this bug.",e),n=[];break}I_.default(this._state.accounts,n)||(t&&null!==this._state.accounts&&this._log.error("MetaMask: 'eth_accounts' unexpectedly updated accounts. Please report this bug.",n),this._state.accounts=n,this.selectedAddress!==n[0]&&(this.selectedAddress=n[0]||null),this._state.initialized&&this.emit("accountsChanged",n))}_handleUnlockStateChanged({accounts:e,isUnlocked:t}={}){"boolean"==typeof t?t!==this._state.isUnlocked&&(this._state.isUnlocked=t,this._handleAccountsChanged(e||[])):this._log.error("MetaMask: Received invalid isUnlocked parameter. Please report this bug.")}}gA.BaseProvider=j_,j_._defaultState={accounts:null,isConnected:!1,isUnlocked:!1,initialized:!1,isPermanentlyDisconnected:!1};var U_={},z_={},F_="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e},q_=/%[sdj%]/g;function W_(e){if(!oE(e)){for(var t=[],n=0;n<arguments.length;n++)t.push(Y_(arguments[n]));return t.join(" ")}n=1;for(var r=arguments,i=r.length,o=String(e).replace(q_,(function(e){if("%%"===e)return"%";if(n>=i)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}})),a=r[n];n<i;a=r[++n])nE(a)||!lE(a)?o+=" "+a:o+=" "+Y_(a);return o}function V_(e,t){if(sE(n.process))return function(){return V_(e,t).apply(this,arguments)};if(!0===P.noDeprecation)return e;var r=!1;return function(){if(!r){if(P.throwDeprecation)throw new Error(t);P.traceDeprecation?console.trace(t):console.error(t),r=!0}return e.apply(this,arguments)}}var K_,H_={};function $_(e){return sE(K_)&&(K_=P.env.NODE_DEBUG||""),e=e.toUpperCase(),H_[e]||(new RegExp("\\b"+e+"\\b","i").test(K_)?H_[e]=function(){var t=W_.apply(null,arguments);console.error("%s %d: %s",e,0,t)}:H_[e]=function(){}),H_[e]}function Y_(e,t){var n={seen:[],stylize:Q_};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),tE(t)?n.showHidden=t:t&&bE(n,t),sE(n.showHidden)&&(n.showHidden=!1),sE(n.depth)&&(n.depth=2),sE(n.colors)&&(n.colors=!1),sE(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=G_),Z_(n,e,n.depth)}function G_(e,t){var n=Y_.styles[t];return n?"["+Y_.colors[n][0]+"m"+e+"["+Y_.colors[n][1]+"m":e}function Q_(e,t){return e}function Z_(e,t,n){if(e.customInspect&&t&&fE(t.inspect)&&t.inspect!==Y_&&(!t.constructor||t.constructor.prototype!==t)){var r=t.inspect(n,e);return oE(r)||(r=Z_(e,r,n)),r}var i=function(e,t){if(sE(t))return e.stylize("undefined","undefined");if(oE(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return iE(t)?e.stylize(""+t,"number"):tE(t)?e.stylize(""+t,"boolean"):nE(t)?e.stylize("null","null"):void 0}(e,t);if(i)return i;var o=Object.keys(t),a=function(e){var t={};return e.forEach((function(e,n){t[e]=!0})),t}(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(t)),dE(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return X_(t);if(0===o.length){if(fE(t)){var s=t.name?": "+t.name:"";return e.stylize("[Function"+s+"]","special")}if(uE(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(cE(t))return e.stylize(Date.prototype.toString.call(t),"date");if(dE(t))return X_(t)}var u,l="",c=!1,d=["{","}"];return eE(t)&&(c=!0,d=["[","]"]),fE(t)&&(l=" [Function"+(t.name?": "+t.name:"")+"]"),uE(t)&&(l=" "+RegExp.prototype.toString.call(t)),cE(t)&&(l=" "+Date.prototype.toUTCString.call(t)),dE(t)&&(l=" "+X_(t)),0!==o.length||c&&0!=t.length?n<0?uE(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),u=c?function(e,t,n,r,i){for(var o=[],a=0,s=t.length;a<s;++a)wE(t,String(a))?o.push(J_(e,t,n,r,String(a),!0)):o.push("");return i.forEach((function(i){i.match(/^\d+$/)||o.push(J_(e,t,n,r,i,!0))})),o}(e,t,n,a,o):o.map((function(r){return J_(e,t,n,a,r,c)})),e.seen.pop(),function(e,t,n){var r=e.reduce((function(e,t){return t.indexOf("\n"),e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0);return r>60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}(u,l,d)):d[0]+l+d[1]}function X_(e){return"["+Error.prototype.toString.call(e)+"]"}function J_(e,t,n,r,i,o){var a,s,u;if((u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?s=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(s=e.stylize("[Setter]","special")),wE(r,i)||(a="["+i+"]"),s||(e.seen.indexOf(u.value)<0?(s=nE(n)?Z_(e,u.value,null):Z_(e,u.value,n-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+s.split("\n").map((function(e){return" "+e})).join("\n")):s=e.stylize("[Circular]","special")),sE(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function eE(e){return Array.isArray(e)}function tE(e){return"boolean"==typeof e}function nE(e){return null===e}function rE(e){return null==e}function iE(e){return"number"==typeof e}function oE(e){return"string"==typeof e}function aE(e){return"symbol"==typeof e}function sE(e){return void 0===e}function uE(e){return lE(e)&&"[object RegExp]"===mE(e)}function lE(e){return"object"==typeof e&&null!==e}function cE(e){return lE(e)&&"[object Date]"===mE(e)}function dE(e){return lE(e)&&("[object Error]"===mE(e)||e instanceof Error)}function fE(e){return"function"==typeof e}function hE(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function pE(e){return xt(e)}function mE(e){return Object.prototype.toString.call(e)}function gE(e){return e<10?"0"+e.toString(10):e.toString(10)}Y_.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},Y_.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};var vE=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function yE(){console.log("%s - %s",function(){var e=new Date,t=[gE(e.getHours()),gE(e.getMinutes()),gE(e.getSeconds())].join(":");return[e.getDate(),vE[e.getMonth()],t].join(" ")}(),W_.apply(null,arguments))}function bE(e,t){if(!t||!lE(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}function wE(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var AE={inherits:F_,_extend:bE,log:yE,isBuffer:pE,isPrimitive:hE,isFunction:fE,isError:dE,isDate:cE,isObject:lE,isRegExp:uE,isUndefined:sE,isSymbol:aE,isString:oE,isNumber:iE,isNullOrUndefined:rE,isNull:nE,isBoolean:tE,isArray:eE,inspect:Y_,deprecate:V_,format:W_,debuglog:$_},_E=Object.freeze({__proto__:null,_extend:bE,debuglog:$_,default:AE,deprecate:V_,format:W_,inherits:F_,inspect:Y_,isArray:eE,isBoolean:tE,isBuffer:pE,isDate:cE,isError:dE,isFunction:fE,isNull:nE,isNullOrUndefined:rE,isNumber:iE,isObject:lE,isPrimitive:hE,isRegExp:uE,isString:oE,isSymbol:aE,isUndefined:sE,log:yE});function EE(){this.head=null,this.tail=null,this.length=0}EE.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},EE.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},EE.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},EE.prototype.clear=function(){this.head=this.tail=null,this.length=0},EE.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},EE.prototype.concat=function(e){if(0===this.length)return Ke.alloc(0);if(1===this.length)return this.head.data;for(var t=Ke.allocUnsafe(e>>>0),n=this.head,r=0;n;)n.data.copy(t,r),r+=n.data.length,n=n.next;return t};var SE=Ke.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function kE(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),function(e){if(e&&!SE(e))throw new Error("Unknown encoding: "+e)}(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=CE;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=xE;break;default:return void(this.write=ME)}this.charBuffer=new Ke(6),this.charReceived=0,this.charLength=0}function ME(e){return e.toString(this.encoding)}function CE(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function xE(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}kE.prototype.write=function(e){for(var t="";this.charLength;){var n=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived<this.charLength)return"";if(e=e.slice(n,e.length),!((r=(t=this.charBuffer.slice(0,this.charLength).toString(this.encoding)).charCodeAt(t.length-1))>=55296&&r<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var r,i=e.length;if(this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,i),i-=this.charReceived),i=(t+=e.toString(this.encoding,0,i)).length-1,(r=t.charCodeAt(i))>=55296&&r<=56319){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),e.copy(this.charBuffer,0,0,o),t.substring(0,i)}return t},kE.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var n=e[e.length-t];if(1==t&&n>>5==6){this.charLength=2;break}if(t<=2&&n>>4==14){this.charLength=3;break}if(t<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=t},kE.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;t+=r.slice(0,n).toString(i)}return t},TE.ReadableState=OE;var RE=$_("stream");function OE(e,t){e=e||{},this.objectMode=!!e.objectMode,t instanceof oS&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var n=e.highWaterMark,r=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:r,this.highWaterMark=~~this.highWaterMark,this.buffer=new EE,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(this.decoder=new kE(e.encoding),this.encoding=e.encoding)}function TE(e){if(!(this instanceof TE))return new TE(e);this._readableState=new OE(e,this),this.readable=!0,e&&"function"==typeof e.read&&(this._read=e.read),bA.call(this)}function PE(e,t,n,r,i){var o=function(e,t){var n=null;return xt(t)||"string"==typeof t||null==t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}(t,n);if(o)e.emit("error",o);else if(null===n)t.reading=!1,function(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,NE(e)}}(e,t);else if(t.objectMode||n&&n.length>0)if(t.ended&&!i){var a=new Error("stream.push() after EOF");e.emit("error",a)}else if(t.endEmitted&&i){var s=new Error("stream.unshift() after end event");e.emit("error",s)}else{var u;!t.decoder||i||r||(n=t.decoder.write(n),u=!t.objectMode&&0===n.length),i||(t.reading=!1),u||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&NE(e))),function(e,t){t.readingMore||(t.readingMore=!0,b(BE,e,t))}(e,t)}else i||(t.reading=!1);return function(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}(t)}F_(TE,bA),TE.prototype.push=function(e,t){var n=this._readableState;return n.objectMode||"string"!=typeof e||(t=t||n.defaultEncoding)!==n.encoding&&(e=Ke.from(e,t),t=""),PE(this,n,e,t,!1)},TE.prototype.unshift=function(e){return PE(this,this._readableState,e,"",!0)},TE.prototype.isPaused=function(){return!1===this._readableState.flowing},TE.prototype.setEncoding=function(e){return this._readableState.decoder=new kE(e),this._readableState.encoding=e,this};var LE=8388608;function IE(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>=LE?e=LE:(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 NE(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(RE("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?b(DE,e):DE(e))}function DE(e){RE("emit readable"),e.emit("readable"),zE(e)}function BE(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(RE("maybeReadMore read 0"),e.read(0),n!==t.length);)n=t.length;t.readingMore=!1}function jE(e){RE("readable nexttick read 0"),e.read(0)}function UE(e,t){t.reading||(RE("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),zE(e),t.flowing&&!t.reading&&e.read(0)}function zE(e){var t=e._readableState;for(RE("flow",t.flowing);t.flowing&&null!==e.read(););}function FE(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=function(e,t,n){var r;return e<t.head.data.length?(r=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):r=e===t.head.data.length?t.shift():n?function(e,t){var n=t.head,r=1,i=n.data;for(e-=i.length;n=n.next;){var o=n.data,a=e>o.length?o.length:e;if(a===o.length?i+=o:i+=o.slice(0,e),0==(e-=a)){a===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(a));break}++r}return t.length-=r,i}(e,t):function(e,t){var n=Ke.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,a=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,a),0==(e-=a)){a===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(a));break}++i}return t.length-=i,n}(e,t),r}(e,t.buffer,t.decoder),n);var n}function qE(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,b(WE,t,e))}function WE(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function VE(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}function KE(){}function HE(e,t,n){this.chunk=e,this.encoding=t,this.callback=n,this.next=null}function $E(e,t){Object.defineProperty(this,"buffer",{get:V_((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")}),e=e||{},this.objectMode=!!e.objectMode,t instanceof oS&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var n=e.highWaterMark,r=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:r,this.highWaterMark=~~this.highWaterMark,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var i=!1===e.decodeStrings;this.decodeStrings=!i,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,i=n.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,i){--t.pendingcb,n?b(i,r):i(r),e._writableState.errorEmitted=!0,e.emit("error",r)}(e,n,r,t,i);else{var o=XE(n);o||n.corked||n.bufferProcessing||!n.bufferedRequest||ZE(e,n),r?b(QE,e,n,o,i):QE(e,n,o,i)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new tS(this)}function YE(e){if(!(this instanceof YE||this instanceof oS))return new YE(e);this._writableState=new $E(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev)),bA.call(this)}function GE(e,t,n,r,i,o,a){t.writelen=r,t.writecb=a,t.writing=!0,t.sync=!0,n?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function QE(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),eS(e,t)}function ZE(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,i=new Array(r),o=t.corkedRequestsFree;o.entry=n;for(var a=0;n;)i[a]=n,n=n.next,a+=1;GE(e,t,!0,t.length,i,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new tS(t)}else{for(;n;){var s=n.chunk,u=n.encoding,l=n.callback;if(GE(e,t,!1,t.objectMode?1:s.length,s,u,l),n=n.next,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequestCount=0,t.bufferedRequest=n,t.bufferProcessing=!1}function XE(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function JE(e,t){t.prefinished||(t.prefinished=!0,e.emit("prefinish"))}function eS(e,t){var n=XE(t);return n&&(0===t.pendingcb?(JE(e,t),t.finished=!0,e.emit("finish")):JE(e,t)),n}function tS(e){var t=this;this.next=null,this.entry=null,this.finish=function(n){var r=t.entry;for(t.entry=null;r;){var i=r.callback;e.pendingcb--,i(n),r=r.next}e.corkedRequestsFree?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}}TE.prototype.read=function(e){RE("read",e),e=parseInt(e,10);var t=this._readableState,n=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return RE("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?qE(this):NE(this),null;if(0===(e=IE(e,t))&&t.ended)return 0===t.length&&qE(this),null;var r,i=t.needReadable;return RE("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&RE("length less than watermark",i=!0),t.ended||t.reading?RE("reading or ended",i=!1):i&&(RE("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=IE(n,t))),null===(r=e>0?FE(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&qE(this)),null!==r&&this.emit("data",r),r},TE.prototype._read=function(e){this.emit("error",new Error("not implemented"))},TE.prototype.pipe=function(e,t){var n=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=e;break;case 1:r.pipes=[r.pipes,e];break;default:r.pipes.push(e)}r.pipesCount+=1,RE("pipe count=%d opts=%j",r.pipesCount,t);var i=t&&!1===t.end?l:a;function o(e){RE("onunpipe"),e===n&&l()}function a(){RE("onend"),e.end()}r.endEmitted?b(i):n.once("end",i),e.on("unpipe",o);var s=function(e){return function(){var t=e._readableState;RE("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&e.listeners("data").length&&(t.flowing=!0,zE(e))}}(n);e.on("drain",s);var u=!1;function l(){RE("cleanup"),e.removeListener("close",h),e.removeListener("finish",p),e.removeListener("drain",s),e.removeListener("error",f),e.removeListener("unpipe",o),n.removeListener("end",a),n.removeListener("end",l),n.removeListener("data",d),u=!0,!r.awaitDrain||e._writableState&&!e._writableState.needDrain||s()}var c=!1;function d(t){RE("ondata"),c=!1,!1!==e.write(t)||c||((1===r.pipesCount&&r.pipes===e||r.pipesCount>1&&-1!==VE(r.pipes,e))&&!u&&(RE("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,c=!0),n.pause())}function f(t){var n;RE("onerror",t),m(),e.removeListener("error",f),0===(n="error",e.listeners(n).length)&&e.emit("error",t)}function h(){e.removeListener("finish",p),m()}function p(){RE("onfinish"),e.removeListener("close",h),m()}function m(){RE("unpipe"),n.unpipe(e)}return n.on("data",d),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",f),e.once("close",h),e.once("finish",p),e.emit("pipe",n),r.flowing||(RE("pipe resume"),n.resume()),e},TE.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this)),this;if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i<r;i++)n[i].emit("unpipe",this);return this}var o=VE(t.pipes,e);return-1===o||(t.pipes.splice(o,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this)),this},TE.prototype.on=function(e,t){var n=bA.prototype.on.call(this,e,t);if("data"===e)!1!==this._readableState.flowing&&this.resume();else if("readable"===e){var r=this._readableState;r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.emittedReadable=!1,r.reading?r.length&&NE(this):b(jE,this))}return n},TE.prototype.addListener=TE.prototype.on,TE.prototype.resume=function(){var e=this._readableState;return e.flowing||(RE("resume"),e.flowing=!0,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,b(UE,e,t))}(this,e)),this},TE.prototype.pause=function(){return RE("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(RE("pause"),this._readableState.flowing=!1,this.emit("pause")),this},TE.prototype.wrap=function(e){var t=this._readableState,n=!1,r=this;for(var i in e.on("end",(function(){if(RE("wrapped end"),t.decoder&&!t.ended){var e=t.decoder.end();e&&e.length&&r.push(e)}r.push(null)})),e.on("data",(function(i){RE("wrapped data"),t.decoder&&(i=t.decoder.write(i)),t.objectMode&&null==i||(t.objectMode||i&&i.length)&&(r.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));return function(e,t){for(var n=0,r=e.length;n<r;n++)t(e[n],n)}(["error","close","destroy","pause","resume"],(function(t){e.on(t,r.emit.bind(r,t))})),r._read=function(t){RE("wrapped _read",t),n&&(n=!1,e.resume())},r},TE._fromList=FE,YE.WritableState=$E,F_(YE,bA),$E.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},YE.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},YE.prototype.write=function(e,t,n){var r=this._writableState,i=!1;return"function"==typeof t&&(n=t,t=null),Ke.isBuffer(e)?t="buffer":t||(t=r.defaultEncoding),"function"!=typeof n&&(n=KE),r.ended?function(e,t){var n=new Error("write after end");e.emit("error",n),b(t,n)}(this,n):function(e,t,n,r){var i=!0,o=!1;return null===n?o=new TypeError("May not write null values to stream"):Ke.isBuffer(n)||"string"==typeof n||void 0===n||t.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(e.emit("error",o),b(r,o),i=!1),i}(this,r,e,n)&&(r.pendingcb++,i=function(e,t,n,r,i){n=function(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=Ke.from(t,n)),t}(t,n,r),Ke.isBuffer(n)&&(r="buffer");var o=t.objectMode?1:n.length;t.length+=o;var a=t.length<t.highWaterMark;if(a||(t.needDrain=!0),t.writing||t.corked){var s=t.lastBufferedRequest;t.lastBufferedRequest=new HE(n,r,i),s?s.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else GE(e,t,!1,o,n,r,i);return a}(this,r,e,t,n)),i},YE.prototype.cork=function(){this._writableState.corked++},YE.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||ZE(this,e))},YE.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 TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},YE.prototype._write=function(e,t,n){n(new Error("not implemented"))},YE.prototype._writev=null,YE.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(e,t,n){t.ending=!0,eS(e,t),n&&(t.finished?b(n):e.once("finish",n)),t.ended=!0,e.writable=!1}(this,r,n)},F_(oS,TE);for(var nS=Object.keys(YE.prototype),rS=0;rS<nS.length;rS++){var iS=nS[rS];oS.prototype[iS]||(oS.prototype[iS]=YE.prototype[iS])}function oS(e){if(!(this instanceof oS))return new oS(e);TE.call(this,e),YE.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",aS)}function aS(){this.allowHalfOpen||this._writableState.ended||b(sS,this)}function sS(e){e.end()}function uS(e){this.afterTransform=function(t,n){return function(e,t,n){var r=e._transformState;r.transforming=!1;var i=r.writecb;if(!i)return e.emit("error",new Error("no writecb in Transform class"));r.writechunk=null,r.writecb=null,null!=n&&e.push(n),i(t);var o=e._readableState;o.reading=!1,(o.needReadable||o.length<o.highWaterMark)&&e._read(o.highWaterMark)}(e,t,n)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null,this.writeencoding=null}function lS(e){if(!(this instanceof lS))return new lS(e);oS.call(this,e),this._transformState=new uS(this);var t=this;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.once("prefinish",(function(){"function"==typeof this._flush?this._flush((function(e){cS(t,e)})):cS(t)}))}function cS(e,t){if(t)return e.emit("error",t);var n=e._writableState,r=e._transformState;if(n.length)throw new Error("Calling transform done when ws.length != 0");if(r.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}function dS(e){if(!(this instanceof dS))return new dS(e);lS.call(this,e)}function fS(){bA.call(this)}F_(lS,oS),lS.prototype.push=function(e,t){return this._transformState.needTransform=!1,oS.prototype.push.call(this,e,t)},lS.prototype._transform=function(e,t,n){throw new Error("Not implemented")},lS.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},lS.prototype._read=function(e){var t=this._transformState;null!==t.writechunk&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0},F_(dS,lS),dS.prototype._transform=function(e,t,n){n(null,e)},F_(fS,bA),fS.Readable=TE,fS.Writable=YE,fS.Duplex=oS,fS.Transform=lS,fS.PassThrough=dS,fS.Stream=fS,fS.prototype.pipe=function(e,t){var n=this;function r(t){e.writable&&!1===e.write(t)&&n.pause&&n.pause()}function i(){n.readable&&n.resume&&n.resume()}n.on("data",r),e.on("drain",i),e._isStdio||t&&!1===t.end||(n.on("end",a),n.on("close",s));var o=!1;function a(){o||(o=!0,e.end())}function s(){o||(o=!0,"function"==typeof e.destroy&&e.destroy())}function u(e){if(l(),0===bA.listenerCount(this,"error"))throw e}function l(){n.removeListener("data",r),e.removeListener("drain",i),n.removeListener("end",a),n.removeListener("close",s),n.removeListener("error",u),e.removeListener("error",u),n.removeListener("end",l),n.removeListener("close",l),e.removeListener("close",l)}return n.on("error",u),e.on("error",u),n.on("end",l),n.on("close",l),e.on("close",l),e.emit("pipe",n),e};var hS=o(Object.freeze({__proto__:null,Duplex:oS,PassThrough:dS,Readable:TE,Stream:fS,Transform:lS,Writable:YE,default:fS}));Object.defineProperty(z_,"__esModule",{value:!0});const pS=hS;class mS extends pS.Duplex{constructor(e){super({objectMode:!0}),this._port=e,this._port.onMessage.addListener((e=>this._onMessage(e))),this._port.onDisconnect.addListener((()=>this._onDisconnect())),this._log=()=>null}_onMessage(e){if(xt(e)){const t=Ke.from(e);this._log(t,!1),this.push(t)}else this._log(e,!1),this.push(e)}_onDisconnect(){this.destroy()}_read(){}_write(e,t,n){try{if(xt(e)){const t=e.toJSON();t._isBuffer=!0,this._log(t,!0),this._port.postMessage(t)}else this._log(e,!0),this._port.postMessage(e)}catch(e){return n(new Error("PortDuplexStream - disconnected"))}return n()}_setLogger(e){this._log=e}}z_.default=mS;var gS=function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))},vS=function(e,t,n){this.name=e,this.version=t,this.os=n,this.type="browser"},yS=function(e){this.version=e,this.type="node",this.name="node",this.os=P.platform},bS=function(e,t,n,r){this.name=e,this.version=t,this.os=n,this.bot=r,this.type="bot-device"},wS=function(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null},AS=function(){this.type="react-native",this.name="react-native",this.version=null,this.os=null},_S=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,ES=3,SS=[["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|$)/],["pie",/^Microsoft Pocket Internet Explorer\/(\d+\.\d+)$/],["pie",/^Mozilla\/\d\.\d+\s\(compatible;\s(?:MSP?IE|MSInternet Explorer) (\d+\.\d+);.*Windows CE.*\)$/],["netfront",/^Mozilla\/\d\.\d+.*NetFront\/(\d.\d)/],["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",/FB[AS]V\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["curl",/^curl\/([0-9\.]+)$/],["searchbot",/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/]],kS=[["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/],["Windows CE",/Windows CE|WinCE|Microsoft Pocket Internet Explorer/],["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 MS(e){return""!==e&&SS.reduce((function(t,n){var r=n[0],i=n[1];if(t)return t;var o=i.exec(e);return!!o&&[r,o]}),!1)}function CS(e){var t=MS(e);if(!t)return null;var n=t[0],r=t[1];if("searchbot"===n)return new wS;var i=r[1]&&r[1].split(".").join("_").split("_").slice(0,3);i?i.length<ES&&(i=gS(gS([],i,!0),function(e){for(var t=[],n=0;n<e;n++)t.push("0");return t}(ES-i.length),!0)):i=[];var o=i.join("."),a=xS(e),s=_S.exec(e);return s&&s[1]?new bS(n,o,a,s[1]):new vS(n,o,a)}function xS(e){for(var t=0,n=kS.length;t<n;t++){var r=kS[t],i=r[0];if(r[1].exec(e))return i}return null}function RS(){return void 0!==P&&P.version?new yS(P.version.slice(1)):null}var OS=Object.freeze({__proto__:null,BotInfo:wS,BrowserInfo:vS,NodeInfo:yS,ReactNativeInfo:AS,SearchBotDeviceInfo:bS,browserName:function(e){var t=MS(e);return t?t[0]:null},detect:function(e){return e?CS(e):"undefined"==typeof document&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product?new AS:"undefined"!=typeof navigator?CS(navigator.userAgent):RS()},detectOS:xS,getNodeVersion:RS,parseUserAgent:CS}),TS=o(OS),PS={},LS={},IS=r&&r.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(LS,"__esModule",{value:!0}),LS.sendSiteMetadata=void 0;const NS=IS(A_),DS=E_;function BS(e){const{document:t}=e,n=t.querySelector('head > meta[property="og:site_name"]');if(n)return n.content;const r=t.querySelector('head > meta[name="title"]');return r?r.content:t.title&&t.title.length>0?t.title:window.location.hostname}async function jS(e){const{document:t}=e,n=t.querySelectorAll('head > link[rel~="icon"]');for(const e of n)if(e&&await US(e.href))return e.href;return null}function US(e){return new Promise(((t,n)=>{try{const n=document.createElement("img");n.onload=()=>t(!0),n.onerror=()=>t(!1),n.src=e}catch(e){n(e)}}))}LS.sendSiteMetadata=async function(e,t){try{const t=await async function(){return{name:BS(window),icon:await jS(window)}}();e.handle({jsonrpc:"2.0",id:1,method:"metamask_sendDomainMetadata",params:t},DS.NOOP)}catch(e){t.error({message:NS.default.errors.sendSiteMetadata(),originalError:e})}};var zS={},FS={},qS={exports:{}},WS={exports:{}};void 0===P||!P.version||0===P.version.indexOf("v0.")||0===P.version.indexOf("v1.")&&0!==P.version.indexOf("v1.8.")?WS.exports={nextTick:function(e,t,n,r){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var i,o,a=arguments.length;switch(a){case 0:case 1:return b(e);case 2:return b((function(){e.call(null,t)}));case 3:return b((function(){e.call(null,t,n)}));case 4:return b((function(){e.call(null,t,n,r)}));default:for(i=new Array(a-1),o=0;o<i.length;)i[o++]=arguments[o];return b((function(){e.apply(null,i)}))}}}:WS.exports=P;var VS=WS.exports,KS={}.toString,HS=Array.isArray||function(e){return"[object Array]"==KS.call(e)},$S=kA.EventEmitter,YS={exports:{}},GS=o(Ot);!function(e,t){var n=GS,r=n.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}function o(e,t,n){return r(e,t,n)}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?e.exports=n:(i(n,t),t.Buffer=o),i(r,o),o.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return r(e,t,n)},o.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=r(e);return void 0!==t?"string"==typeof n?i.fill(t,n):i.fill(t):i.fill(0),i},o.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}}(YS,YS.exports);var QS=YS.exports,ZS={};function XS(e){return Object.prototype.toString.call(e)}ZS.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===XS(e)},ZS.isBoolean=function(e){return"boolean"==typeof e},ZS.isNull=function(e){return null===e},ZS.isNullOrUndefined=function(e){return null==e},ZS.isNumber=function(e){return"number"==typeof e},ZS.isString=function(e){return"string"==typeof e},ZS.isSymbol=function(e){return"symbol"==typeof e},ZS.isUndefined=function(e){return void 0===e},ZS.isRegExp=function(e){return"[object RegExp]"===XS(e)},ZS.isObject=function(e){return"object"==typeof e&&null!==e},ZS.isDate=function(e){return"[object Date]"===XS(e)},ZS.isError=function(e){return"[object Error]"===XS(e)||e instanceof Error},ZS.isFunction=function(e){return"function"==typeof e},ZS.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},ZS.isBuffer=GS.Buffer.isBuffer;var JS={exports:{}};"function"==typeof Object.create?JS.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:JS.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}};var ek,tk=JS.exports,nk=o(_E),rk={exports:{}};function ik(){return ek||(ek=1,function(e){var t=QS.Buffer,n=nk;e.exports=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}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},e.prototype.concat=function(e){if(0===this.length)return t.alloc(0);for(var n,r,i=t.allocUnsafe(e>>>0),o=this.head,a=0;o;)n=i,r=a,o.data.copy(n,r),a+=o.data.length,o=o.next;return i},e}(),n&&n.inspect&&n.inspect.custom&&(e.exports.prototype[n.inspect.custom]=function(){var e=n.inspect({length:this.length});return this.constructor.name+" "+e})}(rk)),rk.exports}var ok=VS;function ak(e,t){e.emit("error",t)}var sk,uk,lk,ck,dk={destroy:function(e,t){var n=this,r=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return r||i?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,ok.nextTick(ak,this,e)):ok.nextTick(ak,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?n._writableState?n._writableState.errorEmitted||(n._writableState.errorEmitted=!0,ok.nextTick(ak,n,e)):ok.nextTick(ak,n,e):t&&t(e)})),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)}},fk=function(e,t){if(hk("noDeprecation"))return e;var n=!1;return function(){if(!n){if(hk("throwDeprecation"))throw new Error(t);hk("traceDeprecation")?console.trace(t):console.warn(t),n=!0}return e.apply(this,arguments)}};function hk(e){try{if(!r.localStorage)return!1}catch(e){return!1}var t=r.localStorage[e];return null!=t&&"true"===String(t).toLowerCase()}function pk(){if(uk)return sk;uk=1;var e=VS;function t(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,n){var r=e.entry;for(e.entry=null;r;){var i=r.callback;t.pendingcb--,i(n),r=r.next}t.corkedRequestsFree.next=e}(t,e)}}sk=p;var n,i=e.nextTick;p.WritableState=h;var o=Object.create(ZS);o.inherits=tk;var a,s={deprecate:fk},u=$S,l=QS.Buffer,c=(void 0!==r?r:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},d=dk;function f(){}function h(r,o){n=n||mk(),r=r||{};var a=o instanceof n;this.objectMode=!!r.objectMode,a&&(this.objectMode=this.objectMode||!!r.writableObjectMode);var s=r.highWaterMark,u=r.writableHighWaterMark,l=this.objectMode?16:16384;this.highWaterMark=s||0===s?s:a&&(u||0===u)?u:l,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var c=!1===r.decodeStrings;this.decodeStrings=!c,this.defaultEncoding=r.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,n){var r=t._writableState,o=r.sync,a=r.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),n)!function(t,n,r,i,o){--n.pendingcb,r?(e.nextTick(o,i),e.nextTick(w,t,n),t._writableState.errorEmitted=!0,t.emit("error",i)):(o(i),t._writableState.errorEmitted=!0,t.emit("error",i),w(t,n))}(t,r,o,n,a);else{var s=y(r);s||r.corked||r.bufferProcessing||!r.bufferedRequest||v(t,r),o?i(g,t,r,s,a):g(t,r,s,a)}}(o,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new t(this)}function p(e){if(n=n||mk(),!(a.call(p,this)||this instanceof n))return new p(e);this._writableState=new h(e,this),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)),u.call(this)}function m(e,t,n,r,i,o,a){t.writelen=r,t.writecb=a,t.writing=!0,t.sync=!0,n?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function g(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),w(e,t)}function v(e,n){n.bufferProcessing=!0;var r=n.bufferedRequest;if(e._writev&&r&&r.next){var i=n.bufferedRequestCount,o=new Array(i),a=n.corkedRequestsFree;a.entry=r;for(var s=0,u=!0;r;)o[s]=r,r.isBuf||(u=!1),r=r.next,s+=1;o.allBuffers=u,m(e,n,!0,n.length,o,"",a.finish),n.pendingcb++,n.lastBufferedRequest=null,a.next?(n.corkedRequestsFree=a.next,a.next=null):n.corkedRequestsFree=new t(n),n.bufferedRequestCount=0}else{for(;r;){var l=r.chunk,c=r.encoding,d=r.callback;if(m(e,n,!1,n.objectMode?1:l.length,l,c,d),r=r.next,n.bufferedRequestCount--,n.writing)break}null===r&&(n.lastBufferedRequest=null)}n.bufferedRequest=r,n.bufferProcessing=!1}function y(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function b(e,t){e._final((function(n){t.pendingcb--,n&&e.emit("error",n),t.prefinished=!0,e.emit("prefinish"),w(e,t)}))}function w(t,n){var r=y(n);return r&&(function(t,n){n.prefinished||n.finalCalled||("function"==typeof t._final?(n.pendingcb++,n.finalCalled=!0,e.nextTick(b,t,n)):(n.prefinished=!0,t.emit("prefinish")))}(t,n),0===n.pendingcb&&(n.finished=!0,t.emit("finish"))),r}return o.inherits(p,u),h.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(h.prototype,"buffer",{get:s.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(p,Symbol.hasInstance,{value:function(e){return!!a.call(this,e)||this===p&&e&&e._writableState instanceof h}})):a=function(e){return e instanceof this},p.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},p.prototype.write=function(t,n,r){var i,o=this._writableState,a=!1,s=!o.objectMode&&(i=t,l.isBuffer(i)||i instanceof c);return s&&!l.isBuffer(t)&&(t=function(e){return l.from(e)}(t)),"function"==typeof n&&(r=n,n=null),s?n="buffer":n||(n=o.defaultEncoding),"function"!=typeof r&&(r=f),o.ended?function(t,n){var r=new Error("write after end");t.emit("error",r),e.nextTick(n,r)}(this,r):(s||function(t,n,r,i){var o=!0,a=!1;return null===r?a=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||n.objectMode||(a=new TypeError("Invalid non-string/buffer chunk")),a&&(t.emit("error",a),e.nextTick(i,a),o=!1),o}(this,o,t,r))&&(o.pendingcb++,a=function(e,t,n,r,i,o){if(!n){var a=function(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=l.from(t,n)),t}(t,r,i);r!==a&&(n=!0,i="buffer",r=a)}var s=t.objectMode?1:r.length;t.length+=s;var u=t.length<t.highWaterMark;if(u||(t.needDrain=!0),t.writing||t.corked){var c=t.lastBufferedRequest;t.lastBufferedRequest={chunk:r,encoding:i,isBuf:n,callback:o,next:null},c?c.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else m(e,t,!1,s,r,i,o);return u}(this,o,s,t,n,r)),a},p.prototype.cork=function(){this._writableState.corked++},p.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||v(this,e))},p.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 TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(p.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),p.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},p.prototype._writev=null,p.prototype.end=function(t,n,r){var i=this._writableState;"function"==typeof t?(r=t,t=null,n=null):"function"==typeof n&&(r=n,n=null),null!=t&&this.write(t,n),i.corked&&(i.corked=1,this.uncork()),i.ending||function(t,n,r){n.ending=!0,w(t,n),r&&(n.finished?e.nextTick(r):t.once("finish",r)),n.ended=!0,t.writable=!1}(this,i,r)},Object.defineProperty(p.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),p.prototype.destroy=d.destroy,p.prototype._undestroy=d.undestroy,p.prototype._destroy=function(e,t){this.end(),t(e)},sk}function mk(){if(ck)return lk;ck=1;var e=VS,t=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};lk=u;var n=Object.create(ZS);n.inherits=tk;var r=Ak(),i=pk();n.inherits(u,r);for(var o=t(i.prototype),a=0;a<o.length;a++){var s=o[a];u.prototype[s]||(u.prototype[s]=i.prototype[s])}function u(e){if(!(this instanceof u))return new u(e);r.call(this,e),i.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",l)}function l(){this.allowHalfOpen||this._writableState.ended||e.nextTick(c,this)}function c(e){e.end()}return Object.defineProperty(u.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(u.prototype,"destroyed",{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)}}),u.prototype._destroy=function(t,n){this.push(null),this.end(),e.nextTick(n,t)},lk}var gk,vk,yk,bk={};function wk(){if(gk)return bk;gk=1;var e=QS.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 n(n){var r;switch(this.encoding=function(n){var r=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}}(n);if("string"!=typeof r&&(e.isEncoding===t||!t(n)))throw new Error("Unknown encoding: "+n);return r||n}(n),this.encoding){case"utf16le":this.text=o,this.end=a,r=4;break;case"utf8":this.fillLast=i,r=4;break;case"base64":this.text=s,this.end=u,r=3;break;default:return this.write=l,void(this.end=c)}this.lastNeed=0,this.lastTotal=0,this.lastChar=e.allocUnsafe(r)}function r(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,n=function(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function o(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function a(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function s(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function u(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 c(e){return e&&e.length?this.write(e):""}return bk.StringDecoder=n,n.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||""},n.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},n.prototype.text=function(e,t){var n=function(e,t,n){var i=t.length-1;if(i<n)return 0;var o=r(t[i]);return o>=0?(o>0&&(e.lastNeed=o-1),o):--i<n||-2===o?0:(o=r(t[i]))>=0?(o>0&&(e.lastNeed=o-2),o):--i<n||-2===o?0:(o=r(t[i]))>=0?(o>0&&(2===o?o=0:e.lastNeed=o-3),o):0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var i=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,i),e.toString("utf8",t,i)},n.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length},bk}function Ak(){if(yk)return vk;yk=1;var e=VS;vk=g;var t,n=HS;g.ReadableState=m,kA.EventEmitter;var i=function(e,t){return e.listeners(t).length},o=$S,a=QS.Buffer,s=(void 0!==r?r:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},u=Object.create(ZS);u.inherits=tk;var l=nk,c=void 0;c=l&&l.debuglog?l.debuglog("stream"):function(){};var d,f=ik(),h=dk;u.inherits(g,o);var p=["error","close","destroy","pause","resume"];function m(e,n){e=e||{};var r=n instanceof(t=t||mk());this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,o=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new f,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.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(d||(d=wk().StringDecoder),this.decoder=new d(e.encoding),this.encoding=e.encoding)}function g(e){if(t=t||mk(),!(this instanceof g))return new g(e);this._readableState=new m(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),o.call(this)}function v(e,t,n,r,i){var o,u=e._readableState;return null===t?(u.reading=!1,function(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,A(e)}}(e,u)):(i||(o=function(e,t){var n,r;return r=t,a.isBuffer(r)||r instanceof s||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}(u,t)),o?e.emit("error",o):u.objectMode||t&&t.length>0?("string"==typeof t||u.objectMode||Object.getPrototypeOf(t)===a.prototype||(t=function(e){return a.from(e)}(t)),r?u.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):y(e,u,t,!0):u.ended?e.emit("error",new Error("stream.push() after EOF")):(u.reading=!1,u.decoder&&!n?(t=u.decoder.write(t),u.objectMode||0!==t.length?y(e,u,t,!1):E(e,u)):y(e,u,t,!1))):r||(u.reading=!1)),function(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}(u)}function y(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&A(e)),E(e,t)}Object.defineProperty(g.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),g.prototype.destroy=h.destroy,g.prototype._undestroy=h.undestroy,g.prototype._destroy=function(e,t){this.push(null),t(e)},g.prototype.push=function(e,t){var n,r=this._readableState;return r.objectMode?n=!0:"string"==typeof e&&((t=t||r.defaultEncoding)!==r.encoding&&(e=a.from(e,t),t=""),n=!0),v(this,e,t,!1,n)},g.prototype.unshift=function(e){return v(this,e,null,!0,!1)},g.prototype.isPaused=function(){return!1===this._readableState.flowing},g.prototype.setEncoding=function(e){return d||(d=wk().StringDecoder),this._readableState.decoder=new d(e),this._readableState.encoding=e,this};var b=8388608;function w(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>=b?e=b:(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 A(t){var n=t._readableState;n.needReadable=!1,n.emittedReadable||(c("emitReadable",n.flowing),n.emittedReadable=!0,n.sync?e.nextTick(_,t):_(t))}function _(e){c("emit readable"),e.emit("readable"),C(e)}function E(t,n){n.readingMore||(n.readingMore=!0,e.nextTick(S,t,n))}function S(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(c("maybeReadMore read 0"),e.read(0),n!==t.length);)n=t.length;t.readingMore=!1}function k(e){c("readable nexttick read 0"),e.read(0)}function M(e,t){t.reading||(c("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),C(e),t.flowing&&!t.reading&&e.read(0)}function C(e){var t=e._readableState;for(c("flow",t.flowing);t.flowing&&null!==e.read(););}function x(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=function(e,t,n){var r;return e<t.head.data.length?(r=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):r=e===t.head.data.length?t.shift():n?function(e,t){var n=t.head,r=1,i=n.data;for(e-=i.length;n=n.next;){var o=n.data,a=e>o.length?o.length:e;if(a===o.length?i+=o:i+=o.slice(0,e),0==(e-=a)){a===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(a));break}++r}return t.length-=r,i}(e,t):function(e,t){var n=a.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),0==(e-=s)){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}(e,t),r}(e,t.buffer,t.decoder),n);var n}function R(t){var n=t._readableState;if(n.length>0)throw new Error('"endReadable()" called on non-empty stream');n.endEmitted||(n.ended=!0,e.nextTick(O,n,t))}function O(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function T(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}return g.prototype.read=function(e){c("read",e),e=parseInt(e,10);var t=this._readableState,n=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return c("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?R(this):A(this),null;if(0===(e=w(e,t))&&t.ended)return 0===t.length&&R(this),null;var r,i=t.needReadable;return c("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&c("length less than watermark",i=!0),t.ended||t.reading?c("reading or ended",i=!1):i&&(c("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=w(n,t))),null===(r=e>0?x(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&R(this)),null!==r&&this.emit("data",r),r},g.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},g.prototype.pipe=function(t,r){var o=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=t;break;case 1:a.pipes=[a.pipes,t];break;default:a.pipes.push(t)}a.pipesCount+=1,c("pipe count=%d opts=%j",a.pipesCount,r);var s=r&&!1===r.end||t===P.stdout||t===P.stderr?y:l;function u(e,n){c("onunpipe"),e===o&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,c("cleanup"),t.removeListener("close",g),t.removeListener("finish",v),t.removeListener("drain",d),t.removeListener("error",m),t.removeListener("unpipe",u),o.removeListener("end",l),o.removeListener("end",y),o.removeListener("data",p),f=!0,!a.awaitDrain||t._writableState&&!t._writableState.needDrain||d())}function l(){c("onend"),t.end()}a.endEmitted?e.nextTick(s):o.once("end",s),t.on("unpipe",u);var d=function(e){return function(){var t=e._readableState;c("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&i(e,"data")&&(t.flowing=!0,C(e))}}(o);t.on("drain",d);var f=!1,h=!1;function p(e){c("ondata"),h=!1,!1!==t.write(e)||h||((1===a.pipesCount&&a.pipes===t||a.pipesCount>1&&-1!==T(a.pipes,t))&&!f&&(c("false write response, pause",a.awaitDrain),a.awaitDrain++,h=!0),o.pause())}function m(e){c("onerror",e),y(),t.removeListener("error",m),0===i(t,"error")&&t.emit("error",e)}function g(){t.removeListener("finish",v),y()}function v(){c("onfinish"),t.removeListener("close",g),y()}function y(){c("unpipe"),o.unpipe(t)}return o.on("data",p),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?n(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(t,"error",m),t.once("close",g),t.once("finish",v),t.emit("pipe",o),a.flowing||(c("pipe resume"),o.resume()),t},g.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n)),this;if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<i;o++)r[o].emit("unpipe",this,{hasUnpiped:!1});return this}var a=T(t.pipes,e);return-1===a||(t.pipes.splice(a,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,n)),this},g.prototype.on=function(t,n){var r=o.prototype.on.call(this,t,n);if("data"===t)!1!==this._readableState.flowing&&this.resume();else if("readable"===t){var i=this._readableState;i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.emittedReadable=!1,i.reading?i.length&&A(this):e.nextTick(k,this))}return r},g.prototype.addListener=g.prototype.on,g.prototype.resume=function(){var t=this._readableState;return t.flowing||(c("resume"),t.flowing=!0,function(t,n){n.resumeScheduled||(n.resumeScheduled=!0,e.nextTick(M,t,n))}(this,t)),this},g.prototype.pause=function(){return c("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(c("pause"),this._readableState.flowing=!1,this.emit("pause")),this},g.prototype.wrap=function(e){var t=this,n=this._readableState,r=!1;for(var i in e.on("end",(function(){if(c("wrapped end"),n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(i){c("wrapped data"),n.decoder&&(i=n.decoder.write(i)),n.objectMode&&null==i||(n.objectMode||i&&i.length)&&(t.push(i)||(r=!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 o=0;o<p.length;o++)e.on(p[o],this.emit.bind(this,p[o]));return this._read=function(t){c("wrapped _read",t),r&&(r=!1,e.resume())},this},Object.defineProperty(g.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),g._fromList=x,vk}var _k=Mk,Ek=mk(),Sk=Object.create(ZS);function kk(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function Mk(e){if(!(this instanceof Mk))return new Mk(e);Ek.call(this,e),this._transformState={afterTransform:kk.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",Ck)}function Ck(){var e=this;"function"==typeof this._flush?this._flush((function(t,n){xk(e,t,n)})):xk(this,null,null)}function xk(e,t,n){if(t)return e.emit("error",t);if(null!=n&&e.push(n),e._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(e._transformState.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}Sk.inherits=tk,Sk.inherits(Mk,Ek),Mk.prototype.push=function(e,t){return this._transformState.needTransform=!1,Ek.prototype.push.call(this,e,t)},Mk.prototype._transform=function(e,t,n){throw new Error("_transform() is not implemented")},Mk.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},Mk.prototype._read=function(e){var t=this._transformState;null!==t.writechunk&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0},Mk.prototype._destroy=function(e,t){var n=this;Ek.prototype._destroy.call(this,e,(function(e){t(e),n.emit("close")}))};var Rk=Pk,Ok=_k,Tk=Object.create(ZS);function Pk(e){if(!(this instanceof Pk))return new Pk(e);Ok.call(this,e)}Tk.inherits=tk,Tk.inherits(Pk,Ok),Pk.prototype._transform=function(e,t,n){n(null,e)},function(e,t){(t=e.exports=Ak()).Stream=t,t.Readable=t,t.Writable=pk(),t.Duplex=mk(),t.Transform=_k,t.PassThrough=Rk}(qS,qS.exports);var Lk=qS.exports,Ik={exports:{}},Nk=function e(t,n){if(t&&n)return e(t)(n);if("function"!=typeof t)throw new TypeError("need wrapper function");return Object.keys(t).forEach((function(e){r[e]=t[e]})),r;function r(){for(var e=new Array(arguments.length),n=0;n<e.length;n++)e[n]=arguments[n];var r=t.apply(this,e),i=e[e.length-1];return"function"==typeof r&&r!==i&&Object.keys(i).forEach((function(e){r[e]=i[e]})),r}},Dk=Nk;function Bk(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function jk(e){var t=function(){if(t.called)throw new Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)},n=e.name||"Function wrapped with `once`";return t.onceError=n+" shouldn't be called more than once",t.called=!1,t}Ik.exports=Dk(Bk),Ik.exports.strict=Dk(jk),Bk.proto=Bk((function(){Object.defineProperty(Function.prototype,"once",{value:function(){return Bk(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return jk(this)},configurable:!0})}));var Uk=Ik.exports,zk=Uk,Fk=function(){},qk=function(e,t,n){if("function"==typeof t)return qk(e,null,t);t||(t={}),n=zk(n||Fk);var r=e._writableState,i=e._readableState,o=t.readable||!1!==t.readable&&e.readable,a=t.writable||!1!==t.writable&&e.writable,s=!1,u=function(){e.writable||l()},l=function(){a=!1,o||n.call(e)},c=function(){o=!1,a||n.call(e)},d=function(t){n.call(e,t?new Error("exited with error code: "+t):null)},f=function(t){n.call(e,t)},h=function(){b(p)},p=function(){if(!s)return(!o||i&&i.ended&&!i.destroyed)&&(!a||r&&r.ended&&!r.destroyed)?void 0:n.call(e,new Error("premature close"))},m=function(){e.req.on("finish",l)};return function(e){return e.setHeader&&"function"==typeof e.abort}(e)?(e.on("complete",l),e.on("abort",h),e.req?m():e.on("request",m)):a&&!r&&(e.on("end",u),e.on("close",u)),function(e){return e.stdio&&Array.isArray(e.stdio)&&3===e.stdio.length}(e)&&e.on("exit",d),e.on("end",c),e.on("finish",l),!1!==t.error&&e.on("error",f),e.on("close",h),function(){s=!0,e.removeListener("complete",l),e.removeListener("abort",h),e.removeListener("request",m),e.req&&e.req.removeListener("finish",l),e.removeListener("end",u),e.removeListener("close",u),e.removeListener("finish",l),e.removeListener("exit",d),e.removeListener("end",c),e.removeListener("error",f),e.removeListener("close",h)}},Wk=qk,Vk={};Object.defineProperty(Vk,"__esModule",{value:!0}),Vk.Substream=void 0;const Kk=Lk;class Hk extends Kk.Duplex{constructor({parent:e,name:t}){super({objectMode:!0}),this._parent=e,this._name=t}_read(){}_write(e,t,n){this._parent.push({name:this._name,data:e}),n()}}Vk.Substream=Hk;var $k=r&&r.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(FS,"__esModule",{value:!0}),FS.ObjectMultiplex=void 0;const Yk=Lk,Gk=$k(Wk),Qk=$k(Uk),Zk=Vk,Xk=Symbol("IGNORE_SUBSTREAM");class Jk extends Yk.Duplex{constructor(e={}){super(Object.assign(Object.assign({},e),{objectMode:!0})),this._substreams={}}createStream(e){if(this.destroyed)throw new Error(`ObjectMultiplex - parent stream for name "${e}" already destroyed`);if(this._readableState.ended||this._writableState.ended)throw new Error(`ObjectMultiplex - parent stream for name "${e}" already ended`);if(!e)throw new Error("ObjectMultiplex - name must not be empty");if(this._substreams[e])throw new Error(`ObjectMultiplex - Substream for name "${e}" already exists`);const t=new Zk.Substream({parent:this,name:e});return this._substreams[e]=t,function(e,t){const n=Qk.default(t);Gk.default(e,{readable:!1},n),Gk.default(e,{writable:!1},n)}(this,(e=>t.destroy(e||void 0))),t}ignoreStream(e){if(!e)throw new Error("ObjectMultiplex - name must not be empty");if(this._substreams[e])throw new Error(`ObjectMultiplex - Substream for name "${e}" already exists`);this._substreams[e]=Xk}_read(){}_write(e,t,n){const{name:r,data:i}=e;if(!r)return console.warn(`ObjectMultiplex - malformed chunk without name "${e}"`),n();const o=this._substreams[r];return o?(o!==Xk&&o.push(i),n()):(console.warn(`ObjectMultiplex - orphaned data for stream "${r}"`),n())}}FS.ObjectMultiplex=Jk;var eM=FS.ObjectMultiplex;const tM=e=>null!==e&&"object"==typeof e&&"function"==typeof e.pipe;tM.writable=e=>tM(e)&&!1!==e.writable&&"function"==typeof e._write&&"object"==typeof e._writableState,tM.readable=e=>tM(e)&&!1!==e.readable&&"function"==typeof e._read&&"object"==typeof e._readableState,tM.duplex=e=>tM.writable(e)&&tM.readable(e),tM.transform=e=>tM.duplex(e)&&"function"==typeof e._transform;var nM=tM,rM={},iM={};Object.defineProperty(iM,"__esModule",{value:!0});const oM=Lk;iM.default=function(e){if(!e||!e.engine)throw new Error("Missing engine parameter!");const{engine:t}=e,n=new oM.Duplex({objectMode:!0,read:()=>{},write:function(e,r,i){t.handle(e,((e,t)=>{n.push(t)})),i()}});return t.on&&t.on("notification",(e=>{n.push(e)})),n};var aM={},sM={};Object.defineProperty(sM,"__esModule",{value:!0});const uM=kA;function lM(e,t,n){try{Reflect.apply(e,t,n)}catch(e){setTimeout((()=>{throw e}))}}class cM extends uM.EventEmitter{emit(e,...t){let n="error"===e;const r=this._events;if(void 0!==r)n=n&&void 0===r.error;else if(!n)return!1;if(n){let e;if(t.length>0&&([e]=t),e instanceof Error)throw e;const n=new Error("Unhandled error."+(e?` (${e.message})`:""));throw n.context=e,n}const i=r[e];if(void 0===i)return!1;if("function"==typeof i)lM(i,this,t);else{const e=i.length,n=function(e){const t=e.length,n=new Array(t);for(let r=0;r<t;r+=1)n[r]=e[r];return n}(i);for(let r=0;r<e;r+=1)lM(n[r],this,t)}return!0}}sM.default=cM;var dM=r&&r.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(aM,"__esModule",{value:!0});const fM=dM(sM),hM=Lk;aM.default=function(e={}){const t={},n=new hM.Duplex({objectMode:!0,read:()=>{},write:function(n,o,a){let s=null;try{n.id?function(e){const n=t[e.id];n?(delete t[e.id],Object.assign(n.res,e),setTimeout(n.end)):console.warn(`StreamMiddleware - Unknown response id "${e.id}"`)}(n):function(n){(null==e?void 0:e.retryOnMessage)&&n.method===e.retryOnMessage&&Object.values(t).forEach((({req:e,retryCount:n=0})=>{if(e.id){if(n>=3)throw new Error(`StreamMiddleware - Retry limit exceeded for request id "${e.id}"`);t[e.id].retryCount=n+1,i(e)}})),r.emit("notification",n)}(n)}catch(e){s=e}a(s)}}),r=new fM.default;return{events:r,middleware:(e,n,r,o)=>{t[e.id]={req:e,res:n,next:r,end:o},i(e)},stream:n};function i(e){n.push(e)}};var pM=r&&r.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(rM,"__esModule",{value:!0}),rM.createStreamMiddleware=rM.createEngineStream=void 0;const mM=pM(iM);rM.createEngineStream=mM.default;const gM=pM(aM);rM.createStreamMiddleware=gM.default;var vM=Uk,yM=Wk,bM=o(Object.freeze({__proto__:null,default:{}})),wM=function(){},AM=/^v?\.0/.test(P.version),_M=function(e){return"function"==typeof e},EM=function(e,t,n,r){r=vM(r);var i=!1;e.on("close",(function(){i=!0})),yM(e,{readable:t,writable:n},(function(e){if(e)return r(e);i=!0,r()}));var o=!1;return function(t){if(!i&&!o)return o=!0,function(e){return!!AM&&!!bM&&(e instanceof(bM.ReadStream||wM)||e instanceof(bM.WriteStream||wM))&&_M(e.close)}(e)?e.close(wM):function(e){return e.setHeader&&_M(e.abort)}(e)?e.abort():_M(e.destroy)?e.destroy():void r(t||new Error("stream was destroyed"))}},SM=function(e){e()},kM=function(e,t){return e.pipe(t)},MM=function(){var e,t=Array.prototype.slice.call(arguments),n=_M(t[t.length-1]||wM)&&t.pop()||wM;if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new Error("pump requires two streams per minimum");var r=t.map((function(i,o){var a=o<t.length-1;return EM(i,a,o>0,(function(t){e||(e=t),t&&r.forEach(SM),a||(r.forEach(SM),n(e))}))}));return t.reduce(kM)},CM=r&&r.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(zS,"__esModule",{value:!0}),zS.StreamProvider=zS.AbstractStreamProvider=void 0;const xM=CM(eM),RM=nM,OM=rM,TM=CM(MM),PM=CM(A_),LM=E_,IM=gA;class NM extends IM.BaseProvider{constructor(e,{jsonRpcStreamName:t,logger:n,maxEventListeners:r,rpcMiddleware:i}){if(super({logger:n,maxEventListeners:r,rpcMiddleware:i}),!RM.duplex(e))throw new Error(PM.default.errors.invalidDuplexStream());this._handleStreamDisconnect=this._handleStreamDisconnect.bind(this);const o=new xM.default;TM.default(e,o,e,this._handleStreamDisconnect.bind(this,"MetaMask")),this._jsonRpcConnection=OM.createStreamMiddleware({retryOnMessage:"METAMASK_EXTENSION_CONNECT_CAN_RETRY"}),TM.default(this._jsonRpcConnection.stream,o.createStream(t),this._jsonRpcConnection.stream,this._handleStreamDisconnect.bind(this,"MetaMask RpcProvider")),this._rpcEngine.push(this._jsonRpcConnection.middleware),this._jsonRpcConnection.events.on("notification",(t=>{const{method:n,params:r}=t;"metamask_accountsChanged"===n?this._handleAccountsChanged(r):"metamask_unlockStateChanged"===n?this._handleUnlockStateChanged(r):"metamask_chainChanged"===n?this._handleChainChanged(r):LM.EMITTED_NOTIFICATIONS.includes(n)?this.emit("message",{type:n,data:r}):"METAMASK_STREAM_FAILURE"===n&&e.destroy(new Error(PM.default.errors.permanentlyDisconnected()))}))}async _initializeStateAsync(){let e;try{e=await this.request({method:"metamask_getProviderState"})}catch(e){this._log.error("MetaMask: Failed to get initial state. Please report this bug.",e)}this._initializeState(e)}_handleStreamDisconnect(e,t){let n=`MetaMask: Lost connection to "${e}".`;(null==t?void 0:t.stack)&&(n+=`\n${t.stack}`),this._log.warn(n),this.listenerCount("error")>0&&this.emit("error",n),this._handleDisconnect(!1,t?t.message:void 0)}_handleChainChanged({chainId:e,networkVersion:t}={}){LM.isValidChainId(e)&&LM.isValidNetworkVersion(t)?"loading"===t?this._handleDisconnect(!0):super._handleChainChanged({chainId:e}):this._log.error(PM.default.errors.invalidNetworkParams(),{chainId:e,networkVersion:t})}}zS.AbstractStreamProvider=NM,zS.StreamProvider=class extends NM{async initialize(){return this._initializeStateAsync()}},function(e){var t=r&&r.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.MetaMaskInpageProvider=e.MetaMaskInpageProviderStreamName=void 0;const n=RA,i=LS,o=t(A_),a=E_,s=zS;e.MetaMaskInpageProviderStreamName="metamask-provider";class u extends s.AbstractStreamProvider{constructor(t,{jsonRpcStreamName:n=e.MetaMaskInpageProviderStreamName,logger:r=console,maxEventListeners:o,shouldSendMetadata:s}={}){if(super(t,{jsonRpcStreamName:n,logger:r,maxEventListeners:o,rpcMiddleware:a.getDefaultExternalMiddleware(r)}),this._sentWarnings={enable:!1,experimentalMethods:!1,send:!1,events:{close:!1,data:!1,networkChanged:!1,notification:!1}},this._initializeStateAsync(),this.networkVersion=null,this.isMetaMask=!0,this._sendSync=this._sendSync.bind(this),this.enable=this.enable.bind(this),this.send=this.send.bind(this),this.sendAsync=this.sendAsync.bind(this),this._warnOfDeprecation=this._warnOfDeprecation.bind(this),this._metamask=this._getExperimentalApi(),this._jsonRpcConnection.events.on("notification",(e=>{const{method:t}=e;a.EMITTED_NOTIFICATIONS.includes(t)&&(this.emit("data",e),this.emit("notification",e.params.result))})),s)if("complete"===document.readyState)i.sendSiteMetadata(this._rpcEngine,this._log);else{const e=()=>{i.sendSiteMetadata(this._rpcEngine,this._log),window.removeEventListener("DOMContentLoaded",e)};window.addEventListener("DOMContentLoaded",e)}}sendAsync(e,t){this._rpcRequest(e,t)}addListener(e,t){return this._warnOfDeprecation(e),super.addListener(e,t)}on(e,t){return this._warnOfDeprecation(e),super.on(e,t)}once(e,t){return this._warnOfDeprecation(e),super.once(e,t)}prependListener(e,t){return this._warnOfDeprecation(e),super.prependListener(e,t)}prependOnceListener(e,t){return this._warnOfDeprecation(e),super.prependOnceListener(e,t)}_handleDisconnect(e,t){super._handleDisconnect(e,t),this.networkVersion&&!e&&(this.networkVersion=null)}_warnOfDeprecation(e){var t;!1===(null===(t=this._sentWarnings)||void 0===t?void 0:t.events[e])&&(this._log.warn(o.default.warnings.events[e]),this._sentWarnings.events[e]=!0)}enable(){return this._sentWarnings.enable||(this._log.warn(o.default.warnings.enableDeprecation),this._sentWarnings.enable=!0),new Promise(((e,t)=>{try{this._rpcRequest({method:"eth_requestAccounts",params:[]},a.getRpcPromiseCallback(e,t))}catch(e){t(e)}}))}send(e,t){return this._sentWarnings.send||(this._log.warn(o.default.warnings.sendDeprecation),this._sentWarnings.send=!0),"string"!=typeof e||t&&!Array.isArray(t)?e&&"object"==typeof e&&"function"==typeof t?this._rpcRequest(e,t):this._sendSync(e):new Promise(((n,r)=>{try{this._rpcRequest({method:e,params:t},a.getRpcPromiseCallback(n,r,!1))}catch(e){r(e)}}))}_sendSync(e){let t;switch(e.method){case"eth_accounts":t=this.selectedAddress?[this.selectedAddress]:[];break;case"eth_coinbase":t=this.selectedAddress||null;break;case"eth_uninstallFilter":this._rpcRequest(e,a.NOOP),t=!0;break;case"net_version":t=this.networkVersion||null;break;default:throw new Error(o.default.errors.unsupportedSync(e.method))}return{id:e.id,jsonrpc:e.jsonrpc,result:t}}_getExperimentalApi(){return new Proxy({isUnlocked:async()=>(this._state.initialized||await new Promise((e=>{this.on("_initialized",(()=>e()))})),this._state.isUnlocked),requestBatch:async e=>{if(!Array.isArray(e))throw n.ethErrors.rpc.invalidRequest({message:"Batch requests must be made with an array of request objects.",data:e});return new Promise(((t,n)=>{this._rpcRequest(e,a.getRpcPromiseCallback(t,n))}))}},{get:(e,t,...n)=>(this._sentWarnings.experimentalMethods||(this._log.warn(o.default.warnings.experimentalMethods),this._sentWarnings.experimentalMethods=!0),Reflect.get(e,t,...n))})}_handleChainChanged({chainId:e,networkVersion:t}={}){super._handleChainChanged({chainId:e,networkVersion:t}),this._state.isConnected&&t!==this.networkVersion&&(this.networkVersion=t,this._state.initialized&&this.emit("networkChanged",this.networkVersion))}}e.MetaMaskInpageProvider=u}(PS);var DM={CHROME_ID:"nkbihfbeogaeaoehlefnkodbefgpgknn",FIREFOX_ID:"webextension@metamask.io"},BM=r&&r.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(U_,"__esModule",{value:!0}),U_.createExternalExtensionProvider=void 0;const jM=BM(z_),UM=TS,zM=PS,FM=zS,qM=E_,WM=BM(DM),VM=UM.detect();U_.createExternalExtensionProvider=function(){let e;try{const t=function(){switch(null==VM?void 0:VM.name){case"chrome":default:return WM.default.CHROME_ID;case"firefox":return WM.default.FIREFOX_ID}}(),n=chrome.runtime.connect(t),r=new jM.default(n);e=new FM.StreamProvider(r,{jsonRpcStreamName:zM.MetaMaskInpageProviderStreamName,logger:console,rpcMiddleware:qM.getDefaultExternalMiddleware(console)}),e.initialize()}catch(e){throw console.dir("MetaMask connect error.",e),e}return e};var KM={},HM={};Object.defineProperty(HM,"__esModule",{value:!0}),HM.shimWeb3=void 0,HM.shimWeb3=function(e,t=console){let n=!1,r=!1;if(!window.web3){const i="__isMetaMaskShim__";let o={currentProvider:e};Object.defineProperty(o,i,{value:!0,enumerable:!0,configurable:!1,writable:!1}),o=new Proxy(o,{get:(o,a,...s)=>("currentProvider"!==a||n?"currentProvider"===a||a===i||r||(r=!0,t.error("MetaMask no longer injects web3. For details, see: https://docs.metamask.io/guide/provider-migration.html#replacing-window-web3"),e.request({method:"metamask_logWeb3ShimUsage"}).catch((e=>{t.debug("MetaMask: Failed to log web3 shim usage.",e)}))):(n=!0,t.warn("You are accessing the MetaMask window.web3.currentProvider shim. This property is deprecated; use window.ethereum instead. For details, see: https://docs.metamask.io/guide/provider-migration.html#replacing-window-web3")),Reflect.get(o,a,...s)),set:(...e)=>(t.warn("You are accessing the MetaMask window.web3 shim. This object is deprecated; use window.ethereum instead. For details, see: https://docs.metamask.io/guide/provider-migration.html#replacing-window-web3"),Reflect.set(...e))}),Object.defineProperty(window,"web3",{value:o,enumerable:!1,configurable:!0,writable:!0})}},Object.defineProperty(KM,"__esModule",{value:!0}),KM.setGlobalProvider=KM.initializeProvider=void 0;const $M=PS,YM=HM;function GM(e){window.ethereum=e,window.dispatchEvent(new Event("ethereum#initialized"))}KM.initializeProvider=function({connectionStream:e,jsonRpcStreamName:t,logger:n=console,maxEventListeners:r=100,shouldSendMetadata:i=!0,shouldSetOnWindow:o=!0,shouldShimWeb3:a=!1}){const s=new $M.MetaMaskInpageProvider(e,{jsonRpcStreamName:t,logger:n,maxEventListeners:r,shouldSendMetadata:i}),u=new Proxy(s,{deleteProperty:()=>!0});return o&&GM(u),a&&YM.shimWeb3(u,n),u},KM.setGlobalProvider=GM,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.StreamProvider=e.shimWeb3=e.setGlobalProvider=e.MetaMaskInpageProvider=e.MetaMaskInpageProviderStreamName=e.initializeProvider=e.createExternalExtensionProvider=e.BaseProvider=void 0;const t=gA;Object.defineProperty(e,"BaseProvider",{enumerable:!0,get:function(){return t.BaseProvider}});const n=U_;Object.defineProperty(e,"createExternalExtensionProvider",{enumerable:!0,get:function(){return n.createExternalExtensionProvider}});const r=KM;Object.defineProperty(e,"initializeProvider",{enumerable:!0,get:function(){return r.initializeProvider}}),Object.defineProperty(e,"setGlobalProvider",{enumerable:!0,get:function(){return r.setGlobalProvider}});const i=PS;Object.defineProperty(e,"MetaMaskInpageProvider",{enumerable:!0,get:function(){return i.MetaMaskInpageProvider}}),Object.defineProperty(e,"MetaMaskInpageProviderStreamName",{enumerable:!0,get:function(){return i.MetaMaskInpageProviderStreamName}});const o=HM;Object.defineProperty(e,"shimWeb3",{enumerable:!0,get:function(){return o.shimWeb3}});const a=zS;Object.defineProperty(e,"StreamProvider",{enumerable:!0,get:function(){return a.StreamProvider}})}(mA);class QM extends mA.MetaMaskInpageProvider{constructor({connectionStream:e,shouldSendMetadata:t,debug:n=!1,autoRequestAccounts:r=!1}){super(e,{logger:console,maxEventListeners:100,shouldSendMetadata:t}),this.state={debug:!1,autoRequestAccounts:!1,providerStateRequested:!1},n&&console.debug(`SDKProvider::constructor debug=${n} autoRequestAccounts=${r}`),this.state.autoRequestAccounts=r,this.state.debug=n}forceInitializeState(){return fA(this,void 0,void 0,(function*(){return this.state.debug&&console.debug(`SDKProvider::forceInitializeState() autoRequestAccounts=${this.state.autoRequestAccounts}`),this._initializeStateAsync()}))}_setConnected(){this.state.debug&&console.debug("SDKProvider::_setConnected()"),this._state.isConnected=!0}getState(){return this._state}getSDKProviderState(){return this.state}setSDKProviderState(e){this.state=Object.assign(Object.assign({},this.state),e)}handleDisconnect({terminate:e=!1}){!function({terminate:e=!1,instance:t}){const{state:n}=t;t.isConnected()?(n.debug&&console.debug(`SDKProvider::handleDisconnect() cleaning up provider state terminate=${e}`,t),e&&(t.chainId=null,t._state.accounts=null,t.selectedAddress=null,t._state.isUnlocked=!1,t._state.isPermanentlyDisconnected=!0,t._state.initialized=!1),t._handleAccountsChanged([]),t._state.isConnected=!1,t.emit("disconnect",RA.ethErrors.provider.disconnected()),n.providerStateRequested=!1):n.debug&&console.debug("SDKProvider::handleDisconnect() not connected --- interrup disconnection")}({terminate:e,instance:this})}_initializeStateAsync(){return fA(this,void 0,void 0,(function*(){return function(e){var t;return fA(this,void 0,void 0,(function*(){void 0===e.state&&(e.state={debug:!1,autoRequestAccounts:!1,providerStateRequested:!1});const{state:n}=e;if(n.debug&&console.debug("SDKProvider::_initializeStateAsync()"),n.providerStateRequested)n.debug&&console.debug("SDKProvider::_initializeStateAsync() initialization already in progress");else{let r;n.providerStateRequested=!0;try{r=yield e.request({method:"metamask_getProviderState"})}catch(t){return e._log.error("MetaMask: Failed to get initial state. Please report this bug.",t),void(n.providerStateRequested=!1)}if(n.debug&&console.debug(`SDKProvider::_initializeStateAsync state selectedAddress=${e.selectedAddress} `,r),0===(null===(t=null==r?void 0:r.accounts)||void 0===t?void 0:t.length))if(n.debug&&console.debug("SDKProvider::_initializeStateAsync initial state doesn't contain accounts"),e.selectedAddress)n.debug&&console.debug("SDKProvider::_initializeStateAsync using instance.selectedAddress instead"),r.accounts=[e.selectedAddress];else{n.debug&&console.debug("SDKProvider::_initializeStateAsync Fetch accounts remotely.");const t=yield e.request({method:"eth_requestAccounts",params:[]});r.accounts=t}e._initializeState(r),n.providerStateRequested=!1}}))}(this)}))}_initializeState(e){return function(e,t,n){const{state:r}=e;return r.debug&&console.debug("SDKProvider::_initializeState() set state._initialized to false"),e._state.initialized=!1,t(n)}(this,super._initializeState.bind(this),e)}_handleChainChanged({chainId:e,networkVersion:t}={}){!function({instance:e,chainId:t,networkVersion:n,superHandleChainChanged:r}){const{state:i}=e;i.debug&&console.debug(`SDKProvider::_handleChainChanged chainId=${t} networkVersion=${n}`);let o=n;n||(console.info("forced network version to prevent provider error"),o="1"),e._state.isConnected=!0,e.emit("connect",{chainId:t}),r({chainId:t,networkVersion:o})}({instance:this,chainId:e,networkVersion:t,superHandleChainChanged:super._handleChainChanged.bind(this)})}}var ZM={exports:{}};!function(e,t){!function(t){var n=Object.hasOwnProperty,r=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},i="object"==typeof P&&!0,o="function"==typeof Symbol,a="object"==typeof Reflect,s="function"==typeof setImmediate?setImmediate:setTimeout,u=o?a&&"function"==typeof Reflect.ownKeys?Reflect.ownKeys:function(e){var t=Object.getOwnPropertyNames(e);return t.push.apply(t,Object.getOwnPropertySymbols(e)),t}:Object.keys;function l(){this._events={},this._conf&&c.call(this,this._conf)}function c(e){e&&(this._conf=e,e.delimiter&&(this.delimiter=e.delimiter),e.maxListeners!==t&&(this._maxListeners=e.maxListeners),e.wildcard&&(this.wildcard=e.wildcard),e.newListener&&(this._newListener=e.newListener),e.removeListener&&(this._removeListener=e.removeListener),e.verboseMemoryLeak&&(this.verboseMemoryLeak=e.verboseMemoryLeak),e.ignoreErrors&&(this.ignoreErrors=e.ignoreErrors),this.wildcard&&(this.listenerTree={}))}function d(e,t){var n="(node) warning: possible EventEmitter memory leak detected. "+e+" listeners added. Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak&&(n+=" Event name: "+t+"."),void 0!==P&&P.emitWarning){var r=new Error(n);r.name="MaxListenersExceededWarning",r.emitter=this,r.count=e,P.emitWarning(r)}else console.error(n),console.trace&&console.trace()}var f=function(e,t,n){var r=arguments.length;switch(r){case 0:return[];case 1:return[e];case 2:return[e,t];case 3:return[e,t,n];default:for(var i=new Array(r);r--;)i[r]=arguments[r];return i}};function h(e,n){for(var r={},i=e.length,o=n?n.length:0,a=0;a<i;a++)r[e[a]]=a<o?n[a]:t;return r}function p(e,t,n){var r,i;if(this._emitter=e,this._target=t,this._listeners={},this._listenersCount=0,(n.on||n.off)&&(r=n.on,i=n.off),t.addEventListener?(r=t.addEventListener,i=t.removeEventListener):t.addListener?(r=t.addListener,i=t.removeListener):t.on&&(r=t.on,i=t.off),!r&&!i)throw Error("target does not implement any known event API");if("function"!=typeof r)throw TypeError("on method must be a function");if("function"!=typeof i)throw TypeError("off method must be a function");this._on=r,this._off=i;var o=e._observers;o?o.push(this):e._observers=[this]}function m(e,r,i,o){var a=Object.assign({},r);if(!e)return a;if("object"!=typeof e)throw TypeError("options must be an object");var s,u,l,c=Object.keys(e),d=c.length;function f(e){throw Error('Invalid "'+s+'" option value'+(e?". Reason: "+e:""))}for(var h=0;h<d;h++){if(s=c[h],!o&&!n.call(r,s))throw Error('Unknown "'+s+'" option');(u=e[s])!==t&&(l=i[s],a[s]=l?l(u,f):u)}return a}function g(e,t){return"function"==typeof e&&e.hasOwnProperty("prototype")||t("value must be a constructor"),e}function v(e){var t="value must be type of "+e.join("|"),n=e.length,r=e[0],i=e[1];return 1===n?function(e,n){if(typeof e===r)return e;n(t)}:2===n?function(e,n){var o=typeof e;if(o===r||o===i)return e;n(t)}:function(r,i){for(var o=typeof r,a=n;a-- >0;)if(o===e[a])return r;i(t)}}Object.assign(p.prototype,{subscribe:function(e,t,n){var r=this,i=this._target,o=this._emitter,a=this._listeners,s=function(){var r=f.apply(null,arguments),a={data:r,name:t,original:e};n?!1!==n.call(i,a)&&o.emit.apply(o,[a.name].concat(r)):o.emit.apply(o,[t].concat(r))};if(a[e])throw Error("Event '"+e+"' is already listening");this._listenersCount++,o._newListener&&o._removeListener&&!r._onNewListener?(this._onNewListener=function(n){n===t&&null===a[e]&&(a[e]=s,r._on.call(i,e,s))},o.on("newListener",this._onNewListener),this._onRemoveListener=function(n){n===t&&!o.hasListeners(n)&&a[e]&&(a[e]=null,r._off.call(i,e,s))},a[e]=null,o.on("removeListener",this._onRemoveListener)):(a[e]=s,r._on.call(i,e,s))},unsubscribe:function(e){var t,n,r,i=this,o=this._listeners,a=this._emitter,s=this._off,l=this._target;if(e&&"string"!=typeof e)throw TypeError("event must be a string");function c(){i._onNewListener&&(a.off("newListener",i._onNewListener),a.off("removeListener",i._onRemoveListener),i._onNewListener=null,i._onRemoveListener=null);var e=_.call(a,i);a._observers.splice(e,1)}if(e){if(!(t=o[e]))return;s.call(l,e,t),delete o[e],--this._listenersCount||c()}else{for(r=(n=u(o)).length;r-- >0;)e=n[r],s.call(l,e,o[e]);this._listeners={},this._listenersCount=0,c()}}});var y=v(["function"]),w=v(["object","function"]);function A(e,t,n){var r,i,o,a=0,s=new e((function(u,l,c){function d(){i&&(i=null),a&&(clearTimeout(a),a=0)}n=m(n,{timeout:0,overload:!1},{timeout:function(e,t){return("number"!=typeof(e*=1)||e<0||!Number.isFinite(e))&&t("timeout must be a positive number"),e}}),r=!n.overload&&"function"==typeof e.prototype.cancel&&"function"==typeof c;var f=function(e){d(),u(e)},h=function(e){d(),l(e)};r?t(f,h,c):(i=[function(e){h(e||Error("canceled"))}],t(f,h,(function(e){if(o)throw Error("Unable to subscribe on cancel event asynchronously");if("function"!=typeof e)throw TypeError("onCancel callback must be a function");i.push(e)})),o=!0),n.timeout>0&&(a=setTimeout((function(){var e=Error("timeout");e.code="ETIMEDOUT",a=0,s.cancel(e),l(e)}),n.timeout))}));return r||(s.cancel=function(e){if(i){for(var t=i.length,n=1;n<t;n++)i[n](e);i[0](e),i=null}}),s}function _(e){var t=this._observers;if(!t)return-1;for(var n=t.length,r=0;r<n;r++)if(t[r]._target===e)return r;return-1}function E(e,t,n,r,i){if(!n)return null;if(0===r){var o=typeof t;if("string"===o){var a,s,l=0,c=0,d=this.delimiter,f=d.length;if(-1!==(s=t.indexOf(d))){a=new Array(5);do{a[l++]=t.slice(c,s),c=s+f}while(-1!==(s=t.indexOf(d,c)));a[l++]=t.slice(c),t=a,i=l}else t=[t],i=1}else"object"===o?i=t.length:(t=[t],i=1)}var h,p,m,g,v,y,b,w=null,A=t[r],_=t[r+1];if(r===i)n._listeners&&("function"==typeof n._listeners?(e&&e.push(n._listeners),w=[n]):(e&&e.push.apply(e,n._listeners),w=[n]));else{if("*"===A){for(s=(y=u(n)).length;s-- >0;)"_listeners"!==(h=y[s])&&(b=E(e,t,n[h],r+1,i))&&(w?w.push.apply(w,b):w=b);return w}if("**"===A){for((v=r+1===i||r+2===i&&"*"===_)&&n._listeners&&(w=E(e,t,n,i,i)),s=(y=u(n)).length;s-- >0;)"_listeners"!==(h=y[s])&&("*"===h||"**"===h?(n[h]._listeners&&!v&&(b=E(e,t,n[h],i,i))&&(w?w.push.apply(w,b):w=b),b=E(e,t,n[h],r,i)):b=E(e,t,n[h],h===_?r+2:r,i),b&&(w?w.push.apply(w,b):w=b));return w}n[A]&&(w=E(e,t,n[A],r+1,i))}if((p=n["*"])&&E(e,t,p,r+1,i),m=n["**"])if(r<i)for(m._listeners&&E(e,t,m,i,i),s=(y=u(m)).length;s-- >0;)"_listeners"!==(h=y[s])&&(h===_?E(e,t,m[h],r+2,i):h===A?E(e,t,m[h],r+1,i):((g={})[h]=m[h],E(e,t,{"**":g},r+1,i)));else m._listeners?E(e,t,m,i,i):m["*"]&&m["*"]._listeners&&E(e,t,m["*"],i,i);return w}function S(e,t,n){var r,i,o=0,a=0,s=this.delimiter,u=s.length;if("string"==typeof e)if(-1!==(r=e.indexOf(s))){i=new Array(5);do{i[o++]=e.slice(a,r),a=r+u}while(-1!==(r=e.indexOf(s,a)));i[o++]=e.slice(a)}else i=[e],o=1;else i=e,o=e.length;if(o>1)for(r=0;r+1<o;r++)if("**"===i[r]&&"**"===i[r+1])return;var l,c=this.listenerTree;for(r=0;r<o;r++)if(c=c[l=i[r]]||(c[l]={}),r===o-1)return c._listeners?("function"==typeof c._listeners&&(c._listeners=[c._listeners]),n?c._listeners.unshift(t):c._listeners.push(t),!c._listeners.warned&&this._maxListeners>0&&c._listeners.length>this._maxListeners&&(c._listeners.warned=!0,d.call(this,c._listeners.length,l))):c._listeners=t,!0;return!0}function k(e,t,n,r){for(var i,o,a,s,l=u(e),c=l.length,d=e._listeners;c-- >0;)i=e[o=l[c]],a="_listeners"===o?n:n?n.concat(o):[o],s=r||"symbol"==typeof o,d&&t.push(s?a:a.join(this.delimiter)),"object"==typeof i&&k.call(this,i,t,a,s);return t}function M(e){for(var t,n,r,i=u(e),o=i.length;o-- >0;)(t=e[n=i[o]])&&(r=!0,"_listeners"===n||M(t)||delete e[n]);return r}function C(e,t,n){this.emitter=e,this.event=t,this.listener=n}function x(e,n,r){if(!0===r)a=!0;else if(!1===r)o=!0;else{if(!r||"object"!=typeof r)throw TypeError("options should be an object or true");var o=r.async,a=r.promisify,u=r.nextTick,l=r.objectify}if(o||u||a){var c=n,d=n._origin||n;if(u&&!i)throw Error("process.nextTick is not supported");a===t&&(a="AsyncFunction"===n.constructor.name),n=function(){var e=arguments,t=this,n=this.event;return a?u?Promise.resolve():new Promise((function(e){s(e)})).then((function(){return t.event=n,c.apply(t,e)})):(u?b:s)((function(){t.event=n,c.apply(t,e)}))},n._async=!0,n._origin=d}return[n,l?new C(this,e,n):this]}function R(e){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,c.call(this,e)}C.prototype.off=function(){return this.emitter.off(this.event,this.listener),this},R.EventEmitter2=R,R.prototype.listenTo=function(e,n,i){if("object"!=typeof e)throw TypeError("target musts be an object");var o=this;function a(t){if("object"!=typeof t)throw TypeError("events must be an object");var n,r=i.reducers,a=_.call(o,e);n=-1===a?new p(o,e,i):o._observers[a];for(var s,l=u(t),c=l.length,d="function"==typeof r,f=0;f<c;f++)s=l[f],n.subscribe(s,t[s]||s,d?r:r&&r[s])}return i=m(i,{on:t,off:t,reducers:t},{on:y,off:y,reducers:w}),r(n)?a(h(n)):a("string"==typeof n?h(n.split(/\s+/)):n),this},R.prototype.stopListeningTo=function(e,t){var n=this._observers;if(!n)return!1;var r,i=n.length,o=!1;if(e&&"object"!=typeof e)throw TypeError("target should be an object");for(;i-- >0;)r=n[i],e&&r._target!==e||(r.unsubscribe(t),o=!0);return o},R.prototype.delimiter=".",R.prototype.setMaxListeners=function(e){e!==t&&(this._maxListeners=e,this._conf||(this._conf={}),this._conf.maxListeners=e)},R.prototype.getMaxListeners=function(){return this._maxListeners},R.prototype.event="",R.prototype.once=function(e,t,n){return this._once(e,t,!1,n)},R.prototype.prependOnceListener=function(e,t,n){return this._once(e,t,!0,n)},R.prototype._once=function(e,t,n,r){return this._many(e,1,t,n,r)},R.prototype.many=function(e,t,n,r){return this._many(e,t,n,!1,r)},R.prototype.prependMany=function(e,t,n,r){return this._many(e,t,n,!0,r)},R.prototype._many=function(e,t,n,r,i){var o=this;if("function"!=typeof n)throw new Error("many only accepts instances of Function");function a(){return 0==--t&&o.off(e,a),n.apply(this,arguments)}return a._origin=n,this._on(e,a,r,i)},R.prototype.emit=function(){if(!this._events&&!this._all)return!1;this._events||l.call(this);var e,t,n,r,i,a,s=arguments[0],u=this.wildcard;if("newListener"===s&&!this._newListener&&!this._events.newListener)return!1;if(u&&(e=s,"newListener"!==s&&"removeListener"!==s&&"object"==typeof s)){if(n=s.length,o)for(r=0;r<n;r++)if("symbol"==typeof s[r]){a=!0;break}a||(s=s.join(this.delimiter))}var c,d=arguments.length;if(this._all&&this._all.length)for(r=0,n=(c=this._all.slice()).length;r<n;r++)switch(this.event=s,d){case 1:c[r].call(this,s);break;case 2:c[r].call(this,s,arguments[1]);break;case 3:c[r].call(this,s,arguments[1],arguments[2]);break;default:c[r].apply(this,arguments)}if(u)c=[],E.call(this,c,e,this.listenerTree,0,n);else{if("function"==typeof(c=this._events[s])){switch(this.event=s,d){case 1:c.call(this);break;case 2:c.call(this,arguments[1]);break;case 3:c.call(this,arguments[1],arguments[2]);break;default:for(t=new Array(d-1),i=1;i<d;i++)t[i-1]=arguments[i];c.apply(this,t)}return!0}c&&(c=c.slice())}if(c&&c.length){if(d>3)for(t=new Array(d-1),i=1;i<d;i++)t[i-1]=arguments[i];for(r=0,n=c.length;r<n;r++)switch(this.event=s,d){case 1:c[r].call(this);break;case 2:c[r].call(this,arguments[1]);break;case 3:c[r].call(this,arguments[1],arguments[2]);break;default:c[r].apply(this,t)}return!0}if(!this.ignoreErrors&&!this._all&&"error"===s)throw arguments[1]instanceof Error?arguments[1]:new Error("Uncaught, unspecified 'error' event.");return!!this._all},R.prototype.emitAsync=function(){if(!this._events&&!this._all)return!1;this._events||l.call(this);var e,t,n,r,i,a,s=arguments[0],u=this.wildcard;if("newListener"===s&&!this._newListener&&!this._events.newListener)return Promise.resolve([!1]);if(u&&(e=s,"newListener"!==s&&"removeListener"!==s&&"object"==typeof s)){if(r=s.length,o)for(i=0;i<r;i++)if("symbol"==typeof s[i]){t=!0;break}t||(s=s.join(this.delimiter))}var c,d=[],f=arguments.length;if(this._all)for(i=0,r=this._all.length;i<r;i++)switch(this.event=s,f){case 1:d.push(this._all[i].call(this,s));break;case 2:d.push(this._all[i].call(this,s,arguments[1]));break;case 3:d.push(this._all[i].call(this,s,arguments[1],arguments[2]));break;default:d.push(this._all[i].apply(this,arguments))}if(u?(c=[],E.call(this,c,e,this.listenerTree,0)):c=this._events[s],"function"==typeof c)switch(this.event=s,f){case 1:d.push(c.call(this));break;case 2:d.push(c.call(this,arguments[1]));break;case 3:d.push(c.call(this,arguments[1],arguments[2]));break;default:for(n=new Array(f-1),a=1;a<f;a++)n[a-1]=arguments[a];d.push(c.apply(this,n))}else if(c&&c.length){if(c=c.slice(),f>3)for(n=new Array(f-1),a=1;a<f;a++)n[a-1]=arguments[a];for(i=0,r=c.length;i<r;i++)switch(this.event=s,f){case 1:d.push(c[i].call(this));break;case 2:d.push(c[i].call(this,arguments[1]));break;case 3:d.push(c[i].call(this,arguments[1],arguments[2]));break;default:d.push(c[i].apply(this,n))}}else if(!this.ignoreErrors&&!this._all&&"error"===s)return arguments[1]instanceof Error?Promise.reject(arguments[1]):Promise.reject("Uncaught, unspecified 'error' event.");return Promise.all(d)},R.prototype.on=function(e,t,n){return this._on(e,t,!1,n)},R.prototype.prependListener=function(e,t,n){return this._on(e,t,!0,n)},R.prototype.onAny=function(e){return this._onAny(e,!1)},R.prototype.prependAny=function(e){return this._onAny(e,!0)},R.prototype.addListener=R.prototype.on,R.prototype._onAny=function(e,t){if("function"!=typeof e)throw new Error("onAny only accepts instances of Function");return this._all||(this._all=[]),t?this._all.unshift(e):this._all.push(e),this},R.prototype._on=function(e,n,r,i){if("function"==typeof e)return this._onAny(e,n),this;if("function"!=typeof n)throw new Error("on only accepts instances of Function");this._events||l.call(this);var o,a=this;return i!==t&&(n=(o=x.call(this,e,n,i))[0],a=o[1]),this._newListener&&this.emit("newListener",e,n),this.wildcard?(S.call(this,e,n,r),a):(this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),r?this._events[e].unshift(n):this._events[e].push(n),!this._events[e].warned&&this._maxListeners>0&&this._events[e].length>this._maxListeners&&(this._events[e].warned=!0,d.call(this,this._events[e].length,e))):this._events[e]=n,a)},R.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var n,i=[];if(this.wildcard){var o="string"==typeof e?e.split(this.delimiter):e.slice();if(!(i=E.call(this,null,o,this.listenerTree,0)))return this}else{if(!this._events[e])return this;n=this._events[e],i.push({_listeners:n})}for(var a=0;a<i.length;a++){var s=i[a];if(n=s._listeners,r(n)){for(var u=-1,l=0,c=n.length;l<c;l++)if(n[l]===t||n[l].listener&&n[l].listener===t||n[l]._origin&&n[l]._origin===t){u=l;break}if(u<0)continue;return this.wildcard?s._listeners.splice(u,1):this._events[e].splice(u,1),0===n.length&&(this.wildcard?delete s._listeners:delete this._events[e]),this._removeListener&&this.emit("removeListener",e,t),this}(n===t||n.listener&&n.listener===t||n._origin&&n._origin===t)&&(this.wildcard?delete s._listeners:delete this._events[e],this._removeListener&&this.emit("removeListener",e,t))}return this.listenerTree&&M(this.listenerTree),this},R.prototype.offAny=function(e){var t,n=0,r=0;if(e&&this._all&&this._all.length>0){for(n=0,r=(t=this._all).length;n<r;n++)if(e===t[n])return t.splice(n,1),this._removeListener&&this.emit("removeListenerAny",e),this}else{if(t=this._all,this._removeListener)for(n=0,r=t.length;n<r;n++)this.emit("removeListenerAny",t[n]);this._all=[]}return this},R.prototype.removeListener=R.prototype.off,R.prototype.removeAllListeners=function(e){if(e===t)return!this._events||l.call(this),this;if(this.wildcard){var n,r=E.call(this,null,e,this.listenerTree,0);if(!r)return this;for(n=0;n<r.length;n++)r[n]._listeners=null;this.listenerTree&&M(this.listenerTree)}else this._events&&(this._events[e]=null);return this},R.prototype.listeners=function(e){var n,r,i,o,a,s=this._events;if(e===t){if(this.wildcard)throw Error("event name required for wildcard emitter");if(!s)return[];for(o=(n=u(s)).length,i=[];o-- >0;)"function"==typeof(r=s[n[o]])?i.push(r):i.push.apply(i,r);return i}if(this.wildcard){if(!(a=this.listenerTree))return[];var l=[],c="string"==typeof e?e.split(this.delimiter):e.slice();return E.call(this,l,c,a,0),l}return s&&(r=s[e])?"function"==typeof r?[r]:r:[]},R.prototype.eventNames=function(e){var t=this._events;return this.wildcard?k.call(this,this.listenerTree,[],null,e):t?u(t):[]},R.prototype.listenerCount=function(e){return this.listeners(e).length},R.prototype.hasListeners=function(e){if(this.wildcard){var n=[],r="string"==typeof e?e.split(this.delimiter):e.slice();return E.call(this,n,r,this.listenerTree,0),n.length>0}var i=this._events,o=this._all;return!!(o&&o.length||i&&(e===t?u(i).length:i[e]))},R.prototype.listenersAny=function(){return this._all?this._all:[]},R.prototype.waitFor=function(e,n){var r=this,i=typeof n;return"number"===i?n={timeout:n}:"function"===i&&(n={filter:n}),A((n=m(n,{timeout:0,filter:t,handleError:!1,Promise:Promise,overload:!1},{filter:y,Promise:g})).Promise,(function(t,i,o){function a(){var o=n.filter;if(!o||o.apply(r,arguments))if(r.off(e,a),n.handleError){var s=arguments[0];s?i(s):t(f.apply(null,arguments).slice(1))}else t(f.apply(null,arguments))}o((function(){r.off(e,a)})),r._on(e,a,!1)}),{timeout:n.timeout,overload:n.overload})};var O=R.prototype;Object.defineProperties(R,{defaultMaxListeners:{get:function(){return O._maxListeners},set:function(e){if("number"!=typeof e||e<0||Number.isNaN(e))throw TypeError("n must be a non-negative number");O._maxListeners=e},enumerable:!0},once:{value:function(e,t,n){return A((n=m(n,{Promise:Promise,timeout:0,overload:!1},{Promise:g})).Promise,(function(n,r,i){var o;if("function"==typeof e.addEventListener)return o=function(){n(f.apply(null,arguments))},i((function(){e.removeEventListener(t,o)})),void e.addEventListener(t,o,{once:!0});var a,s=function(){a&&e.removeListener("error",a),n(f.apply(null,arguments))};"error"!==t&&(a=function(n){e.removeListener(t,s),r(n)},e.once("error",a)),i((function(){a&&e.removeListener("error",a),e.removeListener(t,s)})),e.once(t,s)}),{timeout:n.timeout,overload:n.overload})},writable:!0,configurable:!0}}),Object.defineProperties(O,{_maxListeners:{value:10,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),"function"==typeof t&&t.amd?t((function(){return R})):e.exports=R}()}(ZM);var XM=i(ZM.exports);function JM(e){return JM="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},JM(e)}function eC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function tC(e){var t=function(e,t){if("object"!==JM(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==JM(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===JM(t)?t:String(t)}function nC(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,tC(r.key),r)}}function rC(e,t,n){return t&&nC(e.prototype,t),n&&nC(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function iC(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function oC(e,t){return oC=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},oC(e,t)}function aC(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&oC(e,t)}function sC(e,t){if(t&&("object"===JM(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return iC(e)}function uC(e){return uC=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},uC(e)}function lC(e,t,n){return(t=tC(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function cC(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function dC(e){return function(e){if(Array.isArray(e))return e}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return cC(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?cC(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function fC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function hC(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?fC(Object(n),!0).forEach((function(t){lC(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fC(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var pC={type:"logger",log:function(e){this.output("log",e)},warn:function(e){this.output("warn",e)},error:function(e){this.output("error",e)},output:function(e,t){console&&console[e]&&console[e].apply(console,t)}},mC=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};eC(this,e),this.init(t,n)}return rC(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||pC,this.options=t,this.debug=t.debug}},{key:"setDebug",value:function(e){this.debug=e}},{key:"log",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"log","",!0)}},{key:"warn",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","",!0)}},{key:"error",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"error","")}},{key:"deprecate",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}},{key:"forward",value:function(e,t,n,r){return r&&!this.debug?null:("string"==typeof e[0]&&(e[0]="".concat(n).concat(this.prefix," ").concat(e[0])),this.logger[t](e))}},{key:"create",value:function(t){return new e(this.logger,hC(hC({},{prefix:"".concat(this.prefix,":").concat(t,":")}),this.options))}},{key:"clone",value:function(t){return(t=t||this.options).prefix=t.prefix||this.prefix,new e(this.logger,t)}}]),e}(),gC=new mC,vC=function(){function e(){eC(this,e),this.observers={}}return rC(e,[{key:"on",value:function(e,t){var n=this;return e.split(" ").forEach((function(e){n.observers[e]=n.observers[e]||[],n.observers[e].push(t)})),this}},{key:"off",value:function(e,t){this.observers[e]&&(t?this.observers[e]=this.observers[e].filter((function(e){return e!==t})):delete this.observers[e])}},{key:"emit",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];this.observers[e]&&[].concat(this.observers[e]).forEach((function(e){e.apply(void 0,n)})),this.observers["*"]&&[].concat(this.observers["*"]).forEach((function(t){t.apply(t,[e].concat(n))}))}}]),e}();function yC(){var e,t,n=new Promise((function(n,r){e=n,t=r}));return n.resolve=e,n.reject=t,n}function bC(e){return null==e?"":""+e}function wC(e,t,n){function r(e){return e&&e.indexOf("###")>-1?e.replace(/###/g,"."):e}function i(){return!e||"string"==typeof e}for(var o="string"!=typeof t?[].concat(t):t.split(".");o.length>1;){if(i())return{};var a=r(o.shift());!e[a]&&n&&(e[a]=new n),e=Object.prototype.hasOwnProperty.call(e,a)?e[a]:{}}return i()?{}:{obj:e,k:r(o.shift())}}function AC(e,t,n){var r=wC(e,t,Object);r.obj[r.k]=n}function _C(e,t){var n=wC(e,t),r=n.obj,i=n.k;if(r)return r[i]}function EC(e,t,n){for(var r in t)"__proto__"!==r&&"constructor"!==r&&(r in e?"string"==typeof e[r]||e[r]instanceof String||"string"==typeof t[r]||t[r]instanceof String?n&&(e[r]=t[r]):EC(e[r],t[r],n):e[r]=t[r]);return e}function SC(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var kC={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function MC(e){return"string"==typeof e?e.replace(/[&<>"'\/]/g,(function(e){return kC[e]})):e}var CC="undefined"!=typeof window&&window.navigator&&void 0===window.navigator.userAgentData&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,xC=[" ",",","?","!",";"];function RC(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".";if(e){if(e[t])return e[t];for(var r=t.split(n),i=e,o=0;o<r.length;++o){if(!i)return;if("string"==typeof i[r[o]]&&o+1<r.length)return;if(void 0===i[r[o]]){for(var a=2,s=r.slice(o,o+a).join(n),u=i[s];void 0===u&&r.length>o+a;)a++,u=i[s=r.slice(o,o+a).join(n)];if(void 0===u)return;if(null===u)return null;if(t.endsWith(s)){if("string"==typeof u)return u;if(s&&"string"==typeof u[s])return u[s]}var l=r.slice(o+a).join(n);return l?RC(u,l,n):void 0}i=i[r[o]]}return i}}function OC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function TC(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?OC(Object(n),!0).forEach((function(t){lC(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):OC(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function PC(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=uC(e);if(t){var i=uC(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return sC(this,n)}}var LC=function(e){aC(n,e);var t=PC(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};return eC(this,n),r=t.call(this),CC&&vC.call(iC(r)),r.data=e||{},r.options=i,void 0===r.options.keySeparator&&(r.options.keySeparator="."),void 0===r.options.ignoreJSONStructure&&(r.options.ignoreJSONStructure=!0),r}return rC(n,[{key:"addNamespaces",value:function(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}},{key:"removeNamespaces",value:function(e){var t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}},{key:"getResource",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator,o=void 0!==r.ignoreJSONStructure?r.ignoreJSONStructure:this.options.ignoreJSONStructure,a=[e,t];n&&"string"!=typeof n&&(a=a.concat(n)),n&&"string"==typeof n&&(a=a.concat(i?n.split(i):n)),e.indexOf(".")>-1&&(a=e.split("."));var s=_C(this.data,a);return s||!o||"string"!=typeof n?s:RC(this.data&&this.data[e]&&this.data[e][t],n,i)}},{key:"addResource",value:function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1},o=void 0!==i.keySeparator?i.keySeparator:this.options.keySeparator,a=[e,t];n&&(a=a.concat(o?n.split(o):n)),e.indexOf(".")>-1&&(r=t,t=(a=e.split("."))[1]),this.addNamespaces(t),AC(this.data,a,r),i.silent||this.emit("added",e,t,n,r)}},{key:"addResources",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(var i in n)"string"!=typeof n[i]&&"[object Array]"!==Object.prototype.toString.apply(n[i])||this.addResource(e,t,i,n[i],{silent:!0});r.silent||this.emit("added",e,t,n)}},{key:"addResourceBundle",value:function(e,t,n,r,i){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1},a=[e,t];e.indexOf(".")>-1&&(r=n,n=t,t=(a=e.split("."))[1]),this.addNamespaces(t);var s=_C(this.data,a)||{};r?EC(s,n,i):s=TC(TC({},s),n),AC(this.data,a,s),o.silent||this.emit("added",e,t,n)}},{key:"removeResourceBundle",value:function(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}},{key:"hasResourceBundle",value:function(e,t){return void 0!==this.getResource(e,t)}},{key:"getResourceBundle",value:function(e,t){return t||(t=this.options.defaultNS),"v1"===this.options.compatibilityAPI?TC(TC({},{}),this.getResource(e,t)):this.getResource(e,t)}},{key:"getDataByLanguage",value:function(e){return this.data[e]}},{key:"hasLanguageSomeTranslations",value:function(e){var t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find((function(e){return t[e]&&Object.keys(t[e]).length>0}))}},{key:"toJSON",value:function(){return this.data}}]),n}(vC),IC={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,t,n,r,i){var o=this;return e.forEach((function(e){o.processors[e]&&(t=o.processors[e].process(t,n,r,i))})),t}};function NC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function DC(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?NC(Object(n),!0).forEach((function(t){lC(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):NC(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function BC(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=uC(e);if(t){var i=uC(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return sC(this,n)}}var jC={},UC=function(e){aC(n,e);var t=BC(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return eC(this,n),r=t.call(this),CC&&vC.call(iC(r)),function(e,t,n){e.forEach((function(e){t[e]&&(n[e]=t[e])}))}(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,iC(r)),r.options=i,void 0===r.options.keySeparator&&(r.options.keySeparator="."),r.logger=gC.create("translator"),r}return rC(n,[{key:"changeLanguage",value:function(e){e&&(this.language=e)}},{key:"exists",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};if(null==e)return!1;var n=this.resolve(e,t);return n&&void 0!==n.res}},{key:"extractFromKey",value:function(e,t){var n=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===n&&(n=":");var r=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,i=t.ns||this.options.defaultNS||[],o=n&&e.indexOf(n)>-1,a=!(this.options.userDefinedKeySeparator||t.keySeparator||this.options.userDefinedNsSeparator||t.nsSeparator||function(e,t,n){t=t||"",n=n||"";var r=xC.filter((function(e){return t.indexOf(e)<0&&n.indexOf(e)<0}));if(0===r.length)return!0;var i=new RegExp("(".concat(r.map((function(e){return"?"===e?"\\?":e})).join("|"),")")),o=!i.test(e);if(!o){var a=e.indexOf(n);a>0&&!i.test(e.substring(0,a))&&(o=!0)}return o}(e,n,r));if(o&&!a){var s=e.match(this.interpolator.nestingRegexp);if(s&&s.length>0)return{key:e,namespaces:i};var u=e.split(n);(n!==r||n===r&&this.options.ns.indexOf(u[0])>-1)&&(i=u.shift()),e=u.join(r)}return"string"==typeof i&&(i=[i]),{key:e,namespaces:i}}},{key:"translate",value:function(e,t,r){var i=this;if("object"!==JM(t)&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),"object"===JM(t)&&(t=DC({},t)),t||(t={}),null==e)return"";Array.isArray(e)||(e=[String(e)]);var o=void 0!==t.returnDetails?t.returnDetails:this.options.returnDetails,a=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,s=this.extractFromKey(e[e.length-1],t),u=s.key,l=s.namespaces,c=l[l.length-1],d=t.lng||this.language,f=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d&&"cimode"===d.toLowerCase()){if(f){var h=t.nsSeparator||this.options.nsSeparator;return o?{res:"".concat(c).concat(h).concat(u),usedKey:u,exactUsedKey:u,usedLng:d,usedNS:c}:"".concat(c).concat(h).concat(u)}return o?{res:u,usedKey:u,exactUsedKey:u,usedLng:d,usedNS:c}:u}var p=this.resolve(e,t),m=p&&p.res,g=p&&p.usedKey||u,v=p&&p.exactUsedKey||u,y=Object.prototype.toString.apply(m),b=void 0!==t.joinArrays?t.joinArrays:this.options.joinArrays,w=!this.i18nFormat||this.i18nFormat.handleAsObject;if(w&&m&&"string"!=typeof m&&"boolean"!=typeof m&&"number"!=typeof m&&["[object Number]","[object Function]","[object RegExp]"].indexOf(y)<0&&("string"!=typeof b||"[object Array]"!==y)){if(!t.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");var A=this.options.returnedObjectHandler?this.options.returnedObjectHandler(g,m,DC(DC({},t),{},{ns:l})):"key '".concat(u," (").concat(this.language,")' returned an object instead of string.");return o?(p.res=A,p):A}if(a){var _="[object Array]"===y,E=_?[]:{},S=_?v:g;for(var k in m)if(Object.prototype.hasOwnProperty.call(m,k)){var M="".concat(S).concat(a).concat(k);E[k]=this.translate(M,DC(DC({},t),{joinArrays:!1,ns:l})),E[k]===M&&(E[k]=m[k])}m=E}}else if(w&&"string"==typeof b&&"[object Array]"===y)(m=m.join(b))&&(m=this.extendTranslation(m,e,t,r));else{var C=!1,x=!1,R=void 0!==t.count&&"string"!=typeof t.count,O=n.hasDefaultValue(t),T=R?this.pluralResolver.getSuffix(d,t.count,t):"",P=t["defaultValue".concat(T)]||t.defaultValue;!this.isValidLookup(m)&&O&&(C=!0,m=P),this.isValidLookup(m)||(x=!0,m=u);var L=(t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&x?void 0:m,I=O&&P!==m&&this.options.updateMissing;if(x||C||I){if(this.logger.log(I?"updateKey":"missingKey",d,c,u,I?P:m),a){var N=this.resolve(u,DC(DC({},t),{},{keySeparator:!1}));N&&N.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}var D=[],B=this.languageUtils.getFallbackCodes(this.options.fallbackLng,t.lng||this.language);if("fallback"===this.options.saveMissingTo&&B&&B[0])for(var j=0;j<B.length;j++)D.push(B[j]);else"all"===this.options.saveMissingTo?D=this.languageUtils.toResolveHierarchy(t.lng||this.language):D.push(t.lng||this.language);var U=function(e,n,r){var o=O&&r!==m?r:L;i.options.missingKeyHandler?i.options.missingKeyHandler(e,c,n,o,I,t):i.backendConnector&&i.backendConnector.saveMissing&&i.backendConnector.saveMissing(e,c,n,o,I,t),i.emit("missingKey",e,c,n,m)};this.options.saveMissing&&(this.options.saveMissingPlurals&&R?D.forEach((function(e){i.pluralResolver.getSuffixes(e,t).forEach((function(n){U([e],u+n,t["defaultValue".concat(n)]||P)}))})):U(D,u,P))}m=this.extendTranslation(m,e,t,p,r),x&&m===u&&this.options.appendNamespaceToMissingKey&&(m="".concat(c,":").concat(u)),(x||C)&&this.options.parseMissingKeyHandler&&(m="v1"!==this.options.compatibilityAPI?this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?"".concat(c,":").concat(u):u,C?m:void 0):this.options.parseMissingKeyHandler(m))}return o?(p.res=m,p):m}},{key:"extendTranslation",value:function(e,t,n,r,i){var o=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,DC(DC({},this.options.interpolation.defaultVariables),n),r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init(DC(DC({},n),{interpolation:DC(DC({},this.options.interpolation),n.interpolation)}));var a,s="string"==typeof e&&(n&&n.interpolation&&void 0!==n.interpolation.skipOnVariables?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);if(s){var u=e.match(this.interpolator.nestingRegexp);a=u&&u.length}var l=n.replace&&"string"!=typeof n.replace?n.replace:n;if(this.options.interpolation.defaultVariables&&(l=DC(DC({},this.options.interpolation.defaultVariables),l)),e=this.interpolator.interpolate(e,l,n.lng||this.language,n),s){var c=e.match(this.interpolator.nestingRegexp);a<(c&&c.length)&&(n.nest=!1)}!n.lng&&"v1"!==this.options.compatibilityAPI&&r&&r.res&&(n.lng=r.usedLng),!1!==n.nest&&(e=this.interpolator.nest(e,(function(){for(var e=arguments.length,r=new Array(e),a=0;a<e;a++)r[a]=arguments[a];return i&&i[0]===r[0]&&!n.context?(o.logger.warn("It seems you are nesting recursively key: ".concat(r[0]," in key: ").concat(t[0])),null):o.translate.apply(o,r.concat([t]))}),n)),n.interpolation&&this.interpolator.reset()}var d=n.postProcess||this.options.postProcess,f="string"==typeof d?[d]:d;return null!=e&&f&&f.length&&!1!==n.applyPostProcessor&&(e=IC.handle(f,e,t,this.options&&this.options.postProcessPassResolved?DC({i18nResolved:r},n):n,this)),e}},{key:"resolve",value:function(e){var t,n,r,i,o,a=this,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return"string"==typeof e&&(e=[e]),e.forEach((function(e){if(!a.isValidLookup(t)){var u=a.extractFromKey(e,s),l=u.key;n=l;var c=u.namespaces;a.options.fallbackNS&&(c=c.concat(a.options.fallbackNS));var d=void 0!==s.count&&"string"!=typeof s.count,f=d&&!s.ordinal&&0===s.count&&a.pluralResolver.shouldUseIntlApi(),h=void 0!==s.context&&("string"==typeof s.context||"number"==typeof s.context)&&""!==s.context,p=s.lngs?s.lngs:a.languageUtils.toResolveHierarchy(s.lng||a.language,s.fallbackLng);c.forEach((function(e){a.isValidLookup(t)||(o=e,!jC["".concat(p[0],"-").concat(e)]&&a.utils&&a.utils.hasLoadedNamespace&&!a.utils.hasLoadedNamespace(o)&&(jC["".concat(p[0],"-").concat(e)]=!0,a.logger.warn('key "'.concat(n,'" for languages "').concat(p.join(", "),'" won\'t get resolved as namespace "').concat(o,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),p.forEach((function(n){if(!a.isValidLookup(t)){i=n;var o,u=[l];if(a.i18nFormat&&a.i18nFormat.addLookupKeys)a.i18nFormat.addLookupKeys(u,l,n,e,s);else{var c;d&&(c=a.pluralResolver.getSuffix(n,s.count,s));var p="".concat(a.options.pluralSeparator,"zero");if(d&&(u.push(l+c),f&&u.push(l+p)),h){var m="".concat(l).concat(a.options.contextSeparator).concat(s.context);u.push(m),d&&(u.push(m+c),f&&u.push(m+p))}}for(;o=u.pop();)a.isValidLookup(t)||(r=o,t=a.getResource(n,e,o,s))}})))}))}})),{res:t,usedKey:n,exactUsedKey:r,usedLng:i,usedNS:o}}},{key:"isValidLookup",value:function(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}},{key:"getResource",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,n,r):this.resourceStore.getResource(e,t,n,r)}}],[{key:"hasDefaultValue",value:function(e){var t="defaultValue";for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t===n.substring(0,12)&&void 0!==e[n])return!0;return!1}}]),n}(vC);function zC(e){return e.charAt(0).toUpperCase()+e.slice(1)}var FC=function(){function e(t){eC(this,e),this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=gC.create("languageUtils")}return rC(e,[{key:"getScriptPartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return null;var t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}},{key:"getLanguagePartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return e;var t=e.split("-");return this.formatLanguageCode(t[0])}},{key:"formatLanguageCode",value:function(e){if("string"==typeof e&&e.indexOf("-")>-1){var t=["hans","hant","latn","cyrl","cans","mong","arab"],n=e.split("-");return this.options.lowerCaseLng?n=n.map((function(e){return e.toLowerCase()})):2===n.length?(n[0]=n[0].toLowerCase(),n[1]=n[1].toUpperCase(),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=zC(n[1].toLowerCase()))):3===n.length&&(n[0]=n[0].toLowerCase(),2===n[1].length&&(n[1]=n[1].toUpperCase()),"sgn"!==n[0]&&2===n[2].length&&(n[2]=n[2].toUpperCase()),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=zC(n[1].toLowerCase())),t.indexOf(n[2].toLowerCase())>-1&&(n[2]=zC(n[2].toLowerCase()))),n.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}},{key:"isSupportedCode",value:function(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}},{key:"getBestMatchFromCodes",value:function(e){var t,n=this;return e?(e.forEach((function(e){if(!t){var r=n.formatLanguageCode(e);n.options.supportedLngs&&!n.isSupportedCode(r)||(t=r)}})),!t&&this.options.supportedLngs&&e.forEach((function(e){if(!t){var r=n.getLanguagePartFromCode(e);if(n.isSupportedCode(r))return t=r;t=n.options.supportedLngs.find((function(e){return e===r?e:e.indexOf("-")<0&&r.indexOf("-")<0?void 0:0===e.indexOf(r)?e:void 0}))}})),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t):null}},{key:"getFallbackCodes",value:function(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),"string"==typeof e&&(e=[e]),"[object Array]"===Object.prototype.toString.apply(e))return e;if(!t)return e.default||[];var n=e[t];return n||(n=e[this.getScriptPartFromCode(t)]),n||(n=e[this.formatLanguageCode(t)]),n||(n=e[this.getLanguagePartFromCode(t)]),n||(n=e.default),n||[]}},{key:"toResolveHierarchy",value:function(e,t){var n=this,r=this.getFallbackCodes(t||this.options.fallbackLng||[],e),i=[],o=function(e){e&&(n.isSupportedCode(e)?i.push(e):n.logger.warn("rejecting language code not found in supportedLngs: ".concat(e)))};return"string"==typeof e&&e.indexOf("-")>-1?("languageOnly"!==this.options.load&&o(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&o(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&o(this.getLanguagePartFromCode(e))):"string"==typeof e&&o(this.formatLanguageCode(e)),r.forEach((function(e){i.indexOf(e)<0&&o(n.formatLanguageCode(e))})),i}}]),e}(),qC=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],WC={1:function(e){return Number(e>1)},2:function(e){return Number(1!=e)},3:function(e){return 0},4:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},5:function(e){return Number(0==e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5)},6:function(e){return Number(1==e?0:e>=2&&e<=4?1:2)},7:function(e){return Number(1==e?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},8:function(e){return Number(1==e?0:2==e?1:8!=e&&11!=e?2:3)},9:function(e){return Number(e>=2)},10:function(e){return Number(1==e?0:2==e?1:e<7?2:e<11?3:4)},11:function(e){return Number(1==e||11==e?0:2==e||12==e?1:e>2&&e<20?2:3)},12:function(e){return Number(e%10!=1||e%100==11)},13:function(e){return Number(0!==e)},14:function(e){return Number(1==e?0:2==e?1:3==e?2:3)},15:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2)},16:function(e){return Number(e%10==1&&e%100!=11?0:0!==e?1:2)},17:function(e){return Number(1==e||e%10==1&&e%100!=11?0:1)},18:function(e){return Number(0==e?0:1==e?1:2)},19:function(e){return Number(1==e?0:0==e||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3)},20:function(e){return Number(1==e?0:0==e||e%100>0&&e%100<20?1:2)},21:function(e){return Number(e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0)},22:function(e){return Number(1==e?0:2==e?1:(e<0||e>10)&&e%10==0?2:3)}},VC=["v1","v2","v3"],KC={zero:0,one:1,two:2,few:3,many:4,other:5},HC=function(){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};eC(this,e),this.languageUtils=t,this.options=r,this.logger=gC.create("pluralResolver"),this.options.compatibilityJSON&&"v4"!==this.options.compatibilityJSON||"undefined"!=typeof Intl&&Intl.PluralRules||(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=(n={},qC.forEach((function(e){e.lngs.forEach((function(t){n[t]={numbers:e.nr,plurals:WC[e.fc]}}))})),n)}return rC(e,[{key:"addRule",value:function(e,t){this.rules[e]=t}},{key:"getRule",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(e,{type:t.ordinal?"ordinal":"cardinal"})}catch(e){return}return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}},{key:"needsPlural",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.getRule(e,t);return this.shouldUseIntlApi()?n&&n.resolvedOptions().pluralCategories.length>1:n&&n.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.getSuffixes(e,n).map((function(e){return"".concat(t).concat(e)}))}},{key:"getSuffixes",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this.getRule(e,n);return r?this.shouldUseIntlApi()?r.resolvedOptions().pluralCategories.sort((function(e,t){return KC[e]-KC[t]})).map((function(e){return"".concat(t.options.prepend).concat(e)})):r.numbers.map((function(r){return t.getSuffix(e,r,n)})):[]}},{key:"getSuffix",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=this.getRule(e,n);return r?this.shouldUseIntlApi()?"".concat(this.options.prepend).concat(r.select(t)):this.getSuffixRetroCompatible(r,t):(this.logger.warn("no plural rule found for: ".concat(e)),"")}},{key:"getSuffixRetroCompatible",value:function(e,t){var n=this,r=e.noAbs?e.plurals(t):e.plurals(Math.abs(t)),i=e.numbers[r];this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]&&(2===i?i="plural":1===i&&(i=""));var o=function(){return n.options.prepend&&i.toString()?n.options.prepend+i.toString():i.toString()};return"v1"===this.options.compatibilityJSON?1===i?"":"number"==typeof i?"_plural_".concat(i.toString()):o():"v2"===this.options.compatibilityJSON||this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]?o():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}},{key:"shouldUseIntlApi",value:function(){return!VC.includes(this.options.compatibilityJSON)}}]),e}();function $C(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function YC(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?$C(Object(n),!0).forEach((function(t){lC(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$C(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function GC(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:".",i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],o=function(e,t,n){var r=_C(e,n);return void 0!==r?r:_C(t,n)}(e,t,n);return!o&&i&&"string"==typeof n&&void 0===(o=RC(e,n,r))&&(o=RC(t,n,r)),o}var QC=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};eC(this,e),this.logger=gC.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||function(e){return e},this.init(t)}return rC(e,[{key:"init",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});var t=e.interpolation;this.escape=void 0!==t.escape?t.escape:MC,this.escapeValue=void 0===t.escapeValue||t.escapeValue,this.useRawValueToEscape=void 0!==t.useRawValueToEscape&&t.useRawValueToEscape,this.prefix=t.prefix?SC(t.prefix):t.prefixEscaped||"{{",this.suffix=t.suffix?SC(t.suffix):t.suffixEscaped||"}}",this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||",",this.unescapePrefix=t.unescapeSuffix?"":t.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":t.unescapeSuffix||"",this.nestingPrefix=t.nestingPrefix?SC(t.nestingPrefix):t.nestingPrefixEscaped||SC("$t("),this.nestingSuffix=t.nestingSuffix?SC(t.nestingSuffix):t.nestingSuffixEscaped||SC(")"),this.nestingOptionsSeparator=t.nestingOptionsSeparator?t.nestingOptionsSeparator:t.nestingOptionsSeparator||",",this.maxReplaces=t.maxReplaces?t.maxReplaces:1e3,this.alwaysFormat=void 0!==t.alwaysFormat&&t.alwaysFormat,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var e="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(e,"g");var t="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(t,"g");var n="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(n,"g")}},{key:"interpolate",value:function(e,t,n,r){var i,o,a,s=this,u=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function l(e){return e.replace(/\$/g,"$$$$")}var c=function(e){if(e.indexOf(s.formatSeparator)<0){var i=GC(t,u,e,s.options.keySeparator,s.options.ignoreJSONStructure);return s.alwaysFormat?s.format(i,void 0,n,YC(YC(YC({},r),t),{},{interpolationkey:e})):i}var o=e.split(s.formatSeparator),a=o.shift().trim(),l=o.join(s.formatSeparator).trim();return s.format(GC(t,u,a,s.options.keySeparator,s.options.ignoreJSONStructure),l,n,YC(YC(YC({},r),t),{},{interpolationkey:a}))};this.resetRegExp();var d=r&&r.missingInterpolationHandler||this.options.missingInterpolationHandler,f=r&&r.interpolation&&void 0!==r.interpolation.skipOnVariables?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:function(e){return l(e)}},{regex:this.regexp,safeValue:function(e){return s.escapeValue?l(s.escape(e)):l(e)}}].forEach((function(t){for(a=0;i=t.regex.exec(e);){var n=i[1].trim();if(void 0===(o=c(n)))if("function"==typeof d){var u=d(e,i,r);o="string"==typeof u?u:""}else if(r&&Object.prototype.hasOwnProperty.call(r,n))o="";else{if(f){o=i[0];continue}s.logger.warn("missed to pass in variable ".concat(n," for interpolating ").concat(e)),o=""}else"string"==typeof o||s.useRawValueToEscape||(o=bC(o));var l=t.safeValue(o);if(e=e.replace(i[0],l),f?(t.regex.lastIndex+=o.length,t.regex.lastIndex-=i[0].length):t.regex.lastIndex=0,++a>=s.maxReplaces)break}})),e}},{key:"nest",value:function(e,t){var n,r,i,o=this,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};function s(e,t){var n=this.nestingOptionsSeparator;if(e.indexOf(n)<0)return e;var r=e.split(new RegExp("".concat(n,"[ ]*{"))),o="{".concat(r[1]);e=r[0];var a=(o=this.interpolate(o,i)).match(/'/g),s=o.match(/"/g);(a&&a.length%2==0&&!s||s.length%2!=0)&&(o=o.replace(/'/g,'"'));try{i=JSON.parse(o),t&&(i=YC(YC({},t),i))}catch(t){return this.logger.warn("failed parsing options string in nesting for key ".concat(e),t),"".concat(e).concat(n).concat(o)}return delete i.defaultValue,e}for(;n=this.nestingRegexp.exec(e);){var u=[];(i=(i=YC({},a)).replace&&"string"!=typeof i.replace?i.replace:i).applyPostProcessor=!1,delete i.defaultValue;var l=!1;if(-1!==n[0].indexOf(this.formatSeparator)&&!/{.*}/.test(n[1])){var c=n[1].split(this.formatSeparator).map((function(e){return e.trim()}));n[1]=c.shift(),u=c,l=!0}if((r=t(s.call(this,n[1].trim(),i),i))&&n[0]===e&&"string"!=typeof r)return r;"string"!=typeof r&&(r=bC(r)),r||(this.logger.warn("missed to resolve ".concat(n[1]," for nesting ").concat(e)),r=""),l&&(r=u.reduce((function(e,t){return o.format(e,t,a.lng,YC(YC({},a),{},{interpolationkey:n[1].trim()}))}),r.trim())),e=e.replace(n[0],r),this.regexp.lastIndex=0}return e}}]),e}();function ZC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function XC(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ZC(Object(n),!0).forEach((function(t){lC(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ZC(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function JC(e){var t={};return function(n,r,i){var o=r+JSON.stringify(i),a=t[o];return a||(a=e(r,i),t[o]=a),a(n)}}var ex=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};eC(this,e),this.logger=gC.create("formatter"),this.options=t,this.formats={number:JC((function(e,t){var n=new Intl.NumberFormat(e,XC({},t));return function(e){return n.format(e)}})),currency:JC((function(e,t){var n=new Intl.NumberFormat(e,XC(XC({},t),{},{style:"currency"}));return function(e){return n.format(e)}})),datetime:JC((function(e,t){var n=new Intl.DateTimeFormat(e,XC({},t));return function(e){return n.format(e)}})),relativetime:JC((function(e,t){var n=new Intl.RelativeTimeFormat(e,XC({},t));return function(e){return n.format(e,t.range||"day")}})),list:JC((function(e,t){var n=new Intl.ListFormat(e,XC({},t));return function(e){return n.format(e)}}))},this.init(t)}return rC(e,[{key:"init",value:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||","}},{key:"add",value:function(e,t){this.formats[e.toLowerCase().trim()]=t}},{key:"addCached",value:function(e,t){this.formats[e.toLowerCase().trim()]=JC(t)}},{key:"format",value:function(e,t,n){var r=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=t.split(this.formatSeparator).reduce((function(e,t){var o=function(e){var t=e.toLowerCase().trim(),n={};if(e.indexOf("(")>-1){var r=e.split("(");t=r[0].toLowerCase().trim();var i=r[1].substring(0,r[1].length-1);"currency"===t&&i.indexOf(":")<0?n.currency||(n.currency=i.trim()):"relativetime"===t&&i.indexOf(":")<0?n.range||(n.range=i.trim()):i.split(";").forEach((function(e){if(e){var t=dC(e.split(":")),r=t[0],i=t.slice(1).join(":").trim().replace(/^'+|'+$/g,"");n[r.trim()]||(n[r.trim()]=i),"false"===i&&(n[r.trim()]=!1),"true"===i&&(n[r.trim()]=!0),isNaN(i)||(n[r.trim()]=parseInt(i,10))}}))}return{formatName:t,formatOptions:n}}(t),a=o.formatName,s=o.formatOptions;if(r.formats[a]){var u=e;try{var l=i&&i.formatParams&&i.formatParams[i.interpolationkey]||{},c=l.locale||l.lng||i.locale||i.lng||n;u=r.formats[a](e,c,XC(XC(XC({},s),i),l))}catch(e){r.logger.warn(e)}return u}return r.logger.warn("there was no format function for ".concat(a)),e}),e);return o}}]),e}();function tx(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function nx(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?tx(Object(n),!0).forEach((function(t){lC(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tx(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function rx(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=uC(e);if(t){var i=uC(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return sC(this,n)}}var ix=function(e){aC(n,e);var t=rx(n);function n(e,r,i){var o,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return eC(this,n),o=t.call(this),CC&&vC.call(iC(o)),o.backend=e,o.store=r,o.services=i,o.languageUtils=i.languageUtils,o.options=a,o.logger=gC.create("backendConnector"),o.waitingReads=[],o.maxParallelReads=a.maxParallelReads||10,o.readingCalls=0,o.maxRetries=a.maxRetries>=0?a.maxRetries:5,o.retryTimeout=a.retryTimeout>=1?a.retryTimeout:350,o.state={},o.queue=[],o.backend&&o.backend.init&&o.backend.init(i,a.backend,a),o}return rC(n,[{key:"queueLoad",value:function(e,t,n,r){var i=this,o={},a={},s={},u={};return e.forEach((function(e){var r=!0;t.forEach((function(t){var s="".concat(e,"|").concat(t);!n.reload&&i.store.hasResourceBundle(e,t)?i.state[s]=2:i.state[s]<0||(1===i.state[s]?void 0===a[s]&&(a[s]=!0):(i.state[s]=1,r=!1,void 0===a[s]&&(a[s]=!0),void 0===o[s]&&(o[s]=!0),void 0===u[t]&&(u[t]=!0)))})),r||(s[e]=!0)})),(Object.keys(o).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(o),pending:Object.keys(a),toLoadLanguages:Object.keys(s),toLoadNamespaces:Object.keys(u)}}},{key:"loaded",value:function(e,t,n){var r=e.split("|"),i=r[0],o=r[1];t&&this.emit("failedLoading",i,o,t),n&&this.store.addResourceBundle(i,o,n),this.state[e]=t?-1:2;var a={};this.queue.forEach((function(n){!function(e,t,n,r){var i=wC(e,t,Object),o=i.obj,a=i.k;o[a]=o[a]||[],r&&(o[a]=o[a].concat(n)),r||o[a].push(n)}(n.loaded,[i],o),function(e,t){void 0!==e.pending[t]&&(delete e.pending[t],e.pendingCount--)}(n,e),t&&n.errors.push(t),0!==n.pendingCount||n.done||(Object.keys(n.loaded).forEach((function(e){a[e]||(a[e]={});var t=n.loaded[e];t.length&&t.forEach((function(t){void 0===a[e][t]&&(a[e][t]=!0)}))})),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())})),this.emit("loaded",a),this.queue=this.queue.filter((function(e){return!e.done}))}},{key:"read",value:function(e,t,n){var r=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.retryTimeout,a=arguments.length>5?arguments[5]:void 0;if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads)this.waitingReads.push({lng:e,ns:t,fcName:n,tried:i,wait:o,callback:a});else{this.readingCalls++;var s=function(s,u){if(r.readingCalls--,r.waitingReads.length>0){var l=r.waitingReads.shift();r.read(l.lng,l.ns,l.fcName,l.tried,l.wait,l.callback)}s&&u&&i<r.maxRetries?setTimeout((function(){r.read.call(r,e,t,n,i+1,2*o,a)}),o):a(s,u)},u=this.backend[n].bind(this.backend);if(2!==u.length)return u(e,t,s);try{var l=u(e,t);l&&"function"==typeof l.then?l.then((function(e){return s(null,e)})).catch(s):s(null,l)}catch(e){s(e)}}}},{key:"prepareLoading",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();"string"==typeof e&&(e=this.languageUtils.toResolveHierarchy(e)),"string"==typeof t&&(t=[t]);var o=this.queueLoad(e,t,r,i);if(!o.toLoad.length)return o.pending.length||i(),null;o.toLoad.forEach((function(e){n.loadOne(e)}))}},{key:"load",value:function(e,t,n){this.prepareLoading(e,t,{},n)}},{key:"reload",value:function(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}},{key:"loadOne",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=e.split("|"),i=r[0],o=r[1];this.read(i,o,"read",void 0,void 0,(function(r,a){r&&t.logger.warn("".concat(n,"loading namespace ").concat(o," for language ").concat(i," failed"),r),!r&&a&&t.logger.log("".concat(n,"loaded namespace ").concat(o," for language ").concat(i),a),t.loaded(e,r,a)}))}},{key:"saveMissing",value:function(e,t,n,r,i){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:function(){};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(t))this.logger.warn('did not save key "'.concat(n,'" as the namespace "').concat(t,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");else if(null!=n&&""!==n){if(this.backend&&this.backend.create){var s=nx(nx({},o),{},{isUpdate:i}),u=this.backend.create.bind(this.backend);if(u.length<6)try{var l;(l=5===u.length?u(e,t,n,r,s):u(e,t,n,r))&&"function"==typeof l.then?l.then((function(e){return a(null,e)})).catch(a):a(null,l)}catch(e){a(e)}else u(e,t,n,r,a,s)}e&&e[0]&&this.store.addResource(e[0],t,n,r)}}}]),n}(vC);function ox(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){var t={};if("object"===JM(e[1])&&(t=e[1]),"string"==typeof e[1]&&(t.defaultValue=e[1]),"string"==typeof e[2]&&(t.tDescription=e[2]),"object"===JM(e[2])||"object"===JM(e[3])){var n=e[3]||e[2];Object.keys(n).forEach((function(e){t[e]=n[e]}))}return t},interpolation:{escapeValue:!0,format:function(e,t,n,r){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function ax(e){return"string"==typeof e.ns&&(e.ns=[e.ns]),"string"==typeof e.fallbackLng&&(e.fallbackLng=[e.fallbackLng]),"string"==typeof e.fallbackNS&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function sx(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ux(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?sx(Object(n),!0).forEach((function(t){lC(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sx(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function lx(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=uC(e);if(t){var i=uC(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return sC(this,n)}}function cx(){}var dx=function(e){aC(n,e);var t=lx(n);function n(){var e,r,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1?arguments[1]:void 0;if(eC(this,n),e=t.call(this),CC&&vC.call(iC(e)),e.options=ax(i),e.services={},e.logger=gC,e.modules={external:[]},r=iC(e),Object.getOwnPropertyNames(Object.getPrototypeOf(r)).forEach((function(e){"function"==typeof r[e]&&(r[e]=r[e].bind(r))})),o&&!e.isInitialized&&!i.isClone){if(!e.options.initImmediate)return e.init(i,o),sC(e,iC(e));setTimeout((function(){e.init(i,o)}),0)}return e}return rC(n,[{key:"init",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;"function"==typeof t&&(n=t,t={}),!t.defaultNS&&!1!==t.defaultNS&&t.ns&&("string"==typeof t.ns?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));var r=ox();function i(e){return e?"function"==typeof e?new e:e:null}if(this.options=ux(ux(ux({},r),this.options),ax(t)),"v1"!==this.options.compatibilityAPI&&(this.options.interpolation=ux(ux({},r.interpolation),this.options.interpolation)),void 0!==t.keySeparator&&(this.options.userDefinedKeySeparator=t.keySeparator),void 0!==t.nsSeparator&&(this.options.userDefinedNsSeparator=t.nsSeparator),!this.options.isClone){var o;this.modules.logger?gC.init(i(this.modules.logger),this.options):gC.init(null,this.options),this.modules.formatter?o=this.modules.formatter:"undefined"!=typeof Intl&&(o=ex);var a=new FC(this.options);this.store=new LC(this.options.resources,this.options);var s=this.services;s.logger=gC,s.resourceStore=this.store,s.languageUtils=a,s.pluralResolver=new HC(a,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),!o||this.options.interpolation.format&&this.options.interpolation.format!==r.interpolation.format||(s.formatter=i(o),s.formatter.init(s,this.options),this.options.interpolation.format=s.formatter.format.bind(s.formatter)),s.interpolator=new QC(this.options),s.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},s.backendConnector=new ix(i(this.modules.backend),s.resourceStore,s,this.options),s.backendConnector.on("*",(function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];e.emit.apply(e,[t].concat(r))})),this.modules.languageDetector&&(s.languageDetector=i(this.modules.languageDetector),s.languageDetector.init&&s.languageDetector.init(s,this.options.detection,this.options)),this.modules.i18nFormat&&(s.i18nFormat=i(this.modules.i18nFormat),s.i18nFormat.init&&s.i18nFormat.init(this)),this.translator=new UC(this.services,this.options),this.translator.on("*",(function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];e.emit.apply(e,[t].concat(r))})),this.modules.external.forEach((function(t){t.init&&t.init(e)}))}if(this.format=this.options.interpolation.format,n||(n=cx),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){var u=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);u.length>0&&"dev"!==u[0]&&(this.options.lng=u[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach((function(t){e[t]=function(){var n;return(n=e.store)[t].apply(n,arguments)}})),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach((function(t){e[t]=function(){var n;return(n=e.store)[t].apply(n,arguments),e}}));var l=yC(),c=function(){var t=function(t,r){e.isInitialized&&!e.initializedStoreOnce&&e.logger.warn("init: i18next is already initialized. You should call init just once!"),e.isInitialized=!0,e.options.isClone||e.logger.log("initialized",e.options),e.emit("initialized",e.options),l.resolve(r),n(t,r)};if(e.languages&&"v1"!==e.options.compatibilityAPI&&!e.isInitialized)return t(null,e.t.bind(e));e.changeLanguage(e.options.lng,t)};return this.options.resources||!this.options.initImmediate?c():setTimeout(c,0),l}},{key:"loadResources",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:cx,r="string"==typeof e?e:this.language;if("function"==typeof e&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if(r&&"cimode"===r.toLowerCase())return n();var i=[],o=function(e){e&&t.services.languageUtils.toResolveHierarchy(e).forEach((function(e){i.indexOf(e)<0&&i.push(e)}))};r?o(r):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((function(e){return o(e)})),this.options.preload&&this.options.preload.forEach((function(e){return o(e)})),this.services.backendConnector.load(i,this.options.ns,(function(e){e||t.resolvedLanguage||!t.language||t.setResolvedLanguage(t.language),n(e)}))}else n(null)}},{key:"reloadResources",value:function(e,t,n){var r=yC();return e||(e=this.languages),t||(t=this.options.ns),n||(n=cx),this.services.backendConnector.reload(e,t,(function(e){r.resolve(),n(e)})),r}},{key:"use",value:function(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&IC.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}},{key:"setResolvedLanguage",value:function(e){if(e&&this.languages&&!(["cimode","dev"].indexOf(e)>-1))for(var t=0;t<this.languages.length;t++){var n=this.languages[t];if(!(["cimode","dev"].indexOf(n)>-1)&&this.store.hasLanguageSomeTranslations(n)){this.resolvedLanguage=n;break}}}},{key:"changeLanguage",value:function(e,t){var n=this;this.isLanguageChangingTo=e;var r=yC();this.emit("languageChanging",e);var i=function(e){n.language=e,n.languages=n.services.languageUtils.toResolveHierarchy(e),n.resolvedLanguage=void 0,n.setResolvedLanguage(e)},o=function(o){e||o||!n.services.languageDetector||(o=[]);var a="string"==typeof o?o:n.services.languageUtils.getBestMatchFromCodes(o);a&&(n.language||i(a),n.translator.language||n.translator.changeLanguage(a),n.services.languageDetector&&n.services.languageDetector.cacheUserLanguage&&n.services.languageDetector.cacheUserLanguage(a)),n.loadResources(a,(function(e){!function(e,o){o?(i(o),n.translator.changeLanguage(o),n.isLanguageChangingTo=void 0,n.emit("languageChanged",o),n.logger.log("languageChanged",o)):n.isLanguageChangingTo=void 0,r.resolve((function(){return n.t.apply(n,arguments)})),t&&t(e,(function(){return n.t.apply(n,arguments)}))}(e,a)}))};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?0===this.services.languageDetector.detect.length?this.services.languageDetector.detect().then(o):this.services.languageDetector.detect(o):o(e):o(this.services.languageDetector.detect()),r}},{key:"getFixedT",value:function(e,t,n){var r=this,i=function e(t,i){var o;if("object"!==JM(i)){for(var a=arguments.length,s=new Array(a>2?a-2:0),u=2;u<a;u++)s[u-2]=arguments[u];o=r.options.overloadTranslationOptionHandler([t,i].concat(s))}else o=ux({},i);o.lng=o.lng||e.lng,o.lngs=o.lngs||e.lngs,o.ns=o.ns||e.ns,o.keyPrefix=o.keyPrefix||n||e.keyPrefix;var l,c=r.options.keySeparator||".";return l=o.keyPrefix&&Array.isArray(t)?t.map((function(e){return"".concat(o.keyPrefix).concat(c).concat(e)})):o.keyPrefix?"".concat(o.keyPrefix).concat(c).concat(t):t,r.t(l,o)};return"string"==typeof e?i.lng=e:i.lngs=e,i.ns=t,i.keyPrefix=n,i}},{key:"t",value:function(){var e;return this.translator&&(e=this.translator).translate.apply(e,arguments)}},{key:"exists",value:function(){var e;return this.translator&&(e=this.translator).exists.apply(e,arguments)}},{key:"setDefaultNamespace",value:function(e){this.options.defaultNS=e}},{key:"hasLoadedNamespace",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var r=n.lng||this.resolvedLanguage||this.languages[0],i=!!this.options&&this.options.fallbackLng,o=this.languages[this.languages.length-1];if("cimode"===r.toLowerCase())return!0;var a=function(e,n){var r=t.services.backendConnector.state["".concat(e,"|").concat(n)];return-1===r||2===r};if(n.precheck){var s=n.precheck(this,a);if(void 0!==s)return s}return!!this.hasResourceBundle(r,e)||!(this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages))||!(!a(r,e)||i&&!a(o,e))}},{key:"loadNamespaces",value:function(e,t){var n=this,r=yC();return this.options.ns?("string"==typeof e&&(e=[e]),e.forEach((function(e){n.options.ns.indexOf(e)<0&&n.options.ns.push(e)})),this.loadResources((function(e){r.resolve(),t&&t(e)})),r):(t&&t(),Promise.resolve())}},{key:"loadLanguages",value:function(e,t){var n=yC();"string"==typeof e&&(e=[e]);var r=this.options.preload||[],i=e.filter((function(e){return r.indexOf(e)<0}));return i.length?(this.options.preload=r.concat(i),this.loadResources((function(e){n.resolve(),t&&t(e)})),n):(t&&t(),Promise.resolve())}},{key:"dir",value:function(e){if(e||(e=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!e)return"rtl";var t=this.services&&this.services.languageUtils||new FC(ox());return["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(t.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}},{key:"cloneInstance",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:cx,i=ux(ux(ux({},this.options),t),{isClone:!0}),o=new n(i);return void 0===t.debug&&void 0===t.prefix||(o.logger=o.logger.clone(t)),["store","services","language"].forEach((function(t){o[t]=e[t]})),o.services=ux({},this.services),o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o.translator=new UC(o.services,o.options),o.translator.on("*",(function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];o.emit.apply(o,[e].concat(n))})),o.init(i,r),o.translator.options=o.options,o.translator.backendConnector.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o}},{key:"toJSON",value:function(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}]),n}(vC);lC(dx,"createInstance",(function(){return new dx(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},arguments.length>1?arguments[1]:void 0)}));var fx=dx.createInstance();fx.createInstance=dx.createInstance;var hx=fx.createInstance;fx.dir,fx.init,fx.loadResources,fx.reloadResources,fx.use,fx.changeLanguage,fx.getFixedT,fx.t,fx.exists,fx.setDefaultNamespace,fx.hasLoadedNamespace,fx.loadNamespaces,fx.loadLanguages;var px="0.14.1";const mx={eth_requestAccounts:!0,eth_sendTransaction:!0,eth_signTransaction:!0,eth_sign:!0,eth_accounts:!0,personal_sign:!0,eth_signTypedData:!0,eth_signTypedData_v3:!0,eth_signTypedData_v4:!0,wallet_watchAsset:!0,wallet_addEthereumChain:!0,wallet_switchEthereumChain:!0,metamask_connectSign:!0,metamask_connectWith:!0,metamask_batch:!0,metamask_open:!0},gx=".sdk-comm",vx="providerType",yx={METAMASK_GETPROVIDERSTATE:"metamask_getProviderState",METAMASK_CONNECTSIGN:"metamask_connectSign",METAMASK_CONNECTWITH:"metamask_connectWith",METAMASK_OPEN:"metamask_open",METAMASK_BATCH:"metamask_batch",PERSONAL_SIGN:"personal_sign",ETH_REQUESTACCOUNTS:"eth_requestAccounts",ETH_ACCOUNTS:"eth_accounts",ETH_CHAINID:"eth_chainId"},bx={CHAIN_CHANGED:"chainChanged",ACCOUNTS_CHANGED:"accountsChanged",DISCONNECT:"disconnect",CONNECT:"connect",CONNECTED:"connected"};var wx,Ax,_x,Ex,Sx;function kx(e){var n,r;return fA(this,void 0,void 0,(function*(){e.debug&&console.debug("SDK::connectWithExtensionProvider()",e),e.sdkProvider=e.activeProvider,e.activeProvider=window.extension,window.ethereum=window.extension;try{const t=yield null===(n=window.extension)||void 0===n?void 0:n.request({method:"eth_requestAccounts"});e.debug&&console.debug("SDK::connectWithExtensionProvider() accounts",t)}catch(e){return void console.warn("SDK::connectWithExtensionProvider() can't request accounts error",e)}localStorage.setItem(vx,"extension"),e.extensionActive=!0,e.emit(t.EventType.PROVIDER_UPDATE,t.PROVIDER_UPDATE_TYPE.EXTENSION),null===(r=e.analytics)||void 0===r||r.send({event:Zw.SDK_USE_EXTENSION})}))}t.PROVIDER_UPDATE_TYPE=void 0,(wx=t.PROVIDER_UPDATE_TYPE||(t.PROVIDER_UPDATE_TYPE={})).TERMINATE="terminate",wx.EXTENSION="extension",wx.INITIALIZED="initialized";const Mx={DEFAULT_ID:"sdk",NO_VERSION:"NONE"};class Cx{constructor(e){var t;Ax.set(this,void 0),_x.set(this,Dw),Ex.set(this,void 0),Sx.set(this,void 0),pA(this,Ax,e.debug,"f"),pA(this,_x,e.serverURL,"f"),pA(this,Sx,e.metadata||void 0,"f"),pA(this,Ex,null===(t=e.enabled)||void 0===t||t,"f")}send({event:e}){hA(this,Ex,"f")&&fn({id:Mx.DEFAULT_ID,event:e,commLayerVersion:Mx.NO_VERSION,originationInfo:hA(this,Sx,"f")},hA(this,_x,"f")).catch((e=>{hA(this,Ax,"f")&&console.error(e)}))}}var xx;Ax=new WeakMap,_x=new WeakMap,Ex=new WeakMap,Sx=new WeakMap,function(e){e.INPAGE="metamask-inpage",e.CONTENT_SCRIPT="metamask-contentscript",e.PROVIDER="metamask-provider"}(xx||(xx={}));const Rx="https://metamask.app.link/connect",Ox="metamask://connect",Tx={NAME:"MetaMask Main",RDNS:"io.metamask"},Px=/(?:^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}$)|(?:^0{8}-0{4}-0{4}-0{4}-0{12}$)/u,Lx=36e5;class Ix{constructor({shouldSetOnWindow:e,connectionStream:t,shouldSendMetadata:n=!1,shouldShimWeb3:r,debug:i=!1}){this.debug=!1,this.debug=i;const o=new QM({connectionStream:t,shouldSendMetadata:n,shouldSetOnWindow:e,shouldShimWeb3:r,autoRequestAccounts:!1,debug:i});this.debug=i;const a=new Proxy(o,{deleteProperty:()=>!0});this.provider=a,e&&"undefined"!=typeof window&&mA.setGlobalProvider(this.provider),r&&"undefined"!=typeof window&&mA.shimWeb3(this.provider),this.provider.on("_initialized",(()=>{const e={chainId:this.provider.chainId,isConnected:this.provider.isConnected(),isMetaNask:this.provider.isMetaMask,selectedAddress:this.provider.selectedAddress,networkVersion:this.provider.networkVersion};this.debug&&console.info("Ethereum provider initialized",e)}))}static init(e){var t;return e.debug&&console.debug("Ethereum::init()"),this.instance=new Ix(e),null===(t=this.instance)||void 0===t?void 0:t.provider}static destroy(){Ix.instance=void 0}static getInstance(){var e;if(!(null===(e=this.instance)||void 0===e?void 0:e.provider))throw new Error("Ethereum instance not intiialized - call Ethereum.factory first.");return this.instance}static getProvider(){var e;if(!(null===(e=this.instance)||void 0===e?void 0:e.provider))throw new Error("Ethereum instance not intiialized - call Ethereum.factory first.");return this.instance.provider}}function Nx(e,t,n,r){var i,o,a,s,u,l,c,d,f,h,p,m,g,v;return fA(this,void 0,void 0,(function*(){const n=null===(i=e.state.remote)||void 0===i?void 0:i.isReady(),y=null===(o=e.state.remote)||void 0===o?void 0:o.isConnected(),b=null===(a=e.state.remote)||void 0===a?void 0:a.isPaused(),w=Ix.getProvider(),A=null===(s=e.state.remote)||void 0===s?void 0:s.getChannelId(),_=null===(u=e.state.remote)||void 0===u?void 0:u.isAuthorized(),{method:E,data:S}=(e=>{var t;let n;return Ke.isBuffer(e)?(n=e.toJSON(),n._isBuffer=!0):n=e,{method:null===(t=null==n?void 0:n.data)||void 0===t?void 0:t.method,data:n}})(t);if(e.state.debug&&console.debug(`RPCMS::_write method='${E}' isRemoteReady=${n} channelId=${A} isSocketConnected=${y} isRemotePaused=${b} providerConnected=${w.isConnected()}`,t),!A)return e.state.debug&&E!==yx.METAMASK_GETPROVIDERSTATE&&console.warn("RPCMS::_write Invalid channel id -- undefined"),r();e.state.debug&&console.debug(`RPCMS::_write remote.isPaused()=${null===(l=e.state.remote)||void 0===l?void 0:l.isPaused()} authorized=${_} ready=${n} socketConnected=${y}`,t);try{if(null===(c=e.state.remote)||void 0===c||c.sendMessage(null==S?void 0:S.data).then((()=>{e.state.debug&&console.debug(`RCPMS::_write ${E} sent successfully`)})).catch((e=>{console.error("RCPMS::_write error sending message",e)})),!(null===(d=e.state.platformManager)||void 0===d?void 0:d.isSecure()))return e.state.debug&&console.log(`RCPMS::_write unsecure platform for method ${E} -- return callback`),r();if(!y&&!n)return e.state.debug&&console.debug(`RCPMS::_write invalid connection status targetMethod=${E} socketConnected=${y} ready=${n} providerConnected=${w.isConnected()}\n\n`),r();if(!y&&n)return console.warn("RCPMS::_write invalid socket status -- shouln't happen"),r();const t=null!==(p=null===(h=null===(f=e.state.remote)||void 0===f?void 0:f.getKeyInfo())||void 0===h?void 0:h.ecies.public)&&void 0!==p?p:"",i=encodeURI(`channelId=${A}&pubkey=${t}&comm=socket&t=d`);mx[E]?(e.state.debug&&console.debug(`RCPMS::_write redirect link for '${E}' socketConnected=${y}`,`connect?${i}`),null===(m=e.state.platformManager)||void 0===m||m.openDeeplink(`${Rx}?${i}`,`${Ox}?${i}`,"_self")):(null===(g=e.state.remote)||void 0===g?void 0:g.isPaused())?(e.state.debug&&console.debug(`RCPMS::_write MM is PAUSED! deeplink with connect! targetMethod=${E}`),null===(v=e.state.platformManager)||void 0===v||v.openDeeplink(`${Rx}?redirect=true&${i}`,`${Ox}?redirect=true&${i}`,"_self")):console.debug(`RCPMS::_write method ${E} doesn't need redirect.`)}catch(t){return e.state.debug&&console.error("RCPMS::_write error",t),r(new Error("RemoteCommunicationPostMessageStream - disconnected"))}return r()}))}class Dx extends oS{constructor({name:e,remote:n,platformManager:r,debug:i}){super({objectMode:!0}),this.state={_name:null,remote:null,platformManager:null,debug:!1},this.state._name=e,this.state.remote=n,this.state.debug=i,this.state.platformManager=r,this._onMessage=this._onMessage.bind(this),this.state.remote.on(t.EventType.MESSAGE,this._onMessage)}_write(e,t,n){return fA(this,void 0,void 0,(function*(){return Nx(this,e,0,n)}))}_read(){}_onMessage(e){return function(e,t){try{if(e.state.debug&&console.debug("[RCPMS] _onMessage ",t),!t||"object"!=typeof t)return;if("object"!=typeof(null==t?void 0:t.data))return;if(!(null==t?void 0:t.name))return;if((null==t?void 0:t.name)!==xx.PROVIDER)return;if(Ke.isBuffer(t)){const n=Ke.from(t);e.push(n)}else e.push(t)}catch(t){e.state.debug&&console.debug("RCPMS ignore message error",t)}}(this,e)}start(){}}var Bx={exports:{}};!function(e,t){var n="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==r&&r,i=function(){function e(){this.fetch=!1,this.DOMException=n.DOMException}return e.prototype=n,new e}();!function(e){!function(t){var n=void 0!==e&&e||"undefined"!=typeof self&&self||void 0!==n&&n,r="URLSearchParams"in n,i="Symbol"in n&&"iterator"in Symbol,o="FileReader"in n&&"Blob"in n&&function(){try{return new Blob,!0}catch(e){return!1}}(),a="FormData"in n,s="ArrayBuffer"in n;if(s)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],l=ArrayBuffer.isView||function(e){return e&&u.indexOf(Object.prototype.toString.call(e))>-1};function c(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||""===e)throw new TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function d(e){return"string"!=typeof e&&(e=String(e)),e}function f(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return i&&(t[Symbol.iterator]=function(){return t}),t}function h(e){this.map={},e instanceof h?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function p(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function m(e){return new Promise((function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function g(e){var t=new FileReader,n=m(t);return t.readAsArrayBuffer(e),n}function v(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function y(){return this.bodyUsed=!1,this._initBody=function(e){var t;this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:o&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:a&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:r&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():s&&o&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=v(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(e)||l(e))?this._bodyArrayBuffer=v(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},o&&(this.blob=function(){var e=p(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?p(this)||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer)):this.blob().then(g)}),this.text=function(){var e,t,n,r=p(this);if(r)return r;if(this._bodyBlob)return e=this._bodyBlob,n=m(t=new FileReader),t.readAsText(e),n;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=new Array(t.length),r=0;r<t.length;r++)n[r]=String.fromCharCode(t[r]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},a&&(this.formData=function(){return this.text().then(A)}),this.json=function(){return this.text().then(JSON.parse)},this}h.prototype.append=function(e,t){e=c(e),t=d(t);var n=this.map[e];this.map[e]=n?n+", "+t:t},h.prototype.delete=function(e){delete this.map[c(e)]},h.prototype.get=function(e){return e=c(e),this.has(e)?this.map[e]:null},h.prototype.has=function(e){return this.map.hasOwnProperty(c(e))},h.prototype.set=function(e,t){this.map[c(e)]=d(t)},h.prototype.forEach=function(e,t){for(var n in this.map)this.map.hasOwnProperty(n)&&e.call(t,this.map[n],n,this)},h.prototype.keys=function(){var e=[];return this.forEach((function(t,n){e.push(n)})),f(e)},h.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),f(e)},h.prototype.entries=function(){var e=[];return this.forEach((function(t,n){e.push([n,t])})),f(e)},i&&(h.prototype[Symbol.iterator]=h.prototype.entries);var b=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function w(e,t){if(!(this instanceof w))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');var n=(t=t||{}).body;if(e instanceof w){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new h(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,n||null==e._bodyInit||(n=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new h(t.headers)),this.method=function(e){var t=e.toUpperCase();return b.indexOf(t)>-1?t:e}(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(n),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==t.cache&&"no-cache"!==t.cache)){var r=/([?&])_=[^&]*/;r.test(this.url)?this.url=this.url.replace(r,"$1_="+(new Date).getTime()):this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}function A(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(i))}})),t}function _(e,t){if(!(this instanceof _))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText=void 0===t.statusText?"":""+t.statusText,this.headers=new h(t.headers),this.url=t.url||"",this._initBody(e)}w.prototype.clone=function(){return new w(this,{body:this._bodyInit})},y.call(w.prototype),y.call(_.prototype),_.prototype.clone=function(){return new _(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},_.error=function(){var e=new _(null,{status:0,statusText:""});return e.type="error",e};var E=[301,302,303,307,308];_.redirect=function(e,t){if(-1===E.indexOf(t))throw new RangeError("Invalid status code");return new _(null,{status:t,headers:{location:e}})},t.DOMException=n.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function S(e,r){return new Promise((function(i,a){var u=new w(e,r);if(u.signal&&u.signal.aborted)return a(new t.DOMException("Aborted","AbortError"));var l=new XMLHttpRequest;function c(){l.abort()}l.onload=function(){var e,t,n={status:l.status,statusText:l.statusText,headers:(e=l.getAllResponseHeaders()||"",t=new h,e.replace(/\r?\n[\t ]+/g," ").split("\r").map((function(e){return 0===e.indexOf("\n")?e.substr(1,e.length):e})).forEach((function(e){var n=e.split(":"),r=n.shift().trim();if(r){var i=n.join(":").trim();t.append(r,i)}})),t)};n.url="responseURL"in l?l.responseURL:n.headers.get("X-Request-URL");var r="response"in l?l.response:l.responseText;setTimeout((function(){i(new _(r,n))}),0)},l.onerror=function(){setTimeout((function(){a(new TypeError("Network request failed"))}),0)},l.ontimeout=function(){setTimeout((function(){a(new TypeError("Network request failed"))}),0)},l.onabort=function(){setTimeout((function(){a(new t.DOMException("Aborted","AbortError"))}),0)},l.open(u.method,function(e){try{return""===e&&n.location.href?n.location.href:e}catch(t){return e}}(u.url),!0),"include"===u.credentials?l.withCredentials=!0:"omit"===u.credentials&&(l.withCredentials=!1),"responseType"in l&&(o?l.responseType="blob":s&&u.headers.get("Content-Type")&&-1!==u.headers.get("Content-Type").indexOf("application/octet-stream")&&(l.responseType="arraybuffer")),!r||"object"!=typeof r.headers||r.headers instanceof h?u.headers.forEach((function(e,t){l.setRequestHeader(t,e)})):Object.getOwnPropertyNames(r.headers).forEach((function(e){l.setRequestHeader(e,d(r.headers[e]))})),u.signal&&(u.signal.addEventListener("abort",c),l.onreadystatechange=function(){4===l.readyState&&u.signal.removeEventListener("abort",c)}),l.send(void 0===u._bodyInit?null:u._bodyInit)}))}S.polyfill=!0,n.fetch||(n.fetch=S,n.Headers=h,n.Request=w,n.Response=_),t.Headers=h,t.Request=w,t.Response=_,t.fetch=S}({})}(i),i.fetch.ponyfill=!0,delete i.fetch.polyfill;var o=n.fetch?n:i;(t=o.fetch).default=o.fetch,t.fetch=o.fetch,t.Headers=o.Headers,t.Request=o.Request,t.Response=o.Response,e.exports=t}(Bx,Bx.exports);var jx=i(Bx.exports);let Ux=1;const zx=e=>new Promise((t=>{setTimeout((()=>{t(!0)}),e)})),Fx=({checkInstallationOnAllCalls:e=!1,communicationLayerPreference:n,injectProvider:r,shouldShimWeb3:i,platformManager:o,installer:a,sdk:s,remoteConnection:u,debug:l})=>{var c;const d=(({name:e,remoteConnection:t,debug:n})=>{if(!t||!(null==t?void 0:t.getConnector()))throw new Error("Missing remote connection parameter");return new Dx({name:e,remote:null==t?void 0:t.getConnector(),platformManager:null==t?void 0:t.getPlatformManager(),debug:n})})({name:xx.INPAGE,target:xx.CONTENT_SCRIPT,platformManager:o,communicationLayerPreference:n,remoteConnection:u,debug:l}),f=o.getPlatformType(),h=s.options.dappMetadata,p=`Sdk/Javascript SdkVersion/${px} Platform/${f} dApp/${null!==(c=h.url)&&void 0!==c?c:h.name}`;let m=null,g=null;const v=!(!r||f===t.PlatformType.NonBrowser||f===t.PlatformType.ReactNative),y=Ix.init({shouldSetOnWindow:v,connectionStream:d,shouldShimWeb3:i,debug:l});let b=!1;const w=e=>{b=e},A=()=>b,_=(n,r,i,c)=>fA(void 0,void 0,void 0,(function*(){var d,f,h,v,y,_,E,S,k,M,C;if(b){null==u||u.showActiveModal();let e=A();for(;e;)yield zx(1e3),e=A();return l&&console.debug("initializeProvider::sendRequest() initial method completed -- prevent installation and call provider"),i(...r)}const x=o.isMetaMaskInstalled(),R=null==u?void 0:u.isConnected();let{selectedAddress:O,chainId:T}=Ix.getProvider();if(O=null!=O?O:m,T=null!==(d=null!=T?T:g)&&void 0!==d?d:s.defaultReadOnlyChainId,O&&(m=O),T&&(g=T),c&&console.debug(`initializeProvider::sendRequest() method=${n} ongoing=${b} selectedAddress=${O} isInstalled=${x} checkInstallationOnAllCalls=${e} socketConnected=${R}`),O&&n.toLowerCase()===yx.ETH_ACCOUNTS.toLowerCase())return[O];if(T&&n.toLowerCase()===yx.ETH_CHAINID.toLowerCase())return T;const P=[yx.ETH_REQUESTACCOUNTS,yx.METAMASK_CONNECTSIGN,yx.METAMASK_CONNECTWITH],L=!mx[n],I=null===(f=s.options.readonlyRPCMap)||void 0===f?void 0:f[T];if(I&&L)try{const e=null===(h=null==r?void 0:r[0])||void 0===h?void 0:h.params,t=yield(({rpcEndpoint:e,method:t,sdkInfo:n,params:r})=>fA(void 0,void 0,void 0,(function*(){const i=JSON.stringify({jsonrpc:"2.0",method:t,params:r,id:(Ux+=1,Ux)}),o={Accept:"application/json","Content-Type":"application/json"};let a;e.includes("infura")&&(o["Metamask-Sdk-Info"]=n);try{a=yield jx(e,{method:"POST",headers:o,body:i})}catch(e){throw e instanceof Error?new Error(`Failed to fetch from RPC: ${e.message}`):new Error(`Failed to fetch from RPC: ${e}`)}if(!a.ok)throw new Error(`Server responded with a status of ${a.status}`);return(yield a.json()).result})))({rpcEndpoint:I,sdkInfo:p,method:n,params:e||[]});return c&&console.log("initializeProvider::ReadOnlyRPCResponse",t),t}catch(e){console.warn(`initializeProvider::sendRequest() method=${n} readOnlyRPCRequest failed:`,e)}if((!x||x&&!R)&&n!==yx.METAMASK_GETPROVIDERSTATE){if(-1!==P.indexOf(n)||e){w(!0);try{yield a.start({wait:!1})}catch(e){if(w(!1),t.PROVIDER_UPDATE_TYPE.EXTENSION===e){if(l&&console.debug(`initializeProvider extension provider detect: re-create ${n} on the active provider`),n.toLowerCase()===yx.METAMASK_CONNECTSIGN.toLowerCase()){const[e]=r,{params:t}=e,n=yield null===(v=s.getProvider())||void 0===v?void 0:v.request({method:yx.ETH_REQUESTACCOUNTS,params:[]});if(!n.length)throw new Error("SDK state invalid -- undefined accounts");return yield null===(y=s.getProvider())||void 0===y?void 0:y.request({method:yx.PERSONAL_SIGN,params:[t[0],n[0]]})}if(n.toLowerCase()===yx.METAMASK_CONNECTWITH.toLowerCase()){const e=yield null===(_=s.getProvider())||void 0===_?void 0:_.request({method:yx.ETH_REQUESTACCOUNTS,params:[]});if(!e.length)throw new Error("SDK state invalid -- undefined accounts");const[t]=r;console.log("connectWith:: initialMethod",t);const{params:n}=t,[i]=n;if(console.warn("FIXME:: handle CONNECT_WITH",i),(null===(E=i.method)||void 0===E?void 0:E.toLowerCase())===yx.PERSONAL_SIGN.toLowerCase()){const t={method:i.method,params:[i.params[0],e[0]]};return console.log("connectWith:: connectedRpc",t),yield null===(S=s.getProvider())||void 0===S?void 0:S.request(t)}console.warn("FIXME:: handle CONNECT_WITH",i)}return yield null===(k=s.getProvider())||void 0===k?void 0:k.request({method:n,params:r})}throw l&&console.debug(`initializeProvider failed to start installer: ${e}`),e}const e=i(...r);try{yield new Promise(((e,n)=>{null==u||u.getConnector().once(t.EventType.AUTHORIZED,(()=>{e(!0)})),s.once(t.EventType.PROVIDER_UPDATE,(e=>{l&&console.debug("initializeProvider::sendRequest() PROVIDER_UPDATE --- remote provider request interupted",e),e===t.PROVIDER_UPDATE_TYPE.EXTENSION?n(t.EventType.PROVIDER_UPDATE):n(new Error("Connection Terminated"))}))}))}catch(e){if(w(!1),e===t.EventType.PROVIDER_UPDATE)return yield null===(M=s.getProvider())||void 0===M?void 0:M.request({method:n,params:r});throw e}return w(!1),e}if(o.isSecure()&&mx[n])return i(...r);if(s.isExtensionActive())return l&&console.debug(`initializeProvider::sendRequest() EXTENSION active - redirect request '${n}' to it`),yield null===(C=s.getProvider())||void 0===C?void 0:C.request({method:n,params:r});throw l&&console.debug(`initializeProvider::sendRequest() method=${n} --- skip --- not connected/installed`),new Error("MetaMask is not connected/installed, please call eth_requestAccounts to connect first.")}const N=yield i(...r);return l&&console.debug(`initializeProvider::sendRequest() method=${n} rpcResponse:`,N),N})),{request:E}=y;y.request=(...e)=>fA(void 0,void 0,void 0,(function*(){return _(null==e?void 0:e[0].method,e,E,l)}));const{send:S}=y;return y.send=(...e)=>fA(void 0,void 0,void 0,(function*(){return _(null==e?void 0:e[0],e,S,l)})),l&&console.debug("initializeProvider metamaskStream.start()"),d.start(),y};function qx(e){var n,r,i;return fA(this,void 0,void 0,(function*(){const{options:o}=e;e.activeProvider=Fx({communicationLayerPreference:null!==(n=o.communicationLayerPreference)&&void 0!==n?n:t.CommunicationLayerPreference.SOCKET,platformManager:e.platformManager,sdk:e,checkInstallationOnAllCalls:o.checkInstallationOnAllCalls,injectProvider:null===(r=o.injectProvider)||void 0===r||r,shouldShimWeb3:null===(i=o.shouldShimWeb3)||void 0===i||i,installer:e.installer,remoteConnection:e.remoteConnection,debug:e.debug}),function(e){var n,r,i,o;null===(r=null===(n=e.remoteConnection)||void 0===n?void 0:n.getConnector())||void 0===r||r.on(t.EventType.CONNECTION_STATUS,(n=>{e.emit(t.EventType.CONNECTION_STATUS,n)})),null===(o=null===(i=e.remoteConnection)||void 0===i?void 0:i.getConnector())||void 0===o||o.on(t.EventType.SERVICE_STATUS,(n=>{e.emit(t.EventType.SERVICE_STATUS,n)}))}(e)}))}const Wx=()=>{if("undefined"==typeof document)return;let e;const t=document.getElementsByTagName("link");for(let n=0;n<t.length;n++)"icon"!==t[n].getAttribute("rel")&&"shortcut icon"!==t[n].getAttribute("rel")||(e=t[n].getAttribute("href"));return e},Vx=163400,Kx=({provider:e,debug:t})=>{if("state"in e)throw new Error("INVALID EXTENSION PROVIDER");return new Proxy(e,{get:(n,r)=>"request"===r?function(r){return fA(this,void 0,void 0,(function*(){t&&console.debug("[wrapExtensionProvider] Overwriting request method, args:",r);const{method:i,params:o}=r;if(i===yx.METAMASK_BATCH&&Array.isArray(o)){const t=[];for(const n of o){const r=yield null==e?void 0:e.request({method:n.method,params:n.params});t.push(r)}return t}return n.request(r)}))}:n[r]})};var Hx;function $x({mustBeMetaMask:e,debug:t}){return fA(this,void 0,void 0,(function*(){if("undefined"==typeof window)throw new Error("window not available");let n;try{return n=yield new Promise(((e,t)=>{const n=setTimeout((()=>{t(new Error("eip6963RequestProvider timed out"))}),500);window.addEventListener(Hx.Announce,(t=>{const r=t,{detail:{info:i,provider:o}={}}=r,{name:a,rdns:s,uuid:u}=null!=i?i:{};Px.test(u)&&a===Tx.NAME&&s===Tx.RDNS&&(clearTimeout(n),e(o))})),window.dispatchEvent(new Event(Hx.Request))})),Kx({provider:n,debug:t})}catch(n){const{ethereum:r}=window;if(!r)throw new Error("Ethereum not found in window object");if("providers"in r){if(Array.isArray(r.providers)){const n=e?r.providers.find((e=>e.isMetaMask)):r.providers[0];if(!n)throw new Error("No suitable provider found");return Kx({provider:n,debug:t})}}else if(e&&!r.isMetaMask)throw new Error("MetaMask provider not found in Ethereum");return Kx({provider:r,debug:t})}}))}!function(e){e.Announce="eip6963:announceProvider",e.Request="eip6963:requestProvider"}(Hx||(Hx={}));var Yx={exports:{}};!function(e,t){e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=90)}({17:function(e,t,n){t.__esModule=!0,t.default=void 0;var r=n(18),i=function(){function e(){}return e.getFirstMatch=function(e,t){var n=t.match(e);return n&&n.length>0&&n[1]||""},e.getSecondMatch=function(e,t){var n=t.match(e);return n&&n.length>1&&n[2]||""},e.matchAndReturnConst=function(e,t,n){if(e.test(t))return n},e.getWindowsVersionName=function(e){switch(e){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,n,r){void 0===r&&(r=!1);var i=e.getVersionPrecision(t),o=e.getVersionPrecision(n),a=Math.max(i,o),s=0,u=e.map([t,n],(function(t){var n=a-e.getVersionPrecision(t),r=t+new Array(n+1).join(".0");return e.map(r.split("."),(function(e){return new Array(20-e.length).join("0")+e})).reverse()}));for(r&&(s=a-Math.min(i,o)),a-=1;a>=s;){if(u[0][a]>u[1][a])return 1;if(u[0][a]===u[1][a]){if(a===s)return 0;a-=1}else if(u[0][a]<u[1][a])return-1}},e.map=function(e,t){var n,r=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(n=0;n<e.length;n+=1)r.push(t(e[n]));return r},e.find=function(e,t){var n,r;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(n=0,r=e.length;n<r;n+=1){var i=e[n];if(t(i,n))return i}},e.assign=function(e){for(var t,n,r=e,i=arguments.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];if(Object.assign)return Object.assign.apply(Object,[e].concat(o));var s=function(){var e=o[t];"object"==typeof e&&null!==e&&Object.keys(e).forEach((function(t){r[t]=e[t]}))};for(t=0,n=o.length;t<n;t+=1)s();return e},e.getBrowserAlias=function(e){return r.BROWSER_ALIASES_MAP[e]},e.getBrowserTypeByAlias=function(e){return r.BROWSER_MAP[e]||""},e}();t.default=i,e.exports=t.default},18:function(e,t,n){t.__esModule=!0,t.ENGINE_MAP=t.OS_MAP=t.PLATFORMS_MAP=t.BROWSER_MAP=t.BROWSER_ALIASES_MAP=void 0,t.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},t.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},t.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},t.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},t.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(91))&&r.__esModule?r:{default:r},o=n(18);function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var s=function(){function e(){}var t,n,r;return e.getParser=function(e,t){if(void 0===t&&(t=!1),"string"!=typeof e)throw new Error("UserAgent should be a string");return new i.default(e,t)},e.parse=function(e){return new i.default(e).getResult()},t=e,r=[{key:"BROWSER_MAP",get:function(){return o.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return o.ENGINE_MAP}},{key:"OS_MAP",get:function(){return o.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return o.PLATFORMS_MAP}}],(n=null)&&a(t.prototype,n),r&&a(t,r),e}();t.default=s,e.exports=t.default},91:function(e,t,n){t.__esModule=!0,t.default=void 0;var r=u(n(92)),i=u(n(93)),o=u(n(94)),a=u(n(95)),s=u(n(17));function u(e){return e&&e.__esModule?e:{default:e}}var l=function(){function e(e,t){if(void 0===t&&(t=!1),null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},!0!==t&&this.parse()}var t=e.prototype;return t.getUA=function(){return this._ua},t.test=function(e){return e.test(this._ua)},t.parseBrowser=function(){var e=this;this.parsedResult.browser={};var t=s.default.find(r.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.browser=t.describe(this.getUA())),this.parsedResult.browser},t.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},t.getBrowserName=function(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},t.getBrowserVersion=function(){return this.getBrowser().version},t.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},t.parseOS=function(){var e=this;this.parsedResult.os={};var t=s.default.find(i.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.os=t.describe(this.getUA())),this.parsedResult.os},t.getOSName=function(e){var t=this.getOS().name;return e?String(t).toLowerCase()||"":t||""},t.getOSVersion=function(){return this.getOS().version},t.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},t.getPlatformType=function(e){void 0===e&&(e=!1);var t=this.getPlatform().type;return e?String(t).toLowerCase()||"":t||""},t.parsePlatform=function(){var e=this;this.parsedResult.platform={};var t=s.default.find(o.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.platform=t.describe(this.getUA())),this.parsedResult.platform},t.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},t.getEngineName=function(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},t.parseEngine=function(){var e=this;this.parsedResult.engine={};var t=s.default.find(a.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.engine=t.describe(this.getUA())),this.parsedResult.engine},t.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},t.getResult=function(){return s.default.assign({},this.parsedResult)},t.satisfies=function(e){var t=this,n={},r=0,i={},o=0;if(Object.keys(e).forEach((function(t){var a=e[t];"string"==typeof a?(i[t]=a,o+=1):"object"==typeof a&&(n[t]=a,r+=1)})),r>0){var a=Object.keys(n),u=s.default.find(a,(function(e){return t.isOS(e)}));if(u){var l=this.satisfies(n[u]);if(void 0!==l)return l}var c=s.default.find(a,(function(e){return t.isPlatform(e)}));if(c){var d=this.satisfies(n[c]);if(void 0!==d)return d}}if(o>0){var f=Object.keys(i),h=s.default.find(f,(function(e){return t.isBrowser(e,!0)}));if(void 0!==h)return this.compareVersion(i[h])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var n=this.getBrowserName().toLowerCase(),r=e.toLowerCase(),i=s.default.getBrowserTypeByAlias(r);return t&&i&&(r=i.toLowerCase()),r===n},t.compareVersion=function(e){var t=[0],n=e,r=!1,i=this.getBrowserVersion();if("string"==typeof i)return">"===e[0]||"<"===e[0]?(n=e.substr(1),"="===e[1]?(r=!0,n=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?n=e.substr(1):"~"===e[0]&&(r=!0,n=e.substr(1)),t.indexOf(s.default.compareVersions(i,n,r))>-1},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase()},t.is=function(e,t){return void 0===t&&(t=!1),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some((function(e){return t.is(e)}))},e}();t.default=l,e.exports=t.default},92:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=/version\/(\d+(\.?_?\d+)+)/i,a=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},n=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},n=i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},n=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},n=i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},n=i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(e){var t={name:"Opera Touch"},n=i.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},n=i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},n=i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},n=i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},n=i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},n=i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},n=i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},n=i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},n=i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},n=i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return n&&(t.version=n),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},n=i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},n=i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},n=i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},n=i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},n=i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},n=i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},n=i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/electron/i],describe:function(e){var t={name:"Electron"},n=i.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},n=i.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},n=i.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},n=i.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},n=i.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t={name:"Android Browser"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:i.default.getFirstMatch(t,e),version:i.default.getSecondMatch(t,e)}}}];t.default=a,e.exports=t.default},93:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),a=[{test:[/Roku\/DVP/],describe:function(e){var t=i.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:o.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=i.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.WindowsPhone,version:t}}},{test:[/windows /i],describe:function(e){var t=i.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),n=i.default.getWindowsVersionName(t);return{name:o.OS_MAP.Windows,version:t,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:o.OS_MAP.iOS},n=i.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return n&&(t.version=n),t}},{test:[/macintosh/i],describe:function(e){var t=i.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),n=i.default.getMacOSVersionName(t),r={name:o.OS_MAP.MacOS,version:t};return n&&(r.versionName=n),r}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=i.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:o.OS_MAP.iOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t=i.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),n=i.default.getAndroidVersionName(t),r={name:o.OS_MAP.Android,version:t};return n&&(r.versionName=n),r}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=i.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),n={name:o.OS_MAP.WebOS};return t&&t.length&&(n.version=t),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=i.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||i.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||i.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:o.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=i.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:o.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:o.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.PlayStation4,version:t}}}];t.default=a,e.exports=t.default},94:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),a=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(e){var t=i.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",n={type:o.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(n.model=t),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),n=e.test(/like (ipod|iphone)/i);return t&&!n},describe:function(e){var t=i.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:o.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}}];t.default=a,e.exports=t.default},95:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),a=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:o.ENGINE_MAP.Blink};var t=i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:o.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:o.ENGINE_MAP.Trident},n=i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:o.ENGINE_MAP.Presto},n=i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=e.test(/gecko/i),n=e.test(/like gecko/i);return t&&!n},describe:function(e){var t={name:o.ENGINE_MAP.Gecko},n=i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:o.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:o.ENGINE_MAP.WebKit},n=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}}];t.default=a,e.exports=t.default}})}(Yx);var Gx,Qx=i(Yx.exports);!function(e){e.Disabled="Disabled",e.Temporary="Temporary",e.UntilResponse="UntilResponse"}(Gx||(Gx={}));const Zx=()=>"wakeLock"in navigator,Xx=()=>{if("undefined"==typeof navigator)return!1;const{userAgent:e}=navigator,t=/CPU (?:iPhone )?OS (\d+)(?:_\d+)?_?\d+ like Mac OS X/iu.exec(e);return!!t&&parseInt(t[1],10)<10&&!window.MSStream};class Jx{constructor(e){this.enabled=!1,this._eventsAdded=!1,this.debug=null!=e&&e}start(){if(this.enabled=!1,Zx()&&!this._eventsAdded){this._eventsAdded=!0,this._wakeLock=void 0;const e=()=>fA(this,void 0,void 0,(function*(){null!==this._wakeLock&&"visible"===document.visibilityState&&(yield this.enable())}));document.addEventListener("visibilitychange",e),document.addEventListener("fullscreenchange",e)}else Xx()?this.noSleepTimer=void 0:(this.noSleepVideo=document.createElement("video"),this.noSleepVideo.setAttribute("title","MetaMask SDK - Listening for responses"),this.noSleepVideo.setAttribute("playsinline",""),this._addSourceToVideo(this.noSleepVideo,"webm","data:video/webm;base64,GkXfowEAAAAAAAAfQoaBAUL3gQFC8oEEQvOBCEKChHdlYm1Ch4EEQoWBAhhTgGcBAAAAAAAVkhFNm3RALE27i1OrhBVJqWZTrIHfTbuMU6uEFlSua1OsggEwTbuMU6uEHFO7a1OsghV17AEAAAAAAACkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmAQAAAAAAAEUq17GDD0JATYCNTGF2ZjU1LjMzLjEwMFdBjUxhdmY1NS4zMy4xMDBzpJBlrrXf3DCDVB8KcgbMpcr+RImIQJBgAAAAAAAWVK5rAQAAAAAAD++uAQAAAAAAADLXgQFzxYEBnIEAIrWcg3VuZIaFVl9WUDiDgQEj44OEAmJaAOABAAAAAAAABrCBsLqBkK4BAAAAAAAPq9eBAnPFgQKcgQAitZyDdW5khohBX1ZPUkJJU4OBAuEBAAAAAAAAEZ+BArWIQOdwAAAAAABiZIEgY6JPbwIeVgF2b3JiaXMAAAAAAoC7AAAAAAAAgLUBAAAAAAC4AQN2b3JiaXMtAAAAWGlwaC5PcmcgbGliVm9yYmlzIEkgMjAxMDExMDEgKFNjaGF1ZmVudWdnZXQpAQAAABUAAABlbmNvZGVyPUxhdmM1NS41Mi4xMDIBBXZvcmJpcyVCQ1YBAEAAACRzGCpGpXMWhBAaQlAZ4xxCzmvsGUJMEYIcMkxbyyVzkCGkoEKIWyiB0JBVAABAAACHQXgUhIpBCCGEJT1YkoMnPQghhIg5eBSEaUEIIYQQQgghhBBCCCGERTlokoMnQQgdhOMwOAyD5Tj4HIRFOVgQgydB6CCED0K4moOsOQghhCQ1SFCDBjnoHITCLCiKgsQwuBaEBDUojILkMMjUgwtCiJqDSTX4GoRnQXgWhGlBCCGEJEFIkIMGQcgYhEZBWJKDBjm4FITLQagahCo5CB+EIDRkFQCQAACgoiiKoigKEBqyCgDIAAAQQFEUx3EcyZEcybEcCwgNWQUAAAEACAAAoEiKpEiO5EiSJFmSJVmSJVmS5omqLMuyLMuyLMsyEBqyCgBIAABQUQxFcRQHCA1ZBQBkAAAIoDiKpViKpWiK54iOCISGrAIAgAAABAAAEDRDUzxHlETPVFXXtm3btm3btm3btm3btm1blmUZCA1ZBQBAAAAQ0mlmqQaIMAMZBkJDVgEACAAAgBGKMMSA0JBVAABAAACAGEoOogmtOd+c46BZDppKsTkdnEi1eZKbirk555xzzsnmnDHOOeecopxZDJoJrTnnnMSgWQqaCa0555wnsXnQmiqtOeeccc7pYJwRxjnnnCateZCajbU555wFrWmOmkuxOeecSLl5UptLtTnnnHPOOeecc84555zqxekcnBPOOeecqL25lpvQxTnnnE/G6d6cEM4555xzzjnnnHPOOeecIDRkFQAABABAEIaNYdwpCNLnaCBGEWIaMulB9+gwCRqDnELq0ehopJQ6CCWVcVJKJwgNWQUAAAIAQAghhRRSSCGFFFJIIYUUYoghhhhyyimnoIJKKqmooowyyyyzzDLLLLPMOuyssw47DDHEEEMrrcRSU2011lhr7jnnmoO0VlprrbVSSimllFIKQkNWAQAgAAAEQgYZZJBRSCGFFGKIKaeccgoqqIDQkFUAACAAgAAAAABP8hzRER3RER3RER3RER3R8RzPESVREiVREi3TMjXTU0VVdWXXlnVZt31b2IVd933d933d+HVhWJZlWZZlWZZlWZZlWZZlWZYgNGQVAAACAAAghBBCSCGFFFJIKcYYc8w56CSUEAgNWQUAAAIACAAAAHAUR3EcyZEcSbIkS9IkzdIsT/M0TxM9URRF0zRV0RVdUTdtUTZl0zVdUzZdVVZtV5ZtW7Z125dl2/d93/d93/d93/d93/d9XQdCQ1YBABIAADqSIymSIimS4ziOJElAaMgqAEAGAEAAAIriKI7jOJIkSZIlaZJneZaomZrpmZ4qqkBoyCoAABAAQAAAAAAAAIqmeIqpeIqoeI7oiJJomZaoqZoryqbsuq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq4LhIasAgAkAAB0JEdyJEdSJEVSJEdygNCQVQCADACAAAAcwzEkRXIsy9I0T/M0TxM90RM901NFV3SB0JBVAAAgAIAAAAAAAAAMybAUy9EcTRIl1VItVVMt1VJF1VNVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVN0zRNEwgNWQkAkAEAkBBTLS3GmgmLJGLSaqugYwxS7KWxSCpntbfKMYUYtV4ah5RREHupJGOKQcwtpNApJq3WVEKFFKSYYyoVUg5SIDRkhQAQmgHgcBxAsixAsiwAAAAAAAAAkDQN0DwPsDQPAAAAAAAAACRNAyxPAzTPAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABA0jRA8zxA8zwAAAAAAAAA0DwP8DwR8EQRAAAAAAAAACzPAzTRAzxRBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABA0jRA8zxA8zwAAAAAAAAAsDwP8EQR0DwRAAAAAAAAACzPAzxRBDzRAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAEOAAABBgIRQasiIAiBMAcEgSJAmSBM0DSJYFTYOmwTQBkmVB06BpME0AAAAAAAAAAAAAJE2DpkHTIIoASdOgadA0iCIAAAAAAAAAAAAAkqZB06BpEEWApGnQNGgaRBEAAAAAAAAAAAAAzzQhihBFmCbAM02IIkQRpgkAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAGHAAAAgwoQwUGrIiAIgTAHA4imUBAIDjOJYFAACO41gWAABYliWKAABgWZooAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAYcAAACDChDBQashIAiAIAcCiKZQHHsSzgOJYFJMmyAJYF0DyApgFEEQAIAAAocAAACLBBU2JxgEJDVgIAUQAABsWxLE0TRZKkaZoniiRJ0zxPFGma53meacLzPM80IYqiaJoQRVE0TZimaaoqME1VFQAAUOAAABBgg6bE4gCFhqwEAEICAByKYlma5nmeJ4qmqZokSdM8TxRF0TRNU1VJkqZ5niiKommapqqyLE3zPFEURdNUVVWFpnmeKIqiaaqq6sLzPE8URdE0VdV14XmeJ4qiaJqq6roQRVE0TdNUTVV1XSCKpmmaqqqqrgtETxRNU1Vd13WB54miaaqqq7ouEE3TVFVVdV1ZBpimaaqq68oyQFVV1XVdV5YBqqqqruu6sgxQVdd1XVmWZQCu67qyLMsCAAAOHAAAAoygk4wqi7DRhAsPQKEhKwKAKAAAwBimFFPKMCYhpBAaxiSEFEImJaXSUqogpFJSKRWEVEoqJaOUUmopVRBSKamUCkIqJZVSAADYgQMA2IGFUGjISgAgDwCAMEYpxhhzTiKkFGPOOScRUoox55yTSjHmnHPOSSkZc8w556SUzjnnnHNSSuacc845KaVzzjnnnJRSSuecc05KKSWEzkEnpZTSOeecEwAAVOAAABBgo8jmBCNBhYasBABSAQAMjmNZmuZ5omialiRpmud5niiapiZJmuZ5nieKqsnzPE8URdE0VZXneZ4oiqJpqirXFUXTNE1VVV2yLIqmaZqq6rowTdNUVdd1XZimaaqq67oubFtVVdV1ZRm2raqq6rqyDFzXdWXZloEsu67s2rIAAPAEBwCgAhtWRzgpGgssNGQlAJABAEAYg5BCCCFlEEIKIYSUUggJAAAYcAAACDChDBQashIASAUAAIyx1lprrbXWQGettdZaa62AzFprrbXWWmuttdZaa6211lJrrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmstpZRSSimllFJKKaWUUkoppZRSSgUA+lU4APg/2LA6wknRWGChISsBgHAAAMAYpRhzDEIppVQIMeacdFRai7FCiDHnJKTUWmzFc85BKCGV1mIsnnMOQikpxVZjUSmEUlJKLbZYi0qho5JSSq3VWIwxqaTWWoutxmKMSSm01FqLMRYjbE2ptdhqq7EYY2sqLbQYY4zFCF9kbC2m2moNxggjWywt1VprMMYY3VuLpbaaizE++NpSLDHWXAAAd4MDAESCjTOsJJ0VjgYXGrISAAgJACAQUooxxhhzzjnnpFKMOeaccw5CCKFUijHGnHMOQgghlIwx5pxzEEIIIYRSSsaccxBCCCGEkFLqnHMQQgghhBBKKZ1zDkIIIYQQQimlgxBCCCGEEEoopaQUQgghhBBCCKmklEIIIYRSQighlZRSCCGEEEIpJaSUUgohhFJCCKGElFJKKYUQQgillJJSSimlEkoJJYQSUikppRRKCCGUUkpKKaVUSgmhhBJKKSWllFJKIYQQSikFAAAcOAAABBhBJxlVFmGjCRcegEJDVgIAZAAAkKKUUiktRYIipRikGEtGFXNQWoqocgxSzalSziDmJJaIMYSUk1Qy5hRCDELqHHVMKQYtlRhCxhik2HJLoXMOAAAAQQCAgJAAAAMEBTMAwOAA4XMQdAIERxsAgCBEZohEw0JweFAJEBFTAUBigkIuAFRYXKRdXECXAS7o4q4DIQQhCEEsDqCABByccMMTb3jCDU7QKSp1IAAAAAAADADwAACQXAAREdHMYWRobHB0eHyAhIiMkAgAAAAAABcAfAAAJCVAREQ0cxgZGhscHR4fICEiIyQBAIAAAgAAAAAggAAEBAQAAAAAAAIAAAAEBB9DtnUBAAAAAAAEPueBAKOFggAAgACjzoEAA4BwBwCdASqwAJAAAEcIhYWIhYSIAgIABhwJ7kPfbJyHvtk5D32ych77ZOQ99snIe+2TkPfbJyHvtk5D32ych77ZOQ99YAD+/6tQgKOFggADgAqjhYIAD4AOo4WCACSADqOZgQArADECAAEQEAAYABhYL/QACIBDmAYAAKOFggA6gA6jhYIAT4AOo5mBAFMAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAGSADqOFggB6gA6jmYEAewAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIAj4AOo5mBAKMAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAKSADqOFggC6gA6jmYEAywAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIAz4AOo4WCAOSADqOZgQDzADECAAEQEAAYABhYL/QACIBDmAYAAKOFggD6gA6jhYIBD4AOo5iBARsAEQIAARAQFGAAYWC/0AAiAQ5gGACjhYIBJIAOo4WCATqADqOZgQFDADECAAEQEAAYABhYL/QACIBDmAYAAKOFggFPgA6jhYIBZIAOo5mBAWsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAXqADqOFggGPgA6jmYEBkwAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIBpIAOo4WCAbqADqOZgQG7ADECAAEQEAAYABhYL/QACIBDmAYAAKOFggHPgA6jmYEB4wAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIB5IAOo4WCAfqADqOZgQILADECAAEQEAAYABhYL/QACIBDmAYAAKOFggIPgA6jhYICJIAOo5mBAjMAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAjqADqOFggJPgA6jmYECWwAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYICZIAOo4WCAnqADqOZgQKDADECAAEQEAAYABhYL/QACIBDmAYAAKOFggKPgA6jhYICpIAOo5mBAqsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCArqADqOFggLPgA6jmIEC0wARAgABEBAUYABhYL/QACIBDmAYAKOFggLkgA6jhYIC+oAOo5mBAvsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAw+ADqOZgQMjADECAAEQEAAYABhYL/QACIBDmAYAAKOFggMkgA6jhYIDOoAOo5mBA0sAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCA0+ADqOFggNkgA6jmYEDcwAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIDeoAOo4WCA4+ADqOZgQObADECAAEQEAAYABhYL/QACIBDmAYAAKOFggOkgA6jhYIDuoAOo5mBA8MAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCA8+ADqOFggPkgA6jhYID+oAOo4WCBA+ADhxTu2sBAAAAAAAAEbuPs4EDt4r3gQHxghEr8IEK"),this._addSourceToVideo(this.noSleepVideo,"mp4","data:video/mp4;base64,AAAAHGZ0eXBNNFYgAAACAGlzb21pc28yYXZjMQAAAAhmcmVlAAAGF21kYXTeBAAAbGliZmFhYyAxLjI4AABCAJMgBDIARwAAArEGBf//rdxF6b3m2Ui3lizYINkj7u94MjY0IC0gY29yZSAxNDIgcjIgOTU2YzhkOCAtIEguMjY0L01QRUctNCBBVkMgY29kZWMgLSBDb3B5bGVmdCAyMDAzLTIwMTQgLSBodHRwOi8vd3d3LnZpZGVvbGFuLm9yZy94MjY0Lmh0bWwgLSBvcHRpb25zOiBjYWJhYz0wIHJlZj0zIGRlYmxvY2s9MTowOjAgYW5hbHlzZT0weDE6MHgxMTEgbWU9aGV4IHN1Ym1lPTcgcHN5PTEgcHN5X3JkPTEuMDA6MC4wMCBtaXhlZF9yZWY9MSBtZV9yYW5nZT0xNiBjaHJvbWFfbWU9MSB0cmVsbGlzPTEgOHg4ZGN0PTAgY3FtPTAgZGVhZHpvbmU9MjEsMTEgZmFzdF9wc2tpcD0xIGNocm9tYV9xcF9vZmZzZXQ9LTIgdGhyZWFkcz02IGxvb2thaGVhZF90aHJlYWRzPTEgc2xpY2VkX3RocmVhZHM9MCBucj0wIGRlY2ltYXRlPTEgaW50ZXJsYWNlZD0wIGJsdXJheV9jb21wYXQ9MCBjb25zdHJhaW5lZF9pbnRyYT0wIGJmcmFtZXM9MCB3ZWlnaHRwPTAga2V5aW50PTI1MCBrZXlpbnRfbWluPTI1IHNjZW5lY3V0PTQwIGludHJhX3JlZnJlc2g9MCByY19sb29rYWhlYWQ9NDAgcmM9Y3JmIG1idHJlZT0xIGNyZj0yMy4wIHFjb21wPTAuNjAgcXBtaW49MCBxcG1heD02OSBxcHN0ZXA9NCB2YnZfbWF4cmF0ZT03NjggdmJ2X2J1ZnNpemU9MzAwMCBjcmZfbWF4PTAuMCBuYWxfaHJkPW5vbmUgZmlsbGVyPTAgaXBfcmF0aW89MS40MCBhcT0xOjEuMDAAgAAAAFZliIQL8mKAAKvMnJycnJycnJycnXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXiEASZACGQAjgCEASZACGQAjgAAAAAdBmjgX4GSAIQBJkAIZACOAAAAAB0GaVAX4GSAhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZpgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGagC/AySEASZACGQAjgAAAAAZBmqAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZrAL8DJIQBJkAIZACOAAAAABkGa4C/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmwAvwMkhAEmQAhkAI4AAAAAGQZsgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGbQC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBm2AvwMkhAEmQAhkAI4AAAAAGQZuAL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGboC/AySEASZACGQAjgAAAAAZBm8AvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZvgL8DJIQBJkAIZACOAAAAABkGaAC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmiAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZpAL8DJIQBJkAIZACOAAAAABkGaYC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmoAvwMkhAEmQAhkAI4AAAAAGQZqgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGawC/AySEASZACGQAjgAAAAAZBmuAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZsAL8DJIQBJkAIZACOAAAAABkGbIC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBm0AvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZtgL8DJIQBJkAIZACOAAAAABkGbgCvAySEASZACGQAjgCEASZACGQAjgAAAAAZBm6AnwMkhAEmQAhkAI4AhAEmQAhkAI4AhAEmQAhkAI4AhAEmQAhkAI4AAAAhubW9vdgAAAGxtdmhkAAAAAAAAAAAAAAAAAAAD6AAABDcAAQAAAQAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAzB0cmFrAAAAXHRraGQAAAADAAAAAAAAAAAAAAABAAAAAAAAA+kAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAALAAAACQAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAAAPpAAAAAAABAAAAAAKobWRpYQAAACBtZGhkAAAAAAAAAAAAAAAAAAB1MAAAdU5VxAAAAAAALWhkbHIAAAAAAAAAAHZpZGUAAAAAAAAAAAAAAABWaWRlb0hhbmRsZXIAAAACU21pbmYAAAAUdm1oZAAAAAEAAAAAAAAAAAAAACRkaW5mAAAAHGRyZWYAAAAAAAAAAQAAAAx1cmwgAAAAAQAAAhNzdGJsAAAAr3N0c2QAAAAAAAAAAQAAAJ9hdmMxAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAALAAkABIAAAASAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGP//AAAALWF2Y0MBQsAN/+EAFWdCwA3ZAsTsBEAAAPpAADqYA8UKkgEABWjLg8sgAAAAHHV1aWRraEDyXyRPxbo5pRvPAyPzAAAAAAAAABhzdHRzAAAAAAAAAAEAAAAeAAAD6QAAABRzdHNzAAAAAAAAAAEAAAABAAAAHHN0c2MAAAAAAAAAAQAAAAEAAAABAAAAAQAAAIxzdHN6AAAAAAAAAAAAAAAeAAADDwAAAAsAAAALAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAAiHN0Y28AAAAAAAAAHgAAAEYAAANnAAADewAAA5gAAAO0AAADxwAAA+MAAAP2AAAEEgAABCUAAARBAAAEXQAABHAAAASMAAAEnwAABLsAAATOAAAE6gAABQYAAAUZAAAFNQAABUgAAAVkAAAFdwAABZMAAAWmAAAFwgAABd4AAAXxAAAGDQAABGh0cmFrAAAAXHRraGQAAAADAAAAAAAAAAAAAAACAAAAAAAABDcAAAAAAAAAAAAAAAEBAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAAAQkAAADcAABAAAAAAPgbWRpYQAAACBtZGhkAAAAAAAAAAAAAAAAAAC7gAAAykBVxAAAAAAALWhkbHIAAAAAAAAAAHNvdW4AAAAAAAAAAAAAAABTb3VuZEhhbmRsZXIAAAADi21pbmYAAAAQc21oZAAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAADT3N0YmwAAABnc3RzZAAAAAAAAAABAAAAV21wNGEAAAAAAAAAAQAAAAAAAAAAAAIAEAAAAAC7gAAAAAAAM2VzZHMAAAAAA4CAgCIAAgAEgICAFEAVBbjYAAu4AAAADcoFgICAAhGQBoCAgAECAAAAIHN0dHMAAAAAAAAAAgAAADIAAAQAAAAAAQAAAkAAAAFUc3RzYwAAAAAAAAAbAAAAAQAAAAEAAAABAAAAAgAAAAIAAAABAAAAAwAAAAEAAAABAAAABAAAAAIAAAABAAAABgAAAAEAAAABAAAABwAAAAIAAAABAAAACAAAAAEAAAABAAAACQAAAAIAAAABAAAACgAAAAEAAAABAAAACwAAAAIAAAABAAAADQAAAAEAAAABAAAADgAAAAIAAAABAAAADwAAAAEAAAABAAAAEAAAAAIAAAABAAAAEQAAAAEAAAABAAAAEgAAAAIAAAABAAAAFAAAAAEAAAABAAAAFQAAAAIAAAABAAAAFgAAAAEAAAABAAAAFwAAAAIAAAABAAAAGAAAAAEAAAABAAAAGQAAAAIAAAABAAAAGgAAAAEAAAABAAAAGwAAAAIAAAABAAAAHQAAAAEAAAABAAAAHgAAAAIAAAABAAAAHwAAAAQAAAABAAAA4HN0c3oAAAAAAAAAAAAAADMAAAAaAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAACMc3RjbwAAAAAAAAAfAAAALAAAA1UAAANyAAADhgAAA6IAAAO+AAAD0QAAA+0AAAQAAAAEHAAABC8AAARLAAAEZwAABHoAAASWAAAEqQAABMUAAATYAAAE9AAABRAAAAUjAAAFPwAABVIAAAVuAAAFgQAABZ0AAAWwAAAFzAAABegAAAX7AAAGFwAAAGJ1ZHRhAAAAWm1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAALWlsc3QAAAAlqXRvbwAAAB1kYXRhAAAAAQAAAABMYXZmNTUuMzMuMTAw"),this.noSleepVideo.addEventListener("loadedmetadata",(()=>{this.debug&&console.debug("WakeLockManager::start() video loadedmetadata",this.noSleepVideo),this.noSleepVideo&&(this.noSleepVideo.duration<=1?this.noSleepVideo.setAttribute("loop",""):this.noSleepVideo.addEventListener("timeupdate",(()=>{this.noSleepVideo&&this.noSleepVideo.currentTime>.5&&(this.noSleepVideo.currentTime=Math.random())})))})))}_addSourceToVideo(e,t,n){const r=document.createElement("source");r.src=n,r.type=`video/${t}`,e.appendChild(r)}isEnabled(){return this.enabled}setDebug(e){e&&!this.debug&&console.debug("WakeLockManager::setDebug() activate debug mode"),this.debug=e}enable(){return fA(this,void 0,void 0,(function*(){this.enabled&&this.disable("from_enable");const e=Zx(),t=Xx();if(this.debug&&console.debug(`WakeLockManager::enable() hasWakelock=${e} isOldIos=${t}`,this.noSleepVideo),this.start(),Zx())try{const e=yield navigator.wakeLock.request("screen");this._wakeLock=e,this.enabled=!0}catch(e){return this.debug&&console.error("WakeLockManager::enable() failed to enable wake lock",e),this.enabled=!1,!1}else if(Xx())return this.disable("from_enable_old_ios"),this.noSleepTimer=window.setInterval((()=>{document.hidden||(window.location.href=window.location.href.split("#")[0],window.setTimeout(window.stop,0))}),15e3),this.enabled=!0,!0;return!!this.noSleepVideo&&(this.noSleepVideo.play().then((()=>{this.debug&&console.debug("WakeLockManager::enable() video started playing successfully")})).catch((e=>{console.warn("WakeLockManager::enable() video failed to play",e)})),this.enabled=!0,!0)}))}disable(e){if(this.enabled){if(this.debug&&console.debug(`WakeLockManager::disable() context=${e}`),Zx())this._wakeLock&&(this.debug&&console.debug("WakeLockManager::disable() release wake lock"),this._wakeLock.release()),this._wakeLock=void 0;else if(Xx())this.noSleepTimer&&(console.warn("\n NoSleep now disabled for older iOS devices.\n "),window.clearInterval(this.noSleepTimer),this.noSleepTimer=void 0);else try{if(!this.noSleepVideo)return void(this.debug&&console.debug("WakeLockManager::disable() noSleepVideo is undefined"));this.debug&&console.debug("WakeLockManager::disable() pause noSleepVideo"),this.noSleepVideo.firstChild&&(this.noSleepVideo.removeChild(this.noSleepVideo.firstChild),this.noSleepVideo.load()),this.noSleepVideo.pause(),this.noSleepVideo.src="",this.noSleepVideo.remove()}catch(e){console.log(e)}this.enabled=!1}}}const eR=2e3,tR=4e4,nR=500;class rR{constructor({useDeepLink:e,preferredOpenLink:t,wakeLockStatus:n=Gx.UntilResponse,debug:r=!1}){this.state={wakeLock:new Jx,wakeLockStatus:Gx.UntilResponse,wakeLockTimer:void 0,wakeLockFeatureActive:!1,platformType:void 0,useDeeplink:!1,preferredOpenLink:void 0,debug:!1},this.state.platformType=this.getPlatformType(),this.state.useDeeplink=e,this.state.preferredOpenLink=t,this.state.wakeLockStatus=n,this.state.debug=r,this.state.wakeLock.setDebug(r)}enableWakeLock(){return function(e){const{state:t}=e;if(t.wakeLockStatus===Gx.Disabled)return void(t.debug&&console.debug("WakeLock is disabled"));t.wakeLock.enable().catch((e=>{console.error("WakeLock is not supported",e)}));const n=t.wakeLockStatus===Gx.Temporary?eR:tR;t.wakeLockTimer=setTimeout((()=>{e.disableWakeLock()}),n),t.wakeLockFeatureActive||t.wakeLockStatus!==Gx.UntilResponse||(t.wakeLockFeatureActive=!0,window.addEventListener("focus",(()=>{e.disableWakeLock()})))}(this)}disableWakeLock(){return function(e){const{state:t}=e;t.wakeLockStatus!==Gx.Disabled&&(t.wakeLockTimer&&clearTimeout(t.wakeLockTimer),t.wakeLock.disable("disableWakeLock"))}(this)}openDeeplink(e,t,n){return function(e,t,n,r){const{state:i}=e;i.debug&&(console.debug(`Platform::openDeepLink universalLink --\x3e ${t}`),console.debug(`Platform::openDeepLink deepLink --\x3e ${n}`)),e.isBrowser()&&e.enableWakeLock();try{if(i.preferredOpenLink)return void i.preferredOpenLink(i.useDeeplink?n:t,r);if(i.debug&&console.warn(`Platform::openDeepLink() open link now useDeepLink=${i.useDeeplink}`,i.useDeeplink?n:t),"undefined"!=typeof window){let e;e=i.useDeeplink?window.open(n,"_blank"):window.open(t,"_blank"),setTimeout((()=>{var t;return null===(t=null==e?void 0:e.close)||void 0===t?void 0:t.call(e)}),nR)}}catch(e){console.log("Platform::openDeepLink() can't open link",e)}}(this,e,t,n)}isReactNative(){var e;return this.isNotBrowser()&&"undefined"!=typeof window&&(null===window||void 0===window?void 0:window.navigator)&&"ReactNative"===(null===(e=window.navigator)||void 0===e?void 0:e.product)}isMetaMaskInstalled(){return function(e){const{state:t}=e,n=Ix.getProvider()||(null===window||void 0===window?void 0:window.ethereum);return t.debug&&console.debug(`Platform::isMetaMaskInstalled isMetaMask=${null==n?void 0:n.isMetaMask} isConnected=${null==n?void 0:n.isConnected()}`),(null==n?void 0:n.isMetaMask)&&(null==n?void 0:n.isConnected())}(this)}isDesktopWeb(){return this.isBrowser()&&!this.isMobileWeb()}isMobile(){var e,t;const n=Qx.parse(window.navigator.userAgent);return"mobile"===(null===(e=null==n?void 0:n.platform)||void 0===e?void 0:e.type)||"tablet"===(null===(t=null==n?void 0:n.platform)||void 0===t?void 0:t.type)}isSecure(){return this.isReactNative()||this.isMobileWeb()}isMetaMaskMobileWebView(){return"undefined"!=typeof window&&Boolean(window.ReactNativeWebView)&&Boolean(navigator.userAgent.endsWith("MetaMaskMobile"))}isMobileWeb(){return this.state.platformType===t.PlatformType.MobileWeb}isNotBrowser(){var t;return"undefined"==typeof window||!(null===window||void 0===window?void 0:window.navigator)||void 0!==e.commonjsGlobal&&"ReactNative"===(null===(t=null===e.commonjsGlobal||void 0===e.commonjsGlobal?void 0:e.commonjsGlobal.navigator)||void 0===t?void 0:t.product)||"ReactNative"===(null===navigator||void 0===navigator?void 0:navigator.product)}isNodeJS(){return this.isNotBrowser()&&!this.isReactNative()}isBrowser(){return!this.isNotBrowser()}isUseDeepLink(){return this.state.useDeeplink}getPlatformType(){return function(e){const{state:n}=e;return n.platformType?n.platformType:e.isReactNative()?t.PlatformType.ReactNative:e.isNotBrowser()?t.PlatformType.NonBrowser:e.isMetaMaskMobileWebView()?t.PlatformType.MetaMaskMobileWebview:e.isMobile()?t.PlatformType.MobileWeb:t.PlatformType.DesktopWeb}(this)}}
|
|
1
|
+
"use strict";var e=require("./index-78abdb84.cjs");require("@ethersproject/address"),require("@ethersproject/providers"),require("zustand"),require("events"),require("@ethersproject/bytes"),require("@ethersproject/properties"),require("@ethersproject/abstract-signer"),require("buffer"),require("@ethersproject/abstract-provider"),require("@ethersproject/contracts"),require("@ethersproject/constants"),require("@ethersproject/transactions");var t={exports:{}};!function(t,n){e.commonjsGlobal,function(t){var n=void 0!==e.commonjsGlobal?e.commonjsGlobal:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==e.commonjsGlobal?e.commonjsGlobal:"undefined"!=typeof self?self:{};function i(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function o(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})})),n}var a={exports:{}};!function(e,t){var n="undefined"!=typeof self?self:r,i=function(){function e(){this.fetch=!1,this.DOMException=n.DOMException}return e.prototype=n,new e}();!function(e){!function(t){var n="URLSearchParams"in e,r="Symbol"in e&&"iterator"in Symbol,i="FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),o="FormData"in e,a="ArrayBuffer"in e;if(a)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(e){return e&&s.indexOf(Object.prototype.toString.call(e))>-1};function l(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function c(e){return"string"!=typeof e&&(e=String(e)),e}function d(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return r&&(t[Symbol.iterator]=function(){return t}),t}function f(e){this.map={},e instanceof f?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function h(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function p(e){return new Promise((function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function m(e){var t=new FileReader,n=p(t);return t.readAsArrayBuffer(e),n}function g(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function v(){return this.bodyUsed=!1,this._initBody=function(e){var t;this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:i&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:o&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:n&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():a&&i&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=g(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a&&(ArrayBuffer.prototype.isPrototypeOf(e)||u(e))?this._bodyArrayBuffer=g(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var e=h(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?h(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(m)}),this.text=function(){var e,t,n,r=h(this);if(r)return r;if(this._bodyBlob)return e=this._bodyBlob,n=p(t=new FileReader),t.readAsText(e),n;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=new Array(t.length),r=0;r<t.length;r++)n[r]=String.fromCharCode(t[r]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},o&&(this.formData=function(){return this.text().then(w)}),this.json=function(){return this.text().then(JSON.parse)},this}f.prototype.append=function(e,t){e=l(e),t=c(t);var n=this.map[e];this.map[e]=n?n+", "+t:t},f.prototype.delete=function(e){delete this.map[l(e)]},f.prototype.get=function(e){return e=l(e),this.has(e)?this.map[e]:null},f.prototype.has=function(e){return this.map.hasOwnProperty(l(e))},f.prototype.set=function(e,t){this.map[l(e)]=c(t)},f.prototype.forEach=function(e,t){for(var n in this.map)this.map.hasOwnProperty(n)&&e.call(t,this.map[n],n,this)},f.prototype.keys=function(){var e=[];return this.forEach((function(t,n){e.push(n)})),d(e)},f.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),d(e)},f.prototype.entries=function(){var e=[];return this.forEach((function(t,n){e.push([n,t])})),d(e)},r&&(f.prototype[Symbol.iterator]=f.prototype.entries);var y=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function b(e,t){var n=(t=t||{}).body;if(e instanceof b){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new f(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,n||null==e._bodyInit||(n=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new f(t.headers)),this.method=function(e){var t=e.toUpperCase();return y.indexOf(t)>-1?t:e}(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function w(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(i))}})),t}function A(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new f(t.headers),this.url=t.url||"",this._initBody(e)}b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},v.call(b.prototype),v.call(A.prototype),A.prototype.clone=function(){return new A(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},A.error=function(){var e=new A(null,{status:0,statusText:""});return e.type="error",e};var _=[301,302,303,307,308];A.redirect=function(e,t){if(-1===_.indexOf(t))throw new RangeError("Invalid status code");return new A(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function E(e,n){return new Promise((function(r,o){var a=new b(e,n);if(a.signal&&a.signal.aborted)return o(new t.DOMException("Aborted","AbortError"));var s=new XMLHttpRequest;function u(){s.abort()}s.onload=function(){var e,t,n={status:s.status,statusText:s.statusText,headers:(e=s.getAllResponseHeaders()||"",t=new f,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var n=e.split(":"),r=n.shift().trim();if(r){var i=n.join(":").trim();t.append(r,i)}})),t)};n.url="responseURL"in s?s.responseURL:n.headers.get("X-Request-URL");var i="response"in s?s.response:s.responseText;r(new A(i,n))},s.onerror=function(){o(new TypeError("Network request failed"))},s.ontimeout=function(){o(new TypeError("Network request failed"))},s.onabort=function(){o(new t.DOMException("Aborted","AbortError"))},s.open(a.method,a.url,!0),"include"===a.credentials?s.withCredentials=!0:"omit"===a.credentials&&(s.withCredentials=!1),"responseType"in s&&i&&(s.responseType="blob"),a.headers.forEach((function(e,t){s.setRequestHeader(t,e)})),a.signal&&(a.signal.addEventListener("abort",u),s.onreadystatechange=function(){4===s.readyState&&a.signal.removeEventListener("abort",u)}),s.send(void 0===a._bodyInit?null:a._bodyInit)}))}E.polyfill=!0,e.fetch||(e.fetch=E,e.Headers=f,e.Request=b,e.Response=A),t.Headers=f,t.Request=b,t.Response=A,t.fetch=E,Object.defineProperty(t,"__esModule",{value:!0})}({})}(i),i.fetch.ponyfill=!0,delete i.fetch.polyfill;var o=i;(t=o.fetch).default=o.fetch,t.fetch=o.fetch,t.Headers=o.Headers,t.Request=o.Request,t.Response=o.Response,e.exports=t}(a,a.exports);var s=i(a.exports);function u(){throw new Error("setTimeout has not been defined")}function l(){throw new Error("clearTimeout has not been defined")}var c=u,d=l;function f(e){if(c===setTimeout)return setTimeout(e,0);if((c===u||!c)&&setTimeout)return c=setTimeout,setTimeout(e,0);try{return c(e,0)}catch(t){try{return c.call(null,e,0)}catch(t){return c.call(this,e,0)}}}"function"==typeof n.setTimeout&&(c=setTimeout),"function"==typeof n.clearTimeout&&(d=clearTimeout);var h,p=[],m=!1,g=-1;function v(){m&&h&&(m=!1,h.length?p=h.concat(p):g=-1,p.length&&y())}function y(){if(!m){var e=f(v);m=!0;for(var t=p.length;t;){for(h=p,p=[];++g<t;)h&&h[g].run();g=-1,t=p.length}h=null,m=!1,function(e){if(d===clearTimeout)return clearTimeout(e);if((d===l||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(e);try{return d(e)}catch(t){try{return d.call(null,e)}catch(t){return d.call(this,e)}}}(e)}}function b(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];p.push(new w(e,t)),1!==p.length||m||f(y)}function w(e,t){this.fun=e,this.array=t}function A(){}w.prototype.run=function(){this.fun.apply(null,this.array)};var _=A,E=A,S=A,k=A,M=A,C=A,x=A,R=n.performance||{},O=R.now||R.mozNow||R.msNow||R.oNow||R.webkitNow||function(){return(new Date).getTime()},T=new Date,P={nextTick:b,title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:_,addListener:E,once:S,off:k,removeListener:M,removeAllListeners:C,emit:x,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*O.call(R),n=Math.floor(t),r=Math.floor(t%1*1e9);return e&&(n-=e[0],(r-=e[1])<0&&(n--,r+=1e9)),[n,r]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-T)/1e3}},L={exports:{}};!function(e,t){!function(t){var n=Object.hasOwnProperty,r=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},i="object"==typeof P&&!0,o="function"==typeof Symbol,a="object"==typeof Reflect,s="function"==typeof setImmediate?setImmediate:setTimeout,u=o?a&&"function"==typeof Reflect.ownKeys?Reflect.ownKeys:function(e){var t=Object.getOwnPropertyNames(e);return t.push.apply(t,Object.getOwnPropertySymbols(e)),t}:Object.keys;function l(){this._events={},this._conf&&c.call(this,this._conf)}function c(e){e&&(this._conf=e,e.delimiter&&(this.delimiter=e.delimiter),e.maxListeners!==t&&(this._maxListeners=e.maxListeners),e.wildcard&&(this.wildcard=e.wildcard),e.newListener&&(this._newListener=e.newListener),e.removeListener&&(this._removeListener=e.removeListener),e.verboseMemoryLeak&&(this.verboseMemoryLeak=e.verboseMemoryLeak),e.ignoreErrors&&(this.ignoreErrors=e.ignoreErrors),this.wildcard&&(this.listenerTree={}))}function d(e,t){var n="(node) warning: possible EventEmitter memory leak detected. "+e+" listeners added. Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak&&(n+=" Event name: "+t+"."),void 0!==P&&P.emitWarning){var r=new Error(n);r.name="MaxListenersExceededWarning",r.emitter=this,r.count=e,P.emitWarning(r)}else console.error(n),console.trace&&console.trace()}var f=function(e,t,n){var r=arguments.length;switch(r){case 0:return[];case 1:return[e];case 2:return[e,t];case 3:return[e,t,n];default:for(var i=new Array(r);r--;)i[r]=arguments[r];return i}};function h(e,n){for(var r={},i=e.length,o=n?n.length:0,a=0;a<i;a++)r[e[a]]=a<o?n[a]:t;return r}function p(e,t,n){var r,i;if(this._emitter=e,this._target=t,this._listeners={},this._listenersCount=0,(n.on||n.off)&&(r=n.on,i=n.off),t.addEventListener?(r=t.addEventListener,i=t.removeEventListener):t.addListener?(r=t.addListener,i=t.removeListener):t.on&&(r=t.on,i=t.off),!r&&!i)throw Error("target does not implement any known event API");if("function"!=typeof r)throw TypeError("on method must be a function");if("function"!=typeof i)throw TypeError("off method must be a function");this._on=r,this._off=i;var o=e._observers;o?o.push(this):e._observers=[this]}function m(e,r,i,o){var a=Object.assign({},r);if(!e)return a;if("object"!=typeof e)throw TypeError("options must be an object");var s,u,l,c=Object.keys(e),d=c.length;function f(e){throw Error('Invalid "'+s+'" option value'+(e?". Reason: "+e:""))}for(var h=0;h<d;h++){if(s=c[h],!o&&!n.call(r,s))throw Error('Unknown "'+s+'" option');(u=e[s])!==t&&(l=i[s],a[s]=l?l(u,f):u)}return a}function g(e,t){return"function"==typeof e&&e.hasOwnProperty("prototype")||t("value must be a constructor"),e}function v(e){var t="value must be type of "+e.join("|"),n=e.length,r=e[0],i=e[1];return 1===n?function(e,n){if(typeof e===r)return e;n(t)}:2===n?function(e,n){var o=typeof e;if(o===r||o===i)return e;n(t)}:function(r,i){for(var o=typeof r,a=n;a-- >0;)if(o===e[a])return r;i(t)}}Object.assign(p.prototype,{subscribe:function(e,t,n){var r=this,i=this._target,o=this._emitter,a=this._listeners,s=function(){var r=f.apply(null,arguments),a={data:r,name:t,original:e};n?!1!==n.call(i,a)&&o.emit.apply(o,[a.name].concat(r)):o.emit.apply(o,[t].concat(r))};if(a[e])throw Error("Event '"+e+"' is already listening");this._listenersCount++,o._newListener&&o._removeListener&&!r._onNewListener?(this._onNewListener=function(n){n===t&&null===a[e]&&(a[e]=s,r._on.call(i,e,s))},o.on("newListener",this._onNewListener),this._onRemoveListener=function(n){n===t&&!o.hasListeners(n)&&a[e]&&(a[e]=null,r._off.call(i,e,s))},a[e]=null,o.on("removeListener",this._onRemoveListener)):(a[e]=s,r._on.call(i,e,s))},unsubscribe:function(e){var t,n,r,i=this,o=this._listeners,a=this._emitter,s=this._off,l=this._target;if(e&&"string"!=typeof e)throw TypeError("event must be a string");function c(){i._onNewListener&&(a.off("newListener",i._onNewListener),a.off("removeListener",i._onRemoveListener),i._onNewListener=null,i._onRemoveListener=null);var e=_.call(a,i);a._observers.splice(e,1)}if(e){if(!(t=o[e]))return;s.call(l,e,t),delete o[e],--this._listenersCount||c()}else{for(r=(n=u(o)).length;r-- >0;)e=n[r],s.call(l,e,o[e]);this._listeners={},this._listenersCount=0,c()}}});var y=v(["function"]),w=v(["object","function"]);function A(e,t,n){var r,i,o,a=0,s=new e((function(u,l,c){function d(){i&&(i=null),a&&(clearTimeout(a),a=0)}n=m(n,{timeout:0,overload:!1},{timeout:function(e,t){return("number"!=typeof(e*=1)||e<0||!Number.isFinite(e))&&t("timeout must be a positive number"),e}}),r=!n.overload&&"function"==typeof e.prototype.cancel&&"function"==typeof c;var f=function(e){d(),u(e)},h=function(e){d(),l(e)};r?t(f,h,c):(i=[function(e){h(e||Error("canceled"))}],t(f,h,(function(e){if(o)throw Error("Unable to subscribe on cancel event asynchronously");if("function"!=typeof e)throw TypeError("onCancel callback must be a function");i.push(e)})),o=!0),n.timeout>0&&(a=setTimeout((function(){var e=Error("timeout");e.code="ETIMEDOUT",a=0,s.cancel(e),l(e)}),n.timeout))}));return r||(s.cancel=function(e){if(i){for(var t=i.length,n=1;n<t;n++)i[n](e);i[0](e),i=null}}),s}function _(e){var t=this._observers;if(!t)return-1;for(var n=t.length,r=0;r<n;r++)if(t[r]._target===e)return r;return-1}function E(e,t,n,r,i){if(!n)return null;if(0===r){var o=typeof t;if("string"===o){var a,s,l=0,c=0,d=this.delimiter,f=d.length;if(-1!==(s=t.indexOf(d))){a=new Array(5);do{a[l++]=t.slice(c,s),c=s+f}while(-1!==(s=t.indexOf(d,c)));a[l++]=t.slice(c),t=a,i=l}else t=[t],i=1}else"object"===o?i=t.length:(t=[t],i=1)}var h,p,m,g,v,y,b,w=null,A=t[r],_=t[r+1];if(r===i)n._listeners&&("function"==typeof n._listeners?(e&&e.push(n._listeners),w=[n]):(e&&e.push.apply(e,n._listeners),w=[n]));else{if("*"===A){for(s=(y=u(n)).length;s-- >0;)"_listeners"!==(h=y[s])&&(b=E(e,t,n[h],r+1,i))&&(w?w.push.apply(w,b):w=b);return w}if("**"===A){for((v=r+1===i||r+2===i&&"*"===_)&&n._listeners&&(w=E(e,t,n,i,i)),s=(y=u(n)).length;s-- >0;)"_listeners"!==(h=y[s])&&("*"===h||"**"===h?(n[h]._listeners&&!v&&(b=E(e,t,n[h],i,i))&&(w?w.push.apply(w,b):w=b),b=E(e,t,n[h],r,i)):b=E(e,t,n[h],h===_?r+2:r,i),b&&(w?w.push.apply(w,b):w=b));return w}n[A]&&(w=E(e,t,n[A],r+1,i))}if((p=n["*"])&&E(e,t,p,r+1,i),m=n["**"])if(r<i)for(m._listeners&&E(e,t,m,i,i),s=(y=u(m)).length;s-- >0;)"_listeners"!==(h=y[s])&&(h===_?E(e,t,m[h],r+2,i):h===A?E(e,t,m[h],r+1,i):((g={})[h]=m[h],E(e,t,{"**":g},r+1,i)));else m._listeners?E(e,t,m,i,i):m["*"]&&m["*"]._listeners&&E(e,t,m["*"],i,i);return w}function S(e,t,n){var r,i,o=0,a=0,s=this.delimiter,u=s.length;if("string"==typeof e)if(-1!==(r=e.indexOf(s))){i=new Array(5);do{i[o++]=e.slice(a,r),a=r+u}while(-1!==(r=e.indexOf(s,a)));i[o++]=e.slice(a)}else i=[e],o=1;else i=e,o=e.length;if(o>1)for(r=0;r+1<o;r++)if("**"===i[r]&&"**"===i[r+1])return;var l,c=this.listenerTree;for(r=0;r<o;r++)if(c=c[l=i[r]]||(c[l]={}),r===o-1)return c._listeners?("function"==typeof c._listeners&&(c._listeners=[c._listeners]),n?c._listeners.unshift(t):c._listeners.push(t),!c._listeners.warned&&this._maxListeners>0&&c._listeners.length>this._maxListeners&&(c._listeners.warned=!0,d.call(this,c._listeners.length,l))):c._listeners=t,!0;return!0}function k(e,t,n,r){for(var i,o,a,s,l=u(e),c=l.length,d=e._listeners;c-- >0;)i=e[o=l[c]],a="_listeners"===o?n:n?n.concat(o):[o],s=r||"symbol"==typeof o,d&&t.push(s?a:a.join(this.delimiter)),"object"==typeof i&&k.call(this,i,t,a,s);return t}function M(e){for(var t,n,r,i=u(e),o=i.length;o-- >0;)(t=e[n=i[o]])&&(r=!0,"_listeners"===n||M(t)||delete e[n]);return r}function C(e,t,n){this.emitter=e,this.event=t,this.listener=n}function x(e,n,r){if(!0===r)a=!0;else if(!1===r)o=!0;else{if(!r||"object"!=typeof r)throw TypeError("options should be an object or true");var o=r.async,a=r.promisify,u=r.nextTick,l=r.objectify}if(o||u||a){var c=n,d=n._origin||n;if(u&&!i)throw Error("process.nextTick is not supported");a===t&&(a="AsyncFunction"===n.constructor.name),n=function(){var e=arguments,t=this,n=this.event;return a?u?Promise.resolve():new Promise((function(e){s(e)})).then((function(){return t.event=n,c.apply(t,e)})):(u?b:s)((function(){t.event=n,c.apply(t,e)}))},n._async=!0,n._origin=d}return[n,l?new C(this,e,n):this]}function R(e){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,c.call(this,e)}C.prototype.off=function(){return this.emitter.off(this.event,this.listener),this},R.EventEmitter2=R,R.prototype.listenTo=function(e,n,i){if("object"!=typeof e)throw TypeError("target musts be an object");var o=this;function a(t){if("object"!=typeof t)throw TypeError("events must be an object");var n,r=i.reducers,a=_.call(o,e);n=-1===a?new p(o,e,i):o._observers[a];for(var s,l=u(t),c=l.length,d="function"==typeof r,f=0;f<c;f++)s=l[f],n.subscribe(s,t[s]||s,d?r:r&&r[s])}return i=m(i,{on:t,off:t,reducers:t},{on:y,off:y,reducers:w}),r(n)?a(h(n)):a("string"==typeof n?h(n.split(/\s+/)):n),this},R.prototype.stopListeningTo=function(e,t){var n=this._observers;if(!n)return!1;var r,i=n.length,o=!1;if(e&&"object"!=typeof e)throw TypeError("target should be an object");for(;i-- >0;)r=n[i],e&&r._target!==e||(r.unsubscribe(t),o=!0);return o},R.prototype.delimiter=".",R.prototype.setMaxListeners=function(e){e!==t&&(this._maxListeners=e,this._conf||(this._conf={}),this._conf.maxListeners=e)},R.prototype.getMaxListeners=function(){return this._maxListeners},R.prototype.event="",R.prototype.once=function(e,t,n){return this._once(e,t,!1,n)},R.prototype.prependOnceListener=function(e,t,n){return this._once(e,t,!0,n)},R.prototype._once=function(e,t,n,r){return this._many(e,1,t,n,r)},R.prototype.many=function(e,t,n,r){return this._many(e,t,n,!1,r)},R.prototype.prependMany=function(e,t,n,r){return this._many(e,t,n,!0,r)},R.prototype._many=function(e,t,n,r,i){var o=this;if("function"!=typeof n)throw new Error("many only accepts instances of Function");function a(){return 0==--t&&o.off(e,a),n.apply(this,arguments)}return a._origin=n,this._on(e,a,r,i)},R.prototype.emit=function(){if(!this._events&&!this._all)return!1;this._events||l.call(this);var e,t,n,r,i,a,s=arguments[0],u=this.wildcard;if("newListener"===s&&!this._newListener&&!this._events.newListener)return!1;if(u&&(e=s,"newListener"!==s&&"removeListener"!==s&&"object"==typeof s)){if(n=s.length,o)for(r=0;r<n;r++)if("symbol"==typeof s[r]){a=!0;break}a||(s=s.join(this.delimiter))}var c,d=arguments.length;if(this._all&&this._all.length)for(r=0,n=(c=this._all.slice()).length;r<n;r++)switch(this.event=s,d){case 1:c[r].call(this,s);break;case 2:c[r].call(this,s,arguments[1]);break;case 3:c[r].call(this,s,arguments[1],arguments[2]);break;default:c[r].apply(this,arguments)}if(u)c=[],E.call(this,c,e,this.listenerTree,0,n);else{if("function"==typeof(c=this._events[s])){switch(this.event=s,d){case 1:c.call(this);break;case 2:c.call(this,arguments[1]);break;case 3:c.call(this,arguments[1],arguments[2]);break;default:for(t=new Array(d-1),i=1;i<d;i++)t[i-1]=arguments[i];c.apply(this,t)}return!0}c&&(c=c.slice())}if(c&&c.length){if(d>3)for(t=new Array(d-1),i=1;i<d;i++)t[i-1]=arguments[i];for(r=0,n=c.length;r<n;r++)switch(this.event=s,d){case 1:c[r].call(this);break;case 2:c[r].call(this,arguments[1]);break;case 3:c[r].call(this,arguments[1],arguments[2]);break;default:c[r].apply(this,t)}return!0}if(!this.ignoreErrors&&!this._all&&"error"===s)throw arguments[1]instanceof Error?arguments[1]:new Error("Uncaught, unspecified 'error' event.");return!!this._all},R.prototype.emitAsync=function(){if(!this._events&&!this._all)return!1;this._events||l.call(this);var e,t,n,r,i,a,s=arguments[0],u=this.wildcard;if("newListener"===s&&!this._newListener&&!this._events.newListener)return Promise.resolve([!1]);if(u&&(e=s,"newListener"!==s&&"removeListener"!==s&&"object"==typeof s)){if(r=s.length,o)for(i=0;i<r;i++)if("symbol"==typeof s[i]){t=!0;break}t||(s=s.join(this.delimiter))}var c,d=[],f=arguments.length;if(this._all)for(i=0,r=this._all.length;i<r;i++)switch(this.event=s,f){case 1:d.push(this._all[i].call(this,s));break;case 2:d.push(this._all[i].call(this,s,arguments[1]));break;case 3:d.push(this._all[i].call(this,s,arguments[1],arguments[2]));break;default:d.push(this._all[i].apply(this,arguments))}if(u?(c=[],E.call(this,c,e,this.listenerTree,0)):c=this._events[s],"function"==typeof c)switch(this.event=s,f){case 1:d.push(c.call(this));break;case 2:d.push(c.call(this,arguments[1]));break;case 3:d.push(c.call(this,arguments[1],arguments[2]));break;default:for(n=new Array(f-1),a=1;a<f;a++)n[a-1]=arguments[a];d.push(c.apply(this,n))}else if(c&&c.length){if(c=c.slice(),f>3)for(n=new Array(f-1),a=1;a<f;a++)n[a-1]=arguments[a];for(i=0,r=c.length;i<r;i++)switch(this.event=s,f){case 1:d.push(c[i].call(this));break;case 2:d.push(c[i].call(this,arguments[1]));break;case 3:d.push(c[i].call(this,arguments[1],arguments[2]));break;default:d.push(c[i].apply(this,n))}}else if(!this.ignoreErrors&&!this._all&&"error"===s)return arguments[1]instanceof Error?Promise.reject(arguments[1]):Promise.reject("Uncaught, unspecified 'error' event.");return Promise.all(d)},R.prototype.on=function(e,t,n){return this._on(e,t,!1,n)},R.prototype.prependListener=function(e,t,n){return this._on(e,t,!0,n)},R.prototype.onAny=function(e){return this._onAny(e,!1)},R.prototype.prependAny=function(e){return this._onAny(e,!0)},R.prototype.addListener=R.prototype.on,R.prototype._onAny=function(e,t){if("function"!=typeof e)throw new Error("onAny only accepts instances of Function");return this._all||(this._all=[]),t?this._all.unshift(e):this._all.push(e),this},R.prototype._on=function(e,n,r,i){if("function"==typeof e)return this._onAny(e,n),this;if("function"!=typeof n)throw new Error("on only accepts instances of Function");this._events||l.call(this);var o,a=this;return i!==t&&(n=(o=x.call(this,e,n,i))[0],a=o[1]),this._newListener&&this.emit("newListener",e,n),this.wildcard?(S.call(this,e,n,r),a):(this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),r?this._events[e].unshift(n):this._events[e].push(n),!this._events[e].warned&&this._maxListeners>0&&this._events[e].length>this._maxListeners&&(this._events[e].warned=!0,d.call(this,this._events[e].length,e))):this._events[e]=n,a)},R.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var n,i=[];if(this.wildcard){var o="string"==typeof e?e.split(this.delimiter):e.slice();if(!(i=E.call(this,null,o,this.listenerTree,0)))return this}else{if(!this._events[e])return this;n=this._events[e],i.push({_listeners:n})}for(var a=0;a<i.length;a++){var s=i[a];if(n=s._listeners,r(n)){for(var u=-1,l=0,c=n.length;l<c;l++)if(n[l]===t||n[l].listener&&n[l].listener===t||n[l]._origin&&n[l]._origin===t){u=l;break}if(u<0)continue;return this.wildcard?s._listeners.splice(u,1):this._events[e].splice(u,1),0===n.length&&(this.wildcard?delete s._listeners:delete this._events[e]),this._removeListener&&this.emit("removeListener",e,t),this}(n===t||n.listener&&n.listener===t||n._origin&&n._origin===t)&&(this.wildcard?delete s._listeners:delete this._events[e],this._removeListener&&this.emit("removeListener",e,t))}return this.listenerTree&&M(this.listenerTree),this},R.prototype.offAny=function(e){var t,n=0,r=0;if(e&&this._all&&this._all.length>0){for(n=0,r=(t=this._all).length;n<r;n++)if(e===t[n])return t.splice(n,1),this._removeListener&&this.emit("removeListenerAny",e),this}else{if(t=this._all,this._removeListener)for(n=0,r=t.length;n<r;n++)this.emit("removeListenerAny",t[n]);this._all=[]}return this},R.prototype.removeListener=R.prototype.off,R.prototype.removeAllListeners=function(e){if(e===t)return!this._events||l.call(this),this;if(this.wildcard){var n,r=E.call(this,null,e,this.listenerTree,0);if(!r)return this;for(n=0;n<r.length;n++)r[n]._listeners=null;this.listenerTree&&M(this.listenerTree)}else this._events&&(this._events[e]=null);return this},R.prototype.listeners=function(e){var n,r,i,o,a,s=this._events;if(e===t){if(this.wildcard)throw Error("event name required for wildcard emitter");if(!s)return[];for(o=(n=u(s)).length,i=[];o-- >0;)"function"==typeof(r=s[n[o]])?i.push(r):i.push.apply(i,r);return i}if(this.wildcard){if(!(a=this.listenerTree))return[];var l=[],c="string"==typeof e?e.split(this.delimiter):e.slice();return E.call(this,l,c,a,0),l}return s&&(r=s[e])?"function"==typeof r?[r]:r:[]},R.prototype.eventNames=function(e){var t=this._events;return this.wildcard?k.call(this,this.listenerTree,[],null,e):t?u(t):[]},R.prototype.listenerCount=function(e){return this.listeners(e).length},R.prototype.hasListeners=function(e){if(this.wildcard){var n=[],r="string"==typeof e?e.split(this.delimiter):e.slice();return E.call(this,n,r,this.listenerTree,0),n.length>0}var i=this._events,o=this._all;return!!(o&&o.length||i&&(e===t?u(i).length:i[e]))},R.prototype.listenersAny=function(){return this._all?this._all:[]},R.prototype.waitFor=function(e,n){var r=this,i=typeof n;return"number"===i?n={timeout:n}:"function"===i&&(n={filter:n}),A((n=m(n,{timeout:0,filter:t,handleError:!1,Promise:Promise,overload:!1},{filter:y,Promise:g})).Promise,(function(t,i,o){function a(){var o=n.filter;if(!o||o.apply(r,arguments))if(r.off(e,a),n.handleError){var s=arguments[0];s?i(s):t(f.apply(null,arguments).slice(1))}else t(f.apply(null,arguments))}o((function(){r.off(e,a)})),r._on(e,a,!1)}),{timeout:n.timeout,overload:n.overload})};var O=R.prototype;Object.defineProperties(R,{defaultMaxListeners:{get:function(){return O._maxListeners},set:function(e){if("number"!=typeof e||e<0||Number.isNaN(e))throw TypeError("n must be a non-negative number");O._maxListeners=e},enumerable:!0},once:{value:function(e,t,n){return A((n=m(n,{Promise:Promise,timeout:0,overload:!1},{Promise:g})).Promise,(function(n,r,i){var o;if("function"==typeof e.addEventListener)return o=function(){n(f.apply(null,arguments))},i((function(){e.removeEventListener(t,o)})),void e.addEventListener(t,o,{once:!0});var a,s=function(){a&&e.removeListener("error",a),n(f.apply(null,arguments))};"error"!==t&&(a=function(n){e.removeListener(t,s),r(n)},e.once("error",a)),i((function(){a&&e.removeListener("error",a),e.removeListener(t,s)})),e.once(t,s)}),{timeout:n.timeout,overload:n.overload})},writable:!0,configurable:!0}}),Object.defineProperties(O,{_maxListeners:{value:10,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),"function"==typeof t&&t.amd?t((function(){return R})):e.exports=R}()}(L);var I,N=L.exports,D=new Uint8Array(16);function B(){if(!I&&!(I="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return I(D)}var j=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function U(e){return"string"==typeof e&&j.test(e)}for(var z=[],F=0;F<256;++F)z.push((F+256).toString(16).substr(1));function q(e,t,n){var r=(e=e||{}).random||(e.rng||B)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(var i=0;i<16;++i)t[n+i]=r[i];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(z[e[t+0]]+z[e[t+1]]+z[e[t+2]]+z[e[t+3]]+"-"+z[e[t+4]]+z[e[t+5]]+"-"+z[e[t+6]]+z[e[t+7]]+"-"+z[e[t+8]]+z[e[t+9]]+"-"+z[e[t+10]]+z[e[t+11]]+z[e[t+12]]+z[e[t+13]]+z[e[t+14]]+z[e[t+15]]).toLowerCase();if(!U(n))throw TypeError("Stringified UUID is invalid");return n}(r)}const W=Object.create(null);W.open="0",W.close="1",W.ping="2",W.pong="3",W.message="4",W.upgrade="5",W.noop="6";const V=Object.create(null);Object.keys(W).forEach((e=>{V[W[e]]=e}));const K={type:"error",data:"parser error"},H="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),$="function"==typeof ArrayBuffer,Y=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,G=({type:e,data:t},n,r)=>H&&t instanceof Blob?n?r(t):Q(t,r):$&&(t instanceof ArrayBuffer||Y(t))?n?r(t):Q(new Blob([t]),r):r(W[e]+(t||"")),Q=(e,t)=>{const n=new FileReader;return n.onload=function(){const e=n.result.split(",")[1];t("b"+(e||""))},n.readAsDataURL(e)};function Z(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let X;function J(e,t){return H&&e.data instanceof Blob?e.data.arrayBuffer().then(Z).then(t):$&&(e.data instanceof ArrayBuffer||Y(e.data))?t(Z(e.data)):void G(e,!1,(e=>{X||(X=new TextEncoder),t(X.encode(e))}))}const ee="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",te="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e<64;e++)te[ee.charCodeAt(e)]=e;const ne="function"==typeof ArrayBuffer,re=(e,t)=>{if("string"!=typeof e)return{type:"message",data:oe(e,t)};const n=e.charAt(0);return"b"===n?{type:"message",data:ie(e.substring(1),t)}:V[n]?e.length>1?{type:V[n],data:e.substring(1)}:{type:V[n]}:K},ie=(e,t)=>{if(ne){const n=(e=>{let t,n,r,i,o,a=.75*e.length,s=e.length,u=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);const l=new ArrayBuffer(a),c=new Uint8Array(l);for(t=0;t<s;t+=4)n=te[e.charCodeAt(t)],r=te[e.charCodeAt(t+1)],i=te[e.charCodeAt(t+2)],o=te[e.charCodeAt(t+3)],c[u++]=n<<2|r>>4,c[u++]=(15&r)<<4|i>>2,c[u++]=(3&i)<<6|63&o;return l})(e);return oe(n,t)}return{base64:!0,data:e}},oe=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer,ae=String.fromCharCode(30);let se;function ue(e){if(e)return function(e){for(var t in ue.prototype)e[t]=ue.prototype[t];return e}(e)}ue.prototype.on=ue.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},ue.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},ue.prototype.off=ue.prototype.removeListener=ue.prototype.removeAllListeners=ue.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var i=0;i<r.length;i++)if((n=r[i])===t||n.fn===t){r.splice(i,1);break}return 0===r.length&&delete this._callbacks["$"+e],this},ue.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){r=0;for(var i=(n=n.slice(0)).length;r<i;++r)n[r].apply(this,t)}return this},ue.prototype.emitReserved=ue.prototype.emit,ue.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},ue.prototype.hasListeners=function(e){return!!this.listeners(e).length};const le="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function ce(e,...t){return t.reduce(((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t)),{})}const de=le.setTimeout,fe=le.clearTimeout;function he(e,t){t.useNativeTimers?(e.setTimeoutFn=de.bind(le),e.clearTimeoutFn=fe.bind(le)):(e.setTimeoutFn=le.setTimeout.bind(le),e.clearTimeoutFn=le.clearTimeout.bind(le))}class pe extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type="TransportError"}}class me extends ue{constructor(e){super(),this.writable=!1,he(this,e),this.opts=e,this.query=e.query,this.socket=e.socket}onError(e,t,n){return super.emitReserved("error",new pe(e,t,n)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(e){"open"===this.readyState&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=re(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return-1===e.indexOf(":")?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(443!==this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(e){const t=function(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}(e);return t.length?"?"+t:""}}const ge="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),ve=64,ye={};let be,we=0,Ae=0;function _e(e){let t="";do{t=ge[e%ve]+t,e=Math.floor(e/ve)}while(e>0);return t}function Ee(){const e=_e(+new Date);return e!==be?(we=0,be=e):e+"."+_e(we++)}for(;Ae<ve;Ae++)ye[ge[Ae]]=Ae;let Se=!1;try{Se="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(t){}const ke=Se;function Me(e){const t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||ke))return new XMLHttpRequest}catch(e){}if(!t)try{return new(le[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}function Ce(){}const xe=null!=new Me({xdomain:!1}).responseType;class Re extends ue{constructor(e,t){super(),he(this,t),this.opts=t,this.method=t.method||"GET",this.uri=e,this.data=void 0!==t.data?t.data:null,this.create()}create(){var e;const t=ce(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this.opts.xd;const n=this.xhr=new Me(t);try{n.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0);for(let e in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(e)&&n.setRequestHeader(e,this.opts.extraHeaders[e])}}catch(e){}if("POST"===this.method)try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{n.setRequestHeader("Accept","*/*")}catch(e){}null===(e=this.opts.cookieJar)||void 0===e||e.addCookies(n),"withCredentials"in n&&(n.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(n.timeout=this.opts.requestTimeout),n.onreadystatechange=()=>{var e;3===n.readyState&&(null===(e=this.opts.cookieJar)||void 0===e||e.parseCookies(n)),4===n.readyState&&(200===n.status||1223===n.status?this.onLoad():this.setTimeoutFn((()=>{this.onError("number"==typeof n.status?n.status:0)}),0))},n.send(this.data)}catch(e){return void this.setTimeoutFn((()=>{this.onError(e)}),0)}"undefined"!=typeof document&&(this.index=Re.requestsCount++,Re.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(e){if(void 0!==this.xhr&&null!==this.xhr){if(this.xhr.onreadystatechange=Ce,e)try{this.xhr.abort()}catch(e){}"undefined"!=typeof document&&delete Re.requests[this.index],this.xhr=null}}onLoad(){const e=this.xhr.responseText;null!==e&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}function Oe(){for(let e in Re.requests)Re.requests.hasOwnProperty(e)&&Re.requests[e].abort()}Re.requestsCount=0,Re.requests={},"undefined"!=typeof document&&("function"==typeof attachEvent?attachEvent("onunload",Oe):"function"==typeof addEventListener&&addEventListener("onpagehide"in le?"pagehide":"unload",Oe,!1));var Te=[],Pe=[],Le="undefined"!=typeof Uint8Array?Uint8Array:Array,Ie=!1;function Ne(){Ie=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)Te[t]=e[t],Pe[e.charCodeAt(t)]=t;Pe["-".charCodeAt(0)]=62,Pe["_".charCodeAt(0)]=63}function De(e,t,n){for(var r,i,o=[],a=t;a<n;a+=3)r=(e[a]<<16)+(e[a+1]<<8)+e[a+2],o.push(Te[(i=r)>>18&63]+Te[i>>12&63]+Te[i>>6&63]+Te[63&i]);return o.join("")}function Be(e){var t;Ie||Ne();for(var n=e.length,r=n%3,i="",o=[],a=16383,s=0,u=n-r;s<u;s+=a)o.push(De(e,s,s+a>u?u:s+a));return 1===r?(t=e[n-1],i+=Te[t>>2],i+=Te[t<<4&63],i+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],i+=Te[t>>10],i+=Te[t>>4&63],i+=Te[t<<2&63],i+="="),o.push(i),o.join("")}function je(e,t,n,r,i){var o,a,s=8*i-r-1,u=(1<<s)-1,l=u>>1,c=-7,d=n?i-1:0,f=n?-1:1,h=e[t+d];for(d+=f,o=h&(1<<-c)-1,h>>=-c,c+=s;c>0;o=256*o+e[t+d],d+=f,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=r;c>0;a=256*a+e[t+d],d+=f,c-=8);if(0===o)o=1-l;else{if(o===u)return a?NaN:1/0*(h?-1:1);a+=Math.pow(2,r),o-=l}return(h?-1:1)*a*Math.pow(2,o-r)}function Ue(e,t,n,r,i,o){var a,s,u,l=8*o-i-1,c=(1<<l)-1,d=c>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:o-1,p=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+d>=1?f/u:f*Math.pow(2,1-d))*u>=2&&(a++,u/=2),a+d>=c?(s=0,a=c):a+d>=1?(s=(t*u-1)*Math.pow(2,i),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),a=0));i>=8;e[n+h]=255&s,h+=p,s/=256,i-=8);for(a=a<<i|s,l+=i;l>0;e[n+h]=255&a,h+=p,a/=256,l-=8);e[n+h-p]|=128*m}var ze={}.toString,Fe=Array.isArray||function(e){return"[object Array]"==ze.call(e)};Ke.TYPED_ARRAY_SUPPORT=void 0===n.TYPED_ARRAY_SUPPORT||n.TYPED_ARRAY_SUPPORT;var qe=We();function We(){return Ke.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Ve(e,t){if(We()<t)throw new RangeError("Invalid typed array length");return Ke.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=Ke.prototype:(null===e&&(e=new Ke(t)),e.length=t),e}function Ke(e,t,n){if(!(Ke.TYPED_ARRAY_SUPPORT||this instanceof Ke))return new Ke(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return Ye(this,e)}return He(this,e,t,n)}function He(e,t,n,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");return t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r),Ke.TYPED_ARRAY_SUPPORT?(e=t).__proto__=Ke.prototype:e=Ge(e,t),e}(e,t,n,r):"string"==typeof t?function(e,t,n){if("string"==typeof n&&""!==n||(n="utf8"),!Ke.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|Xe(t,n),i=(e=Ve(e,r)).write(t,n);return i!==r&&(e=e.slice(0,i)),e}(e,t,n):function(e,t){if(Ze(t)){var n=0|Qe(t.length);return 0===(e=Ve(e,n)).length||t.copy(e,0,0,n),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(r=t.length)!=r?Ve(e,0):Ge(e,t);if("Buffer"===t.type&&Fe(t.data))return Ge(e,t.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function $e(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')}function Ye(e,t){if($e(t),e=Ve(e,t<0?0:0|Qe(t)),!Ke.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function Ge(e,t){var n=t.length<0?0:0|Qe(t.length);e=Ve(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function Qe(e){if(e>=We())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+We().toString(16)+" bytes");return 0|e}function Ze(e){return!(null==e||!e._isBuffer)}function Xe(e,t){if(Ze(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return kt(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Mt(e).length;default:if(r)return kt(e).length;t=(""+t).toLowerCase(),r=!0}}function Je(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return pt(this,t,n);case"utf8":case"utf-8":return ct(this,t,n);case"ascii":return ft(this,t,n);case"latin1":case"binary":return ht(this,t,n);case"base64":return lt(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return mt(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function et(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function tt(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=Ke.from(t,r)),Ze(t))return 0===t.length?-1:nt(e,t,n,r,i);if("number"==typeof t)return t&=255,Ke.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):nt(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function nt(e,t,n,r,i){var o,a=1,s=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,n/=2}function l(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var c=-1;for(o=n;o<s;o++)if(l(e,o)===l(t,-1===c?0:o-c)){if(-1===c&&(c=o),o-c+1===u)return c*a}else-1!==c&&(o-=o-c),c=-1}else for(n+u>s&&(n=s-u),o=n;o>=0;o--){for(var d=!0,f=0;f<u;f++)if(l(e,o+f)!==l(t,f)){d=!1;break}if(d)return o}return-1}function rt(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a<r;++a){var s=parseInt(t.substr(2*a,2),16);if(isNaN(s))return a;e[n+a]=s}return a}function it(e,t,n,r){return Ct(kt(t,e.length-n),e,n,r)}function ot(e,t,n,r){return Ct(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function at(e,t,n,r){return ot(e,t,n,r)}function st(e,t,n,r){return Ct(Mt(t),e,n,r)}function ut(e,t,n,r){return Ct(function(e,t){for(var n,r,i,o=[],a=0;a<e.length&&!((t-=2)<0);++a)r=(n=e.charCodeAt(a))>>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function lt(e,t,n){return 0===t&&n===e.length?Be(e):Be(e.slice(t,n))}function ct(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var o,a,s,u,l=e[i],c=null,d=l>239?4:l>223?3:l>191?2:1;if(i+d<=n)switch(d){case 1:l<128&&(c=l);break;case 2:128==(192&(o=e[i+1]))&&(u=(31&l)<<6|63&o)>127&&(c=u);break;case 3:o=e[i+1],a=e[i+2],128==(192&o)&&128==(192&a)&&(u=(15&l)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:o=e[i+1],a=e[i+2],s=e[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(u=(15&l)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(c=u)}null===c?(c=65533,d=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),i+=d}return function(e){var t=e.length;if(t<=dt)return String.fromCharCode.apply(String,e);for(var n="",r=0;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=dt));return n}(r)}Ke.poolSize=8192,Ke._augment=function(e){return e.__proto__=Ke.prototype,e},Ke.from=function(e,t,n){return He(null,e,t,n)},Ke.TYPED_ARRAY_SUPPORT&&(Ke.prototype.__proto__=Uint8Array.prototype,Ke.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&Ke[Symbol.species]),Ke.alloc=function(e,t,n){return function(e,t,n,r){return $e(t),t<=0?Ve(e,t):void 0!==n?"string"==typeof r?Ve(e,t).fill(n,r):Ve(e,t).fill(n):Ve(e,t)}(null,e,t,n)},Ke.allocUnsafe=function(e){return Ye(null,e)},Ke.allocUnsafeSlow=function(e){return Ye(null,e)},Ke.isBuffer=xt,Ke.compare=function(e,t){if(!Ze(e)||!Ze(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i<o;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},Ke.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},Ke.concat=function(e,t){if(!Fe(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return Ke.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=Ke.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var o=e[n];if(!Ze(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(r,i),i+=o.length}return r},Ke.byteLength=Xe,Ke.prototype._isBuffer=!0,Ke.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)et(this,t,t+1);return this},Ke.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)et(this,t,t+3),et(this,t+1,t+2);return this},Ke.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)et(this,t,t+7),et(this,t+1,t+6),et(this,t+2,t+5),et(this,t+3,t+4);return this},Ke.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?ct(this,0,e):Je.apply(this,arguments)},Ke.prototype.equals=function(e){if(!Ze(e))throw new TypeError("Argument must be a Buffer");return this===e||0===Ke.compare(this,e)},Ke.prototype.inspect=function(){var e="";return this.length>0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),"<Buffer "+e+">"},Ke.prototype.compare=function(e,t,n,r,i){if(!Ze(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0),s=Math.min(o,a),u=this.slice(r,i),l=e.slice(t,n),c=0;c<s;++c)if(u[c]!==l[c]){o=u[c],a=l[c];break}return o<a?-1:a<o?1:0},Ke.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},Ke.prototype.indexOf=function(e,t,n){return tt(this,e,t,n,!0)},Ke.prototype.lastIndexOf=function(e,t,n){return tt(this,e,t,n,!1)},Ke.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return rt(this,e,t,n);case"utf8":case"utf-8":return it(this,e,t,n);case"ascii":return ot(this,e,t,n);case"latin1":case"binary":return at(this,e,t,n);case"base64":return st(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ut(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},Ke.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var dt=4096;function ft(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function ht(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function pt(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=t;o<n;++o)i+=St(e[o]);return i}function mt(e,t,n){for(var r=e.slice(t,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function gt(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function vt(e,t,n,r,i,o){if(!Ze(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function yt(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i<o;++i)e[n+i]=(t&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function bt(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i<o;++i)e[n+i]=t>>>8*(r?i:3-i)&255}function wt(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function At(e,t,n,r,i){return i||wt(e,0,n,4),Ue(e,t,n,r,23,4),n+4}function _t(e,t,n,r,i){return i||wt(e,0,n,8),Ue(e,t,n,r,52,8),n+8}Ke.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e),Ke.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=Ke.prototype;else{var i=t-e;n=new Ke(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+e]}return n},Ke.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||gt(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r},Ke.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||gt(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},Ke.prototype.readUInt8=function(e,t){return t||gt(e,1,this.length),this[e]},Ke.prototype.readUInt16LE=function(e,t){return t||gt(e,2,this.length),this[e]|this[e+1]<<8},Ke.prototype.readUInt16BE=function(e,t){return t||gt(e,2,this.length),this[e]<<8|this[e+1]},Ke.prototype.readUInt32LE=function(e,t){return t||gt(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},Ke.prototype.readUInt32BE=function(e,t){return t||gt(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},Ke.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||gt(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},Ke.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||gt(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},Ke.prototype.readInt8=function(e,t){return t||gt(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},Ke.prototype.readInt16LE=function(e,t){t||gt(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},Ke.prototype.readInt16BE=function(e,t){t||gt(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},Ke.prototype.readInt32LE=function(e,t){return t||gt(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},Ke.prototype.readInt32BE=function(e,t){return t||gt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},Ke.prototype.readFloatLE=function(e,t){return t||gt(e,4,this.length),je(this,e,!0,23,4)},Ke.prototype.readFloatBE=function(e,t){return t||gt(e,4,this.length),je(this,e,!1,23,4)},Ke.prototype.readDoubleLE=function(e,t){return t||gt(e,8,this.length),je(this,e,!0,52,8)},Ke.prototype.readDoubleBE=function(e,t){return t||gt(e,8,this.length),je(this,e,!1,52,8)},Ke.prototype.writeUIntLE=function(e,t,n,r){e=+e,t|=0,n|=0,r||vt(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o<n&&(i*=256);)this[t+o]=e/i&255;return t+n},Ke.prototype.writeUIntBE=function(e,t,n,r){e=+e,t|=0,n|=0,r||vt(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},Ke.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||vt(this,e,t,1,255,0),Ke.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},Ke.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||vt(this,e,t,2,65535,0),Ke.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):yt(this,e,t,!0),t+2},Ke.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||vt(this,e,t,2,65535,0),Ke.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):yt(this,e,t,!1),t+2},Ke.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||vt(this,e,t,4,4294967295,0),Ke.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):bt(this,e,t,!0),t+4},Ke.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||vt(this,e,t,4,4294967295,0),Ke.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):bt(this,e,t,!1),t+4},Ke.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);vt(this,e,t,n,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o<n&&(a*=256);)e<0&&0===s&&0!==this[t+o-1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},Ke.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);vt(this,e,t,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},Ke.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||vt(this,e,t,1,127,-128),Ke.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},Ke.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||vt(this,e,t,2,32767,-32768),Ke.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):yt(this,e,t,!0),t+2},Ke.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||vt(this,e,t,2,32767,-32768),Ke.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):yt(this,e,t,!1),t+2},Ke.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||vt(this,e,t,4,2147483647,-2147483648),Ke.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):bt(this,e,t,!0),t+4},Ke.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||vt(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),Ke.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):bt(this,e,t,!1),t+4},Ke.prototype.writeFloatLE=function(e,t,n){return At(this,e,t,!0,n)},Ke.prototype.writeFloatBE=function(e,t,n){return At(this,e,t,!1,n)},Ke.prototype.writeDoubleLE=function(e,t,n){return _t(this,e,t,!0,n)},Ke.prototype.writeDoubleBE=function(e,t,n){return _t(this,e,t,!1,n)},Ke.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i,o=r-n;if(this===e&&n<t&&t<r)for(i=o-1;i>=0;--i)e[i+t]=this[i+n];else if(o<1e3||!Ke.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)e[i+t]=this[i+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+o),t);return o},Ke.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!Ke.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var o;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o<n;++o)this[o]=e;else{var a=Ze(e)?e:kt(new Ke(e,r).toString()),s=a.length;for(o=0;o<n-t;++o)this[o+t]=a[o%s]}return this};var Et=/[^+\/0-9A-Za-z-_]/g;function St(e){return e<16?"0"+e.toString(16):e.toString(16)}function kt(e,t){var n;t=t||1/0;for(var r=e.length,i=null,o=[],a=0;a<r;++a){if((n=e.charCodeAt(a))>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function Mt(e){return function(e){var t,n,r,i,o,a;Ie||Ne();var s=e.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===e[s-2]?2:"="===e[s-1]?1:0,a=new Le(3*s/4-o),r=o>0?s-4:s;var u=0;for(t=0,n=0;t<r;t+=4,n+=3)i=Pe[e.charCodeAt(t)]<<18|Pe[e.charCodeAt(t+1)]<<12|Pe[e.charCodeAt(t+2)]<<6|Pe[e.charCodeAt(t+3)],a[u++]=i>>16&255,a[u++]=i>>8&255,a[u++]=255&i;return 2===o?(i=Pe[e.charCodeAt(t)]<<2|Pe[e.charCodeAt(t+1)]>>4,a[u++]=255&i):1===o&&(i=Pe[e.charCodeAt(t)]<<10|Pe[e.charCodeAt(t+1)]<<4|Pe[e.charCodeAt(t+2)]>>2,a[u++]=i>>8&255,a[u++]=255&i),a}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(Et,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Ct(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function xt(e){return null!=e&&(!!e._isBuffer||Rt(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&Rt(e.slice(0,0))}(e))}function Rt(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var Ot=Object.freeze({__proto__:null,Buffer:Ke,INSPECT_MAX_BYTES:50,SlowBuffer:function(e){return+e!=e&&(e=0),Ke.alloc(+e)},isBuffer:xt,kMaxLength:qe});const Tt="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),Pt=le.WebSocket||le.MozWebSocket,Lt="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();function It(e,t){return"message"===e.type&&"string"!=typeof e.data&&t[0]>=48&&t[0]<=54}const Nt={websocket:class extends me{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const e=this.uri(),t=this.opts.protocols,n=Lt?{}:ce(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=Lt?new Pt(e,t,n):t?new Pt(e,t):new Pt(e)}catch(e){return this.emitReserved("error",e)}this.ws.binaryType=this.socket.binaryType||"arraybuffer",this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],r=t===e.length-1;G(n,this.supportsBinary,(e=>{try{this.ws.send(e)}catch(e){}r&&Tt((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}}doClose(){void 0!==this.ws&&(this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=Ee()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}check(){return!!Pt}},webtransport:class extends me{get name(){return"webtransport"}doOpen(){"function"==typeof WebTransport&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then((()=>{this.onClose()})).catch((e=>{this.onError("webtransport error",e)})),this.transport.ready.then((()=>{this.transport.createBidirectionalStream().then((e=>{const t=e.readable.getReader();let n;this.writer=e.writable.getWriter();const r=()=>{t.read().then((({done:e,value:t})=>{e||(n||1!==t.byteLength||54!==t[0]?(this.onPacket(function(e,t,n){se||(se=new TextDecoder);const r=t||e[0]<48||e[0]>54;return re(r?e:se.decode(e),n)}(t,n,"arraybuffer")),n=!1):n=!0,r())})).catch((e=>{}))};r();const i=this.query.sid?`0{"sid":"${this.query.sid}"}`:"0";this.writer.write((new TextEncoder).encode(i)).then((()=>this.onOpen()))}))})))}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],r=t===e.length-1;J(n,(e=>{It(n,e)&&this.writer.write(Uint8Array.of(54)),this.writer.write(e).then((()=>{r&&Tt((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}))}}doClose(){var e;null===(e=this.transport)||void 0===e||e.close()}},polling:class extends me{constructor(e){if(super(e),this.polling=!1,"undefined"!=typeof location){const t="https:"===location.protocol;let n=location.port;n||(n=t?"443":"80"),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||n!==e.port}const t=e&&e.forceBase64;this.supportsBinary=xe&&!t,this.opts.withCredentials&&(this.cookieJar=void 0)}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this.polling||!this.writable){let e=0;this.polling&&(e++,this.once("pollComplete",(function(){--e||t()}))),this.writable||(e++,this.once("drain",(function(){--e||t()})))}else t()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){((e,t)=>{const n=e.split(ae),r=[];for(let e=0;e<n.length;e++){const i=re(n[e],t);if(r.push(i),"error"===i.type)break}return r})(e,this.socket.binaryType).forEach((e=>{if("opening"===this.readyState&&"open"===e.type&&this.onOpen(),"close"===e.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(e)})),"closed"!==this.readyState&&(this.polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this.poll())}doClose(){const e=()=>{this.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}write(e){this.writable=!1,((e,t)=>{const n=e.length,r=new Array(n);let i=0;e.forEach(((e,o)=>{G(e,!1,(e=>{r[o]=e,++i===n&&t(r.join(ae))}))}))})(e,(e=>{this.doWrite(e,(()=>{this.writable=!0,this.emitReserved("drain")}))}))}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=Ee()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}request(e={}){return Object.assign(e,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new Re(this.uri(),e)}doWrite(e,t){const n=this.request({method:"POST",data:e});n.on("success",t),n.on("error",((e,t)=>{this.onError("xhr post error",e,t)}))}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",((e,t)=>{this.onError("xhr poll error",e,t)})),this.pollXhr=e}}},Dt=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Bt=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function jt(e){const t=e,n=e.indexOf("["),r=e.indexOf("]");-1!=n&&-1!=r&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let i=Dt.exec(e||""),o={},a=14;for(;a--;)o[Bt[a]]=i[a]||"";return-1!=n&&-1!=r&&(o.source=t,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=function(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");return"/"!=t.slice(0,1)&&0!==t.length||r.splice(0,1),"/"==t.slice(-1)&&r.splice(r.length-1,1),r}(0,o.path),o.queryKey=function(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,(function(e,t,r){t&&(n[t]=r)})),n}(0,o.query),o}let Ut=class e extends ue{constructor(e,t={}){super(),this.writeBuffer=[],e&&"object"==typeof e&&(t=e,e=null),e?(e=jt(e),t.hostname=e.host,t.secure="https"===e.protocol||"wss"===e.protocol,t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=jt(t.host).host),he(this,t),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=t.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(e){let t={},n=e.split("&");for(let e=0,r=n.length;e<r;e++){let r=n[e].split("=");t[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return t}(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,"function"==typeof addEventListener&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);const n=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new Nt[e](n)}open(){let t;if(this.opts.rememberUpgrade&&e.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))t="websocket";else{if(0===this.transports.length)return void this.setTimeoutFn((()=>{this.emitReserved("error","No transports available")}),0);t=this.transports[0]}this.readyState="opening";try{t=this.createTransport(t)}catch(e){return this.transports.shift(),void this.open()}t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",(e=>this.onClose("transport close",e)))}probe(t){let n=this.createTransport(t),r=!1;e.priorWebsocketSuccess=!1;const i=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",(t=>{if(!r)if("pong"===t.type&&"probe"===t.data){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;e.priorWebsocketSuccess="websocket"===n.name,this.transport.pause((()=>{r||"closed"!==this.readyState&&(c(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())}))}else{const e=new Error("probe error");e.transport=n.name,this.emitReserved("upgradeError",e)}})))};function o(){r||(r=!0,c(),n.close(),n=null)}const a=e=>{const t=new Error("probe error: "+e);t.transport=n.name,o(),this.emitReserved("upgradeError",t)};function s(){a("transport closed")}function u(){a("socket closed")}function l(e){n&&e.name!==n.name&&o()}const c=()=>{n.removeListener("open",i),n.removeListener("error",a),n.removeListener("close",s),this.off("close",u),this.off("upgrading",l)};n.once("open",i),n.once("error",a),n.once("close",s),this.once("close",u),this.once("upgrading",l),-1!==this.upgrades.indexOf("webtransport")&&"webtransport"!==t?this.setTimeoutFn((()=>{r||n.open()}),200):n.open()}onOpen(){if(this.readyState="open",e.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush(),"open"===this.readyState&&this.opts.upgrade){let e=0;const t=this.upgrades.length;for(;e<t;e++)this.probe(this.upgrades[e])}}onPacket(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this.resetPingTimeout(),this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":const t=new Error("server error");t.code=e.data,this.onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data)}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=this.filterUpgrades(e.upgrades),this.pingInterval=e.pingInterval,this.pingTimeout=e.pingTimeout,this.maxPayload=e.maxPayload,this.onOpen(),"closed"!==this.readyState&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn((()=>{this.onClose("ping timeout")}),this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this.getWritablePackets();this.transport.send(e),this.prevBufferLen=e.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let n=0;n<this.writeBuffer.length;n++){const r=this.writeBuffer[n].data;if(r&&(e+="string"==typeof(t=r)?function(e){let t=0,n=0;for(let r=0,i=e.length;r<i;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n}(t):Math.ceil(1.33*(t.byteLength||t.size))),n>0&&e>this.maxPayload)return this.writeBuffer.slice(0,n);e+=2}var t;return this.writeBuffer}write(e,t,n){return this.sendPacket("message",e,t,n),this}send(e,t,n){return this.sendPacket("message",e,t,n),this}sendPacket(e,t,n,r){if("function"==typeof t&&(r=t,t=void 0),"function"==typeof n&&(r=n,n=null),"closing"===this.readyState||"closed"===this.readyState)return;(n=n||{}).compress=!1!==n.compress;const i={type:e,data:t,options:n};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),r&&this.once("flush",r),this.flush()}close(){const e=()=>{this.onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},n=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",(()=>{this.upgrading?n():e()})):this.upgrading?n():e()),this}onError(t){e.priorWebsocketSuccess=!1,this.emitReserved("error",t),this.onClose("transport error",t)}onClose(e,t){"opening"!==this.readyState&&"open"!==this.readyState&&"closing"!==this.readyState||(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),"function"==typeof removeEventListener&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){const t=[];let n=0;const r=e.length;for(;n<r;n++)~this.transports.indexOf(e[n])&&t.push(e[n]);return t}};Ut.protocol=4;const zt="function"==typeof ArrayBuffer,Ft=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,qt=Object.prototype.toString,Wt="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===qt.call(Blob),Vt="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===qt.call(File);function Kt(e){return zt&&(e instanceof ArrayBuffer||Ft(e))||Wt&&e instanceof Blob||Vt&&e instanceof File}function Ht(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t<n;t++)if(Ht(e[t]))return!0;return!1}if(Kt(e))return!0;if(e.toJSON&&"function"==typeof e.toJSON&&1===arguments.length)return Ht(e.toJSON(),!0);for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&Ht(e[t]))return!0;return!1}function $t(e){const t=[],n=e.data,r=e;return r.data=Yt(n,t),r.attachments=t.length,{packet:r,buffers:t}}function Yt(e,t){if(!e)return e;if(Kt(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}if(Array.isArray(e)){const n=new Array(e.length);for(let r=0;r<e.length;r++)n[r]=Yt(e[r],t);return n}if("object"==typeof e&&!(e instanceof Date)){const n={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=Yt(e[r],t));return n}return e}function Gt(e,t){return e.data=Qt(e.data,t),delete e.attachments,e}function Qt(e,t){if(!e)return e;if(e&&!0===e._placeholder){if("number"==typeof e.num&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=Qt(e[n],t);else if("object"==typeof e)for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=Qt(e[n],t));return e}const Zt=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Xt;function Jt(e){return"[object Object]"===Object.prototype.toString.call(e)}!function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"}(Xt||(Xt={}));class en extends ue{constructor(e){super(),this.reviver=e}add(e){let t;if("string"==typeof e){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const n=t.type===Xt.BINARY_EVENT;n||t.type===Xt.BINARY_ACK?(t.type=n?Xt.EVENT:Xt.ACK,this.reconstructor=new tn(t),0===t.attachments&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else{if(!Kt(e)&&!e.base64)throw new Error("Unknown type: "+e);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t))}}decodeString(e){let t=0;const n={type:Number(e.charAt(0))};if(void 0===Xt[n.type])throw new Error("unknown packet type "+n.type);if(n.type===Xt.BINARY_EVENT||n.type===Xt.BINARY_ACK){const r=t+1;for(;"-"!==e.charAt(++t)&&t!=e.length;);const i=e.substring(r,t);if(i!=Number(i)||"-"!==e.charAt(t))throw new Error("Illegal attachments");n.attachments=Number(i)}if("/"===e.charAt(t+1)){const r=t+1;for(;++t&&","!==e.charAt(t)&&t!==e.length;);n.nsp=e.substring(r,t)}else n.nsp="/";const r=e.charAt(t+1);if(""!==r&&Number(r)==r){const r=t+1;for(;++t;){const n=e.charAt(t);if(null==n||Number(n)!=n){--t;break}if(t===e.length)break}n.id=Number(e.substring(r,t+1))}if(e.charAt(++t)){const r=this.tryParse(e.substr(t));if(!en.isPayloadValid(n.type,r))throw new Error("invalid payload");n.data=r}return n}tryParse(e){try{return JSON.parse(e,this.reviver)}catch(e){return!1}}static isPayloadValid(e,t){switch(e){case Xt.CONNECT:return Jt(t);case Xt.DISCONNECT:return void 0===t;case Xt.CONNECT_ERROR:return"string"==typeof t||Jt(t);case Xt.EVENT:case Xt.BINARY_EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===Zt.indexOf(t[0]));case Xt.ACK:case Xt.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class tn{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const e=Gt(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}var nn=Object.freeze({__proto__:null,Decoder:en,Encoder:class{constructor(e){this.replacer=e}encode(e){return e.type!==Xt.EVENT&&e.type!==Xt.ACK||!Ht(e)?[this.encodeAsString(e)]:this.encodeAsBinary({type:e.type===Xt.EVENT?Xt.BINARY_EVENT:Xt.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id})}encodeAsString(e){let t=""+e.type;return e.type!==Xt.BINARY_EVENT&&e.type!==Xt.BINARY_ACK||(t+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(t+=e.nsp+","),null!=e.id&&(t+=e.id),null!=e.data&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=$t(e),n=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(n),r}},get PacketType(){return Xt},protocol:5});function rn(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const on=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class an extends ue{constructor(e,t,n){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[rn(e,"open",this.onopen.bind(this)),rn(e,"packet",this.onpacket.bind(this)),rn(e,"error",this.onerror.bind(this)),rn(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){if(on.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const n={type:Xt.EVENT,data:t,options:{}};if(n.options.compress=!1!==this.flags.compress,"function"==typeof t[t.length-1]){const e=this.ids++,r=t.pop();this._registerAckCallback(e,r),n.id=e}const r=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!r||!this.connected)||(this.connected?(this.notifyOutgoingListeners(n),this.packet(n)):this.sendBuffer.push(n)),this.flags={},this}_registerAckCallback(e,t){var n;const r=null!==(n=this.flags.timeout)&&void 0!==n?n:this._opts.ackTimeout;if(void 0===r)return void(this.acks[e]=t);const i=this.io.setTimeoutFn((()=>{delete this.acks[e];for(let t=0;t<this.sendBuffer.length;t++)this.sendBuffer[t].id===e&&this.sendBuffer.splice(t,1);t.call(this,new Error("operation has timed out"))}),r);this.acks[e]=(...e)=>{this.io.clearTimeoutFn(i),t.apply(this,[null,...e])}}emitWithAck(e,...t){const n=void 0!==this.flags.timeout||void 0!==this._opts.ackTimeout;return new Promise(((r,i)=>{t.push(((e,t)=>n?e?i(e):r(t):r(e))),this.emit(e,...t)}))}_addToQueue(e){let t;"function"==typeof e[e.length-1]&&(t=e.pop());const n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push(((e,...r)=>{if(n===this._queue[0])return null!==e?n.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)):(this._queue.shift(),t&&t(null,...r)),n.pending=!1,this._drainQueue()})),this._queue.push(n),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||0===this._queue.length)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){"function"==typeof this.auth?this.auth((e=>{this._sendConnectPacket(e)})):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:Xt.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t)}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case Xt.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Xt.EVENT:case Xt.BINARY_EVENT:this.onevent(e);break;case Xt.ACK:case Xt.BINARY_ACK:this.onack(e);break;case Xt.DISCONNECT:this.ondisconnect();break;case Xt.CONNECT_ERROR:this.destroy();const t=new Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t)}}onevent(e){const t=e.data||[];null!=e.id&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const n of t)n.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&"string"==typeof e[e.length-1]&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let n=!1;return function(...r){n||(n=!0,t.packet({type:Xt.ACK,id:e,data:r}))}}onack(e){const t=this.acks[e.id];"function"==typeof t&&(t.apply(this,e.data),delete this.acks[e.id])}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach((e=>this.emitEvent(e))),this.receiveBuffer=[],this.sendBuffer.forEach((e=>{this.notifyOutgoingListeners(e),this.packet(e)})),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach((e=>e())),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Xt.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const n of t)n.apply(this,e.data)}}}function sn(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}sn.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=0==(1&Math.floor(10*t))?e-n:e+n}return 0|Math.min(e,this.max)},sn.prototype.reset=function(){this.attempts=0},sn.prototype.setMin=function(e){this.ms=e},sn.prototype.setMax=function(e){this.max=e},sn.prototype.setJitter=function(e){this.jitter=e};class un extends ue{constructor(e,t){var n;super(),this.nsps={},this.subs=[],e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.opts=t,he(this,t),this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(n=t.randomizationFactor)&&void 0!==n?n:.5),this.backoff=new sn({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this._readyState="closed",this.uri=e;const r=t.parser||nn;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=!1!==t.autoConnect,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return void 0===e?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return void 0===e?this._reconnectionDelay:(this._reconnectionDelay=e,null===(t=this.backoff)||void 0===t||t.setMin(e),this)}randomizationFactor(e){var t;return void 0===e?this._randomizationFactor:(this._randomizationFactor=e,null===(t=this.backoff)||void 0===t||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return void 0===e?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,null===(t=this.backoff)||void 0===t||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new Ut(this.uri,this.opts);const t=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const r=rn(t,"open",(function(){n.onopen(),e&&e()})),i=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},o=rn(t,"error",i);if(!1!==this._timeout){const e=this._timeout,n=this.setTimeoutFn((()=>{r(),i(new Error("timeout")),t.close()}),e);this.opts.autoUnref&&n.unref(),this.subs.push((()=>{this.clearTimeoutFn(n)}))}return this.subs.push(r),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(rn(e,"ping",this.onping.bind(this)),rn(e,"data",this.ondata.bind(this)),rn(e,"error",this.onerror.bind(this)),rn(e,"close",this.onclose.bind(this)),rn(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(e){this.onclose("parse error",e)}}ondecoded(e){Tt((()=>{this.emitReserved("packet",e)}),this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new an(this,e,t),this.nsps[e]=n),n}_destroy(e){const t=Object.keys(this.nsps);for(const e of t)if(this.nsps[e].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let n=0;n<t.length;n++)this.engine.write(t[n],e.options)}cleanup(){this.subs.forEach((e=>e())),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e,t){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const n=this.setTimeoutFn((()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open((t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",t)):e.onreconnect()})))}),t);this.opts.autoUnref&&n.unref(),this.subs.push((()=>{this.clearTimeoutFn(n)}))}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const ln={};function cn(e,t){"object"==typeof e&&(t=e,e=void 0);const n=function(e,t="",n){let r=e;n=n||"undefined"!=typeof location&&location,null==e&&(e=n.protocol+"//"+n.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?n.protocol+e:n.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==n?n.protocol+"//"+e:"https://"+e),r=jt(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const i=-1!==r.host.indexOf(":")?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+i+":"+r.port+t,r.href=r.protocol+"://"+i+(n&&n.port===r.port?"":":"+r.port),r}(e,(t=t||{}).path||"/socket.io"),r=n.source,i=n.id,o=n.path,a=ln[i]&&o in ln[i].nsps;let s;return t.forceNew||t["force new connection"]||!1===t.multiplex||a?s=new un(r,t):(ln[i]||(ln[i]=new un(r,t)),s=ln[i]),n.query&&!t.query&&(t.query=n.queryKey),s.socket(n.path,t)}function dn(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))}Object.assign(cn,{Manager:un,Socket:an,io:cn,connect:cn}),"function"==typeof SuppressedError&&SuppressedError;const fn=(e,t)=>dn(void 0,void 0,void 0,(function*(){const n=t.endsWith("/")?`${t}debug`:`${t}/debug`,r=JSON.stringify(e),i=yield s(n,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:r});return yield i.text()}));var hn=void 0!==n?n:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},pn=[],mn=[],gn="undefined"!=typeof Uint8Array?Uint8Array:Array,vn=!1;function yn(){vn=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)pn[t]=e[t],mn[e.charCodeAt(t)]=t;mn["-".charCodeAt(0)]=62,mn["_".charCodeAt(0)]=63}function bn(e,t,n){for(var r,i,o=[],a=t;a<n;a+=3)r=(e[a]<<16)+(e[a+1]<<8)+e[a+2],o.push(pn[(i=r)>>18&63]+pn[i>>12&63]+pn[i>>6&63]+pn[63&i]);return o.join("")}function wn(e){var t;vn||yn();for(var n=e.length,r=n%3,i="",o=[],a=16383,s=0,u=n-r;s<u;s+=a)o.push(bn(e,s,s+a>u?u:s+a));return 1===r?(t=e[n-1],i+=pn[t>>2],i+=pn[t<<4&63],i+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],i+=pn[t>>10],i+=pn[t>>4&63],i+=pn[t<<2&63],i+="="),o.push(i),o.join("")}function An(e,t,n,r,i){var o,a,s=8*i-r-1,u=(1<<s)-1,l=u>>1,c=-7,d=n?i-1:0,f=n?-1:1,h=e[t+d];for(d+=f,o=h&(1<<-c)-1,h>>=-c,c+=s;c>0;o=256*o+e[t+d],d+=f,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=r;c>0;a=256*a+e[t+d],d+=f,c-=8);if(0===o)o=1-l;else{if(o===u)return a?NaN:1/0*(h?-1:1);a+=Math.pow(2,r),o-=l}return(h?-1:1)*a*Math.pow(2,o-r)}function _n(e,t,n,r,i,o){var a,s,u,l=8*o-i-1,c=(1<<l)-1,d=c>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:o-1,p=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+d>=1?f/u:f*Math.pow(2,1-d))*u>=2&&(a++,u/=2),a+d>=c?(s=0,a=c):a+d>=1?(s=(t*u-1)*Math.pow(2,i),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),a=0));i>=8;e[n+h]=255&s,h+=p,s/=256,i-=8);for(a=a<<i|s,l+=i;l>0;e[n+h]=255&a,h+=p,a/=256,l-=8);e[n+h-p]|=128*m}var En={}.toString,Sn=Array.isArray||function(e){return"[object Array]"==En.call(e)};xn.TYPED_ARRAY_SUPPORT=void 0===hn.TYPED_ARRAY_SUPPORT||hn.TYPED_ARRAY_SUPPORT;var kn=Mn();function Mn(){return xn.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Cn(e,t){if(Mn()<t)throw new RangeError("Invalid typed array length");return xn.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=xn.prototype:(null===e&&(e=new xn(t)),e.length=t),e}function xn(e,t,n){if(!(xn.TYPED_ARRAY_SUPPORT||this instanceof xn))return new xn(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return Tn(this,e)}return Rn(this,e,t,n)}function Rn(e,t,n,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");return t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r),xn.TYPED_ARRAY_SUPPORT?(e=t).__proto__=xn.prototype:e=Pn(e,t),e}(e,t,n,r):"string"==typeof t?function(e,t,n){if("string"==typeof n&&""!==n||(n="utf8"),!xn.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|Nn(t,n),i=(e=Cn(e,r)).write(t,n);return i!==r&&(e=e.slice(0,i)),e}(e,t,n):function(e,t){if(In(t)){var n=0|Ln(t.length);return 0===(e=Cn(e,n)).length||t.copy(e,0,0,n),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(r=t.length)!=r?Cn(e,0):Pn(e,t);if("Buffer"===t.type&&Sn(t.data))return Pn(e,t.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function On(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')}function Tn(e,t){if(On(t),e=Cn(e,t<0?0:0|Ln(t)),!xn.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function Pn(e,t){var n=t.length<0?0:0|Ln(t.length);e=Cn(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function Ln(e){if(e>=Mn())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Mn().toString(16)+" bytes");return 0|e}function In(e){return!(null==e||!e._isBuffer)}function Nn(e,t){if(In(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return ur(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return lr(e).length;default:if(r)return ur(e).length;t=(""+t).toLowerCase(),r=!0}}function Dn(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return Zn(this,t,n);case"utf8":case"utf-8":return $n(this,t,n);case"ascii":return Gn(this,t,n);case"latin1":case"binary":return Qn(this,t,n);case"base64":return Hn(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Xn(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function Bn(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function jn(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=xn.from(t,r)),In(t))return 0===t.length?-1:Un(e,t,n,r,i);if("number"==typeof t)return t&=255,xn.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):Un(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function Un(e,t,n,r,i){var o,a=1,s=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,n/=2}function l(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var c=-1;for(o=n;o<s;o++)if(l(e,o)===l(t,-1===c?0:o-c)){if(-1===c&&(c=o),o-c+1===u)return c*a}else-1!==c&&(o-=o-c),c=-1}else for(n+u>s&&(n=s-u),o=n;o>=0;o--){for(var d=!0,f=0;f<u;f++)if(l(e,o+f)!==l(t,f)){d=!1;break}if(d)return o}return-1}function zn(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a<r;++a){var s=parseInt(t.substr(2*a,2),16);if(isNaN(s))return a;e[n+a]=s}return a}function Fn(e,t,n,r){return cr(ur(t,e.length-n),e,n,r)}function qn(e,t,n,r){return cr(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function Wn(e,t,n,r){return qn(e,t,n,r)}function Vn(e,t,n,r){return cr(lr(t),e,n,r)}function Kn(e,t,n,r){return cr(function(e,t){for(var n,r,i,o=[],a=0;a<e.length&&!((t-=2)<0);++a)r=(n=e.charCodeAt(a))>>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function Hn(e,t,n){return 0===t&&n===e.length?wn(e):wn(e.slice(t,n))}function $n(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var o,a,s,u,l=e[i],c=null,d=l>239?4:l>223?3:l>191?2:1;if(i+d<=n)switch(d){case 1:l<128&&(c=l);break;case 2:128==(192&(o=e[i+1]))&&(u=(31&l)<<6|63&o)>127&&(c=u);break;case 3:o=e[i+1],a=e[i+2],128==(192&o)&&128==(192&a)&&(u=(15&l)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:o=e[i+1],a=e[i+2],s=e[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(u=(15&l)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(c=u)}null===c?(c=65533,d=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),i+=d}return function(e){var t=e.length;if(t<=Yn)return String.fromCharCode.apply(String,e);for(var n="",r=0;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=Yn));return n}(r)}xn.poolSize=8192,xn._augment=function(e){return e.__proto__=xn.prototype,e},xn.from=function(e,t,n){return Rn(null,e,t,n)},xn.TYPED_ARRAY_SUPPORT&&(xn.prototype.__proto__=Uint8Array.prototype,xn.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&xn[Symbol.species]),xn.alloc=function(e,t,n){return function(e,t,n,r){return On(t),t<=0?Cn(e,t):void 0!==n?"string"==typeof r?Cn(e,t).fill(n,r):Cn(e,t).fill(n):Cn(e,t)}(null,e,t,n)},xn.allocUnsafe=function(e){return Tn(null,e)},xn.allocUnsafeSlow=function(e){return Tn(null,e)},xn.isBuffer=dr,xn.compare=function(e,t){if(!In(e)||!In(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i<o;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},xn.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},xn.concat=function(e,t){if(!Sn(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return xn.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=xn.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var o=e[n];if(!In(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(r,i),i+=o.length}return r},xn.byteLength=Nn,xn.prototype._isBuffer=!0,xn.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)Bn(this,t,t+1);return this},xn.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)Bn(this,t,t+3),Bn(this,t+1,t+2);return this},xn.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)Bn(this,t,t+7),Bn(this,t+1,t+6),Bn(this,t+2,t+5),Bn(this,t+3,t+4);return this},xn.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?$n(this,0,e):Dn.apply(this,arguments)},xn.prototype.equals=function(e){if(!In(e))throw new TypeError("Argument must be a Buffer");return this===e||0===xn.compare(this,e)},xn.prototype.inspect=function(){var e="";return this.length>0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),"<Buffer "+e+">"},xn.prototype.compare=function(e,t,n,r,i){if(!In(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0),s=Math.min(o,a),u=this.slice(r,i),l=e.slice(t,n),c=0;c<s;++c)if(u[c]!==l[c]){o=u[c],a=l[c];break}return o<a?-1:a<o?1:0},xn.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},xn.prototype.indexOf=function(e,t,n){return jn(this,e,t,n,!0)},xn.prototype.lastIndexOf=function(e,t,n){return jn(this,e,t,n,!1)},xn.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return zn(this,e,t,n);case"utf8":case"utf-8":return Fn(this,e,t,n);case"ascii":return qn(this,e,t,n);case"latin1":case"binary":return Wn(this,e,t,n);case"base64":return Vn(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Kn(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},xn.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Yn=4096;function Gn(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function Qn(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function Zn(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=t;o<n;++o)i+=sr(e[o]);return i}function Xn(e,t,n){for(var r=e.slice(t,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function Jn(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function er(e,t,n,r,i,o){if(!In(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function tr(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i<o;++i)e[n+i]=(t&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function nr(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i<o;++i)e[n+i]=t>>>8*(r?i:3-i)&255}function rr(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function ir(e,t,n,r,i){return i||rr(e,0,n,4),_n(e,t,n,r,23,4),n+4}function or(e,t,n,r,i){return i||rr(e,0,n,8),_n(e,t,n,r,52,8),n+8}xn.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e),xn.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=xn.prototype;else{var i=t-e;n=new xn(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+e]}return n},xn.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||Jn(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r},xn.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||Jn(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},xn.prototype.readUInt8=function(e,t){return t||Jn(e,1,this.length),this[e]},xn.prototype.readUInt16LE=function(e,t){return t||Jn(e,2,this.length),this[e]|this[e+1]<<8},xn.prototype.readUInt16BE=function(e,t){return t||Jn(e,2,this.length),this[e]<<8|this[e+1]},xn.prototype.readUInt32LE=function(e,t){return t||Jn(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},xn.prototype.readUInt32BE=function(e,t){return t||Jn(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},xn.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||Jn(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},xn.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||Jn(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},xn.prototype.readInt8=function(e,t){return t||Jn(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},xn.prototype.readInt16LE=function(e,t){t||Jn(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},xn.prototype.readInt16BE=function(e,t){t||Jn(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},xn.prototype.readInt32LE=function(e,t){return t||Jn(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},xn.prototype.readInt32BE=function(e,t){return t||Jn(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},xn.prototype.readFloatLE=function(e,t){return t||Jn(e,4,this.length),An(this,e,!0,23,4)},xn.prototype.readFloatBE=function(e,t){return t||Jn(e,4,this.length),An(this,e,!1,23,4)},xn.prototype.readDoubleLE=function(e,t){return t||Jn(e,8,this.length),An(this,e,!0,52,8)},xn.prototype.readDoubleBE=function(e,t){return t||Jn(e,8,this.length),An(this,e,!1,52,8)},xn.prototype.writeUIntLE=function(e,t,n,r){e=+e,t|=0,n|=0,r||er(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o<n&&(i*=256);)this[t+o]=e/i&255;return t+n},xn.prototype.writeUIntBE=function(e,t,n,r){e=+e,t|=0,n|=0,r||er(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},xn.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||er(this,e,t,1,255,0),xn.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},xn.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||er(this,e,t,2,65535,0),xn.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):tr(this,e,t,!0),t+2},xn.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||er(this,e,t,2,65535,0),xn.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):tr(this,e,t,!1),t+2},xn.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||er(this,e,t,4,4294967295,0),xn.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):nr(this,e,t,!0),t+4},xn.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||er(this,e,t,4,4294967295,0),xn.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):nr(this,e,t,!1),t+4},xn.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);er(this,e,t,n,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o<n&&(a*=256);)e<0&&0===s&&0!==this[t+o-1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},xn.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);er(this,e,t,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},xn.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||er(this,e,t,1,127,-128),xn.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},xn.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||er(this,e,t,2,32767,-32768),xn.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):tr(this,e,t,!0),t+2},xn.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||er(this,e,t,2,32767,-32768),xn.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):tr(this,e,t,!1),t+2},xn.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||er(this,e,t,4,2147483647,-2147483648),xn.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):nr(this,e,t,!0),t+4},xn.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||er(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),xn.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):nr(this,e,t,!1),t+4},xn.prototype.writeFloatLE=function(e,t,n){return ir(this,e,t,!0,n)},xn.prototype.writeFloatBE=function(e,t,n){return ir(this,e,t,!1,n)},xn.prototype.writeDoubleLE=function(e,t,n){return or(this,e,t,!0,n)},xn.prototype.writeDoubleBE=function(e,t,n){return or(this,e,t,!1,n)},xn.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i,o=r-n;if(this===e&&n<t&&t<r)for(i=o-1;i>=0;--i)e[i+t]=this[i+n];else if(o<1e3||!xn.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)e[i+t]=this[i+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+o),t);return o},xn.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!xn.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var o;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o<n;++o)this[o]=e;else{var a=In(e)?e:ur(new xn(e,r).toString()),s=a.length;for(o=0;o<n-t;++o)this[o+t]=a[o%s]}return this};var ar=/[^+\/0-9A-Za-z-_]/g;function sr(e){return e<16?"0"+e.toString(16):e.toString(16)}function ur(e,t){var n;t=t||1/0;for(var r=e.length,i=null,o=[],a=0;a<r;++a){if((n=e.charCodeAt(a))>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function lr(e){return function(e){var t,n,r,i,o,a;vn||yn();var s=e.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===e[s-2]?2:"="===e[s-1]?1:0,a=new gn(3*s/4-o),r=o>0?s-4:s;var u=0;for(t=0,n=0;t<r;t+=4,n+=3)i=mn[e.charCodeAt(t)]<<18|mn[e.charCodeAt(t+1)]<<12|mn[e.charCodeAt(t+2)]<<6|mn[e.charCodeAt(t+3)],a[u++]=i>>16&255,a[u++]=i>>8&255,a[u++]=255&i;return 2===o?(i=mn[e.charCodeAt(t)]<<2|mn[e.charCodeAt(t+1)]>>4,a[u++]=255&i):1===o&&(i=mn[e.charCodeAt(t)]<<10|mn[e.charCodeAt(t+1)]<<4|mn[e.charCodeAt(t+2)]>>2,a[u++]=i>>8&255,a[u++]=255&i),a}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(ar,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function cr(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function dr(e){return null!=e&&(!!e._isBuffer||fr(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&fr(e.slice(0,0))}(e))}function fr(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var hr="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n?n:"undefined"!=typeof self?self:{};function pr(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})})),n}var mr={},gr={},vr={},yr=pr(Object.freeze({__proto__:null,Buffer:xn,INSPECT_MAX_BYTES:50,SlowBuffer:function(e){return+e!=e&&(e=0),xn.alloc(+e)},isBuffer:dr,kMaxLength:kn})),br={};function wr(){throw new Error("setTimeout has not been defined")}function Ar(){throw new Error("clearTimeout has not been defined")}var _r=wr,Er=Ar;function Sr(e){if(_r===setTimeout)return setTimeout(e,0);if((_r===wr||!_r)&&setTimeout)return _r=setTimeout,setTimeout(e,0);try{return _r(e,0)}catch(t){try{return _r.call(null,e,0)}catch(t){return _r.call(this,e,0)}}}"function"==typeof hn.setTimeout&&(_r=setTimeout),"function"==typeof hn.clearTimeout&&(Er=clearTimeout);var kr,Mr=[],Cr=!1,xr=-1;function Rr(){Cr&&kr&&(Cr=!1,kr.length?Mr=kr.concat(Mr):xr=-1,Mr.length&&Or())}function Or(){if(!Cr){var e=Sr(Rr);Cr=!0;for(var t=Mr.length;t;){for(kr=Mr,Mr=[];++xr<t;)kr&&kr[xr].run();xr=-1,t=Mr.length}kr=null,Cr=!1,function(e){if(Er===clearTimeout)return clearTimeout(e);if((Er===Ar||!Er)&&clearTimeout)return Er=clearTimeout,clearTimeout(e);try{return Er(e)}catch(t){try{return Er.call(null,e)}catch(t){return Er.call(this,e)}}}(e)}}function Tr(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];Mr.push(new Pr(e,t)),1!==Mr.length||Cr||Sr(Or)}function Pr(e,t){this.fun=e,this.array=t}function Lr(){}Pr.prototype.run=function(){this.fun.apply(null,this.array)};var Ir=Lr,Nr=Lr,Dr=Lr,Br=Lr,jr=Lr,Ur=Lr,zr=Lr,Fr=hn.performance||{},qr=Fr.now||Fr.mozNow||Fr.msNow||Fr.oNow||Fr.webkitNow||function(){return(new Date).getTime()},Wr=new Date,Vr={nextTick:Tr,title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:Ir,addListener:Nr,once:Dr,off:Br,removeListener:jr,removeAllListeners:Ur,emit:zr,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*qr.call(Fr),n=Math.floor(t),r=Math.floor(t%1*1e9);return e&&(n-=e[0],(r-=e[1])<0&&(n--,r+=1e9)),[n,r]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-Wr)/1e3}},Kr={exports:{}},Hr={exports:{}};!function(e,t){var n=yr,r=n.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}function o(e,t,n){return r(e,t,n)}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?e.exports=n:(i(n,t),t.Buffer=o),o.prototype=Object.create(r.prototype),i(r,o),o.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return r(e,t,n)},o.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=r(e);return void 0!==t?"string"==typeof n?i.fill(t,n):i.fill(t):i.fill(0),i},o.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}}(Hr,Hr.exports);var $r=Hr.exports,Yr=65536,Gr=$r.Buffer,Qr=hr.crypto||hr.msCrypto;Qr&&Qr.getRandomValues?Kr.exports=function(e,t){if(e>4294967295)throw new RangeError("requested too many random bytes");var n=Gr.allocUnsafe(e);if(e>0)if(e>Yr)for(var r=0;r<e;r+=Yr)Qr.getRandomValues(n.slice(r,r+Yr));else Qr.getRandomValues(n);return"function"==typeof t?Tr((function(){t(null,n)})):n}:Kr.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")};var Zr=Kr.exports,Xr={exports:{}};"function"==typeof Object.create?Xr.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Xr.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}};var Jr=Xr.exports,ei={exports:{}};function ti(){}function ni(){ni.init.call(this)}function ri(e){return void 0===e._maxListeners?ni.defaultMaxListeners:e._maxListeners}function ii(e,t,n,r){var i,o,a,s;if("function"!=typeof n)throw new TypeError('"listener" argument must be a function');if((o=e._events)?(o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),a=o[t]):(o=e._events=new ti,e._eventsCount=0),a){if("function"==typeof a?a=o[t]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),!a.warned&&(i=ri(e))&&i>0&&a.length>i){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=a.length,s=u,"function"==typeof console.warn?console.warn(s):console.log(s)}}else a=o[t]=n,++e._eventsCount;return e}function oi(e,t,n){var r=!1;function i(){e.removeListener(t,i),r||(r=!0,n.apply(e,arguments))}return i.listener=n,i}function ai(e){var t=this._events;if(t){var n=t[e];if("function"==typeof n)return 1;if(n)return n.length}return 0}function si(e,t){for(var n=new Array(t);t--;)n[t]=e[t];return n}ti.prototype=Object.create(null),ni.EventEmitter=ni,ni.usingDomains=!1,ni.prototype.domain=void 0,ni.prototype._events=void 0,ni.prototype._maxListeners=void 0,ni.defaultMaxListeners=10,ni.init=function(){this.domain=null,ni.usingDomains&&(void 0).active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new ti,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},ni.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},ni.prototype.getMaxListeners=function(){return ri(this)},ni.prototype.emit=function(e){var t,n,r,i,o,a,s,u="error"===e;if(a=this._events)u=u&&null==a.error;else if(!u)return!1;if(s=this.domain,u){if(t=arguments[1],!s){if(t instanceof Error)throw t;var l=new Error('Uncaught, unspecified "error" event. ('+t+")");throw l.context=t,l}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=s,t.domainThrown=!1,s.emit("error",t),!1}if(!(n=a[e]))return!1;var c="function"==typeof n;switch(r=arguments.length){case 1:!function(e,t,n){if(t)e.call(n);else for(var r=e.length,i=si(e,r),o=0;o<r;++o)i[o].call(n)}(n,c,this);break;case 2:!function(e,t,n,r){if(t)e.call(n,r);else for(var i=e.length,o=si(e,i),a=0;a<i;++a)o[a].call(n,r)}(n,c,this,arguments[1]);break;case 3:!function(e,t,n,r,i){if(t)e.call(n,r,i);else for(var o=e.length,a=si(e,o),s=0;s<o;++s)a[s].call(n,r,i)}(n,c,this,arguments[1],arguments[2]);break;case 4:!function(e,t,n,r,i,o){if(t)e.call(n,r,i,o);else for(var a=e.length,s=si(e,a),u=0;u<a;++u)s[u].call(n,r,i,o)}(n,c,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(r-1),o=1;o<r;o++)i[o-1]=arguments[o];!function(e,t,n,r){if(t)e.apply(n,r);else for(var i=e.length,o=si(e,i),a=0;a<i;++a)o[a].apply(n,r)}(n,c,this,i)}return!0},ni.prototype.addListener=function(e,t){return ii(this,e,t,!1)},ni.prototype.on=ni.prototype.addListener,ni.prototype.prependListener=function(e,t){return ii(this,e,t,!0)},ni.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,oi(this,e,t)),this},ni.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,oi(this,e,t)),this},ni.prototype.removeListener=function(e,t){var n,r,i,o,a;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(r=this._events))return this;if(!(n=r[e]))return this;if(n===t||n.listener&&n.listener===t)0==--this._eventsCount?this._events=new ti:(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,o=n.length;o-- >0;)if(n[o]===t||n[o].listener&&n[o].listener===t){a=n[o].listener,i=o;break}if(i<0)return this;if(1===n.length){if(n[0]=void 0,0==--this._eventsCount)return this._events=new ti,this;delete r[e]}else!function(e,t){for(var n=t,r=n+1,i=e.length;r<i;n+=1,r+=1)e[n]=e[r];e.pop()}(n,i);r.removeListener&&this.emit("removeListener",e,a||t)}return this},ni.prototype.removeAllListeners=function(e){var t,n;if(!(n=this._events))return this;if(!n.removeListener)return 0===arguments.length?(this._events=new ti,this._eventsCount=0):n[e]&&(0==--this._eventsCount?this._events=new ti:delete n[e]),this;if(0===arguments.length){for(var r,i=Object.keys(n),o=0;o<i.length;++o)"removeListener"!==(r=i[o])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=new ti,this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(t)do{this.removeListener(e,t[t.length-1])}while(t[0]);return this},ni.prototype.listeners=function(e){var t,n=this._events;return n&&(t=n[e])?"function"==typeof t?[t.listener||t]:function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(t):[]},ni.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):ai.call(e,t)},ni.prototype.listenerCount=ai,ni.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};var ui=pr(Object.freeze({__proto__:null,EventEmitter:ni,default:ni})),li=ui.EventEmitter,ci="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e},di=/%[sdj%]/g;function fi(e){if(!Ri(e)){for(var t=[],n=0;n<arguments.length;n++)t.push(yi(arguments[n]));return t.join(" ")}n=1;for(var r=arguments,i=r.length,o=String(e).replace(di,(function(e){if("%%"===e)return"%";if(n>=i)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}})),a=r[n];n<i;a=r[++n])Mi(a)||!Li(a)?o+=" "+a:o+=" "+yi(a);return o}function hi(e,t){if(Ti(hn.process))return function(){return hi(e,t).apply(this,arguments)};if(!0===Vr.noDeprecation)return e;var n=!1;return function(){if(!n){if(Vr.throwDeprecation)throw new Error(t);Vr.traceDeprecation?console.trace(t):console.error(t),n=!0}return e.apply(this,arguments)}}var pi,mi={};function gi(e){return Ti(pi)&&(pi=Vr.env.NODE_DEBUG||""),e=e.toUpperCase(),mi[e]||(new RegExp("\\b"+e+"\\b","i").test(pi)?mi[e]=function(){var t=fi.apply(null,arguments);console.error("%s %d: %s",e,0,t)}:mi[e]=function(){}),mi[e]}function yi(e,t){var n={seen:[],stylize:wi};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),ki(t)?n.showHidden=t:t&&Wi(n,t),Ti(n.showHidden)&&(n.showHidden=!1),Ti(n.depth)&&(n.depth=2),Ti(n.colors)&&(n.colors=!1),Ti(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=bi),Ai(n,e,n.depth)}function bi(e,t){var n=yi.styles[t];return n?"["+yi.colors[n][0]+"m"+e+"["+yi.colors[n][1]+"m":e}function wi(e,t){return e}function Ai(e,t,n){if(e.customInspect&&t&&Di(t.inspect)&&t.inspect!==yi&&(!t.constructor||t.constructor.prototype!==t)){var r=t.inspect(n,e);return Ri(r)||(r=Ai(e,r,n)),r}var i=function(e,t){if(Ti(t))return e.stylize("undefined","undefined");if(Ri(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return xi(t)?e.stylize(""+t,"number"):ki(t)?e.stylize(""+t,"boolean"):Mi(t)?e.stylize("null","null"):void 0}(e,t);if(i)return i;var o=Object.keys(t),a=function(e){var t={};return e.forEach((function(e,n){t[e]=!0})),t}(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(t)),Ni(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return _i(t);if(0===o.length){if(Di(t)){var s=t.name?": "+t.name:"";return e.stylize("[Function"+s+"]","special")}if(Pi(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(Ii(t))return e.stylize(Date.prototype.toString.call(t),"date");if(Ni(t))return _i(t)}var u,l="",c=!1,d=["{","}"];return Si(t)&&(c=!0,d=["[","]"]),Di(t)&&(l=" [Function"+(t.name?": "+t.name:"")+"]"),Pi(t)&&(l=" "+RegExp.prototype.toString.call(t)),Ii(t)&&(l=" "+Date.prototype.toUTCString.call(t)),Ni(t)&&(l=" "+_i(t)),0!==o.length||c&&0!=t.length?n<0?Pi(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),u=c?function(e,t,n,r,i){for(var o=[],a=0,s=t.length;a<s;++a)Vi(t,String(a))?o.push(Ei(e,t,n,r,String(a),!0)):o.push("");return i.forEach((function(i){i.match(/^\d+$/)||o.push(Ei(e,t,n,r,i,!0))})),o}(e,t,n,a,o):o.map((function(r){return Ei(e,t,n,a,r,c)})),e.seen.pop(),function(e,t,n){var r=e.reduce((function(e,t){return t.indexOf("\n"),e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0);return r>60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}(u,l,d)):d[0]+l+d[1]}function _i(e){return"["+Error.prototype.toString.call(e)+"]"}function Ei(e,t,n,r,i,o){var a,s,u;if((u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?s=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(s=e.stylize("[Setter]","special")),Vi(r,i)||(a="["+i+"]"),s||(e.seen.indexOf(u.value)<0?(s=Mi(n)?Ai(e,u.value,null):Ai(e,u.value,n-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+s.split("\n").map((function(e){return" "+e})).join("\n")):s=e.stylize("[Circular]","special")),Ti(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function Si(e){return Array.isArray(e)}function ki(e){return"boolean"==typeof e}function Mi(e){return null===e}function Ci(e){return null==e}function xi(e){return"number"==typeof e}function Ri(e){return"string"==typeof e}function Oi(e){return"symbol"==typeof e}function Ti(e){return void 0===e}function Pi(e){return Li(e)&&"[object RegExp]"===Ui(e)}function Li(e){return"object"==typeof e&&null!==e}function Ii(e){return Li(e)&&"[object Date]"===Ui(e)}function Ni(e){return Li(e)&&("[object Error]"===Ui(e)||e instanceof Error)}function Di(e){return"function"==typeof e}function Bi(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function ji(e){return dr(e)}function Ui(e){return Object.prototype.toString.call(e)}function zi(e){return e<10?"0"+e.toString(10):e.toString(10)}yi.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},yi.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};var Fi=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function qi(){var e,t;console.log("%s - %s",(t=[zi((e=new Date).getHours()),zi(e.getMinutes()),zi(e.getSeconds())].join(":"),[e.getDate(),Fi[e.getMonth()],t].join(" ")),fi.apply(null,arguments))}function Wi(e,t){if(!t||!Li(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}function Vi(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var Ki,Hi,$i={inherits:ci,_extend:Wi,log:qi,isBuffer:ji,isPrimitive:Bi,isFunction:Di,isError:Ni,isDate:Ii,isObject:Li,isRegExp:Pi,isUndefined:Ti,isSymbol:Oi,isString:Ri,isNumber:xi,isNullOrUndefined:Ci,isNull:Mi,isBoolean:ki,isArray:Si,inspect:yi,deprecate:hi,format:fi,debuglog:gi},Yi=pr(Object.freeze({__proto__:null,_extend:Wi,debuglog:gi,default:$i,deprecate:hi,format:fi,inherits:ci,inspect:yi,isArray:Si,isBoolean:ki,isBuffer:ji,isDate:Ii,isError:Ni,isFunction:Di,isNull:Mi,isNullOrUndefined:Ci,isNumber:xi,isObject:Li,isPrimitive:Bi,isRegExp:Pi,isString:Ri,isSymbol:Oi,isUndefined:Ti,log:qi}));function Gi(e,t){Zi(e,t),Qi(e)}function Qi(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function Zi(e,t){e.emit("error",t)}var Xi={destroy:function(e,t){var n=this,r=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return r||i?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,Tr(Zi,this,e)):Tr(Zi,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?n._writableState?n._writableState.errorEmitted?Tr(Qi,n):(n._writableState.errorEmitted=!0,Tr(Gi,n,e)):Tr(Gi,n,e):t?(Tr(Qi,n),t(e)):Tr(Qi,n)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var n=e._readableState,r=e._writableState;n&&n.autoDestroy||r&&r.autoDestroy?e.destroy(t):e.emit("error",t)}},Ji={},eo={};function to(e,t,n){n||(n=Error);var r=function(e){var n,r;function i(n,r,i){return e.call(this,function(e,n,r){return"string"==typeof t?t:t(e,n,r)}(n,r,i))||this}return r=e,(n=i).prototype=Object.create(r.prototype),n.prototype.constructor=n,n.__proto__=r,i}(n);r.prototype.name=n.name,r.prototype.code=e,eo[e]=r}function no(e,t){if(Array.isArray(e)){var n=e.length;return e=e.map((function(e){return String(e)})),n>2?"one of ".concat(t," ").concat(e.slice(0,n-1).join(", "),", or ")+e[n-1]:2===n?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}to("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),to("ERR_INVALID_ARG_TYPE",(function(e,t,n){var r,i,o;if("string"==typeof t&&(i="not ",t.substr(0,4)===i)?(r="must not be",t=t.replace(/^not /,"")):r="must be",function(e,t,n){return(void 0===n||n>e.length)&&(n=e.length),e.substring(n-9,n)===t}(e," argument"))o="The ".concat(e," ").concat(r," ").concat(no(t,"type"));else{var a=function(e,t,n){return"number"!=typeof n&&(n=0),!(n+1>e.length)&&-1!==e.indexOf(".",n)}(e)?"property":"argument";o='The "'.concat(e,'" ').concat(a," ").concat(r," ").concat(no(t,"type"))}return o+". Received type ".concat(typeof n)}),TypeError),to("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),to("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),to("ERR_STREAM_PREMATURE_CLOSE","Premature close"),to("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),to("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),to("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),to("ERR_STREAM_WRITE_AFTER_END","write after end"),to("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),to("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),to("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),Ji.codes=eo;var ro,io,oo,ao,so,uo,lo=Ji.codes.ERR_INVALID_OPT_VALUE,co={getHighWaterMark:function(e,t,n,r){var i=function(e,t,n){return null!=e.highWaterMark?e.highWaterMark:t?e[n]:null}(t,r,n);if(null!=i){if(!isFinite(i)||Math.floor(i)!==i||i<0)throw new lo(r?n:"highWaterMark",i);return Math.floor(i)}return e.objectMode?16:16384}};function fo(){if(io)return ro;function e(e){try{if(!hr.localStorage)return!1}catch(e){return!1}var t=hr.localStorage[e];return null!=t&&"true"===String(t).toLowerCase()}return io=1,ro=function(t,n){if(e("noDeprecation"))return t;var r=!1;return function(){if(!r){if(e("throwDeprecation"))throw new Error(n);e("traceDeprecation")?console.trace(n):console.warn(n),r=!0}return t.apply(this,arguments)}},ro}function ho(){if(ao)return oo;function e(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,n){var r=e.entry;for(e.entry=null;r;){var i=r.callback;t.pendingcb--,i(void 0),r=r.next}t.corkedRequestsFree.next=e}(t,e)}}var t;ao=1,oo=A,A.WritableState=w;var n,r={deprecate:fo()},i=li,o=yr.Buffer,a=(void 0!==hr?hr:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},s=Xi,u=co.getHighWaterMark,l=Ji.codes,c=l.ERR_INVALID_ARG_TYPE,d=l.ERR_METHOD_NOT_IMPLEMENTED,f=l.ERR_MULTIPLE_CALLBACK,h=l.ERR_STREAM_CANNOT_PIPE,p=l.ERR_STREAM_DESTROYED,m=l.ERR_STREAM_NULL_VALUES,g=l.ERR_STREAM_WRITE_AFTER_END,v=l.ERR_UNKNOWN_ENCODING,y=s.errorOrDestroy;function b(){}function w(n,r,i){t=t||po(),n=n||{},"boolean"!=typeof i&&(i=r instanceof t),this.objectMode=!!n.objectMode,i&&(this.objectMode=this.objectMode||!!n.writableObjectMode),this.highWaterMark=u(this,n,"writableHighWaterMark",i),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var o=!1===n.decodeStrings;this.decodeStrings=!o,this.defaultEncoding=n.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,i=n.writecb;if("function"!=typeof i)throw new f;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,i){--t.pendingcb,n?(Tr(i,r),Tr(C,e,t),e._writableState.errorEmitted=!0,y(e,r)):(i(r),e._writableState.errorEmitted=!0,y(e,r),C(e,t))}(e,n,r,t,i);else{var o=k(n)||e.destroyed;o||n.corked||n.bufferProcessing||!n.bufferedRequest||S(e,n),r?Tr(E,e,n,o,i):E(e,n,o,i)}}(r,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==n.emitClose,this.autoDestroy=!!n.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}function A(e){var r=this instanceof(t=t||po());if(!r&&!n.call(A,this))return new A(e);this._writableState=new w(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)),i.call(this)}function _(e,t,n,r,i,o,a){t.writelen=r,t.writecb=a,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new p("write")):n?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function E(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),C(e,t)}function S(t,n){n.bufferProcessing=!0;var r=n.bufferedRequest;if(t._writev&&r&&r.next){var i=n.bufferedRequestCount,o=new Array(i),a=n.corkedRequestsFree;a.entry=r;for(var s=0,u=!0;r;)o[s]=r,r.isBuf||(u=!1),r=r.next,s+=1;o.allBuffers=u,_(t,n,!0,n.length,o,"",a.finish),n.pendingcb++,n.lastBufferedRequest=null,a.next?(n.corkedRequestsFree=a.next,a.next=null):n.corkedRequestsFree=new e(n),n.bufferedRequestCount=0}else{for(;r;){var l=r.chunk,c=r.encoding,d=r.callback;if(_(t,n,!1,n.objectMode?1:l.length,l,c,d),r=r.next,n.bufferedRequestCount--,n.writing)break}null===r&&(n.lastBufferedRequest=null)}n.bufferedRequest=r,n.bufferProcessing=!1}function k(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function M(e,t){e._final((function(n){t.pendingcb--,n&&y(e,n),t.prefinished=!0,e.emit("prefinish"),C(e,t)}))}function C(e,t){var n=k(t);if(n&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,Tr(M,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var r=e._readableState;(!r||r.autoDestroy&&r.endEmitted)&&e.destroy()}return n}return Jr(A,i),w.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(w.prototype,"buffer",{get:r.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(n=Function.prototype[Symbol.hasInstance],Object.defineProperty(A,Symbol.hasInstance,{value:function(e){return!!n.call(this,e)||this===A&&e&&e._writableState instanceof w}})):n=function(e){return e instanceof this},A.prototype.pipe=function(){y(this,new h)},A.prototype.write=function(e,t,n){var r,i=this._writableState,s=!1,u=!i.objectMode&&(r=e,o.isBuffer(r)||r instanceof a);return u&&!o.isBuffer(e)&&(e=function(e){return o.from(e)}(e)),"function"==typeof t&&(n=t,t=null),u?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof n&&(n=b),i.ending?function(e,t){var n=new g;y(e,n),Tr(t,n)}(this,n):(u||function(e,t,n,r){var i;return null===n?i=new m:"string"==typeof n||t.objectMode||(i=new c("chunk",["string","Buffer"],n)),!i||(y(e,i),Tr(r,i),!1)}(this,i,e,n))&&(i.pendingcb++,s=function(e,t,n,r,i,a){if(!n){var s=function(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=o.from(t,n)),t}(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var u=t.objectMode?1:r.length;t.length+=u;var l=t.length<t.highWaterMark;if(l||(t.needDrain=!0),t.writing||t.corked){var c=t.lastBufferedRequest;t.lastBufferedRequest={chunk:r,encoding:i,isBuf:n,callback:a,next:null},c?c.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else _(e,t,!1,u,r,i,a);return l}(this,i,u,e,t,n)),s},A.prototype.cork=function(){this._writableState.corked++},A.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||S(this,e))},A.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 v(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(A.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(A.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),A.prototype._write=function(e,t,n){n(new d("_write()"))},A.prototype._writev=null,A.prototype.end=function(e,t,n){var r=this._writableState;return"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||function(e,t,n){t.ending=!0,C(e,t),n&&(t.finished?Tr(n):e.once("finish",n)),t.ended=!0,e.writable=!1}(this,r,n),this},Object.defineProperty(A.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(A.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),A.prototype.destroy=s.destroy,A.prototype._undestroy=s.undestroy,A.prototype._destroy=function(e,t){t(e)},oo}function po(){if(uo)return so;uo=1;var e=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};so=a;var t=Co(),n=ho();Jr(a,t);for(var r=e(n.prototype),i=0;i<r.length;i++){var o=r[i];a.prototype[o]||(a.prototype[o]=n.prototype[o])}function a(e){if(!(this instanceof a))return new a(e);t.call(this,e),n.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",s)))}function s(){this._writableState.ended||Tr(u,this)}function u(e){e.end()}return Object.defineProperty(a.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(a.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(a.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(a.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._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)}}),so}var mo,go={};function vo(){if(mo)return go;mo=1;var e=$r.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 n(n){var r;switch(this.encoding=function(n){var r=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}}(n);if("string"!=typeof r&&(e.isEncoding===t||!t(n)))throw new Error("Unknown encoding: "+n);return r||n}(n),this.encoding){case"utf16le":this.text=o,this.end=a,r=4;break;case"utf8":this.fillLast=i,r=4;break;case"base64":this.text=s,this.end=u,r=3;break;default:return this.write=l,void(this.end=c)}this.lastNeed=0,this.lastTotal=0,this.lastChar=e.allocUnsafe(r)}function r(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,n=function(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function o(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function a(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function s(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function u(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 c(e){return e&&e.length?this.write(e):""}return go.StringDecoder=n,n.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||""},n.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},n.prototype.text=function(e,t){var n=function(e,t,n){var i=t.length-1;if(i<n)return 0;var o=r(t[i]);return o>=0?(o>0&&(e.lastNeed=o-1),o):--i<n||-2===o?0:(o=r(t[i]))>=0?(o>0&&(e.lastNeed=o-2),o):--i<n||-2===o?0:(o=r(t[i]))>=0?(o>0&&(2===o?o=0:e.lastNeed=o-3),o):0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var i=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,i),e.toString("utf8",t,i)},n.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length},go}var yo=Ji.codes.ERR_STREAM_PREMATURE_CLOSE;function bo(){}var wo,Ao,_o,Eo,So,ko,Mo=function e(t,n,r){if("function"==typeof n)return e(t,null,n);n||(n={}),r=function(e){var t=!1;return function(){if(!t){t=!0;for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];e.apply(this,r)}}}(r||bo);var i=n.readable||!1!==n.readable&&t.readable,o=n.writable||!1!==n.writable&&t.writable,a=function(){t.writable||u()},s=t._writableState&&t._writableState.finished,u=function(){o=!1,s=!0,i||r.call(t)},l=t._readableState&&t._readableState.endEmitted,c=function(){i=!1,l=!0,o||r.call(t)},d=function(e){r.call(t,e)},f=function(){var e;return i&&!l?(t._readableState&&t._readableState.ended||(e=new yo),r.call(t,e)):o&&!s?(t._writableState&&t._writableState.ended||(e=new yo),r.call(t,e)):void 0},h=function(){t.req.on("finish",u)};return function(e){return e.setHeader&&"function"==typeof e.abort}(t)?(t.on("complete",u),t.on("abort",f),t.req?h():t.on("request",h)):o&&!t._writableState&&(t.on("end",a),t.on("close",a)),t.on("end",c),t.on("finish",u),!1!==n.error&&t.on("error",d),t.on("close",f),function(){t.removeListener("complete",u),t.removeListener("abort",f),t.removeListener("request",h),t.req&&t.req.removeListener("finish",u),t.removeListener("end",a),t.removeListener("close",a),t.removeListener("finish",u),t.removeListener("end",c),t.removeListener("error",d),t.removeListener("close",f)}};function Co(){if(ko)return So;var e;ko=1,So=A,A.ReadableState=w,ui.EventEmitter;var t,n=function(e,t){return e.listeners(t).length},r=li,i=yr.Buffer,o=(void 0!==hr?hr:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},a=Yi;t=a&&a.debuglog?a.debuglog("stream"):function(){};var s,u,l,c=function(){if(Hi)return Ki;function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function t(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?e(Object(i),!0).forEach((function(e){n(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 n(e,t,n){return(t=i(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,i(r.key),r)}}function i(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}Hi=1;var o=yr.Buffer,a=Yi.inspect,s=a&&a.custom||"inspect";return Ki=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 n,i;return n=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,n=""+t.data;t=t.next;)n+=e+t.data;return n}},{key:"concat",value:function(e){if(0===this.length)return o.alloc(0);for(var t,n,r,i=o.allocUnsafe(e>>>0),a=this.head,s=0;a;)t=a.data,n=i,r=s,o.prototype.copy.call(t,n,r),s+=a.data.length,a=a.next;return i}},{key:"consume",value:function(e,t){var n;return e<this.head.data.length?(n=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):n=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),n}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,n=1,r=t.data;for(e-=r.length;t=t.next;){var i=t.data,o=e>i.length?i.length:e;if(o===i.length?r+=i:r+=i.slice(0,e),0==(e-=o)){o===i.length?(++n,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(e){var t=o.allocUnsafe(e),n=this.head,r=1;for(n.data.copy(t),e-=n.data.length;n=n.next;){var i=n.data,a=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,a),0==(e-=a)){a===i.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=i.slice(a));break}++r}return this.length-=r,t}},{key:s,value:function(e,n){return a(this,t(t({},n),{},{depth:0,customInspect:!1}))}}],i&&r(n.prototype,i),Object.defineProperty(n,"prototype",{writable:!1}),e}(),Ki}(),d=Xi,f=co.getHighWaterMark,h=Ji.codes,p=h.ERR_INVALID_ARG_TYPE,m=h.ERR_STREAM_PUSH_AFTER_EOF,g=h.ERR_METHOD_NOT_IMPLEMENTED,v=h.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;Jr(A,r);var y=d.errorOrDestroy,b=["error","close","destroy","pause","resume"];function w(t,n,r){e=e||po(),t=t||{},"boolean"!=typeof r&&(r=n instanceof e),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=f(this,t,"readableHighWaterMark",r),this.buffer=new c,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&&(s||(s=vo().StringDecoder),this.decoder=new s(t.encoding),this.encoding=t.encoding)}function A(t){if(e=e||po(),!(this instanceof A))return new A(t);var n=this instanceof e;this._readableState=new w(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 _(e,n,r,a,s){t("readableAddChunk",n);var u,l=e._readableState;if(null===n)l.reading=!1,function(e,n){if(t("onEofChunk"),!n.ended){if(n.decoder){var r=n.decoder.end();r&&r.length&&(n.buffer.push(r),n.length+=n.objectMode?1:r.length)}n.ended=!0,n.sync?M(e):(n.needReadable=!1,n.emittedReadable||(n.emittedReadable=!0,C(e)))}}(e,l);else if(s||(u=function(e,t){var n,r;return r=t,i.isBuffer(r)||r instanceof o||"string"==typeof t||void 0===t||e.objectMode||(n=new p("chunk",["string","Buffer","Uint8Array"],t)),n}(l,n)),u)y(e,u);else if(l.objectMode||n&&n.length>0)if("string"==typeof n||l.objectMode||Object.getPrototypeOf(n)===i.prototype||(n=function(e){return i.from(e)}(n)),a)l.endEmitted?y(e,new v):E(e,l,n,!0);else if(l.ended)y(e,new m);else{if(l.destroyed)return!1;l.reading=!1,l.decoder&&!r?(n=l.decoder.write(n),l.objectMode||0!==n.length?E(e,l,n,!1):x(e,l)):E(e,l,n,!1)}else a||(l.reading=!1,x(e,l));return!l.ended&&(l.length<l.highWaterMark||0===l.length)}function E(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",n)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&M(e)),x(e,t)}Object.defineProperty(A.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),A.prototype.destroy=d.destroy,A.prototype._undestroy=d.undestroy,A.prototype._destroy=function(e,t){t(e)},A.prototype.push=function(e,t){var n,r=this._readableState;return r.objectMode?n=!0:"string"==typeof e&&((t=t||r.defaultEncoding)!==r.encoding&&(e=i.from(e,t),t=""),n=!0),_(this,e,t,!1,n)},A.prototype.unshift=function(e){return _(this,e,null,!0,!1)},A.prototype.isPaused=function(){return!1===this._readableState.flowing},A.prototype.setEncoding=function(e){s||(s=vo().StringDecoder);var t=new s(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,r="";null!==n;)r+=t.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==r&&this._readableState.buffer.push(r),this._readableState.length=r.length,this};var S=1073741824;function k(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>=S?e=S:(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 M(e){var n=e._readableState;t("emitReadable",n.needReadable,n.emittedReadable),n.needReadable=!1,n.emittedReadable||(t("emitReadable",n.flowing),n.emittedReadable=!0,Tr(C,e))}function C(e){var n=e._readableState;t("emitReadable_",n.destroyed,n.length,n.ended),n.destroyed||!n.length&&!n.ended||(e.emit("readable"),n.emittedReadable=!1),n.needReadable=!n.flowing&&!n.ended&&n.length<=n.highWaterMark,L(e)}function x(e,t){t.readingMore||(t.readingMore=!0,Tr(R,e,t))}function R(e,n){for(;!n.reading&&!n.ended&&(n.length<n.highWaterMark||n.flowing&&0===n.length);){var r=n.length;if(t("maybeReadMore read 0"),e.read(0),r===n.length)break}n.readingMore=!1}function O(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 T(e){t("readable nexttick read 0"),e.read(0)}function P(e,n){t("resume",n.reading),n.reading||e.read(0),n.resumeScheduled=!1,e.emit("resume"),L(e),n.flowing&&!n.reading&&e.read(0)}function L(e){var n=e._readableState;for(t("flow",n.flowing);n.flowing&&null!==e.read(););}function I(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n);var n}function N(e){var n=e._readableState;t("endReadable",n.endEmitted),n.endEmitted||(n.ended=!0,Tr(D,n,e))}function D(e,n){if(t("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,n.readable=!1,n.emit("end"),e.autoDestroy)){var r=n._writableState;(!r||r.autoDestroy&&r.finished)&&n.destroy()}}function B(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}return A.prototype.read=function(e){t("read",e),e=parseInt(e,10);var n=this._readableState,r=e;if(0!==e&&(n.emittedReadable=!1),0===e&&n.needReadable&&((0!==n.highWaterMark?n.length>=n.highWaterMark:n.length>0)||n.ended))return t("read: emitReadable",n.length,n.ended),0===n.length&&n.ended?N(this):M(this),null;if(0===(e=k(e,n))&&n.ended)return 0===n.length&&N(this),null;var i,o=n.needReadable;return t("need readable",o),(0===n.length||n.length-e<n.highWaterMark)&&t("length less than watermark",o=!0),n.ended||n.reading?t("reading or ended",o=!1):o&&(t("do read"),n.reading=!0,n.sync=!0,0===n.length&&(n.needReadable=!0),this._read(n.highWaterMark),n.sync=!1,n.reading||(e=k(r,n))),null===(i=e>0?I(e,n):null)?(n.needReadable=n.length<=n.highWaterMark,e=0):(n.length-=e,n.awaitDrain=0),0===n.length&&(n.ended||(n.needReadable=!0),r!==e&&n.ended&&N(this)),null!==i&&this.emit("data",i),i},A.prototype._read=function(e){y(this,new g("_read()"))},A.prototype.pipe=function(e,r){var i=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,t("pipe count=%d opts=%j",o.pipesCount,r);var a=r&&!1===r.end||e===Vr.stdout||e===Vr.stderr?p:s;function s(){t("onend"),e.end()}o.endEmitted?Tr(a):i.once("end",a),e.on("unpipe",(function n(r,a){t("onunpipe"),r===i&&a&&!1===a.hasUnpiped&&(a.hasUnpiped=!0,t("cleanup"),e.removeListener("close",f),e.removeListener("finish",h),e.removeListener("drain",u),e.removeListener("error",d),e.removeListener("unpipe",n),i.removeListener("end",s),i.removeListener("end",p),i.removeListener("data",c),l=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||u())}));var u=function(e){return function(){var r=e._readableState;t("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,0===r.awaitDrain&&n(e,"data")&&(r.flowing=!0,L(e))}}(i);e.on("drain",u);var l=!1;function c(n){t("ondata");var r=e.write(n);t("dest.write",r),!1===r&&((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==B(o.pipes,e))&&!l&&(t("false write response, pause",o.awaitDrain),o.awaitDrain++),i.pause())}function d(r){t("onerror",r),p(),e.removeListener("error",d),0===n(e,"error")&&y(e,r)}function f(){e.removeListener("finish",h),p()}function h(){t("onfinish"),e.removeListener("close",f),p()}function p(){t("unpipe"),i.unpipe(e)}return i.on("data",c),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",d),e.once("close",f),e.once("finish",h),e.emit("pipe",i),o.flowing||(t("pipe resume"),i.resume()),e},A.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n)),this;if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<i;o++)r[o].emit("unpipe",this,{hasUnpiped:!1});return this}var a=B(t.pipes,e);return-1===a||(t.pipes.splice(a,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,n)),this},A.prototype.on=function(e,n){var i=r.prototype.on.call(this,e,n),o=this._readableState;return"data"===e?(o.readableListening=this.listenerCount("readable")>0,!1!==o.flowing&&this.resume()):"readable"===e&&(o.endEmitted||o.readableListening||(o.readableListening=o.needReadable=!0,o.flowing=!1,o.emittedReadable=!1,t("on readable",o.length,o.reading),o.length?M(this):o.reading||Tr(T,this))),i},A.prototype.addListener=A.prototype.on,A.prototype.removeListener=function(e,t){var n=r.prototype.removeListener.call(this,e,t);return"readable"===e&&Tr(O,this),n},A.prototype.removeAllListeners=function(e){var t=r.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||Tr(O,this),t},A.prototype.resume=function(){var e=this._readableState;return e.flowing||(t("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,Tr(P,e,t))}(this,e)),e.paused=!1,this},A.prototype.pause=function(){return t("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(t("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},A.prototype.wrap=function(e){var n=this,r=this._readableState,i=!1;for(var o in e.on("end",(function(){if(t("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&n.push(e)}n.push(null)})),e.on("data",(function(o){t("wrapped data"),r.decoder&&(o=r.decoder.write(o)),r.objectMode&&null==o||(r.objectMode||o&&o.length)&&(n.push(o)||(i=!0,e.pause()))})),e)void 0===this[o]&&"function"==typeof e[o]&&(this[o]=function(t){return function(){return e[t].apply(e,arguments)}}(o));for(var a=0;a<b.length;a++)e.on(b[a],this.emit.bind(this,b[a]));return this._read=function(n){t("wrapped _read",n),i&&(i=!1,e.resume())},this},"function"==typeof Symbol&&(A.prototype[Symbol.asyncIterator]=function(){return void 0===u&&(u=function(){if(Ao)return wo;var e;function t(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Ao=1;var n=Mo,r=Symbol("lastResolve"),i=Symbol("lastReject"),o=Symbol("error"),a=Symbol("ended"),s=Symbol("lastPromise"),u=Symbol("handlePromise"),l=Symbol("stream");function c(e,t){return{value:e,done:t}}function d(e){var t=e[r];if(null!==t){var n=e[l].read();null!==n&&(e[s]=null,e[r]=null,e[i]=null,t(c(n,!1)))}}function f(e){Tr(d,e)}var h=Object.getPrototypeOf((function(){})),p=Object.setPrototypeOf((t(e={get stream(){return this[l]},next:function(){var e=this,t=this[o];if(null!==t)return Promise.reject(t);if(this[a])return Promise.resolve(c(void 0,!0));if(this[l].destroyed)return new Promise((function(t,n){Tr((function(){e[o]?n(e[o]):t(c(void 0,!0))}))}));var n,r=this[s];if(r)n=new Promise(function(e,t){return function(n,r){e.then((function(){t[a]?n(c(void 0,!0)):t[u](n,r)}),r)}}(r,this));else{var i=this[l].read();if(null!==i)return Promise.resolve(c(i,!1));n=new Promise(this[u])}return this[s]=n,n}},Symbol.asyncIterator,(function(){return this})),t(e,"return",(function(){var e=this;return new Promise((function(t,n){e[l].destroy(null,(function(e){e?n(e):t(c(void 0,!0))}))}))})),e),h);return wo=function(e){var d,h=Object.create(p,(t(d={},l,{value:e,writable:!0}),t(d,r,{value:null,writable:!0}),t(d,i,{value:null,writable:!0}),t(d,o,{value:null,writable:!0}),t(d,a,{value:e._readableState.endEmitted,writable:!0}),t(d,u,{value:function(e,t){var n=h[l].read();n?(h[s]=null,h[r]=null,h[i]=null,e(c(n,!1))):(h[r]=e,h[i]=t)},writable:!0}),d));return h[s]=null,n(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=h[i];return null!==t&&(h[s]=null,h[r]=null,h[i]=null,t(e)),void(h[o]=e)}var n=h[r];null!==n&&(h[s]=null,h[r]=null,h[i]=null,n(c(void 0,!0))),h[a]=!0})),e.on("readable",f.bind(null,h)),h},wo}()),u(this)}),Object.defineProperty(A.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(A.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(A.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),A._fromList=I,Object.defineProperty(A.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(A.from=function(e,t){return void 0===l&&(l=Eo?_o:(Eo=1,_o=function(){throw new Error("Readable.from is not available in the browser")})),l(A,e,t)}),So}var xo=Do,Ro=Ji.codes,Oo=Ro.ERR_METHOD_NOT_IMPLEMENTED,To=Ro.ERR_MULTIPLE_CALLBACK,Po=Ro.ERR_TRANSFORM_ALREADY_TRANSFORMING,Lo=Ro.ERR_TRANSFORM_WITH_LENGTH_0,Io=po();function No(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(null===r)return this.emit("error",new To);n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function Do(e){if(!(this instanceof Do))return new Do(e);Io.call(this,e),this._transformState={afterTransform:No.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",Bo)}function Bo(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?jo(this,null,null):this._flush((function(t,n){jo(e,t,n)}))}function jo(e,t,n){if(t)return e.emit("error",t);if(null!=n&&e.push(n),e._writableState.length)throw new Lo;if(e._transformState.transforming)throw new Po;return e.push(null)}Jr(Do,Io),Do.prototype.push=function(e,t){return this._transformState.needTransform=!1,Io.prototype.push.call(this,e,t)},Do.prototype._transform=function(e,t,n){n(new Oo("_transform()"))},Do.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},Do.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))},Do.prototype._destroy=function(e,t){Io.prototype._destroy.call(this,e,(function(e){t(e)}))};var Uo,zo=qo,Fo=xo;function qo(e){if(!(this instanceof qo))return new qo(e);Fo.call(this,e)}Jr(qo,Fo),qo.prototype._transform=function(e,t,n){n(null,e)};var Wo=Ji.codes,Vo=Wo.ERR_MISSING_ARGS,Ko=Wo.ERR_STREAM_DESTROYED;function Ho(e){if(e)throw e}function $o(e){e()}function Yo(e,t){return e.pipe(t)}var Go,Qo=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r,i=function(e){return e.length?"function"!=typeof e[e.length-1]?Ho:e.pop():Ho}(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new Vo("streams");var o=t.map((function(e,n){var a=n<t.length-1;return function(e,t,n,r){r=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(r);var i=!1;e.on("close",(function(){i=!0})),void 0===Uo&&(Uo=Mo),Uo(e,{readable:t,writable:n},(function(e){if(e)return r(e);i=!0,r()}));var o=!1;return function(t){if(!i&&!o)return o=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void r(t||new Ko("pipe"))}}(e,a,n>0,(function(e){r||(r=e),e&&o.forEach($o),a||(o.forEach($o),i(r))}))}));return t.reduce(Yo)};Go=ei.exports,(Go=ei.exports=Co()).Stream=Go,Go.Readable=Go,Go.Writable=ho(),Go.Duplex=po(),Go.Transform=xo,Go.PassThrough=zo,Go.finished=Mo,Go.pipeline=Qo;var Zo=ei.exports,Xo=$r.Buffer,Jo=Zo.Transform;function ea(e){Jo.call(this),this._block=Xo.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}Jr(ea,Jo),ea.prototype._transform=function(e,t,n){var r=null;try{this.update(e,t)}catch(e){r=e}n(r)},ea.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)},ea.prototype.update=function(e,t){if(function(e,t){if(!Xo.isBuffer(e)&&"string"!=typeof e)throw new TypeError("Data must be a string or a buffer")}(e),this._finalized)throw new Error("Digest already called");Xo.isBuffer(e)||(e=Xo.from(e,t));for(var n=this._block,r=0;this._blockOffset+e.length-r>=this._blockSize;){for(var i=this._blockOffset;i<this._blockSize;)n[i++]=e[r++];this._update(),this._blockOffset=0}for(;r<e.length;)n[this._blockOffset++]=e[r++];for(var o=0,a=8*e.length;a>0;++o)this._length[o]+=a,(a=this._length[o]/4294967296|0)>0&&(this._length[o]-=4294967296*a);return this},ea.prototype._update=function(){throw new Error("_update is not implemented")},ea.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();void 0!==e&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var n=0;n<4;++n)this._length[n]=0;return t},ea.prototype._digest=function(){throw new Error("_digest is not implemented")};var ta=ea,na=Jr,ra=ta,ia=$r.Buffer,oa=new Array(16);function aa(){ra.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function sa(e,t){return e<<t|e>>>32-t}function ua(e,t,n,r,i,o,a){return sa(e+(t&n|~t&r)+i+o|0,a)+t|0}function la(e,t,n,r,i,o,a){return sa(e+(t&r|n&~r)+i+o|0,a)+t|0}function ca(e,t,n,r,i,o,a){return sa(e+(t^n^r)+i+o|0,a)+t|0}function da(e,t,n,r,i,o,a){return sa(e+(n^(t|~r))+i+o|0,a)+t|0}na(aa,ra),aa.prototype._update=function(){for(var e=oa,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var n=this._a,r=this._b,i=this._c,o=this._d;n=ua(n,r,i,o,e[0],3614090360,7),o=ua(o,n,r,i,e[1],3905402710,12),i=ua(i,o,n,r,e[2],606105819,17),r=ua(r,i,o,n,e[3],3250441966,22),n=ua(n,r,i,o,e[4],4118548399,7),o=ua(o,n,r,i,e[5],1200080426,12),i=ua(i,o,n,r,e[6],2821735955,17),r=ua(r,i,o,n,e[7],4249261313,22),n=ua(n,r,i,o,e[8],1770035416,7),o=ua(o,n,r,i,e[9],2336552879,12),i=ua(i,o,n,r,e[10],4294925233,17),r=ua(r,i,o,n,e[11],2304563134,22),n=ua(n,r,i,o,e[12],1804603682,7),o=ua(o,n,r,i,e[13],4254626195,12),i=ua(i,o,n,r,e[14],2792965006,17),n=la(n,r=ua(r,i,o,n,e[15],1236535329,22),i,o,e[1],4129170786,5),o=la(o,n,r,i,e[6],3225465664,9),i=la(i,o,n,r,e[11],643717713,14),r=la(r,i,o,n,e[0],3921069994,20),n=la(n,r,i,o,e[5],3593408605,5),o=la(o,n,r,i,e[10],38016083,9),i=la(i,o,n,r,e[15],3634488961,14),r=la(r,i,o,n,e[4],3889429448,20),n=la(n,r,i,o,e[9],568446438,5),o=la(o,n,r,i,e[14],3275163606,9),i=la(i,o,n,r,e[3],4107603335,14),r=la(r,i,o,n,e[8],1163531501,20),n=la(n,r,i,o,e[13],2850285829,5),o=la(o,n,r,i,e[2],4243563512,9),i=la(i,o,n,r,e[7],1735328473,14),n=ca(n,r=la(r,i,o,n,e[12],2368359562,20),i,o,e[5],4294588738,4),o=ca(o,n,r,i,e[8],2272392833,11),i=ca(i,o,n,r,e[11],1839030562,16),r=ca(r,i,o,n,e[14],4259657740,23),n=ca(n,r,i,o,e[1],2763975236,4),o=ca(o,n,r,i,e[4],1272893353,11),i=ca(i,o,n,r,e[7],4139469664,16),r=ca(r,i,o,n,e[10],3200236656,23),n=ca(n,r,i,o,e[13],681279174,4),o=ca(o,n,r,i,e[0],3936430074,11),i=ca(i,o,n,r,e[3],3572445317,16),r=ca(r,i,o,n,e[6],76029189,23),n=ca(n,r,i,o,e[9],3654602809,4),o=ca(o,n,r,i,e[12],3873151461,11),i=ca(i,o,n,r,e[15],530742520,16),n=da(n,r=ca(r,i,o,n,e[2],3299628645,23),i,o,e[0],4096336452,6),o=da(o,n,r,i,e[7],1126891415,10),i=da(i,o,n,r,e[14],2878612391,15),r=da(r,i,o,n,e[5],4237533241,21),n=da(n,r,i,o,e[12],1700485571,6),o=da(o,n,r,i,e[3],2399980690,10),i=da(i,o,n,r,e[10],4293915773,15),r=da(r,i,o,n,e[1],2240044497,21),n=da(n,r,i,o,e[8],1873313359,6),o=da(o,n,r,i,e[15],4264355552,10),i=da(i,o,n,r,e[6],2734768916,15),r=da(r,i,o,n,e[13],1309151649,21),n=da(n,r,i,o,e[4],4149444226,6),o=da(o,n,r,i,e[11],3174756917,10),i=da(i,o,n,r,e[2],718787259,15),r=da(r,i,o,n,e[9],3951481745,21),this._a=this._a+n|0,this._b=this._b+r|0,this._c=this._c+i|0,this._d=this._d+o|0},aa.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=ia.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e};var fa=aa,ha=yr.Buffer,pa=Jr,ma=ta,ga=new Array(16),va=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],ya=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],ba=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],wa=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],Aa=[0,1518500249,1859775393,2400959708,2840853838],_a=[1352829926,1548603684,1836072691,2053994217,0];function Ea(){ma.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function Sa(e,t){return e<<t|e>>>32-t}function ka(e,t,n,r,i,o,a,s){return Sa(e+(t^n^r)+o+a|0,s)+i|0}function Ma(e,t,n,r,i,o,a,s){return Sa(e+(t&n|~t&r)+o+a|0,s)+i|0}function Ca(e,t,n,r,i,o,a,s){return Sa(e+((t|~n)^r)+o+a|0,s)+i|0}function xa(e,t,n,r,i,o,a,s){return Sa(e+(t&r|n&~r)+o+a|0,s)+i|0}function Ra(e,t,n,r,i,o,a,s){return Sa(e+(t^(n|~r))+o+a|0,s)+i|0}pa(Ea,ma),Ea.prototype._update=function(){for(var e=ga,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);for(var n=0|this._a,r=0|this._b,i=0|this._c,o=0|this._d,a=0|this._e,s=0|this._a,u=0|this._b,l=0|this._c,c=0|this._d,d=0|this._e,f=0;f<80;f+=1){var h,p;f<16?(h=ka(n,r,i,o,a,e[va[f]],Aa[0],ba[f]),p=Ra(s,u,l,c,d,e[ya[f]],_a[0],wa[f])):f<32?(h=Ma(n,r,i,o,a,e[va[f]],Aa[1],ba[f]),p=xa(s,u,l,c,d,e[ya[f]],_a[1],wa[f])):f<48?(h=Ca(n,r,i,o,a,e[va[f]],Aa[2],ba[f]),p=Ca(s,u,l,c,d,e[ya[f]],_a[2],wa[f])):f<64?(h=xa(n,r,i,o,a,e[va[f]],Aa[3],ba[f]),p=Ma(s,u,l,c,d,e[ya[f]],_a[3],wa[f])):(h=Ra(n,r,i,o,a,e[va[f]],Aa[4],ba[f]),p=ka(s,u,l,c,d,e[ya[f]],_a[4],wa[f])),n=a,a=o,o=Sa(i,10),i=r,r=h,s=d,d=c,c=Sa(l,10),l=u,u=p}var m=this._b+i+c|0;this._b=this._c+o+d|0,this._c=this._d+a+s|0,this._d=this._e+n+u|0,this._e=this._a+r+l|0,this._a=m},Ea.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=ha.alloc?ha.alloc(20):new ha(20);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e.writeInt32LE(this._e,16),e};var Oa=Ea,Ta={exports:{}},Pa=$r.Buffer;function La(e,t){this._block=Pa.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}La.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=Pa.from(e,t));for(var n=this._block,r=this._blockSize,i=e.length,o=this._len,a=0;a<i;){for(var s=o%r,u=Math.min(i-a,r-s),l=0;l<u;l++)n[s+l]=e[a+l];a+=u,(o+=u)%r==0&&this._update(n)}return this._len+=i,this},La.prototype.digest=function(e){var t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=this._finalSize&&(this._update(this._block),this._block.fill(0));var n=8*this._len;if(n<=4294967295)this._block.writeUInt32BE(n,this._blockSize-4);else{var r=(4294967295&n)>>>0,i=(n-r)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(r,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},La.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var Ia=La,Na=Jr,Da=Ia,Ba=$r.Buffer,ja=[1518500249,1859775393,-1894007588,-899497514],Ua=new Array(80);function za(){this.init(),this._w=Ua,Da.call(this,64,56)}function Fa(e){return e<<30|e>>>2}function qa(e,t,n,r){return 0===e?t&n|~t&r:2===e?t&n|t&r|n&r:t^n^r}Na(za,Da),za.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},za.prototype._update=function(e){for(var t,n=this._w,r=0|this._a,i=0|this._b,o=0|this._c,a=0|this._d,s=0|this._e,u=0;u<16;++u)n[u]=e.readInt32BE(4*u);for(;u<80;++u)n[u]=n[u-3]^n[u-8]^n[u-14]^n[u-16];for(var l=0;l<80;++l){var c=~~(l/20),d=0|((t=r)<<5|t>>>27)+qa(c,i,o,a)+s+n[l]+ja[c];s=a,a=o,o=Fa(i),i=r,r=d}this._a=r+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0},za.prototype._hash=function(){var e=Ba.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e};var Wa=za,Va=Jr,Ka=Ia,Ha=$r.Buffer,$a=[1518500249,1859775393,-1894007588,-899497514],Ya=new Array(80);function Ga(){this.init(),this._w=Ya,Ka.call(this,64,56)}function Qa(e){return e<<5|e>>>27}function Za(e){return e<<30|e>>>2}function Xa(e,t,n,r){return 0===e?t&n|~t&r:2===e?t&n|t&r|n&r:t^n^r}Va(Ga,Ka),Ga.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},Ga.prototype._update=function(e){for(var t,n=this._w,r=0|this._a,i=0|this._b,o=0|this._c,a=0|this._d,s=0|this._e,u=0;u<16;++u)n[u]=e.readInt32BE(4*u);for(;u<80;++u)n[u]=(t=n[u-3]^n[u-8]^n[u-14]^n[u-16])<<1|t>>>31;for(var l=0;l<80;++l){var c=~~(l/20),d=Qa(r)+Xa(c,i,o,a)+s+n[l]+$a[c]|0;s=a,a=o,o=Za(i),i=r,r=d}this._a=r+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0},Ga.prototype._hash=function(){var e=Ha.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e};var Ja=Ga,es=Jr,ts=Ia,ns=$r.Buffer,rs=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],is=new Array(64);function os(){this.init(),this._w=is,ts.call(this,64,56)}function as(e,t,n){return n^e&(t^n)}function ss(e,t,n){return e&t|n&(e|t)}function us(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function ls(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function cs(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}es(os,ts),os.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},os.prototype._update=function(e){for(var t,n=this._w,r=0|this._a,i=0|this._b,o=0|this._c,a=0|this._d,s=0|this._e,u=0|this._f,l=0|this._g,c=0|this._h,d=0;d<16;++d)n[d]=e.readInt32BE(4*d);for(;d<64;++d)n[d]=0|(((t=n[d-2])>>>17|t<<15)^(t>>>19|t<<13)^t>>>10)+n[d-7]+cs(n[d-15])+n[d-16];for(var f=0;f<64;++f){var h=c+ls(s)+as(s,u,l)+rs[f]+n[f]|0,p=us(r)+ss(r,i,o)|0;c=l,l=u,u=s,s=a+h|0,a=o,o=i,i=r,r=h+p|0}this._a=r+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0,this._f=u+this._f|0,this._g=l+this._g|0,this._h=c+this._h|0},os.prototype._hash=function(){var e=ns.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e};var ds=os,fs=Jr,hs=ds,ps=Ia,ms=$r.Buffer,gs=new Array(64);function vs(){this.init(),this._w=gs,ps.call(this,64,56)}fs(vs,hs),vs.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},vs.prototype._hash=function(){var e=ms.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e};var ys=vs,bs=Jr,ws=Ia,As=$r.Buffer,_s=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],Es=new Array(160);function Ss(){this.init(),this._w=Es,ws.call(this,128,112)}function ks(e,t,n){return n^e&(t^n)}function Ms(e,t,n){return e&t|n&(e|t)}function Cs(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function xs(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function Rs(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function Os(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function Ts(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function Ps(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function Ls(e,t){return e>>>0<t>>>0?1:0}bs(Ss,ws),Ss.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},Ss.prototype._update=function(e){for(var t=this._w,n=0|this._ah,r=0|this._bh,i=0|this._ch,o=0|this._dh,a=0|this._eh,s=0|this._fh,u=0|this._gh,l=0|this._hh,c=0|this._al,d=0|this._bl,f=0|this._cl,h=0|this._dl,p=0|this._el,m=0|this._fl,g=0|this._gl,v=0|this._hl,y=0;y<32;y+=2)t[y]=e.readInt32BE(4*y),t[y+1]=e.readInt32BE(4*y+4);for(;y<160;y+=2){var b=t[y-30],w=t[y-30+1],A=Rs(b,w),_=Os(w,b),E=Ts(b=t[y-4],w=t[y-4+1]),S=Ps(w,b),k=t[y-14],M=t[y-14+1],C=t[y-32],x=t[y-32+1],R=_+M|0,O=A+k+Ls(R,_)|0;O=(O=O+E+Ls(R=R+S|0,S)|0)+C+Ls(R=R+x|0,x)|0,t[y]=O,t[y+1]=R}for(var T=0;T<160;T+=2){O=t[T],R=t[T+1];var P=Ms(n,r,i),L=Ms(c,d,f),I=Cs(n,c),N=Cs(c,n),D=xs(a,p),B=xs(p,a),j=_s[T],U=_s[T+1],z=ks(a,s,u),F=ks(p,m,g),q=v+B|0,W=l+D+Ls(q,v)|0;W=(W=(W=W+z+Ls(q=q+F|0,F)|0)+j+Ls(q=q+U|0,U)|0)+O+Ls(q=q+R|0,R)|0;var V=N+L|0,K=I+P+Ls(V,N)|0;l=u,v=g,u=s,g=m,s=a,m=p,a=o+W+Ls(p=h+q|0,h)|0,o=i,h=f,i=r,f=d,r=n,d=c,n=W+K+Ls(c=q+V|0,q)|0}this._al=this._al+c|0,this._bl=this._bl+d|0,this._cl=this._cl+f|0,this._dl=this._dl+h|0,this._el=this._el+p|0,this._fl=this._fl+m|0,this._gl=this._gl+g|0,this._hl=this._hl+v|0,this._ah=this._ah+n+Ls(this._al,c)|0,this._bh=this._bh+r+Ls(this._bl,d)|0,this._ch=this._ch+i+Ls(this._cl,f)|0,this._dh=this._dh+o+Ls(this._dl,h)|0,this._eh=this._eh+a+Ls(this._el,p)|0,this._fh=this._fh+s+Ls(this._fl,m)|0,this._gh=this._gh+u+Ls(this._gl,g)|0,this._hh=this._hh+l+Ls(this._hl,v)|0},Ss.prototype._hash=function(){var e=As.allocUnsafe(64);function t(t,n,r){e.writeInt32BE(t,r),e.writeInt32BE(n,r+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e};var Is=Ss,Ns=Jr,Ds=Is,Bs=Ia,js=$r.Buffer,Us=new Array(160);function zs(){this.init(),this._w=Us,Bs.call(this,128,112)}Ns(zs,Ds),zs.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},zs.prototype._hash=function(){var e=js.allocUnsafe(48);function t(t,n,r){e.writeInt32BE(t,r),e.writeInt32BE(n,r+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e};var Fs=zs,qs=Ta.exports=function(e){e=e.toLowerCase();var t=qs[e];if(!t)throw new Error(e+" is not supported (we accept pull requests)");return new t};qs.sha=Wa,qs.sha1=Ja,qs.sha224=ys,qs.sha256=ds,qs.sha384=Fs,qs.sha512=Is;var Ws=Ta.exports;function Vs(){this.head=null,this.tail=null,this.length=0}Vs.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},Vs.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},Vs.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},Vs.prototype.clear=function(){this.head=this.tail=null,this.length=0},Vs.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},Vs.prototype.concat=function(e){if(0===this.length)return xn.alloc(0);if(1===this.length)return this.head.data;for(var t=xn.allocUnsafe(e>>>0),n=this.head,r=0;n;)n.data.copy(t,r),r+=n.data.length,n=n.next;return t};var Ks=xn.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function Hs(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),function(e){if(e&&!Ks(e))throw new Error("Unknown encoding: "+e)}(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=Ys;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=Gs;break;default:return void(this.write=$s)}this.charBuffer=new xn(6),this.charReceived=0,this.charLength=0}function $s(e){return e.toString(this.encoding)}function Ys(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function Gs(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}Hs.prototype.write=function(e){for(var t="";this.charLength;){var n=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived<this.charLength)return"";if(e=e.slice(n,e.length),!((r=(t=this.charBuffer.slice(0,this.charLength).toString(this.encoding)).charCodeAt(t.length-1))>=55296&&r<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var r,i=e.length;if(this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,i),i-=this.charReceived),i=(t+=e.toString(this.encoding,0,i)).length-1,(r=t.charCodeAt(i))>=55296&&r<=56319){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),e.copy(this.charBuffer,0,0,o),t.substring(0,i)}return t},Hs.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var n=e[e.length-t];if(1==t&&n>>5==6){this.charLength=2;break}if(t<=2&&n>>4==14){this.charLength=3;break}if(t<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=t},Hs.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;t+=r.slice(0,n).toString(i)}return t};var Qs=Object.freeze({__proto__:null,StringDecoder:Hs});Js.ReadableState=Xs;var Zs=gi("stream");function Xs(e,t){e=e||{},this.objectMode=!!e.objectMode,t instanceof Cu&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var n=e.highWaterMark,r=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:r,this.highWaterMark=~~this.highWaterMark,this.buffer=new Vs,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(this.decoder=new Hs(e.encoding),this.encoding=e.encoding)}function Js(e){if(!(this instanceof Js))return new Js(e);this._readableState=new Xs(e,this),this.readable=!0,e&&"function"==typeof e.read&&(this._read=e.read),ni.call(this)}function eu(e,t,n,r,i){var o=function(e,t){var n=null;return dr(t)||"string"==typeof t||null==t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}(t,n);if(o)e.emit("error",o);else if(null===n)t.reading=!1,function(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,ru(e)}}(e,t);else if(t.objectMode||n&&n.length>0)if(t.ended&&!i){var a=new Error("stream.push() after EOF");e.emit("error",a)}else if(t.endEmitted&&i){var s=new Error("stream.unshift() after end event");e.emit("error",s)}else{var u;!t.decoder||i||r||(n=t.decoder.write(n),u=!t.objectMode&&0===n.length),i||(t.reading=!1),u||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&ru(e))),function(e,t){t.readingMore||(t.readingMore=!0,Tr(ou,e,t))}(e,t)}else i||(t.reading=!1);return function(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}(t)}ci(Js,ni),Js.prototype.push=function(e,t){var n=this._readableState;return n.objectMode||"string"!=typeof e||(t=t||n.defaultEncoding)!==n.encoding&&(e=xn.from(e,t),t=""),eu(this,n,e,t,!1)},Js.prototype.unshift=function(e){return eu(this,this._readableState,e,"",!0)},Js.prototype.isPaused=function(){return!1===this._readableState.flowing},Js.prototype.setEncoding=function(e){return this._readableState.decoder=new Hs(e),this._readableState.encoding=e,this};var tu=8388608;function nu(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>=tu?e=tu:(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 ru(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(Zs("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?Tr(iu,e):iu(e))}function iu(e){Zs("emit readable"),e.emit("readable"),uu(e)}function ou(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(Zs("maybeReadMore read 0"),e.read(0),n!==t.length);)n=t.length;t.readingMore=!1}function au(e){Zs("readable nexttick read 0"),e.read(0)}function su(e,t){t.reading||(Zs("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),uu(e),t.flowing&&!t.reading&&e.read(0)}function uu(e){var t=e._readableState;for(Zs("flow",t.flowing);t.flowing&&null!==e.read(););}function lu(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=function(e,t,n){var r;return e<t.head.data.length?(r=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):r=e===t.head.data.length?t.shift():n?function(e,t){var n=t.head,r=1,i=n.data;for(e-=i.length;n=n.next;){var o=n.data,a=e>o.length?o.length:e;if(a===o.length?i+=o:i+=o.slice(0,e),0==(e-=a)){a===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(a));break}++r}return t.length-=r,i}(e,t):function(e,t){var n=xn.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,a=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,a),0==(e-=a)){a===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(a));break}++i}return t.length-=i,n}(e,t),r}(e,t.buffer,t.decoder),n);var n}function cu(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,Tr(du,t,e))}function du(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function fu(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}function hu(){}function pu(e,t,n){this.chunk=e,this.encoding=t,this.callback=n,this.next=null}function mu(e,t){Object.defineProperty(this,"buffer",{get:hi((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")}),e=e||{},this.objectMode=!!e.objectMode,t instanceof Cu&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var n=e.highWaterMark,r=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:r,this.highWaterMark=~~this.highWaterMark,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var i=!1===e.decodeStrings;this.decodeStrings=!i,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,i=n.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,i){--t.pendingcb,n?Tr(i,r):i(r),e._writableState.errorEmitted=!0,e.emit("error",r)}(e,n,r,t,i);else{var o=wu(n);o||n.corked||n.bufferProcessing||!n.bufferedRequest||bu(e,n),r?Tr(yu,e,n,o,i):yu(e,n,o,i)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new Eu(this)}function gu(e){if(!(this instanceof gu||this instanceof Cu))return new gu(e);this._writableState=new mu(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev)),ni.call(this)}function vu(e,t,n,r,i,o,a){t.writelen=r,t.writecb=a,t.writing=!0,t.sync=!0,n?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function yu(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),_u(e,t)}function bu(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,i=new Array(r),o=t.corkedRequestsFree;o.entry=n;for(var a=0;n;)i[a]=n,n=n.next,a+=1;vu(e,t,!0,t.length,i,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new Eu(t)}else{for(;n;){var s=n.chunk,u=n.encoding,l=n.callback;if(vu(e,t,!1,t.objectMode?1:s.length,s,u,l),n=n.next,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequestCount=0,t.bufferedRequest=n,t.bufferProcessing=!1}function wu(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function Au(e,t){t.prefinished||(t.prefinished=!0,e.emit("prefinish"))}function _u(e,t){var n=wu(t);return n&&(0===t.pendingcb?(Au(e,t),t.finished=!0,e.emit("finish")):Au(e,t)),n}function Eu(e){var t=this;this.next=null,this.entry=null,this.finish=function(n){var r=t.entry;for(t.entry=null;r;){var i=r.callback;e.pendingcb--,i(n),r=r.next}e.corkedRequestsFree?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}}Js.prototype.read=function(e){Zs("read",e),e=parseInt(e,10);var t=this._readableState,n=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return Zs("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?cu(this):ru(this),null;if(0===(e=nu(e,t))&&t.ended)return 0===t.length&&cu(this),null;var r,i=t.needReadable;return Zs("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&Zs("length less than watermark",i=!0),t.ended||t.reading?Zs("reading or ended",i=!1):i&&(Zs("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=nu(n,t))),null===(r=e>0?lu(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&cu(this)),null!==r&&this.emit("data",r),r},Js.prototype._read=function(e){this.emit("error",new Error("not implemented"))},Js.prototype.pipe=function(e,t){var n=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=e;break;case 1:r.pipes=[r.pipes,e];break;default:r.pipes.push(e)}r.pipesCount+=1,Zs("pipe count=%d opts=%j",r.pipesCount,t);var i=t&&!1===t.end?l:a;function o(e){Zs("onunpipe"),e===n&&l()}function a(){Zs("onend"),e.end()}r.endEmitted?Tr(i):n.once("end",i),e.on("unpipe",o);var s=function(e){return function(){var t=e._readableState;Zs("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&e.listeners("data").length&&(t.flowing=!0,uu(e))}}(n);e.on("drain",s);var u=!1;function l(){Zs("cleanup"),e.removeListener("close",h),e.removeListener("finish",p),e.removeListener("drain",s),e.removeListener("error",f),e.removeListener("unpipe",o),n.removeListener("end",a),n.removeListener("end",l),n.removeListener("data",d),u=!0,!r.awaitDrain||e._writableState&&!e._writableState.needDrain||s()}var c=!1;function d(t){Zs("ondata"),c=!1,!1!==e.write(t)||c||((1===r.pipesCount&&r.pipes===e||r.pipesCount>1&&-1!==fu(r.pipes,e))&&!u&&(Zs("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,c=!0),n.pause())}function f(t){Zs("onerror",t),m(),e.removeListener("error",f),0===e.listeners("error").length&&e.emit("error",t)}function h(){e.removeListener("finish",p),m()}function p(){Zs("onfinish"),e.removeListener("close",h),m()}function m(){Zs("unpipe"),n.unpipe(e)}return n.on("data",d),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",f),e.once("close",h),e.once("finish",p),e.emit("pipe",n),r.flowing||(Zs("pipe resume"),n.resume()),e},Js.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this)),this;if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i<r;i++)n[i].emit("unpipe",this);return this}var o=fu(t.pipes,e);return-1===o||(t.pipes.splice(o,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this)),this},Js.prototype.on=function(e,t){var n=ni.prototype.on.call(this,e,t);if("data"===e)!1!==this._readableState.flowing&&this.resume();else if("readable"===e){var r=this._readableState;r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.emittedReadable=!1,r.reading?r.length&&ru(this):Tr(au,this))}return n},Js.prototype.addListener=Js.prototype.on,Js.prototype.resume=function(){var e=this._readableState;return e.flowing||(Zs("resume"),e.flowing=!0,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,Tr(su,e,t))}(this,e)),this},Js.prototype.pause=function(){return Zs("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(Zs("pause"),this._readableState.flowing=!1,this.emit("pause")),this},Js.prototype.wrap=function(e){var t=this._readableState,n=!1,r=this;for(var i in e.on("end",(function(){if(Zs("wrapped end"),t.decoder&&!t.ended){var e=t.decoder.end();e&&e.length&&r.push(e)}r.push(null)})),e.on("data",(function(i){Zs("wrapped data"),t.decoder&&(i=t.decoder.write(i)),t.objectMode&&null==i||(t.objectMode||i&&i.length)&&(r.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));return function(e,t){for(var n=0,r=e.length;n<r;n++)t(e[n])}(["error","close","destroy","pause","resume"],(function(t){e.on(t,r.emit.bind(r,t))})),r._read=function(t){Zs("wrapped _read",t),n&&(n=!1,e.resume())},r},Js._fromList=lu,gu.WritableState=mu,ci(gu,ni),mu.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},gu.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},gu.prototype.write=function(e,t,n){var r=this._writableState,i=!1;return"function"==typeof t&&(n=t,t=null),xn.isBuffer(e)?t="buffer":t||(t=r.defaultEncoding),"function"!=typeof n&&(n=hu),r.ended?function(e,t){var n=new Error("write after end");e.emit("error",n),Tr(t,n)}(this,n):function(e,t,n,r){var i=!0,o=!1;return null===n?o=new TypeError("May not write null values to stream"):xn.isBuffer(n)||"string"==typeof n||void 0===n||t.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(e.emit("error",o),Tr(r,o),i=!1),i}(this,r,e,n)&&(r.pendingcb++,i=function(e,t,n,r,i){n=function(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=xn.from(t,n)),t}(t,n,r),xn.isBuffer(n)&&(r="buffer");var o=t.objectMode?1:n.length;t.length+=o;var a=t.length<t.highWaterMark;if(a||(t.needDrain=!0),t.writing||t.corked){var s=t.lastBufferedRequest;t.lastBufferedRequest=new pu(n,r,i),s?s.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else vu(e,t,!1,o,n,r,i);return a}(this,r,e,t,n)),i},gu.prototype.cork=function(){this._writableState.corked++},gu.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||bu(this,e))},gu.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 TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},gu.prototype._write=function(e,t,n){n(new Error("not implemented"))},gu.prototype._writev=null,gu.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(e,t,n){t.ending=!0,_u(e,t),n&&(t.finished?Tr(n):e.once("finish",n)),t.ended=!0,e.writable=!1}(this,r,n)},ci(Cu,Js);for(var Su=Object.keys(gu.prototype),ku=0;ku<Su.length;ku++){var Mu=Su[ku];Cu.prototype[Mu]||(Cu.prototype[Mu]=gu.prototype[Mu])}function Cu(e){if(!(this instanceof Cu))return new Cu(e);Js.call(this,e),gu.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",xu)}function xu(){this.allowHalfOpen||this._writableState.ended||Tr(Ru,this)}function Ru(e){e.end()}function Ou(e){this.afterTransform=function(t,n){return function(e,t,n){var r=e._transformState;r.transforming=!1;var i=r.writecb;if(!i)return e.emit("error",new Error("no writecb in Transform class"));r.writechunk=null,r.writecb=null,null!=n&&e.push(n),i(t);var o=e._readableState;o.reading=!1,(o.needReadable||o.length<o.highWaterMark)&&e._read(o.highWaterMark)}(e,t,n)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null,this.writeencoding=null}function Tu(e){if(!(this instanceof Tu))return new Tu(e);Cu.call(this,e),this._transformState=new Ou(this);var t=this;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.once("prefinish",(function(){"function"==typeof this._flush?this._flush((function(e){Pu(t,e)})):Pu(t)}))}function Pu(e,t){if(t)return e.emit("error",t);var n=e._writableState,r=e._transformState;if(n.length)throw new Error("Calling transform done when ws.length != 0");if(r.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}function Lu(e){if(!(this instanceof Lu))return new Lu(e);Tu.call(this,e)}function Iu(){ni.call(this)}ci(Tu,Cu),Tu.prototype.push=function(e,t){return this._transformState.needTransform=!1,Cu.prototype.push.call(this,e,t)},Tu.prototype._transform=function(e,t,n){throw new Error("Not implemented")},Tu.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},Tu.prototype._read=function(e){var t=this._transformState;null!==t.writechunk&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0},ci(Lu,Tu),Lu.prototype._transform=function(e,t,n){n(null,e)},ci(Iu,ni),Iu.Readable=Js,Iu.Writable=gu,Iu.Duplex=Cu,Iu.Transform=Tu,Iu.PassThrough=Lu,Iu.Stream=Iu,Iu.prototype.pipe=function(e,t){var n=this;function r(t){e.writable&&!1===e.write(t)&&n.pause&&n.pause()}function i(){n.readable&&n.resume&&n.resume()}n.on("data",r),e.on("drain",i),e._isStdio||t&&!1===t.end||(n.on("end",a),n.on("close",s));var o=!1;function a(){o||(o=!0,e.end())}function s(){o||(o=!0,"function"==typeof e.destroy&&e.destroy())}function u(e){if(l(),0===ni.listenerCount(this,"error"))throw e}function l(){n.removeListener("data",r),e.removeListener("drain",i),n.removeListener("end",a),n.removeListener("close",s),n.removeListener("error",u),e.removeListener("error",u),n.removeListener("end",l),n.removeListener("close",l),e.removeListener("close",l)}return n.on("error",u),e.on("error",u),n.on("end",l),n.on("close",l),e.on("close",l),e.emit("pipe",n),e};var Nu=pr(Object.freeze({__proto__:null,Duplex:Cu,PassThrough:Lu,Readable:Js,Stream:Iu,Transform:Tu,Writable:gu,default:Iu})),Du=pr(Qs),Bu=$r.Buffer,ju=Nu.Transform,Uu=Du.StringDecoder;function zu(e){ju.call(this),this.hashMode="string"==typeof e,this.hashMode?this[e]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}Jr(zu,ju),zu.prototype.update=function(e,t,n){"string"==typeof e&&(e=Bu.from(e,t));var r=this._update(e);return this.hashMode?this:(n&&(r=this._toString(r,n)),r)},zu.prototype.setAutoPadding=function(){},zu.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},zu.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},zu.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},zu.prototype._transform=function(e,t,n){var r;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(e){r=e}finally{n(r)}},zu.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(e){t=e}e(t)},zu.prototype._finalOrDigest=function(e){var t=this.__final()||Bu.alloc(0);return e&&(t=this._toString(t,e,!0)),t},zu.prototype._toString=function(e,t,n){if(this._decoder||(this._decoder=new Uu(t),this._encoding=t),this._encoding!==t)throw new Error("can't switch encodings");var r=this._decoder.write(e);return n&&(r+=this._decoder.end()),r};var Fu=zu,qu=fa,Wu=Oa,Vu=Ws,Ku=Fu;function Hu(e){Ku.call(this,"digest"),this._hash=e}Jr(Hu,Ku),Hu.prototype._update=function(e){this._hash.update(e)},Hu.prototype._final=function(){return this._hash.digest()};var $u=function(e){return"md5"===(e=e.toLowerCase())?new qu:"rmd160"===e||"ripemd160"===e?new Wu:new Hu(Vu(e))},Yu=Jr,Gu=$r.Buffer,Qu=Fu,Zu=Gu.alloc(128),Xu=64;function Ju(e,t){Qu.call(this,"digest"),"string"==typeof t&&(t=Gu.from(t)),this._alg=e,this._key=t,t.length>Xu?t=e(t):t.length<Xu&&(t=Gu.concat([t,Zu],Xu));for(var n=this._ipad=Gu.allocUnsafe(Xu),r=this._opad=Gu.allocUnsafe(Xu),i=0;i<Xu;i++)n[i]=54^t[i],r[i]=92^t[i];this._hash=[n]}Yu(Ju,Qu),Ju.prototype._update=function(e){this._hash.push(e)},Ju.prototype._final=function(){var e=this._alg(Gu.concat(this._hash));return this._alg(Gu.concat([this._opad,e]))};var el=fa,tl=function(e){return(new el).update(e).digest()},nl=Jr,rl=Ju,il=Fu,ol=$r.Buffer,al=tl,sl=Oa,ul=Ws,ll=ol.alloc(128);function cl(e,t){il.call(this,"digest"),"string"==typeof t&&(t=ol.from(t));var n="sha512"===e||"sha384"===e?128:64;this._alg=e,this._key=t,t.length>n?t=("rmd160"===e?new sl:ul(e)).update(t).digest():t.length<n&&(t=ol.concat([t,ll],n));for(var r=this._ipad=ol.allocUnsafe(n),i=this._opad=ol.allocUnsafe(n),o=0;o<n;o++)r[o]=54^t[o],i[o]=92^t[o];this._hash="rmd160"===e?new sl:ul(e),this._hash.update(r)}nl(cl,il),cl.prototype._update=function(e){this._hash.update(e)},cl.prototype._final=function(){var e=this._hash.digest();return("rmd160"===this._alg?new sl:ul(this._alg)).update(this._opad).update(e).digest()};var dl=function(e,t){return"rmd160"===(e=e.toLowerCase())||"ripemd160"===e?new cl("rmd160",t):"md5"===e?new rl(al,t):new cl(e,t)},fl={sha224WithRSAEncryption:{sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption:{sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption:{sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption:{sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA512":{sign:"ecdsa/rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA1":{sign:"rsa",hash:"sha1",id:"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{sign:"ecdsa",hash:"sha1",id:""},sha256:{sign:"ecdsa",hash:"sha256",id:""},sha224:{sign:"ecdsa",hash:"sha224",id:""},sha384:{sign:"ecdsa",hash:"sha384",id:""},sha512:{sign:"ecdsa",hash:"sha512",id:""},"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA:{sign:"dsa",hash:"sha1",id:""},"DSA-WITH-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-WITH-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-WITH-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-WITH-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-RIPEMD160":{sign:"dsa",hash:"rmd160",id:""},ripemd160WithRSA:{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption:{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}},hl=fl,pl={},ml=Math.pow(2,30)-1,gl=function(e,t){if("number"!=typeof e)throw new TypeError("Iterations not a number");if(e<0)throw new TypeError("Bad iterations");if("number"!=typeof t)throw new TypeError("Key length not a number");if(t<0||t>ml||t!=t)throw new TypeError("Bad key length")},vl=hr.process&&hr.process.browser?"utf-8":hr.process&&hr.process.version?parseInt(Vr.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary":"utf-8",yl=$r.Buffer,bl=function(e,t,n){if(yl.isBuffer(e))return e;if("string"==typeof e)return yl.from(e,t);if(ArrayBuffer.isView(e))return yl.from(e.buffer);throw new TypeError(n+" must be a string, a Buffer, a typed array or a DataView")},wl=tl,Al=Oa,_l=Ws,El=$r.Buffer,Sl=gl,kl=vl,Ml=bl,Cl=El.alloc(128),xl={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function Rl(e,t,n){var r=function(e){return"rmd160"===e||"ripemd160"===e?function(e){return(new Al).update(e).digest()}:"md5"===e?wl:function(t){return _l(e).update(t).digest()}}(e),i="sha512"===e||"sha384"===e?128:64;t.length>i?t=r(t):t.length<i&&(t=El.concat([t,Cl],i));for(var o=El.allocUnsafe(i+xl[e]),a=El.allocUnsafe(i+xl[e]),s=0;s<i;s++)o[s]=54^t[s],a[s]=92^t[s];var u=El.allocUnsafe(i+n+4);o.copy(u,0,0,i),this.ipad1=u,this.ipad2=o,this.opad=a,this.alg=e,this.blocksize=i,this.hash=r,this.size=xl[e]}Rl.prototype.run=function(e,t){return e.copy(t,this.blocksize),this.hash(t).copy(this.opad,this.blocksize),this.hash(this.opad)};var Ol,Tl,Pl=function(e,t,n,r,i){Sl(n,r);var o=new Rl(i=i||"sha1",e=Ml(e,kl,"Password"),(t=Ml(t,kl,"Salt")).length),a=El.allocUnsafe(r),s=El.allocUnsafe(t.length+4);t.copy(s,0,0,t.length);for(var u=0,l=xl[i],c=Math.ceil(r/l),d=1;d<=c;d++){s.writeUInt32BE(d,t.length);for(var f=o.run(s,o.ipad1),h=f,p=1;p<n;p++){h=o.run(h,o.ipad2);for(var m=0;m<l;m++)f[m]^=h[m]}f.copy(a,u),u+=l}return a},Ll=$r.Buffer,Il=gl,Nl=vl,Dl=Pl,Bl=bl,jl=hr.crypto&&hr.crypto.subtle,Ul={sha:"SHA-1","sha-1":"SHA-1",sha1:"SHA-1",sha256:"SHA-256","sha-256":"SHA-256",sha384:"SHA-384","sha-384":"SHA-384","sha-512":"SHA-512",sha512:"SHA-512"},zl=[];function Fl(){return Tl||(Tl=hr.process&&hr.process.nextTick?hr.process.nextTick:hr.queueMicrotask?hr.queueMicrotask:hr.setImmediate?hr.setImmediate:hr.setTimeout)}function ql(e,t,n,r,i){return jl.importKey("raw",e,{name:"PBKDF2"},!1,["deriveBits"]).then((function(e){return jl.deriveBits({name:"PBKDF2",salt:t,iterations:n,hash:{name:i}},e,r<<3)})).then((function(e){return Ll.from(e)}))}pl.pbkdf2=function(e,t,n,r,i,o){"function"==typeof i&&(o=i,i=void 0);var a=Ul[(i=i||"sha1").toLowerCase()];if(a&&"function"==typeof hr.Promise){if(Il(n,r),e=Bl(e,Nl,"Password"),t=Bl(t,Nl,"Salt"),"function"!=typeof o)throw new Error("No callback provided to pbkdf2");!function(e,t){e.then((function(e){Fl()((function(){t(null,e)}))}),(function(e){Fl()((function(){t(e)}))}))}(function(e){if(hr.process&&!hr.process.browser)return Promise.resolve(!1);if(!jl||!jl.importKey||!jl.deriveBits)return Promise.resolve(!1);if(void 0!==zl[e])return zl[e];var t=ql(Ol=Ol||Ll.alloc(8),Ol,10,128,e).then((function(){return!0})).catch((function(){return!1}));return zl[e]=t,t}(a).then((function(o){return o?ql(e,t,n,r,a):Dl(e,t,n,r,i)})),o)}else Fl()((function(){var a;try{a=Dl(e,t,n,r,i)}catch(e){return o(e)}o(null,a)}))},pl.pbkdf2Sync=Pl;var Wl={},Vl={},Kl={readUInt32BE:function(e,t){return(e[0+t]<<24|e[1+t]<<16|e[2+t]<<8|e[3+t])>>>0},writeUInt32BE:function(e,t,n){e[0+n]=t>>>24,e[1+n]=t>>>16&255,e[2+n]=t>>>8&255,e[3+n]=255&t},ip:function(e,t,n,r){for(var i=0,o=0,a=6;a>=0;a-=2){for(var s=0;s<=24;s+=8)i<<=1,i|=t>>>s+a&1;for(s=0;s<=24;s+=8)i<<=1,i|=e>>>s+a&1}for(a=6;a>=0;a-=2){for(s=1;s<=25;s+=8)o<<=1,o|=t>>>s+a&1;for(s=1;s<=25;s+=8)o<<=1,o|=e>>>s+a&1}n[r+0]=i>>>0,n[r+1]=o>>>0},rip:function(e,t,n,r){for(var i=0,o=0,a=0;a<4;a++)for(var s=24;s>=0;s-=8)i<<=1,i|=t>>>s+a&1,i<<=1,i|=e>>>s+a&1;for(a=4;a<8;a++)for(s=24;s>=0;s-=8)o<<=1,o|=t>>>s+a&1,o<<=1,o|=e>>>s+a&1;n[r+0]=i>>>0,n[r+1]=o>>>0},pc1:function(e,t,n,r){for(var i=0,o=0,a=7;a>=5;a--){for(var s=0;s<=24;s+=8)i<<=1,i|=t>>s+a&1;for(s=0;s<=24;s+=8)i<<=1,i|=e>>s+a&1}for(s=0;s<=24;s+=8)i<<=1,i|=t>>s+a&1;for(a=1;a<=3;a++){for(s=0;s<=24;s+=8)o<<=1,o|=t>>s+a&1;for(s=0;s<=24;s+=8)o<<=1,o|=e>>s+a&1}for(s=0;s<=24;s+=8)o<<=1,o|=e>>s+a&1;n[r+0]=i>>>0,n[r+1]=o>>>0},r28shl:function(e,t){return e<<t&268435455|e>>>28-t}},Hl=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];Kl.pc2=function(e,t,n,r){for(var i=0,o=0,a=Hl.length>>>1,s=0;s<a;s++)i<<=1,i|=e>>>Hl[s]&1;for(s=a;s<Hl.length;s++)o<<=1,o|=t>>>Hl[s]&1;n[r+0]=i>>>0,n[r+1]=o>>>0},Kl.expand=function(e,t,n){var r=0,i=0;r=(1&e)<<5|e>>>27;for(var o=23;o>=15;o-=4)r<<=6,r|=e>>>o&63;for(o=11;o>=3;o-=4)i|=e>>>o&63,i<<=6;i|=(31&e)<<1|e>>>31,t[n+0]=r>>>0,t[n+1]=i>>>0};var $l=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];Kl.substitute=function(e,t){for(var n=0,r=0;r<4;r++)n<<=4,n|=$l[64*r+(e>>>18-6*r&63)];for(r=0;r<4;r++)n<<=4,n|=$l[256+64*r+(t>>>18-6*r&63)];return n>>>0};var Yl=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];Kl.permute=function(e){for(var t=0,n=0;n<Yl.length;n++)t<<=1,t|=e>>>Yl[n]&1;return t>>>0},Kl.padSplit=function(e,t,n){for(var r=e.toString(2);r.length<t;)r="0"+r;for(var i=[],o=0;o<t;o+=n)i.push(r.slice(o,o+n));return i.join(" ")};var Gl=Ql;function Ql(e,t){if(!e)throw new Error(t||"Assertion failed")}Ql.equal=function(e,t,n){if(e!=t)throw new Error(n||"Assertion failed: "+e+" != "+t)};var Zl=Gl;function Xl(e){this.options=e,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=new Array(this.blockSize),this.bufferOff=0,this.padding=!1!==e.padding}var Jl=Xl;Xl.prototype._init=function(){},Xl.prototype.update=function(e){return 0===e.length?[]:"decrypt"===this.type?this._updateDecrypt(e):this._updateEncrypt(e)},Xl.prototype._buffer=function(e,t){for(var n=Math.min(this.buffer.length-this.bufferOff,e.length-t),r=0;r<n;r++)this.buffer[this.bufferOff+r]=e[t+r];return this.bufferOff+=n,n},Xl.prototype._flushBuffer=function(e,t){return this._update(this.buffer,0,e,t),this.bufferOff=0,this.blockSize},Xl.prototype._updateEncrypt=function(e){var t=0,n=0,r=(this.bufferOff+e.length)/this.blockSize|0,i=new Array(r*this.blockSize);0!==this.bufferOff&&(t+=this._buffer(e,t),this.bufferOff===this.buffer.length&&(n+=this._flushBuffer(i,n)));for(var o=e.length-(e.length-t)%this.blockSize;t<o;t+=this.blockSize)this._update(e,t,i,n),n+=this.blockSize;for(;t<e.length;t++,this.bufferOff++)this.buffer[this.bufferOff]=e[t];return i},Xl.prototype._updateDecrypt=function(e){for(var t=0,n=0,r=Math.ceil((this.bufferOff+e.length)/this.blockSize)-1,i=new Array(r*this.blockSize);r>0;r--)t+=this._buffer(e,t),n+=this._flushBuffer(i,n);return t+=this._buffer(e,t),i},Xl.prototype.final=function(e){var t,n;return e&&(t=this.update(e)),n="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),t?t.concat(n):n},Xl.prototype._pad=function(e,t){if(0===t)return!1;for(;t<e.length;)e[t++]=0;return!0},Xl.prototype._finalEncrypt=function(){if(!this._pad(this.buffer,this.bufferOff))return[];var e=new Array(this.blockSize);return this._update(this.buffer,0,e,0),e},Xl.prototype._unpad=function(e){return e},Xl.prototype._finalDecrypt=function(){Zl.equal(this.bufferOff,this.blockSize,"Not enough data to decrypt");var e=new Array(this.blockSize);return this._flushBuffer(e,0),this._unpad(e)};var ec=Gl,tc=Kl,nc=Jl;function rc(){this.tmp=new Array(2),this.keys=null}function ic(e){nc.call(this,e);var t=new rc;this._desState=t,this.deriveKeys(t,e.key)}Jr(ic,nc);var oc=ic;ic.create=function(e){return new ic(e)};var ac=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];ic.prototype.deriveKeys=function(e,t){e.keys=new Array(32),ec.equal(t.length,this.blockSize,"Invalid key length");var n=tc.readUInt32BE(t,0),r=tc.readUInt32BE(t,4);tc.pc1(n,r,e.tmp,0),n=e.tmp[0],r=e.tmp[1];for(var i=0;i<e.keys.length;i+=2){var o=ac[i>>>1];n=tc.r28shl(n,o),r=tc.r28shl(r,o),tc.pc2(n,r,e.keys,i)}},ic.prototype._update=function(e,t,n,r){var i=this._desState,o=tc.readUInt32BE(e,t),a=tc.readUInt32BE(e,t+4);tc.ip(o,a,i.tmp,0),o=i.tmp[0],a=i.tmp[1],"encrypt"===this.type?this._encrypt(i,o,a,i.tmp,0):this._decrypt(i,o,a,i.tmp,0),o=i.tmp[0],a=i.tmp[1],tc.writeUInt32BE(n,o,r),tc.writeUInt32BE(n,a,r+4)},ic.prototype._pad=function(e,t){if(!1===this.padding)return!1;for(var n=e.length-t,r=t;r<e.length;r++)e[r]=n;return!0},ic.prototype._unpad=function(e){if(!1===this.padding)return e;for(var t=e[e.length-1],n=e.length-t;n<e.length;n++)ec.equal(e[n],t);return e.slice(0,e.length-t)},ic.prototype._encrypt=function(e,t,n,r,i){for(var o=t,a=n,s=0;s<e.keys.length;s+=2){var u=e.keys[s],l=e.keys[s+1];tc.expand(a,e.tmp,0),u^=e.tmp[0],l^=e.tmp[1];var c=tc.substitute(u,l),d=a;a=(o^tc.permute(c))>>>0,o=d}tc.rip(a,o,r,i)},ic.prototype._decrypt=function(e,t,n,r,i){for(var o=n,a=t,s=e.keys.length-2;s>=0;s-=2){var u=e.keys[s],l=e.keys[s+1];tc.expand(o,e.tmp,0),u^=e.tmp[0],l^=e.tmp[1];var c=tc.substitute(u,l),d=o;o=(a^tc.permute(c))>>>0,a=d}tc.rip(o,a,r,i)};var sc={},uc=Gl,lc=Jr,cc={};function dc(e){uc.equal(e.length,8,"Invalid IV length"),this.iv=new Array(8);for(var t=0;t<this.iv.length;t++)this.iv[t]=e[t]}sc.instantiate=function(e){function t(t){e.call(this,t),this._cbcInit()}lc(t,e);for(var n=Object.keys(cc),r=0;r<n.length;r++){var i=n[r];t.prototype[i]=cc[i]}return t.create=function(e){return new t(e)},t},cc._cbcInit=function(){var e=new dc(this.options.iv);this._cbcState=e},cc._update=function(e,t,n,r){var i=this._cbcState,o=this.constructor.super_.prototype,a=i.iv;if("encrypt"===this.type){for(var s=0;s<this.blockSize;s++)a[s]^=e[t+s];for(o._update.call(this,a,0,n,r),s=0;s<this.blockSize;s++)a[s]=n[r+s]}else{for(o._update.call(this,e,t,n,r),s=0;s<this.blockSize;s++)n[r+s]^=a[s];for(s=0;s<this.blockSize;s++)a[s]=e[t+s]}};var fc=Gl,hc=Jl,pc=oc;function mc(e,t){fc.equal(t.length,24,"Invalid key length");var n=t.slice(0,8),r=t.slice(8,16),i=t.slice(16,24);this.ciphers="encrypt"===e?[pc.create({type:"encrypt",key:n}),pc.create({type:"decrypt",key:r}),pc.create({type:"encrypt",key:i})]:[pc.create({type:"decrypt",key:i}),pc.create({type:"encrypt",key:r}),pc.create({type:"decrypt",key:n})]}function gc(e){hc.call(this,e);var t=new mc(this.type,this.options.key);this._edeState=t}Jr(gc,hc);var vc=gc;gc.create=function(e){return new gc(e)},gc.prototype._update=function(e,t,n,r){var i=this._edeState;i.ciphers[0]._update(e,t,n,r),i.ciphers[1]._update(n,r,n,r),i.ciphers[2]._update(n,r,n,r)},gc.prototype._pad=pc.prototype._pad,gc.prototype._unpad=pc.prototype._unpad,Vl.utils=Kl,Vl.Cipher=Jl,Vl.DES=oc,Vl.CBC=sc,Vl.EDE=vc;var yc=Fu,bc=Vl,wc=Jr,Ac=$r.Buffer,_c={"des-ede3-cbc":bc.CBC.instantiate(bc.EDE),"des-ede3":bc.EDE,"des-ede-cbc":bc.CBC.instantiate(bc.EDE),"des-ede":bc.EDE,"des-cbc":bc.CBC.instantiate(bc.DES),"des-ecb":bc.DES};_c.des=_c["des-cbc"],_c.des3=_c["des-ede3-cbc"];var Ec=Sc;function Sc(e){yc.call(this);var t,n=e.mode.toLowerCase(),r=_c[n];t=e.decrypt?"decrypt":"encrypt";var i=e.key;Ac.isBuffer(i)||(i=Ac.from(i)),"des-ede"!==n&&"des-ede-cbc"!==n||(i=Ac.concat([i,i.slice(0,8)]));var o=e.iv;Ac.isBuffer(o)||(o=Ac.from(o)),this._des=r.create({key:i,iv:o,type:t})}wc(Sc,yc),Sc.prototype._update=function(e){return Ac.from(this._des.update(e))},Sc.prototype._final=function(){return Ac.from(this._des.final())};var kc={},Mc={},Cc={},xc=function(e,t){for(var n=Math.min(e.length,t.length),r=new xn(n),i=0;i<n;++i)r[i]=e[i]^t[i];return r},Rc=xc;Cc.encrypt=function(e,t){var n=Rc(t,e._prev);return e._prev=e._cipher.encryptBlock(n),e._prev},Cc.decrypt=function(e,t){var n=e._prev;e._prev=t;var r=e._cipher.decryptBlock(t);return Rc(r,n)};var Oc={},Tc=$r.Buffer,Pc=xc;function Lc(e,t,n){var r=t.length,i=Pc(t,e._cache);return e._cache=e._cache.slice(r),e._prev=Tc.concat([e._prev,n?t:i]),i}Oc.encrypt=function(e,t,n){for(var r,i=Tc.allocUnsafe(0);t.length;){if(0===e._cache.length&&(e._cache=e._cipher.encryptBlock(e._prev),e._prev=Tc.allocUnsafe(0)),!(e._cache.length<=t.length)){i=Tc.concat([i,Lc(e,t,n)]);break}r=e._cache.length,i=Tc.concat([i,Lc(e,t.slice(0,r),n)]),t=t.slice(r)}return i};var Ic={},Nc=$r.Buffer;function Dc(e,t,n){var r=e._cipher.encryptBlock(e._prev)[0]^t;return e._prev=Nc.concat([e._prev.slice(1),Nc.from([n?t:r])]),r}Ic.encrypt=function(e,t,n){for(var r=t.length,i=Nc.allocUnsafe(r),o=-1;++o<r;)i[o]=Dc(e,t[o],n);return i};var Bc={},jc=$r.Buffer;function Uc(e,t,n){for(var r,i,o=-1,a=0;++o<8;)r=t&1<<7-o?128:0,a+=(128&(i=e._cipher.encryptBlock(e._prev)[0]^r))>>o%8,e._prev=zc(e._prev,n?r:i);return a}function zc(e,t){var n=e.length,r=-1,i=jc.allocUnsafe(e.length);for(e=jc.concat([e,jc.from([t])]);++r<n;)i[r]=e[r]<<1|e[r+1]>>7;return i}Bc.encrypt=function(e,t,n){for(var r=t.length,i=jc.allocUnsafe(r),o=-1;++o<r;)i[o]=Uc(e,t[o],n);return i};var Fc={},qc=xc;function Wc(e){return e._prev=e._cipher.encryptBlock(e._prev),e._prev}Fc.encrypt=function(e,t){for(;e._cache.length<t.length;)e._cache=xn.concat([e._cache,Wc(e)]);var n=e._cache.slice(0,t.length);return e._cache=e._cache.slice(t.length),qc(t,n)};var Vc={},Kc=function(e){for(var t,n=e.length;n--;){if(255!==(t=e.readUInt8(n))){t++,e.writeUInt8(t,n);break}e.writeUInt8(0,n)}},Hc=xc,$c=$r.Buffer,Yc=Kc;function Gc(e){var t=e._cipher.encryptBlockRaw(e._prev);return Yc(e._prev),t}Vc.encrypt=function(e,t){var n=Math.ceil(t.length/16),r=e._cache.length;e._cache=$c.concat([e._cache,$c.allocUnsafe(16*n)]);for(var i=0;i<n;i++){var o=Gc(e),a=r+16*i;e._cache.writeUInt32BE(o[0],a+0),e._cache.writeUInt32BE(o[1],a+4),e._cache.writeUInt32BE(o[2],a+8),e._cache.writeUInt32BE(o[3],a+12)}var s=e._cache.slice(0,t.length);return e._cache=e._cache.slice(t.length),Hc(t,s)};var Qc={"aes-128-ecb":{cipher:"AES",key:128,iv:0,mode:"ECB",type:"block"},"aes-192-ecb":{cipher:"AES",key:192,iv:0,mode:"ECB",type:"block"},"aes-256-ecb":{cipher:"AES",key:256,iv:0,mode:"ECB",type:"block"},"aes-128-cbc":{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},"aes-192-cbc":{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},"aes-256-cbc":{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},aes128:{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},aes192:{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},aes256:{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},"aes-128-cfb":{cipher:"AES",key:128,iv:16,mode:"CFB",type:"stream"},"aes-192-cfb":{cipher:"AES",key:192,iv:16,mode:"CFB",type:"stream"},"aes-256-cfb":{cipher:"AES",key:256,iv:16,mode:"CFB",type:"stream"},"aes-128-cfb8":{cipher:"AES",key:128,iv:16,mode:"CFB8",type:"stream"},"aes-192-cfb8":{cipher:"AES",key:192,iv:16,mode:"CFB8",type:"stream"},"aes-256-cfb8":{cipher:"AES",key:256,iv:16,mode:"CFB8",type:"stream"},"aes-128-cfb1":{cipher:"AES",key:128,iv:16,mode:"CFB1",type:"stream"},"aes-192-cfb1":{cipher:"AES",key:192,iv:16,mode:"CFB1",type:"stream"},"aes-256-cfb1":{cipher:"AES",key:256,iv:16,mode:"CFB1",type:"stream"},"aes-128-ofb":{cipher:"AES",key:128,iv:16,mode:"OFB",type:"stream"},"aes-192-ofb":{cipher:"AES",key:192,iv:16,mode:"OFB",type:"stream"},"aes-256-ofb":{cipher:"AES",key:256,iv:16,mode:"OFB",type:"stream"},"aes-128-ctr":{cipher:"AES",key:128,iv:16,mode:"CTR",type:"stream"},"aes-192-ctr":{cipher:"AES",key:192,iv:16,mode:"CTR",type:"stream"},"aes-256-ctr":{cipher:"AES",key:256,iv:16,mode:"CTR",type:"stream"},"aes-128-gcm":{cipher:"AES",key:128,iv:12,mode:"GCM",type:"auth"},"aes-192-gcm":{cipher:"AES",key:192,iv:12,mode:"GCM",type:"auth"},"aes-256-gcm":{cipher:"AES",key:256,iv:12,mode:"GCM",type:"auth"}},Zc={ECB:{encrypt:function(e,t){return e._cipher.encryptBlock(t)},decrypt:function(e,t){return e._cipher.decryptBlock(t)}},CBC:Cc,CFB:Oc,CFB8:Ic,CFB1:Bc,OFB:Fc,CTR:Vc,GCM:Vc},Xc=Qc;for(var Jc in Xc)Xc[Jc].module=Zc[Xc[Jc].mode];var ed=Xc,td={},nd=$r.Buffer;function rd(e){nd.isBuffer(e)||(e=nd.from(e));for(var t=e.length/4|0,n=new Array(t),r=0;r<t;r++)n[r]=e.readUInt32BE(4*r);return n}function id(e){for(;0<e.length;e++)e[0]=0}function od(e,t,n,r,i){for(var o,a,s,u,l=n[0],c=n[1],d=n[2],f=n[3],h=e[0]^t[0],p=e[1]^t[1],m=e[2]^t[2],g=e[3]^t[3],v=4,y=1;y<i;y++)o=l[h>>>24]^c[p>>>16&255]^d[m>>>8&255]^f[255&g]^t[v++],a=l[p>>>24]^c[m>>>16&255]^d[g>>>8&255]^f[255&h]^t[v++],s=l[m>>>24]^c[g>>>16&255]^d[h>>>8&255]^f[255&p]^t[v++],u=l[g>>>24]^c[h>>>16&255]^d[p>>>8&255]^f[255&m]^t[v++],h=o,p=a,m=s,g=u;return o=(r[h>>>24]<<24|r[p>>>16&255]<<16|r[m>>>8&255]<<8|r[255&g])^t[v++],a=(r[p>>>24]<<24|r[m>>>16&255]<<16|r[g>>>8&255]<<8|r[255&h])^t[v++],s=(r[m>>>24]<<24|r[g>>>16&255]<<16|r[h>>>8&255]<<8|r[255&p])^t[v++],u=(r[g>>>24]<<24|r[h>>>16&255]<<16|r[p>>>8&255]<<8|r[255&m])^t[v++],[o>>>=0,a>>>=0,s>>>=0,u>>>=0]}var ad=[0,1,2,4,8,16,32,64,128,27,54],sd=function(){for(var e=new Array(256),t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;for(var n=[],r=[],i=[[],[],[],[]],o=[[],[],[],[]],a=0,s=0,u=0;u<256;++u){var l=s^s<<1^s<<2^s<<3^s<<4;l=l>>>8^255&l^99,n[a]=l,r[l]=a;var c=e[a],d=e[c],f=e[d],h=257*e[l]^16843008*l;i[0][a]=h<<24|h>>>8,i[1][a]=h<<16|h>>>16,i[2][a]=h<<8|h>>>24,i[3][a]=h,h=16843009*f^65537*d^257*c^16843008*a,o[0][l]=h<<24|h>>>8,o[1][l]=h<<16|h>>>16,o[2][l]=h<<8|h>>>24,o[3][l]=h,0===a?a=s=1:(a=c^e[e[e[f^c]]],s^=e[e[s]])}return{SBOX:n,INV_SBOX:r,SUB_MIX:i,INV_SUB_MIX:o}}();function ud(e){this._key=rd(e),this._reset()}ud.blockSize=16,ud.keySize=32,ud.prototype.blockSize=ud.blockSize,ud.prototype.keySize=ud.keySize,ud.prototype._reset=function(){for(var e=this._key,t=e.length,n=t+6,r=4*(n+1),i=[],o=0;o<t;o++)i[o]=e[o];for(o=t;o<r;o++){var a=i[o-1];o%t==0?(a=a<<8|a>>>24,a=sd.SBOX[a>>>24]<<24|sd.SBOX[a>>>16&255]<<16|sd.SBOX[a>>>8&255]<<8|sd.SBOX[255&a],a^=ad[o/t|0]<<24):t>6&&o%t==4&&(a=sd.SBOX[a>>>24]<<24|sd.SBOX[a>>>16&255]<<16|sd.SBOX[a>>>8&255]<<8|sd.SBOX[255&a]),i[o]=i[o-t]^a}for(var s=[],u=0;u<r;u++){var l=r-u,c=i[l-(u%4?0:4)];s[u]=u<4||l<=4?c:sd.INV_SUB_MIX[0][sd.SBOX[c>>>24]]^sd.INV_SUB_MIX[1][sd.SBOX[c>>>16&255]]^sd.INV_SUB_MIX[2][sd.SBOX[c>>>8&255]]^sd.INV_SUB_MIX[3][sd.SBOX[255&c]]}this._nRounds=n,this._keySchedule=i,this._invKeySchedule=s},ud.prototype.encryptBlockRaw=function(e){return od(e=rd(e),this._keySchedule,sd.SUB_MIX,sd.SBOX,this._nRounds)},ud.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),n=nd.allocUnsafe(16);return n.writeUInt32BE(t[0],0),n.writeUInt32BE(t[1],4),n.writeUInt32BE(t[2],8),n.writeUInt32BE(t[3],12),n},ud.prototype.decryptBlock=function(e){var t=(e=rd(e))[1];e[1]=e[3],e[3]=t;var n=od(e,this._invKeySchedule,sd.INV_SUB_MIX,sd.INV_SBOX,this._nRounds),r=nd.allocUnsafe(16);return r.writeUInt32BE(n[0],0),r.writeUInt32BE(n[3],4),r.writeUInt32BE(n[2],8),r.writeUInt32BE(n[1],12),r},ud.prototype.scrub=function(){id(this._keySchedule),id(this._invKeySchedule),id(this._key)},td.AES=ud;var ld=$r.Buffer,cd=ld.alloc(16,0);function dd(e){var t=ld.allocUnsafe(16);return t.writeUInt32BE(e[0]>>>0,0),t.writeUInt32BE(e[1]>>>0,4),t.writeUInt32BE(e[2]>>>0,8),t.writeUInt32BE(e[3]>>>0,12),t}function fd(e){this.h=e,this.state=ld.alloc(16,0),this.cache=ld.allocUnsafe(0)}fd.prototype.ghash=function(e){for(var t=-1;++t<e.length;)this.state[t]^=e[t];this._multiply()},fd.prototype._multiply=function(){for(var e,t,n,r=[(e=this.h).readUInt32BE(0),e.readUInt32BE(4),e.readUInt32BE(8),e.readUInt32BE(12)],i=[0,0,0,0],o=-1;++o<128;){for(0!=(this.state[~~(o/8)]&1<<7-o%8)&&(i[0]^=r[0],i[1]^=r[1],i[2]^=r[2],i[3]^=r[3]),n=0!=(1&r[3]),t=3;t>0;t--)r[t]=r[t]>>>1|(1&r[t-1])<<31;r[0]=r[0]>>>1,n&&(r[0]=r[0]^225<<24)}this.state=dd(i)},fd.prototype.update=function(e){var t;for(this.cache=ld.concat([this.cache,e]);this.cache.length>=16;)t=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(t)},fd.prototype.final=function(e,t){return this.cache.length&&this.ghash(ld.concat([this.cache,cd],16)),this.ghash(dd([0,e,0,t])),this.state};var hd=fd,pd=td,md=$r.Buffer,gd=Fu,vd=hd,yd=xc,bd=Kc;function wd(e,t,n,r){gd.call(this);var i=md.alloc(4,0);this._cipher=new pd.AES(t);var o=this._cipher.encryptBlock(i);this._ghash=new vd(o),n=function(e,t,n){if(12===t.length)return e._finID=md.concat([t,md.from([0,0,0,1])]),md.concat([t,md.from([0,0,0,2])]);var r=new vd(n),i=t.length,o=i%16;r.update(t),o&&(o=16-o,r.update(md.alloc(o,0))),r.update(md.alloc(8,0));var a=8*i,s=md.alloc(8);s.writeUIntBE(a,0,8),r.update(s),e._finID=r.state;var u=md.from(e._finID);return bd(u),u}(this,n,o),this._prev=md.from(n),this._cache=md.allocUnsafe(0),this._secCache=md.allocUnsafe(0),this._decrypt=r,this._alen=0,this._len=0,this._mode=e,this._authTag=null,this._called=!1}Jr(wd,gd),wd.prototype._update=function(e){if(!this._called&&this._alen){var t=16-this._alen%16;t<16&&(t=md.alloc(t,0),this._ghash.update(t))}this._called=!0;var n=this._mode.encrypt(this,e);return this._decrypt?this._ghash.update(e):this._ghash.update(n),this._len+=e.length,n},wd.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var e=yd(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(e,t){var n=0;e.length!==t.length&&n++;for(var r=Math.min(e.length,t.length),i=0;i<r;++i)n+=e[i]^t[i];return n}(e,this._authTag))throw new Error("Unsupported state or unable to authenticate data");this._authTag=e,this._cipher.scrub()},wd.prototype.getAuthTag=function(){if(this._decrypt||!md.isBuffer(this._authTag))throw new Error("Attempting to get auth tag in unsupported state");return this._authTag},wd.prototype.setAuthTag=function(e){if(!this._decrypt)throw new Error("Attempting to set auth tag in unsupported state");this._authTag=e},wd.prototype.setAAD=function(e){if(this._called)throw new Error("Attempting to set AAD in unsupported state");this._ghash.update(e),this._alen+=e.length};var Ad=wd,_d=td,Ed=$r.Buffer,Sd=Fu;function kd(e,t,n,r){Sd.call(this),this._cipher=new _d.AES(t),this._prev=Ed.from(n),this._cache=Ed.allocUnsafe(0),this._secCache=Ed.allocUnsafe(0),this._decrypt=r,this._mode=e}Jr(kd,Sd),kd.prototype._update=function(e){return this._mode.encrypt(this,e,this._decrypt)},kd.prototype._final=function(){this._cipher.scrub()};var Md=kd,Cd=$r.Buffer,xd=fa,Rd=function(e,t,n,r){if(Cd.isBuffer(e)||(e=Cd.from(e,"binary")),t&&(Cd.isBuffer(t)||(t=Cd.from(t,"binary")),8!==t.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var i=n/8,o=Cd.alloc(i),a=Cd.alloc(r||0),s=Cd.alloc(0);i>0||r>0;){var u=new xd;u.update(s),u.update(e),t&&u.update(t),s=u.digest();var l=0;if(i>0){var c=o.length-i;l=Math.min(i,s.length),s.copy(o,c,0,l),i-=l}if(l<s.length&&r>0){var d=a.length-r,f=Math.min(r,s.length-l);s.copy(a,d,l,l+f),r-=f}}return s.fill(0),{key:o,iv:a}},Od=ed,Td=Ad,Pd=$r.Buffer,Ld=Md,Id=Fu,Nd=td,Dd=Rd;function Bd(e,t,n){Id.call(this),this._cache=new Ud,this._cipher=new Nd.AES(t),this._prev=Pd.from(n),this._mode=e,this._autopadding=!0}Jr(Bd,Id),Bd.prototype._update=function(e){var t,n;this._cache.add(e);for(var r=[];t=this._cache.get();)n=this._mode.encrypt(this,t),r.push(n);return Pd.concat(r)};var jd=Pd.alloc(16,16);function Ud(){this.cache=Pd.allocUnsafe(0)}function zd(e,t,n){var r=Od[e.toLowerCase()];if(!r)throw new TypeError("invalid suite type");if("string"==typeof t&&(t=Pd.from(t)),t.length!==r.key/8)throw new TypeError("invalid key length "+t.length);if("string"==typeof n&&(n=Pd.from(n)),"GCM"!==r.mode&&n.length!==r.iv)throw new TypeError("invalid iv length "+n.length);return"stream"===r.type?new Ld(r.module,t,n):"auth"===r.type?new Td(r.module,t,n):new Bd(r.module,t,n)}Bd.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return e=this._mode.encrypt(this,e),this._cipher.scrub(),e;if(!e.equals(jd))throw this._cipher.scrub(),new Error("data not multiple of block length")},Bd.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},Ud.prototype.add=function(e){this.cache=Pd.concat([this.cache,e])},Ud.prototype.get=function(){if(this.cache.length>15){var e=this.cache.slice(0,16);return this.cache=this.cache.slice(16),e}return null},Ud.prototype.flush=function(){for(var e=16-this.cache.length,t=Pd.allocUnsafe(e),n=-1;++n<e;)t.writeUInt8(e,n);return Pd.concat([this.cache,t])},Mc.createCipheriv=zd,Mc.createCipher=function(e,t){var n=Od[e.toLowerCase()];if(!n)throw new TypeError("invalid suite type");var r=Dd(t,!1,n.key,n.iv);return zd(e,r.key,r.iv)};var Fd={},qd=Ad,Wd=$r.Buffer,Vd=ed,Kd=Md,Hd=Fu,$d=td,Yd=Rd;function Gd(e,t,n){Hd.call(this),this._cache=new Qd,this._last=void 0,this._cipher=new $d.AES(t),this._prev=Wd.from(n),this._mode=e,this._autopadding=!0}function Qd(){this.cache=Wd.allocUnsafe(0)}function Zd(e,t,n){var r=Vd[e.toLowerCase()];if(!r)throw new TypeError("invalid suite type");if("string"==typeof n&&(n=Wd.from(n)),"GCM"!==r.mode&&n.length!==r.iv)throw new TypeError("invalid iv length "+n.length);if("string"==typeof t&&(t=Wd.from(t)),t.length!==r.key/8)throw new TypeError("invalid key length "+t.length);return"stream"===r.type?new Kd(r.module,t,n,!0):"auth"===r.type?new qd(r.module,t,n,!0):new Gd(r.module,t,n)}Jr(Gd,Hd),Gd.prototype._update=function(e){var t,n;this._cache.add(e);for(var r=[];t=this._cache.get(this._autopadding);)n=this._mode.decrypt(this,t),r.push(n);return Wd.concat(r)},Gd.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return function(e){var t=e[15];if(t<1||t>16)throw new Error("unable to decrypt data");for(var n=-1;++n<t;)if(e[n+(16-t)]!==t)throw new Error("unable to decrypt data");if(16!==t)return e.slice(0,16-t)}(this._mode.decrypt(this,e));if(e)throw new Error("data not multiple of block length")},Gd.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},Qd.prototype.add=function(e){this.cache=Wd.concat([this.cache,e])},Qd.prototype.get=function(e){var t;if(e){if(this.cache.length>16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t}else if(this.cache.length>=16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t;return null},Qd.prototype.flush=function(){if(this.cache.length)return this.cache},Fd.createDecipher=function(e,t){var n=Vd[e.toLowerCase()];if(!n)throw new TypeError("invalid suite type");var r=Yd(t,!1,n.key,n.iv);return Zd(e,r.key,r.iv)},Fd.createDecipheriv=Zd;var Xd=Mc,Jd=Fd,ef=Qc;kc.createCipher=kc.Cipher=Xd.createCipher,kc.createCipheriv=kc.Cipheriv=Xd.createCipheriv,kc.createDecipher=kc.Decipher=Jd.createDecipher,kc.createDecipheriv=kc.Decipheriv=Jd.createDecipheriv,kc.listCiphers=kc.getCiphers=function(){return Object.keys(ef)};var tf={};!function(e){e["des-ecb"]={key:8,iv:0},e["des-cbc"]=e.des={key:8,iv:8},e["des-ede3-cbc"]=e.des3={key:24,iv:8},e["des-ede3"]={key:24,iv:0},e["des-ede-cbc"]={key:16,iv:8},e["des-ede"]={key:16,iv:0}}(tf);var nf=Ec,rf=kc,of=ed,af=tf,sf=Rd;function uf(e,t,n){if(e=e.toLowerCase(),of[e])return rf.createCipheriv(e,t,n);if(af[e])return new nf({key:t,iv:n,mode:e});throw new TypeError("invalid suite type")}function lf(e,t,n){if(e=e.toLowerCase(),of[e])return rf.createDecipheriv(e,t,n);if(af[e])return new nf({key:t,iv:n,mode:e,decrypt:!0});throw new TypeError("invalid suite type")}Wl.createCipher=Wl.Cipher=function(e,t){var n,r;if(e=e.toLowerCase(),of[e])n=of[e].key,r=of[e].iv;else{if(!af[e])throw new TypeError("invalid suite type");n=8*af[e].key,r=af[e].iv}var i=sf(t,!1,n,r);return uf(e,i.key,i.iv)},Wl.createCipheriv=Wl.Cipheriv=uf,Wl.createDecipher=Wl.Decipher=function(e,t){var n,r;if(e=e.toLowerCase(),of[e])n=of[e].key,r=of[e].iv;else{if(!af[e])throw new TypeError("invalid suite type");n=8*af[e].key,r=af[e].iv}var i=sf(t,!1,n,r);return lf(e,i.key,i.iv)},Wl.createDecipheriv=Wl.Decipheriv=lf,Wl.listCiphers=Wl.getCiphers=function(){return Object.keys(af).concat(rf.getCiphers())};var cf={},df={exports:{}};!function(e,t){function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function r(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function i(e,t,n){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}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:yr.Buffer}catch(e){}function a(e,t){var n=e.charCodeAt(t);return n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:n-48&15}function s(e,t,n){var r=a(e,n);return n-1>=t&&(r|=a(e,n-1)<<4),r}function u(e,t,n,r){for(var i=0,o=Math.min(e.length,n),a=t;a<o;a++){var s=e.charCodeAt(a)-48;i*=r,i+=s>=49?s-49+10:s>=17?s-17+10:s}return i}i.isBN=function(e){return e instanceof i||null!==e&&"object"==typeof e&&e.constructor.wordSize===i.wordSize&&Array.isArray(e.words)},i.max=function(e,t){return e.cmp(t)>0?e:t},i.min=function(e,t){return e.cmp(t)<0?e:t},i.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<e.length&&(16===t?this._parseHex(e,i,r):(this._parseBase(e,t,i),"le"===r&&this._initArray(this.toArray(),t,r)))},i.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(n(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},i.prototype._initArray=function(e,t,r){if(n("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===r)for(i=e.length-1,o=0;i>=0;i-=3)a=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i<e.length;i+=3)a=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},i.prototype._parseHex=function(e,t,n){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 i,o=0,a=0;if("be"===n)for(r=e.length-1;r>=t;r-=2)i=s(e,t,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(e.length-t)%2==0?t+1:t;r<e.length;r+=2)i=s(e,t,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this.strip()},i.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,a=o%r,s=Math.min(o,o-a)+n,l=0,c=n;c<s;c+=r)l=u(e,c,c+r,t),this.imuln(i),this.words[0]+l<67108864?this.words[0]+=l:this._iaddn(l);if(0!==a){var d=1;for(l=u(e,c,e.length,t),c=0;c<a;c++)d*=t;this.imuln(d),this.words[0]+l<67108864?this.words[0]+=l:this._iaddn(l)}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.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 l=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function f(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var l=1;l<r;l++){for(var c=u>>>26,d=67108863&u,f=Math.min(l,t.length-1),h=Math.max(0,l-e.length+1);h<=f;h++){var p=l-h|0;c+=(a=(i=0|e.words[p])*(o=0|t.words[h])+d)/67108864|0,d=67108863&a}n.words[l]=0|d,u=0|c}return 0!==u?n.words[l]=0|u:n.length--,n.strip()}i.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<i|o)).toString(16);r=0!=(o=s>>>24-i&16777215)||a!==this.length-1?l[6-u.length]+u+r:u+r,(i+=2)>=26&&(i-=26,a--)}for(0!==o&&(r=o.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var f=c[e],h=d[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(h).toString(e);r=(p=p.idivn(h)).isZero()?m+r:l[f-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(e,t){return n(void 0!==o),this.toArrayLike(o,e,t)},i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},i.prototype.toArrayLike=function(e,t,r){var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0"),this.strip();var a,s,u="le"===t,l=new e(o),c=this.clone();if(u){for(s=0;!c.isZero();s++)a=c.andln(255),c.iushrn(8),l[s]=a;for(;s<o;s++)l[s]=0}else{for(s=0;s<o-i;s++)l[s]=0;for(s=0;!c.isZero();s++)a=c.andln(255),c.iushrn(8),l[o-s-1]=a}return l},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var n=this._zeroBits(this.words[t]);if(e+=n,26!==n)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 n(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 n=0;n<t.length;n++)this.words[n]=this.words[n]&e.words[n];return this.length=t.length,this.strip()},i.prototype.iand=function(e){return n(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,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;r<n.length;r++)this.words[r]=t.words[r]^n.words[r];if(this!==t)for(;r<t.length;r++)this.words[r]=t.words[r];return this.length=t.length,this.strip()},i.prototype.ixor=function(e){return n(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){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i<t;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<<i:this.words[r]&~(1<<i),this.strip()},i.prototype.iadd=function(e){var t,n,r;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?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o<r.length;o++)t=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&t,i=t>>>26;for(;0!==i&&o<n.length;o++)t=(0|n.words[o])+i,this.words[o]=67108863&t,i=t>>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;o<n.length;o++)this.words[o]=n.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 n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,a=0;a<r.length;a++)o=(t=(0|n.words[a])-(0|r.words[a])+o)>>26,this.words[a]=67108863&t;for(;0!==o&&a<n.length;a++)o=(t=(0|n.words[a])+o)>>26,this.words[a]=67108863&t;if(0===o&&a<n.length&&n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this.length=Math.max(this.length,a),n!==this&&(this.negative=1),this.strip()},i.prototype.sub=function(e){return this.clone().isub(e)};var h=function(e,t,n){var r,i,o,a=e.words,s=t.words,u=n.words,l=0,c=0|a[0],d=8191&c,f=c>>>13,h=0|a[1],p=8191&h,m=h>>>13,g=0|a[2],v=8191&g,y=g>>>13,b=0|a[3],w=8191&b,A=b>>>13,_=0|a[4],E=8191&_,S=_>>>13,k=0|a[5],M=8191&k,C=k>>>13,x=0|a[6],R=8191&x,O=x>>>13,T=0|a[7],P=8191&T,L=T>>>13,I=0|a[8],N=8191&I,D=I>>>13,B=0|a[9],j=8191&B,U=B>>>13,z=0|s[0],F=8191&z,q=z>>>13,W=0|s[1],V=8191&W,K=W>>>13,H=0|s[2],$=8191&H,Y=H>>>13,G=0|s[3],Q=8191&G,Z=G>>>13,X=0|s[4],J=8191&X,ee=X>>>13,te=0|s[5],ne=8191&te,re=te>>>13,ie=0|s[6],oe=8191&ie,ae=ie>>>13,se=0|s[7],ue=8191&se,le=se>>>13,ce=0|s[8],de=8191&ce,fe=ce>>>13,he=0|s[9],pe=8191&he,me=he>>>13;n.negative=e.negative^t.negative,n.length=19;var ge=(l+(r=Math.imul(d,F))|0)+((8191&(i=(i=Math.imul(d,q))+Math.imul(f,F)|0))<<13)|0;l=((o=Math.imul(f,q))+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,r=Math.imul(p,F),i=(i=Math.imul(p,q))+Math.imul(m,F)|0,o=Math.imul(m,q);var ve=(l+(r=r+Math.imul(d,V)|0)|0)+((8191&(i=(i=i+Math.imul(d,K)|0)+Math.imul(f,V)|0))<<13)|0;l=((o=o+Math.imul(f,K)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,r=Math.imul(v,F),i=(i=Math.imul(v,q))+Math.imul(y,F)|0,o=Math.imul(y,q),r=r+Math.imul(p,V)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,K)|0;var ye=(l+(r=r+Math.imul(d,$)|0)|0)+((8191&(i=(i=i+Math.imul(d,Y)|0)+Math.imul(f,$)|0))<<13)|0;l=((o=o+Math.imul(f,Y)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,r=Math.imul(w,F),i=(i=Math.imul(w,q))+Math.imul(A,F)|0,o=Math.imul(A,q),r=r+Math.imul(v,V)|0,i=(i=i+Math.imul(v,K)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,K)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,Y)|0;var be=(l+(r=r+Math.imul(d,Q)|0)|0)+((8191&(i=(i=i+Math.imul(d,Z)|0)+Math.imul(f,Q)|0))<<13)|0;l=((o=o+Math.imul(f,Z)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(E,F),i=(i=Math.imul(E,q))+Math.imul(S,F)|0,o=Math.imul(S,q),r=r+Math.imul(w,V)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(A,V)|0,o=o+Math.imul(A,K)|0,r=r+Math.imul(v,$)|0,i=(i=i+Math.imul(v,Y)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,Y)|0,r=r+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,Z)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,Z)|0;var we=(l+(r=r+Math.imul(d,J)|0)|0)+((8191&(i=(i=i+Math.imul(d,ee)|0)+Math.imul(f,J)|0))<<13)|0;l=((o=o+Math.imul(f,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(M,F),i=(i=Math.imul(M,q))+Math.imul(C,F)|0,o=Math.imul(C,q),r=r+Math.imul(E,V)|0,i=(i=i+Math.imul(E,K)|0)+Math.imul(S,V)|0,o=o+Math.imul(S,K)|0,r=r+Math.imul(w,$)|0,i=(i=i+Math.imul(w,Y)|0)+Math.imul(A,$)|0,o=o+Math.imul(A,Y)|0,r=r+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,Z)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,Z)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,ee)|0;var Ae=(l+(r=r+Math.imul(d,ne)|0)|0)+((8191&(i=(i=i+Math.imul(d,re)|0)+Math.imul(f,ne)|0))<<13)|0;l=((o=o+Math.imul(f,re)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(R,F),i=(i=Math.imul(R,q))+Math.imul(O,F)|0,o=Math.imul(O,q),r=r+Math.imul(M,V)|0,i=(i=i+Math.imul(M,K)|0)+Math.imul(C,V)|0,o=o+Math.imul(C,K)|0,r=r+Math.imul(E,$)|0,i=(i=i+Math.imul(E,Y)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,Y)|0,r=r+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,Z)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,Z)|0,r=r+Math.imul(v,J)|0,i=(i=i+Math.imul(v,ee)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,ee)|0,r=r+Math.imul(p,ne)|0,i=(i=i+Math.imul(p,re)|0)+Math.imul(m,ne)|0,o=o+Math.imul(m,re)|0;var _e=(l+(r=r+Math.imul(d,oe)|0)|0)+((8191&(i=(i=i+Math.imul(d,ae)|0)+Math.imul(f,oe)|0))<<13)|0;l=((o=o+Math.imul(f,ae)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,r=Math.imul(P,F),i=(i=Math.imul(P,q))+Math.imul(L,F)|0,o=Math.imul(L,q),r=r+Math.imul(R,V)|0,i=(i=i+Math.imul(R,K)|0)+Math.imul(O,V)|0,o=o+Math.imul(O,K)|0,r=r+Math.imul(M,$)|0,i=(i=i+Math.imul(M,Y)|0)+Math.imul(C,$)|0,o=o+Math.imul(C,Y)|0,r=r+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,Z)|0)+Math.imul(S,Q)|0,o=o+Math.imul(S,Z)|0,r=r+Math.imul(w,J)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(A,J)|0,o=o+Math.imul(A,ee)|0,r=r+Math.imul(v,ne)|0,i=(i=i+Math.imul(v,re)|0)+Math.imul(y,ne)|0,o=o+Math.imul(y,re)|0,r=r+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,ae)|0)+Math.imul(m,oe)|0,o=o+Math.imul(m,ae)|0;var Ee=(l+(r=r+Math.imul(d,ue)|0)|0)+((8191&(i=(i=i+Math.imul(d,le)|0)+Math.imul(f,ue)|0))<<13)|0;l=((o=o+Math.imul(f,le)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(N,F),i=(i=Math.imul(N,q))+Math.imul(D,F)|0,o=Math.imul(D,q),r=r+Math.imul(P,V)|0,i=(i=i+Math.imul(P,K)|0)+Math.imul(L,V)|0,o=o+Math.imul(L,K)|0,r=r+Math.imul(R,$)|0,i=(i=i+Math.imul(R,Y)|0)+Math.imul(O,$)|0,o=o+Math.imul(O,Y)|0,r=r+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,Z)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,Z)|0,r=r+Math.imul(E,J)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(S,J)|0,o=o+Math.imul(S,ee)|0,r=r+Math.imul(w,ne)|0,i=(i=i+Math.imul(w,re)|0)+Math.imul(A,ne)|0,o=o+Math.imul(A,re)|0,r=r+Math.imul(v,oe)|0,i=(i=i+Math.imul(v,ae)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,ae)|0,r=r+Math.imul(p,ue)|0,i=(i=i+Math.imul(p,le)|0)+Math.imul(m,ue)|0,o=o+Math.imul(m,le)|0;var Se=(l+(r=r+Math.imul(d,de)|0)|0)+((8191&(i=(i=i+Math.imul(d,fe)|0)+Math.imul(f,de)|0))<<13)|0;l=((o=o+Math.imul(f,fe)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(j,F),i=(i=Math.imul(j,q))+Math.imul(U,F)|0,o=Math.imul(U,q),r=r+Math.imul(N,V)|0,i=(i=i+Math.imul(N,K)|0)+Math.imul(D,V)|0,o=o+Math.imul(D,K)|0,r=r+Math.imul(P,$)|0,i=(i=i+Math.imul(P,Y)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,Y)|0,r=r+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,Z)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,Z)|0,r=r+Math.imul(M,J)|0,i=(i=i+Math.imul(M,ee)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,ee)|0,r=r+Math.imul(E,ne)|0,i=(i=i+Math.imul(E,re)|0)+Math.imul(S,ne)|0,o=o+Math.imul(S,re)|0,r=r+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,ae)|0)+Math.imul(A,oe)|0,o=o+Math.imul(A,ae)|0,r=r+Math.imul(v,ue)|0,i=(i=i+Math.imul(v,le)|0)+Math.imul(y,ue)|0,o=o+Math.imul(y,le)|0,r=r+Math.imul(p,de)|0,i=(i=i+Math.imul(p,fe)|0)+Math.imul(m,de)|0,o=o+Math.imul(m,fe)|0;var ke=(l+(r=r+Math.imul(d,pe)|0)|0)+((8191&(i=(i=i+Math.imul(d,me)|0)+Math.imul(f,pe)|0))<<13)|0;l=((o=o+Math.imul(f,me)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(j,V),i=(i=Math.imul(j,K))+Math.imul(U,V)|0,o=Math.imul(U,K),r=r+Math.imul(N,$)|0,i=(i=i+Math.imul(N,Y)|0)+Math.imul(D,$)|0,o=o+Math.imul(D,Y)|0,r=r+Math.imul(P,Q)|0,i=(i=i+Math.imul(P,Z)|0)+Math.imul(L,Q)|0,o=o+Math.imul(L,Z)|0,r=r+Math.imul(R,J)|0,i=(i=i+Math.imul(R,ee)|0)+Math.imul(O,J)|0,o=o+Math.imul(O,ee)|0,r=r+Math.imul(M,ne)|0,i=(i=i+Math.imul(M,re)|0)+Math.imul(C,ne)|0,o=o+Math.imul(C,re)|0,r=r+Math.imul(E,oe)|0,i=(i=i+Math.imul(E,ae)|0)+Math.imul(S,oe)|0,o=o+Math.imul(S,ae)|0,r=r+Math.imul(w,ue)|0,i=(i=i+Math.imul(w,le)|0)+Math.imul(A,ue)|0,o=o+Math.imul(A,le)|0,r=r+Math.imul(v,de)|0,i=(i=i+Math.imul(v,fe)|0)+Math.imul(y,de)|0,o=o+Math.imul(y,fe)|0;var Me=(l+(r=r+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;l=((o=o+Math.imul(m,me)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,r=Math.imul(j,$),i=(i=Math.imul(j,Y))+Math.imul(U,$)|0,o=Math.imul(U,Y),r=r+Math.imul(N,Q)|0,i=(i=i+Math.imul(N,Z)|0)+Math.imul(D,Q)|0,o=o+Math.imul(D,Z)|0,r=r+Math.imul(P,J)|0,i=(i=i+Math.imul(P,ee)|0)+Math.imul(L,J)|0,o=o+Math.imul(L,ee)|0,r=r+Math.imul(R,ne)|0,i=(i=i+Math.imul(R,re)|0)+Math.imul(O,ne)|0,o=o+Math.imul(O,re)|0,r=r+Math.imul(M,oe)|0,i=(i=i+Math.imul(M,ae)|0)+Math.imul(C,oe)|0,o=o+Math.imul(C,ae)|0,r=r+Math.imul(E,ue)|0,i=(i=i+Math.imul(E,le)|0)+Math.imul(S,ue)|0,o=o+Math.imul(S,le)|0,r=r+Math.imul(w,de)|0,i=(i=i+Math.imul(w,fe)|0)+Math.imul(A,de)|0,o=o+Math.imul(A,fe)|0;var Ce=(l+(r=r+Math.imul(v,pe)|0)|0)+((8191&(i=(i=i+Math.imul(v,me)|0)+Math.imul(y,pe)|0))<<13)|0;l=((o=o+Math.imul(y,me)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,r=Math.imul(j,Q),i=(i=Math.imul(j,Z))+Math.imul(U,Q)|0,o=Math.imul(U,Z),r=r+Math.imul(N,J)|0,i=(i=i+Math.imul(N,ee)|0)+Math.imul(D,J)|0,o=o+Math.imul(D,ee)|0,r=r+Math.imul(P,ne)|0,i=(i=i+Math.imul(P,re)|0)+Math.imul(L,ne)|0,o=o+Math.imul(L,re)|0,r=r+Math.imul(R,oe)|0,i=(i=i+Math.imul(R,ae)|0)+Math.imul(O,oe)|0,o=o+Math.imul(O,ae)|0,r=r+Math.imul(M,ue)|0,i=(i=i+Math.imul(M,le)|0)+Math.imul(C,ue)|0,o=o+Math.imul(C,le)|0,r=r+Math.imul(E,de)|0,i=(i=i+Math.imul(E,fe)|0)+Math.imul(S,de)|0,o=o+Math.imul(S,fe)|0;var xe=(l+(r=r+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,me)|0)+Math.imul(A,pe)|0))<<13)|0;l=((o=o+Math.imul(A,me)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(j,J),i=(i=Math.imul(j,ee))+Math.imul(U,J)|0,o=Math.imul(U,ee),r=r+Math.imul(N,ne)|0,i=(i=i+Math.imul(N,re)|0)+Math.imul(D,ne)|0,o=o+Math.imul(D,re)|0,r=r+Math.imul(P,oe)|0,i=(i=i+Math.imul(P,ae)|0)+Math.imul(L,oe)|0,o=o+Math.imul(L,ae)|0,r=r+Math.imul(R,ue)|0,i=(i=i+Math.imul(R,le)|0)+Math.imul(O,ue)|0,o=o+Math.imul(O,le)|0,r=r+Math.imul(M,de)|0,i=(i=i+Math.imul(M,fe)|0)+Math.imul(C,de)|0,o=o+Math.imul(C,fe)|0;var Re=(l+(r=r+Math.imul(E,pe)|0)|0)+((8191&(i=(i=i+Math.imul(E,me)|0)+Math.imul(S,pe)|0))<<13)|0;l=((o=o+Math.imul(S,me)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,r=Math.imul(j,ne),i=(i=Math.imul(j,re))+Math.imul(U,ne)|0,o=Math.imul(U,re),r=r+Math.imul(N,oe)|0,i=(i=i+Math.imul(N,ae)|0)+Math.imul(D,oe)|0,o=o+Math.imul(D,ae)|0,r=r+Math.imul(P,ue)|0,i=(i=i+Math.imul(P,le)|0)+Math.imul(L,ue)|0,o=o+Math.imul(L,le)|0,r=r+Math.imul(R,de)|0,i=(i=i+Math.imul(R,fe)|0)+Math.imul(O,de)|0,o=o+Math.imul(O,fe)|0;var Oe=(l+(r=r+Math.imul(M,pe)|0)|0)+((8191&(i=(i=i+Math.imul(M,me)|0)+Math.imul(C,pe)|0))<<13)|0;l=((o=o+Math.imul(C,me)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,r=Math.imul(j,oe),i=(i=Math.imul(j,ae))+Math.imul(U,oe)|0,o=Math.imul(U,ae),r=r+Math.imul(N,ue)|0,i=(i=i+Math.imul(N,le)|0)+Math.imul(D,ue)|0,o=o+Math.imul(D,le)|0,r=r+Math.imul(P,de)|0,i=(i=i+Math.imul(P,fe)|0)+Math.imul(L,de)|0,o=o+Math.imul(L,fe)|0;var Te=(l+(r=r+Math.imul(R,pe)|0)|0)+((8191&(i=(i=i+Math.imul(R,me)|0)+Math.imul(O,pe)|0))<<13)|0;l=((o=o+Math.imul(O,me)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(j,ue),i=(i=Math.imul(j,le))+Math.imul(U,ue)|0,o=Math.imul(U,le),r=r+Math.imul(N,de)|0,i=(i=i+Math.imul(N,fe)|0)+Math.imul(D,de)|0,o=o+Math.imul(D,fe)|0;var Pe=(l+(r=r+Math.imul(P,pe)|0)|0)+((8191&(i=(i=i+Math.imul(P,me)|0)+Math.imul(L,pe)|0))<<13)|0;l=((o=o+Math.imul(L,me)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,r=Math.imul(j,de),i=(i=Math.imul(j,fe))+Math.imul(U,de)|0,o=Math.imul(U,fe);var Le=(l+(r=r+Math.imul(N,pe)|0)|0)+((8191&(i=(i=i+Math.imul(N,me)|0)+Math.imul(D,pe)|0))<<13)|0;l=((o=o+Math.imul(D,me)|0)+(i>>>13)|0)+(Le>>>26)|0,Le&=67108863;var Ie=(l+(r=Math.imul(j,pe))|0)+((8191&(i=(i=Math.imul(j,me))+Math.imul(U,pe)|0))<<13)|0;return l=((o=Math.imul(U,me))+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,u[0]=ge,u[1]=ve,u[2]=ye,u[3]=be,u[4]=we,u[5]=Ae,u[6]=_e,u[7]=Ee,u[8]=Se,u[9]=ke,u[10]=Me,u[11]=Ce,u[12]=xe,u[13]=Re,u[14]=Oe,u[15]=Te,u[16]=Pe,u[17]=Le,u[18]=Ie,0!==l&&(u[19]=l,n.length++),n};function p(e,t,n){return(new m).mulp(e,t,n)}function m(e,t){this.x=e,this.y=t}Math.imul||(h=f),i.prototype.mulTo=function(e,t){var n,r=this.length+e.length;return n=10===this.length&&10===e.length?h(this,e,t):r<63?f(this,e,t):r<1024?function(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o<n.length-1;o++){var a=i;i=0;for(var s=67108863&r,u=Math.min(o,t.length-1),l=Math.max(0,o-e.length+1);l<=u;l++){var c=o-l,d=(0|e.words[c])*(0|t.words[l]),f=67108863&d;s=67108863&(f=f+s|0),i+=(a=(a=a+(d/67108864|0)|0)+(f>>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,e,t):p(this,e,t),n},m.prototype.makeRBT=function(e){for(var t=new Array(e),n=i.prototype._countBits(e)-1,r=0;r<e;r++)t[r]=this.revBin(r,n,e);return t},m.prototype.revBin=function(e,t,n){if(0===e||e===n-1)return e;for(var r=0,i=0;i<t;i++)r|=(1&e)<<t-i-1,e>>=1;return r},m.prototype.permute=function(e,t,n,r,i,o){for(var a=0;a<o;a++)r[a]=t[e[a]],i[a]=n[e[a]]},m.prototype.transform=function(e,t,n,r,i,o){this.permute(o,e,t,n,r,i);for(var a=1;a<i;a<<=1)for(var s=a<<1,u=Math.cos(2*Math.PI/s),l=Math.sin(2*Math.PI/s),c=0;c<i;c+=s)for(var d=u,f=l,h=0;h<a;h++){var p=n[c+h],m=r[c+h],g=n[c+h+a],v=r[c+h+a],y=d*g-f*v;v=d*v+f*g,g=y,n[c+h]=p+g,r[c+h]=m+v,n[c+h+a]=p-g,r[c+h+a]=m-v,h!==s&&(y=u*d-l*f,f=u*f+l*d,d=y)}},m.prototype.guessLen13b=function(e,t){var n=1|Math.max(t,e),r=1&n,i=0;for(n=n/2|0;n;n>>>=1)i++;return 1<<i+1+r},m.prototype.conjugate=function(e,t,n){if(!(n<=1))for(var r=0;r<n/2;r++){var i=e[r];e[r]=e[n-r-1],e[n-r-1]=i,i=t[r],t[r]=-t[n-r-1],t[n-r-1]=-i}},m.prototype.normalize13b=function(e,t){for(var n=0,r=0;r<t/2;r++){var i=8192*Math.round(e[2*r+1]/t)+Math.round(e[2*r]/t)+n;e[r]=67108863&i,n=i<67108864?0:i/67108864|0}return e},m.prototype.convert13b=function(e,t,r,i){for(var o=0,a=0;a<t;a++)o+=0|e[a],r[2*a]=8191&o,o>>>=13,r[2*a+1]=8191&o,o>>>=13;for(a=2*t;a<i;++a)r[a]=0;n(0===o),n(0==(-8192&o))},m.prototype.stub=function(e){for(var t=new Array(e),n=0;n<e;n++)t[n]=0;return t},m.prototype.mulp=function(e,t,n){var r=2*this.guessLen13b(e.length,t.length),i=this.makeRBT(r),o=this.stub(r),a=new Array(r),s=new Array(r),u=new Array(r),l=new Array(r),c=new Array(r),d=new Array(r),f=n.words;f.length=r,this.convert13b(e.words,e.length,a,r),this.convert13b(t.words,t.length,l,r),this.transform(a,o,s,u,r,i),this.transform(l,o,c,d,r,i);for(var h=0;h<r;h++){var p=s[h]*c[h]-u[h]*d[h];u[h]=s[h]*d[h]+u[h]*c[h],s[h]=p}return this.conjugate(s,u,r),this.transform(s,u,f,o,r,i),this.conjugate(f,o,r),this.normalize13b(f,r),n.negative=e.negative^t.negative,n.length=e.length+t.length,n.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),p(this,e,t)},i.prototype.imul=function(e){return this.clone().mulTo(e,this)},i.prototype.imuln=function(e){n("number"==typeof e),n(e<67108864);for(var t=0,r=0;r<this.length;r++){var i=(0|this.words[r])*e,o=(67108863&i)+(67108863&t);t>>=26,t+=i/67108864|0,t+=o>>>26,this.words[r]=67108863&o}return 0!==t&&(this.words[r]=t,this.length++),this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n<t.length;n++){var r=n/26|0,i=n%26;t[n]=(e.words[r]&1<<i)>>>i}return t}(e);if(0===t.length)return new i(1);for(var n=this,r=0;r<t.length&&0===t[r];r++,n=n.sqr());if(++r<t.length)for(var o=n.sqr();r<t.length;r++,o=o.sqr())0!==t[r]&&(n=n.mul(o));return n},i.prototype.iushln=function(e){n("number"==typeof e&&e>=0);var t,r=e%26,i=(e-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(t=0;t<this.length;t++){var s=this.words[t]&o,u=(0|this.words[t])-s<<r;this.words[t]=u|a,a=s>>>26-r}a&&(this.words[t]=a,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this.strip()},i.prototype.ishln=function(e){return n(0===this.negative),this.iushln(e)},i.prototype.iushrn=function(e,t,r){var i;n("number"==typeof e&&e>=0),i=t?(t-t%26)/26:0;var o=e%26,a=Math.min((e-o)/26,this.length),s=67108863^67108863>>>o<<o,u=r;if(i-=a,i=Math.max(0,i),u){for(var l=0;l<a;l++)u.words[l]=this.words[l];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,l=0;l<this.length;l++)this.words[l]=this.words[l+a];else this.words[0]=0,this.length=1;var c=0;for(l=this.length-1;l>=0&&(0!==c||l>=i);l--){var d=0|this.words[l];this.words[l]=c<<26-o|d>>>o,c=d&s}return u&&0!==c&&(u.words[u.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,i=1<<t;return!(this.length<=r||!(this.words[r]&i))},i.prototype.imaskn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,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 n("number"==typeof e),n(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(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<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,r){var i,o,a=e.length+r;this._expand(a);var s=0;for(i=0;i<e.length;i++){o=(0|this.words[i+r])+s;var u=(0|e.words[i])*t;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)s=(o=(0|this.words[i+r])+s)>>26,this.words[i+r]=67108863&o;if(0===s)return this.strip();for(n(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},i.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),o=e,a=0|o.words[o.length-1];0!=(n=26-this._countBits(a))&&(o=o.ushln(n),r.iushln(n),a=0|o.words[o.length-1]);var s,u=r.length-o.length;if("mod"!==t){(s=new i(null)).length=u+1,s.words=new Array(s.length);for(var l=0;l<s.length;l++)s.words[l]=0}var c=r.clone()._ishlnsubmul(o,1,u);0===c.negative&&(r=c,s&&(s.words[u]=1));for(var d=u-1;d>=0;d--){var f=67108864*(0|r.words[o.length+d])+(0|r.words[o.length+d-1]);for(f=Math.min(f/a|0,67108863),r._ishlnsubmul(o,f,d);0!==r.negative;)f--,r.negative=0,r._ishlnsubmul(o,1,d),r.isZero()||(r.negative^=1);s&&(s.words[d]=f)}return s&&s.strip(),r.strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(o=s.div.neg()),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(e)),{div:o,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||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,a,s},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modn=function(e){n(e<=67108863);for(var t=(1<<26)%e,r=0,i=this.length-1;i>=0;i--)r=(t*r+(0|this.words[i]))%e;return r},i.prototype.idivn=function(e){n(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*t;this.words[r]=i/e|0,t=i%e}return this.strip()},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o=new i(1),a=new i(0),s=new i(0),u=new i(1),l=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++l;for(var c=r.clone(),d=t.clone();!t.isZero();){for(var f=0,h=1;0==(t.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(t.iushrn(f);f-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(c),a.isub(d)),o.iushrn(1),a.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(c),u.isub(d)),s.iushrn(1),u.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(s),a.isub(u)):(r.isub(t),s.isub(o),u.isub(a))}return{a:s,b:u,gcd:r.iushln(l)}},i.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o,a=new i(1),s=new i(0),u=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var l=0,c=1;0==(t.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(t.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var d=0,f=1;0==(r.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(r.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(s)):(r.isub(t),s.isub(a))}return(o=0===t.cmpn(1)?a:s).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(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var o=i,a=r;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0: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,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){r<i?t=-1:r>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 _(e)},i.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var g={k256:null,p224:null,p192:null,p25519:null};function v(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function A(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function _(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function E(e){_.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},v.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},v.prototype.split=function(e,t){e.iushrn(this.n,0,t)},v.prototype.imulK=function(e){return e.imul(this.k)},r(y,v),y.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i<r;i++)t.words[i]=e.words[i];if(t.length=r,e.length<=9)return e.words[0]=0,void(e.length=1);var o=e.words[9];for(t.words[t.length++]=o&n,i=10;i<e.length;i++){var a=0|e.words[i];e.words[i-10]=(a&n)<<4|o>>>22,o=a}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},y.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n<e.length;n++){var r=0|e.words[n];t+=977*r,e.words[n]=67108863&t,t=64*r+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},r(b,v),r(w,v),r(A,v),A.prototype.imulK=function(e){for(var t=0,n=0;n<e.length;n++){var r=19*(0|e.words[n])+t,i=67108863&r;r>>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(g[e])return g[e];var t;if("k256"===e)t=new y;else if("p224"===e)t=new b;else if("p192"===e)t=new w;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new A}return g[e]=t,t},_.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},_.prototype._verify2=function(e,t){n(0==(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},_.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},_.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},_.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},_.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},_.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},_.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},_.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},_.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},_.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},_.prototype.isqr=function(e){return this.imul(e,e.clone())},_.prototype.sqr=function(e){return this.mul(e,e)},_.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new i(1)).iushrn(2);return this.pow(e,r)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);n(!o.isZero());var s=new i(1).toRed(this),u=s.redNeg(),l=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new i(2*c*c).toRed(this);0!==this.pow(c,l).cmp(u);)c.redIAdd(u);for(var d=this.pow(c,o),f=this.pow(e,o.addn(1).iushrn(1)),h=this.pow(e,o),p=a;0!==h.cmp(s);){for(var m=h,g=0;0!==m.cmp(s);g++)m=m.redSqr();n(g<p);var v=this.pow(d,new i(1).iushln(p-g-1));f=f.redMul(v),d=v.redSqr(),h=h.redMul(d),p=g}return f},_.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},_.prototype.pow=function(e,t){if(t.isZero())return new i(1).toRed(this);if(0===t.cmpn(1))return e.clone();var n=new Array(16);n[0]=new i(1).toRed(this),n[1]=e;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],e);var o=n[0],a=0,s=0,u=t.bitLength()%26;for(0===u&&(u=26),r=t.length-1;r>=0;r--){for(var l=t.words[r],c=u-1;c>=0;c--){var d=l>>c&1;o!==n[0]&&(o=this.sqr(o)),0!==d||0!==a?(a<<=1,a|=d,(4==++s||0===r&&0===c)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}u=26}return o},_.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},_.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new E(e)},r(E,_),E.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},E.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},E.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):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 n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(r).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},E.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(df,hr);var ff,hf,pf,mf,gf,vf=df.exports,yf={exports:{}};function bf(){if(ff)return yf.exports;var e;function t(e){this.rand=e}if(ff=1,yf.exports=function(n){return e||(e=new t(null)),e.generate(n)},yf.exports.Rand=t,t.prototype.generate=function(e){return this._rand(e)},t.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),n=0;n<t.length;n++)t[n]=this.rand.getByte();return t},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?t.prototype._rand=function(e){var t=new Uint8Array(e);return self.crypto.getRandomValues(t),t}:self.msCrypto&&self.msCrypto.getRandomValues?t.prototype._rand=function(e){var t=new Uint8Array(e);return self.msCrypto.getRandomValues(t),t}:"object"==typeof window&&(t.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var n=zb();if("function"!=typeof n.randomBytes)throw new Error("Not supported");t.prototype._rand=function(e){return n.randomBytes(e)}}catch(e){}return yf.exports}function wf(){if(pf)return hf;pf=1;var e=vf,t=bf();function n(e){this.rand=e||new t.Rand}return hf=n,n.create=function(e){return new n(e)},n.prototype._randbelow=function(t){var n=t.bitLength(),r=Math.ceil(n/8);do{var i=new e(this.rand.generate(r))}while(i.cmp(t)>=0);return i},n.prototype._randrange=function(e,t){var n=t.sub(e);return e.add(this._randbelow(n))},n.prototype.test=function(t,n,r){var i=t.bitLength(),o=e.mont(t),a=new e(1).toRed(o);n||(n=Math.max(1,i/48|0));for(var s=t.subn(1),u=0;!s.testn(u);u++);for(var l=t.shrn(u),c=s.toRed(o);n>0;n--){var d=this._randrange(new e(2),s);r&&r(d);var f=d.toRed(o).redPow(l);if(0!==f.cmp(a)&&0!==f.cmp(c)){for(var h=1;h<u;h++){if(0===(f=f.redSqr()).cmp(a))return!1;if(0===f.cmp(c))break}if(h===u)return!1}}return!0},n.prototype.getDivisor=function(t,n){var r=t.bitLength(),i=e.mont(t),o=new e(1).toRed(i);n||(n=Math.max(1,r/48|0));for(var a=t.subn(1),s=0;!a.testn(s);s++);for(var u=t.shrn(s),l=a.toRed(i);n>0;n--){var c=this._randrange(new e(2),a),d=t.gcd(c);if(0!==d.cmpn(1))return d;var f=c.toRed(i).redPow(u);if(0!==f.cmp(o)&&0!==f.cmp(l)){for(var h=1;h<s;h++){if(0===(f=f.redSqr()).cmp(o))return f.fromRed().subn(1).gcd(t);if(0===f.cmp(l))break}if(h===s)return(f=f.redSqr()).fromRed().subn(1).gcd(t)}}return!1},hf}function Af(){if(gf)return mf;gf=1;var e=Zr;mf=p,p.simpleSieve=f,p.fermatTest=h;var t=vf,n=new t(24),r=new(wf()),i=new t(1),o=new t(2),a=new t(5);new t(16),new t(8);var s=new t(10),u=new t(3);new t(7);var l=new t(11),c=new t(4);new t(12);var d=null;function f(e){for(var t=function(){if(null!==d)return d;var e=[];e[0]=2;for(var t=1,n=3;n<1048576;n+=2){for(var r=Math.ceil(Math.sqrt(n)),i=0;i<t&&e[i]<=r&&n%e[i]!=0;i++);t!==i&&e[i]<=r||(e[t++]=n)}return d=e,e}(),n=0;n<t.length;n++)if(0===e.modn(t[n]))return 0===e.cmpn(t[n]);return!0}function h(e){var n=t.mont(e);return 0===o.toRed(n).redPow(e.subn(1)).fromRed().cmpn(1)}function p(d,p){if(d<16)return new t(2===p||5===p?[140,123]:[140,39]);var m,g;for(p=new t(p);;){for(m=new t(e(Math.ceil(d/8)));m.bitLength()>d;)m.ishrn(1);if(m.isEven()&&m.iadd(i),m.testn(1)||m.iadd(o),p.cmp(o)){if(!p.cmp(a))for(;m.mod(s).cmp(u);)m.iadd(c)}else for(;m.mod(n).cmp(l);)m.iadd(c);if(f(g=m.shrn(1))&&f(m)&&h(g)&&h(m)&&r.test(g)&&r.test(m))return m}}return mf}var _f,Ef,Sf,kf,Mf,Cf={modp1:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}},xf={exports:{}},Rf=ui.EventEmitter;function Of(e,t){Pf(e,t),Tf(e)}function Tf(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function Pf(e,t){e.emit("error",t)}var Lf={destroy:function(e,t){var n=this,r=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return r||i?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,Tr(Pf,this,e)):Tr(Pf,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?n._writableState?n._writableState.errorEmitted?Tr(Tf,n):(n._writableState.errorEmitted=!0,Tr(Of,n,e)):Tr(Of,n,e):t?(Tr(Tf,n),t(e)):Tr(Tf,n)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var n=e._readableState,r=e._writableState;n&&n.autoDestroy||r&&r.autoDestroy?e.destroy(t):e.emit("error",t)}},If={},Nf={};function Df(e,t,n){n||(n=Error);var r=function(e){var n,r;function i(n,r,i){return e.call(this,function(e,n,r){return"string"==typeof t?t:t(e,n,r)}(n,r,i))||this}return r=e,(n=i).prototype=Object.create(r.prototype),n.prototype.constructor=n,n.__proto__=r,i}(n);r.prototype.name=n.name,r.prototype.code=e,Nf[e]=r}function Bf(e,t){if(Array.isArray(e)){var n=e.length;return e=e.map((function(e){return String(e)})),n>2?"one of ".concat(t," ").concat(e.slice(0,n-1).join(", "),", or ")+e[n-1]:2===n?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}Df("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),Df("ERR_INVALID_ARG_TYPE",(function(e,t,n){var r,i,o;if("string"==typeof t&&(i="not ",t.substr(0,4)===i)?(r="must not be",t=t.replace(/^not /,"")):r="must be",function(e,t,n){return(void 0===n||n>e.length)&&(n=e.length),e.substring(n-9,n)===t}(e," argument"))o="The ".concat(e," ").concat(r," ").concat(Bf(t,"type"));else{var a=function(e,t,n){return"number"!=typeof n&&(n=0),!(n+1>e.length)&&-1!==e.indexOf(".",n)}(e)?"property":"argument";o='The "'.concat(e,'" ').concat(a," ").concat(r," ").concat(Bf(t,"type"))}return o+". Received type ".concat(typeof n)}),TypeError),Df("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),Df("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),Df("ERR_STREAM_PREMATURE_CLOSE","Premature close"),Df("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),Df("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),Df("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),Df("ERR_STREAM_WRITE_AFTER_END","write after end"),Df("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),Df("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),Df("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),If.codes=Nf;var jf,Uf,zf,Ff,qf=If.codes.ERR_INVALID_OPT_VALUE,Wf={getHighWaterMark:function(e,t,n,r){var i=function(e,t,n){return null!=e.highWaterMark?e.highWaterMark:t?e[n]:null}(t,r,n);if(null!=i){if(!isFinite(i)||Math.floor(i)!==i||i<0)throw new qf(r?n:"highWaterMark",i);return Math.floor(i)}return e.objectMode?16:16384}};function Vf(){if(Uf)return jf;function e(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,n){var r=e.entry;for(e.entry=null;r;){var i=r.callback;t.pendingcb--,i(void 0),r=r.next}t.corkedRequestsFree.next=e}(t,e)}}var t;Uf=1,jf=A,A.WritableState=w;var n,r={deprecate:fo()},i=Rf,o=yr.Buffer,a=(void 0!==hr?hr:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},s=Lf,u=Wf.getHighWaterMark,l=If.codes,c=l.ERR_INVALID_ARG_TYPE,d=l.ERR_METHOD_NOT_IMPLEMENTED,f=l.ERR_MULTIPLE_CALLBACK,h=l.ERR_STREAM_CANNOT_PIPE,p=l.ERR_STREAM_DESTROYED,m=l.ERR_STREAM_NULL_VALUES,g=l.ERR_STREAM_WRITE_AFTER_END,v=l.ERR_UNKNOWN_ENCODING,y=s.errorOrDestroy;function b(){}function w(n,r,i){t=t||Kf(),n=n||{},"boolean"!=typeof i&&(i=r instanceof t),this.objectMode=!!n.objectMode,i&&(this.objectMode=this.objectMode||!!n.writableObjectMode),this.highWaterMark=u(this,n,"writableHighWaterMark",i),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var o=!1===n.decodeStrings;this.decodeStrings=!o,this.defaultEncoding=n.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,i=n.writecb;if("function"!=typeof i)throw new f;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,i){--t.pendingcb,n?(Tr(i,r),Tr(C,e,t),e._writableState.errorEmitted=!0,y(e,r)):(i(r),e._writableState.errorEmitted=!0,y(e,r),C(e,t))}(e,n,r,t,i);else{var o=k(n)||e.destroyed;o||n.corked||n.bufferProcessing||!n.bufferedRequest||S(e,n),r?Tr(E,e,n,o,i):E(e,n,o,i)}}(r,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==n.emitClose,this.autoDestroy=!!n.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}function A(e){var r=this instanceof(t=t||Kf());if(!r&&!n.call(A,this))return new A(e);this._writableState=new w(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)),i.call(this)}function _(e,t,n,r,i,o,a){t.writelen=r,t.writecb=a,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new p("write")):n?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function E(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),C(e,t)}function S(t,n){n.bufferProcessing=!0;var r=n.bufferedRequest;if(t._writev&&r&&r.next){var i=n.bufferedRequestCount,o=new Array(i),a=n.corkedRequestsFree;a.entry=r;for(var s=0,u=!0;r;)o[s]=r,r.isBuf||(u=!1),r=r.next,s+=1;o.allBuffers=u,_(t,n,!0,n.length,o,"",a.finish),n.pendingcb++,n.lastBufferedRequest=null,a.next?(n.corkedRequestsFree=a.next,a.next=null):n.corkedRequestsFree=new e(n),n.bufferedRequestCount=0}else{for(;r;){var l=r.chunk,c=r.encoding,d=r.callback;if(_(t,n,!1,n.objectMode?1:l.length,l,c,d),r=r.next,n.bufferedRequestCount--,n.writing)break}null===r&&(n.lastBufferedRequest=null)}n.bufferedRequest=r,n.bufferProcessing=!1}function k(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function M(e,t){e._final((function(n){t.pendingcb--,n&&y(e,n),t.prefinished=!0,e.emit("prefinish"),C(e,t)}))}function C(e,t){var n=k(t);if(n&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,Tr(M,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var r=e._readableState;(!r||r.autoDestroy&&r.endEmitted)&&e.destroy()}return n}return Jr(A,i),w.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(w.prototype,"buffer",{get:r.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(n=Function.prototype[Symbol.hasInstance],Object.defineProperty(A,Symbol.hasInstance,{value:function(e){return!!n.call(this,e)||this===A&&e&&e._writableState instanceof w}})):n=function(e){return e instanceof this},A.prototype.pipe=function(){y(this,new h)},A.prototype.write=function(e,t,n){var r,i=this._writableState,s=!1,u=!i.objectMode&&(r=e,o.isBuffer(r)||r instanceof a);return u&&!o.isBuffer(e)&&(e=function(e){return o.from(e)}(e)),"function"==typeof t&&(n=t,t=null),u?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof n&&(n=b),i.ending?function(e,t){var n=new g;y(e,n),Tr(t,n)}(this,n):(u||function(e,t,n,r){var i;return null===n?i=new m:"string"==typeof n||t.objectMode||(i=new c("chunk",["string","Buffer"],n)),!i||(y(e,i),Tr(r,i),!1)}(this,i,e,n))&&(i.pendingcb++,s=function(e,t,n,r,i,a){if(!n){var s=function(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=o.from(t,n)),t}(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var u=t.objectMode?1:r.length;t.length+=u;var l=t.length<t.highWaterMark;if(l||(t.needDrain=!0),t.writing||t.corked){var c=t.lastBufferedRequest;t.lastBufferedRequest={chunk:r,encoding:i,isBuf:n,callback:a,next:null},c?c.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else _(e,t,!1,u,r,i,a);return l}(this,i,u,e,t,n)),s},A.prototype.cork=function(){this._writableState.corked++},A.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||S(this,e))},A.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 v(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(A.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(A.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),A.prototype._write=function(e,t,n){n(new d("_write()"))},A.prototype._writev=null,A.prototype.end=function(e,t,n){var r=this._writableState;return"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||function(e,t,n){t.ending=!0,C(e,t),n&&(t.finished?Tr(n):e.once("finish",n)),t.ended=!0,e.writable=!1}(this,r,n),this},Object.defineProperty(A.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(A.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),A.prototype.destroy=s.destroy,A.prototype._undestroy=s.undestroy,A.prototype._destroy=function(e,t){t(e)},jf}function Kf(){if(Ff)return zf;Ff=1;var e=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};zf=a;var t=ih(),n=Vf();Jr(a,t);for(var r=e(n.prototype),i=0;i<r.length;i++){var o=r[i];a.prototype[o]||(a.prototype[o]=n.prototype[o])}function a(e){if(!(this instanceof a))return new a(e);t.call(this,e),n.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",s)))}function s(){this._writableState.ended||Tr(u,this)}function u(e){e.end()}return Object.defineProperty(a.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(a.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(a.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(a.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._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)}}),zf}var Hf,$f={};function Yf(){if(Hf)return $f;Hf=1;var e=$r.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 n(n){var r;switch(this.encoding=function(n){var r=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}}(n);if("string"!=typeof r&&(e.isEncoding===t||!t(n)))throw new Error("Unknown encoding: "+n);return r||n}(n),this.encoding){case"utf16le":this.text=o,this.end=a,r=4;break;case"utf8":this.fillLast=i,r=4;break;case"base64":this.text=s,this.end=u,r=3;break;default:return this.write=l,void(this.end=c)}this.lastNeed=0,this.lastTotal=0,this.lastChar=e.allocUnsafe(r)}function r(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,n=function(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function o(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function a(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function s(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function u(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 c(e){return e&&e.length?this.write(e):""}return $f.StringDecoder=n,n.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||""},n.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},n.prototype.text=function(e,t){var n=function(e,t,n){var i=t.length-1;if(i<n)return 0;var o=r(t[i]);return o>=0?(o>0&&(e.lastNeed=o-1),o):--i<n||-2===o?0:(o=r(t[i]))>=0?(o>0&&(e.lastNeed=o-2),o):--i<n||-2===o?0:(o=r(t[i]))>=0?(o>0&&(2===o?o=0:e.lastNeed=o-3),o):0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var i=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,i),e.toString("utf8",t,i)},n.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length},$f}var Gf=If.codes.ERR_STREAM_PREMATURE_CLOSE;function Qf(){}var Zf,Xf,Jf,eh,th,nh,rh=function e(t,n,r){if("function"==typeof n)return e(t,null,n);n||(n={}),r=function(e){var t=!1;return function(){if(!t){t=!0;for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];e.apply(this,r)}}}(r||Qf);var i=n.readable||!1!==n.readable&&t.readable,o=n.writable||!1!==n.writable&&t.writable,a=function(){t.writable||u()},s=t._writableState&&t._writableState.finished,u=function(){o=!1,s=!0,i||r.call(t)},l=t._readableState&&t._readableState.endEmitted,c=function(){i=!1,l=!0,o||r.call(t)},d=function(e){r.call(t,e)},f=function(){var e;return i&&!l?(t._readableState&&t._readableState.ended||(e=new Gf),r.call(t,e)):o&&!s?(t._writableState&&t._writableState.ended||(e=new Gf),r.call(t,e)):void 0},h=function(){t.req.on("finish",u)};return function(e){return e.setHeader&&"function"==typeof e.abort}(t)?(t.on("complete",u),t.on("abort",f),t.req?h():t.on("request",h)):o&&!t._writableState&&(t.on("end",a),t.on("close",a)),t.on("end",c),t.on("finish",u),!1!==n.error&&t.on("error",d),t.on("close",f),function(){t.removeListener("complete",u),t.removeListener("abort",f),t.removeListener("request",h),t.req&&t.req.removeListener("finish",u),t.removeListener("end",a),t.removeListener("close",a),t.removeListener("finish",u),t.removeListener("end",c),t.removeListener("error",d),t.removeListener("close",f)}};function ih(){if(nh)return th;var e;nh=1,th=A,A.ReadableState=w,ui.EventEmitter;var t,n=function(e,t){return e.listeners(t).length},r=Rf,i=yr.Buffer,o=(void 0!==hr?hr:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},a=Yi;t=a&&a.debuglog?a.debuglog("stream"):function(){};var s,u,l,c=function(){if(Mf)return kf;function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function t(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?e(Object(i),!0).forEach((function(e){n(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 n(e,t,n){return(t=i(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,i(r.key),r)}}function i(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}Mf=1;var o=yr.Buffer,a=Yi.inspect,s=a&&a.custom||"inspect";return kf=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 n,i;return n=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,n=""+t.data;t=t.next;)n+=e+t.data;return n}},{key:"concat",value:function(e){if(0===this.length)return o.alloc(0);for(var t,n,r,i=o.allocUnsafe(e>>>0),a=this.head,s=0;a;)t=a.data,n=i,r=s,o.prototype.copy.call(t,n,r),s+=a.data.length,a=a.next;return i}},{key:"consume",value:function(e,t){var n;return e<this.head.data.length?(n=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):n=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),n}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,n=1,r=t.data;for(e-=r.length;t=t.next;){var i=t.data,o=e>i.length?i.length:e;if(o===i.length?r+=i:r+=i.slice(0,e),0==(e-=o)){o===i.length?(++n,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(e){var t=o.allocUnsafe(e),n=this.head,r=1;for(n.data.copy(t),e-=n.data.length;n=n.next;){var i=n.data,a=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,a),0==(e-=a)){a===i.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=i.slice(a));break}++r}return this.length-=r,t}},{key:s,value:function(e,n){return a(this,t(t({},n),{},{depth:0,customInspect:!1}))}}],i&&r(n.prototype,i),Object.defineProperty(n,"prototype",{writable:!1}),e}(),kf}(),d=Lf,f=Wf.getHighWaterMark,h=If.codes,p=h.ERR_INVALID_ARG_TYPE,m=h.ERR_STREAM_PUSH_AFTER_EOF,g=h.ERR_METHOD_NOT_IMPLEMENTED,v=h.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;Jr(A,r);var y=d.errorOrDestroy,b=["error","close","destroy","pause","resume"];function w(t,n,r){e=e||Kf(),t=t||{},"boolean"!=typeof r&&(r=n instanceof e),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=f(this,t,"readableHighWaterMark",r),this.buffer=new c,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&&(s||(s=Yf().StringDecoder),this.decoder=new s(t.encoding),this.encoding=t.encoding)}function A(t){if(e=e||Kf(),!(this instanceof A))return new A(t);var n=this instanceof e;this._readableState=new w(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 _(e,n,r,a,s){t("readableAddChunk",n);var u,l=e._readableState;if(null===n)l.reading=!1,function(e,n){if(t("onEofChunk"),!n.ended){if(n.decoder){var r=n.decoder.end();r&&r.length&&(n.buffer.push(r),n.length+=n.objectMode?1:r.length)}n.ended=!0,n.sync?M(e):(n.needReadable=!1,n.emittedReadable||(n.emittedReadable=!0,C(e)))}}(e,l);else if(s||(u=function(e,t){var n,r;return r=t,i.isBuffer(r)||r instanceof o||"string"==typeof t||void 0===t||e.objectMode||(n=new p("chunk",["string","Buffer","Uint8Array"],t)),n}(l,n)),u)y(e,u);else if(l.objectMode||n&&n.length>0)if("string"==typeof n||l.objectMode||Object.getPrototypeOf(n)===i.prototype||(n=function(e){return i.from(e)}(n)),a)l.endEmitted?y(e,new v):E(e,l,n,!0);else if(l.ended)y(e,new m);else{if(l.destroyed)return!1;l.reading=!1,l.decoder&&!r?(n=l.decoder.write(n),l.objectMode||0!==n.length?E(e,l,n,!1):x(e,l)):E(e,l,n,!1)}else a||(l.reading=!1,x(e,l));return!l.ended&&(l.length<l.highWaterMark||0===l.length)}function E(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",n)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&M(e)),x(e,t)}Object.defineProperty(A.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),A.prototype.destroy=d.destroy,A.prototype._undestroy=d.undestroy,A.prototype._destroy=function(e,t){t(e)},A.prototype.push=function(e,t){var n,r=this._readableState;return r.objectMode?n=!0:"string"==typeof e&&((t=t||r.defaultEncoding)!==r.encoding&&(e=i.from(e,t),t=""),n=!0),_(this,e,t,!1,n)},A.prototype.unshift=function(e){return _(this,e,null,!0,!1)},A.prototype.isPaused=function(){return!1===this._readableState.flowing},A.prototype.setEncoding=function(e){s||(s=Yf().StringDecoder);var t=new s(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,r="";null!==n;)r+=t.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==r&&this._readableState.buffer.push(r),this._readableState.length=r.length,this};var S=1073741824;function k(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>=S?e=S:(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 M(e){var n=e._readableState;t("emitReadable",n.needReadable,n.emittedReadable),n.needReadable=!1,n.emittedReadable||(t("emitReadable",n.flowing),n.emittedReadable=!0,Tr(C,e))}function C(e){var n=e._readableState;t("emitReadable_",n.destroyed,n.length,n.ended),n.destroyed||!n.length&&!n.ended||(e.emit("readable"),n.emittedReadable=!1),n.needReadable=!n.flowing&&!n.ended&&n.length<=n.highWaterMark,L(e)}function x(e,t){t.readingMore||(t.readingMore=!0,Tr(R,e,t))}function R(e,n){for(;!n.reading&&!n.ended&&(n.length<n.highWaterMark||n.flowing&&0===n.length);){var r=n.length;if(t("maybeReadMore read 0"),e.read(0),r===n.length)break}n.readingMore=!1}function O(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 T(e){t("readable nexttick read 0"),e.read(0)}function P(e,n){t("resume",n.reading),n.reading||e.read(0),n.resumeScheduled=!1,e.emit("resume"),L(e),n.flowing&&!n.reading&&e.read(0)}function L(e){var n=e._readableState;for(t("flow",n.flowing);n.flowing&&null!==e.read(););}function I(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n);var n}function N(e){var n=e._readableState;t("endReadable",n.endEmitted),n.endEmitted||(n.ended=!0,Tr(D,n,e))}function D(e,n){if(t("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,n.readable=!1,n.emit("end"),e.autoDestroy)){var r=n._writableState;(!r||r.autoDestroy&&r.finished)&&n.destroy()}}function B(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}return A.prototype.read=function(e){t("read",e),e=parseInt(e,10);var n=this._readableState,r=e;if(0!==e&&(n.emittedReadable=!1),0===e&&n.needReadable&&((0!==n.highWaterMark?n.length>=n.highWaterMark:n.length>0)||n.ended))return t("read: emitReadable",n.length,n.ended),0===n.length&&n.ended?N(this):M(this),null;if(0===(e=k(e,n))&&n.ended)return 0===n.length&&N(this),null;var i,o=n.needReadable;return t("need readable",o),(0===n.length||n.length-e<n.highWaterMark)&&t("length less than watermark",o=!0),n.ended||n.reading?t("reading or ended",o=!1):o&&(t("do read"),n.reading=!0,n.sync=!0,0===n.length&&(n.needReadable=!0),this._read(n.highWaterMark),n.sync=!1,n.reading||(e=k(r,n))),null===(i=e>0?I(e,n):null)?(n.needReadable=n.length<=n.highWaterMark,e=0):(n.length-=e,n.awaitDrain=0),0===n.length&&(n.ended||(n.needReadable=!0),r!==e&&n.ended&&N(this)),null!==i&&this.emit("data",i),i},A.prototype._read=function(e){y(this,new g("_read()"))},A.prototype.pipe=function(e,r){var i=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,t("pipe count=%d opts=%j",o.pipesCount,r);var a=r&&!1===r.end||e===Vr.stdout||e===Vr.stderr?p:s;function s(){t("onend"),e.end()}o.endEmitted?Tr(a):i.once("end",a),e.on("unpipe",(function n(r,a){t("onunpipe"),r===i&&a&&!1===a.hasUnpiped&&(a.hasUnpiped=!0,t("cleanup"),e.removeListener("close",f),e.removeListener("finish",h),e.removeListener("drain",u),e.removeListener("error",d),e.removeListener("unpipe",n),i.removeListener("end",s),i.removeListener("end",p),i.removeListener("data",c),l=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||u())}));var u=function(e){return function(){var r=e._readableState;t("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,0===r.awaitDrain&&n(e,"data")&&(r.flowing=!0,L(e))}}(i);e.on("drain",u);var l=!1;function c(n){t("ondata");var r=e.write(n);t("dest.write",r),!1===r&&((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==B(o.pipes,e))&&!l&&(t("false write response, pause",o.awaitDrain),o.awaitDrain++),i.pause())}function d(r){t("onerror",r),p(),e.removeListener("error",d),0===n(e,"error")&&y(e,r)}function f(){e.removeListener("finish",h),p()}function h(){t("onfinish"),e.removeListener("close",f),p()}function p(){t("unpipe"),i.unpipe(e)}return i.on("data",c),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",d),e.once("close",f),e.once("finish",h),e.emit("pipe",i),o.flowing||(t("pipe resume"),i.resume()),e},A.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n)),this;if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<i;o++)r[o].emit("unpipe",this,{hasUnpiped:!1});return this}var a=B(t.pipes,e);return-1===a||(t.pipes.splice(a,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,n)),this},A.prototype.on=function(e,n){var i=r.prototype.on.call(this,e,n),o=this._readableState;return"data"===e?(o.readableListening=this.listenerCount("readable")>0,!1!==o.flowing&&this.resume()):"readable"===e&&(o.endEmitted||o.readableListening||(o.readableListening=o.needReadable=!0,o.flowing=!1,o.emittedReadable=!1,t("on readable",o.length,o.reading),o.length?M(this):o.reading||Tr(T,this))),i},A.prototype.addListener=A.prototype.on,A.prototype.removeListener=function(e,t){var n=r.prototype.removeListener.call(this,e,t);return"readable"===e&&Tr(O,this),n},A.prototype.removeAllListeners=function(e){var t=r.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||Tr(O,this),t},A.prototype.resume=function(){var e=this._readableState;return e.flowing||(t("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,Tr(P,e,t))}(this,e)),e.paused=!1,this},A.prototype.pause=function(){return t("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(t("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},A.prototype.wrap=function(e){var n=this,r=this._readableState,i=!1;for(var o in e.on("end",(function(){if(t("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&n.push(e)}n.push(null)})),e.on("data",(function(o){t("wrapped data"),r.decoder&&(o=r.decoder.write(o)),r.objectMode&&null==o||(r.objectMode||o&&o.length)&&(n.push(o)||(i=!0,e.pause()))})),e)void 0===this[o]&&"function"==typeof e[o]&&(this[o]=function(t){return function(){return e[t].apply(e,arguments)}}(o));for(var a=0;a<b.length;a++)e.on(b[a],this.emit.bind(this,b[a]));return this._read=function(n){t("wrapped _read",n),i&&(i=!1,e.resume())},this},"function"==typeof Symbol&&(A.prototype[Symbol.asyncIterator]=function(){return void 0===u&&(u=function(){if(Xf)return Zf;var e;function t(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Xf=1;var n=rh,r=Symbol("lastResolve"),i=Symbol("lastReject"),o=Symbol("error"),a=Symbol("ended"),s=Symbol("lastPromise"),u=Symbol("handlePromise"),l=Symbol("stream");function c(e,t){return{value:e,done:t}}function d(e){var t=e[r];if(null!==t){var n=e[l].read();null!==n&&(e[s]=null,e[r]=null,e[i]=null,t(c(n,!1)))}}function f(e){Tr(d,e)}var h=Object.getPrototypeOf((function(){})),p=Object.setPrototypeOf((t(e={get stream(){return this[l]},next:function(){var e=this,t=this[o];if(null!==t)return Promise.reject(t);if(this[a])return Promise.resolve(c(void 0,!0));if(this[l].destroyed)return new Promise((function(t,n){Tr((function(){e[o]?n(e[o]):t(c(void 0,!0))}))}));var n,r=this[s];if(r)n=new Promise(function(e,t){return function(n,r){e.then((function(){t[a]?n(c(void 0,!0)):t[u](n,r)}),r)}}(r,this));else{var i=this[l].read();if(null!==i)return Promise.resolve(c(i,!1));n=new Promise(this[u])}return this[s]=n,n}},Symbol.asyncIterator,(function(){return this})),t(e,"return",(function(){var e=this;return new Promise((function(t,n){e[l].destroy(null,(function(e){e?n(e):t(c(void 0,!0))}))}))})),e),h);return Zf=function(e){var d,h=Object.create(p,(t(d={},l,{value:e,writable:!0}),t(d,r,{value:null,writable:!0}),t(d,i,{value:null,writable:!0}),t(d,o,{value:null,writable:!0}),t(d,a,{value:e._readableState.endEmitted,writable:!0}),t(d,u,{value:function(e,t){var n=h[l].read();n?(h[s]=null,h[r]=null,h[i]=null,e(c(n,!1))):(h[r]=e,h[i]=t)},writable:!0}),d));return h[s]=null,n(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=h[i];return null!==t&&(h[s]=null,h[r]=null,h[i]=null,t(e)),void(h[o]=e)}var n=h[r];null!==n&&(h[s]=null,h[r]=null,h[i]=null,n(c(void 0,!0))),h[a]=!0})),e.on("readable",f.bind(null,h)),h},Zf}()),u(this)}),Object.defineProperty(A.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(A.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(A.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),A._fromList=I,Object.defineProperty(A.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(A.from=function(e,t){return void 0===l&&(l=eh?Jf:(eh=1,Jf=function(){throw new Error("Readable.from is not available in the browser")})),l(A,e,t)}),th}var oh=hh,ah=If.codes,sh=ah.ERR_METHOD_NOT_IMPLEMENTED,uh=ah.ERR_MULTIPLE_CALLBACK,lh=ah.ERR_TRANSFORM_ALREADY_TRANSFORMING,ch=ah.ERR_TRANSFORM_WITH_LENGTH_0,dh=Kf();function fh(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(null===r)return this.emit("error",new uh);n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function hh(e){if(!(this instanceof hh))return new hh(e);dh.call(this,e),this._transformState={afterTransform:fh.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",ph)}function ph(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?mh(this,null,null):this._flush((function(t,n){mh(e,t,n)}))}function mh(e,t,n){if(t)return e.emit("error",t);if(null!=n&&e.push(n),e._writableState.length)throw new ch;if(e._transformState.transforming)throw new lh;return e.push(null)}Jr(hh,dh),hh.prototype.push=function(e,t){return this._transformState.needTransform=!1,dh.prototype.push.call(this,e,t)},hh.prototype._transform=function(e,t,n){n(new sh("_transform()"))},hh.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},hh.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))},hh.prototype._destroy=function(e,t){dh.prototype._destroy.call(this,e,(function(e){t(e)}))};var gh,vh=bh,yh=oh;function bh(e){if(!(this instanceof bh))return new bh(e);yh.call(this,e)}Jr(bh,yh),bh.prototype._transform=function(e,t,n){n(null,e)};var wh=If.codes,Ah=wh.ERR_MISSING_ARGS,_h=wh.ERR_STREAM_DESTROYED;function Eh(e){if(e)throw e}function Sh(e){e()}function kh(e,t){return e.pipe(t)}var Mh=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r,i=function(e){return e.length?"function"!=typeof e[e.length-1]?Eh:e.pop():Eh}(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new Ah("streams");var o=t.map((function(e,n){var a=n<t.length-1;return function(e,t,n,r){r=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(r);var i=!1;e.on("close",(function(){i=!0})),void 0===gh&&(gh=rh),gh(e,{readable:t,writable:n},(function(e){if(e)return r(e);i=!0,r()}));var o=!1;return function(t){if(!i&&!o)return o=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void r(t||new _h("pipe"))}}(e,a,n>0,(function(e){r||(r=e),e&&o.forEach(Sh),a||(o.forEach(Sh),i(r))}))}));return t.reduce(kh)};!function(e,t){(t=xf.exports=ih()).Stream=t,t.Readable=t,t.Writable=Vf(),t.Duplex=Kf(),t.Transform=oh,t.PassThrough=vh,t.finished=rh,t.pipeline=Mh}(0,xf.exports);var Ch=xf.exports,xh={exports:{}},Rh={exports:{}};!function(e,t){function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function r(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function i(e,t,n){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}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:yr.Buffer}catch(e){}function a(e,t){var r=e.charCodeAt(t);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+e)}function s(e,t,n){var r=a(e,n);return n-1>=t&&(r|=a(e,n-1)<<4),r}function u(e,t,r,i){for(var o=0,a=0,s=Math.min(e.length,r),u=t;u<s;u++){var l=e.charCodeAt(u)-48;o*=i,a=l>=49?l-49+10:l>=17?l-17+10:l,n(l>=0&&a<i,"Invalid character"),o+=a}return o}function l(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,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<e.length&&(16===t?this._parseHex(e,i,r):(this._parseBase(e,t,i),"le"===r&&this._initArray(this.toArray(),t,r)))},i.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(n(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},i.prototype._initArray=function(e,t,r){if(n("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===r)for(i=e.length-1,o=0;i>=0;i-=3)a=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i<e.length;i+=3)a=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},i.prototype._parseHex=function(e,t,n){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 i,o=0,a=0;if("be"===n)for(r=e.length-1;r>=t;r-=2)i=s(e,t,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(e.length-t)%2==0?t+1:t;r<e.length;r+=2)i=s(e,t,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,a=o%r,s=Math.min(o,o-a)+n,l=0,c=n;c<s;c+=r)l=u(e,c,c+r,t),this.imuln(i),this.words[0]+l<67108864?this.words[0]+=l:this._iaddn(l);if(0!==a){var d=1;for(l=u(e,c,e.length,t),c=0;c<a;c++)d*=t;this.imuln(d),this.words[0]+l<67108864?this.words[0]+=l:this._iaddn(l)}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){l(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")]=c}catch(e){i.prototype.inspect=c}else i.prototype.inspect=c;function c(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function p(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var l=1;l<r;l++){for(var c=u>>>26,d=67108863&u,f=Math.min(l,t.length-1),h=Math.max(0,l-e.length+1);h<=f;h++){var p=l-h|0;c+=(a=(i=0|e.words[p])*(o=0|t.words[h])+d)/67108864|0,d=67108863&a}n.words[l]=0|d,u=0|c}return 0!==u?n.words[l]=0|u:n.length--,n._strip()}i.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<i|o)).toString(16);o=s>>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),r=0!==o||a!==this.length-1?d[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=f[e],c=h[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modrn(c).toString(e);r=(p=p.idivn(c)).isZero()?m+r:d[l-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16,2)},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,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var a=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,o);return this["_toArrayLike"+("le"===t?"LE":"BE")](a,i),a},i.prototype._toArrayLikeLE=function(e,t){for(var n=0,r=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|r;e[n++]=255&a,n<e.length&&(e[n++]=a>>8&255),n<e.length&&(e[n++]=a>>16&255),6===o?(n<e.length&&(e[n++]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n<e.length)for(e[n++]=r;n<e.length;)e[n++]=0},i.prototype._toArrayLikeBE=function(e,t){for(var n=e.length-1,r=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|r;e[n--]=255&a,n>=0&&(e[n--]=a>>8&255),n>=0&&(e[n--]=a>>16&255),6===o?(n>=0&&(e[n--]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n>=0)for(e[n--]=r;n>=0;)e[n--]=0},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var n=this._zeroBits(this.words[t]);if(e+=n,26!==n)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 n(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 n=0;n<t.length;n++)this.words[n]=this.words[n]&e.words[n];return this.length=t.length,this._strip()},i.prototype.iand=function(e){return n(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,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;r<n.length;r++)this.words[r]=t.words[r]^n.words[r];if(this!==t)for(;r<t.length;r++)this.words[r]=t.words[r];return this.length=t.length,this._strip()},i.prototype.ixor=function(e){return n(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){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i<t;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<<i:this.words[r]&~(1<<i),this._strip()},i.prototype.iadd=function(e){var t,n,r;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?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o<r.length;o++)t=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&t,i=t>>>26;for(;0!==i&&o<n.length;o++)t=(0|n.words[o])+i,this.words[o]=67108863&t,i=t>>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;o<n.length;o++)this.words[o]=n.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 n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,a=0;a<r.length;a++)o=(t=(0|n.words[a])-(0|r.words[a])+o)>>26,this.words[a]=67108863&t;for(;0!==o&&a<n.length;a++)o=(t=(0|n.words[a])+o)>>26,this.words[a]=67108863&t;if(0===o&&a<n.length&&n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this.length=Math.max(this.length,a),n!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(e){return this.clone().isub(e)};var m=function(e,t,n){var r,i,o,a=e.words,s=t.words,u=n.words,l=0,c=0|a[0],d=8191&c,f=c>>>13,h=0|a[1],p=8191&h,m=h>>>13,g=0|a[2],v=8191&g,y=g>>>13,b=0|a[3],w=8191&b,A=b>>>13,_=0|a[4],E=8191&_,S=_>>>13,k=0|a[5],M=8191&k,C=k>>>13,x=0|a[6],R=8191&x,O=x>>>13,T=0|a[7],P=8191&T,L=T>>>13,I=0|a[8],N=8191&I,D=I>>>13,B=0|a[9],j=8191&B,U=B>>>13,z=0|s[0],F=8191&z,q=z>>>13,W=0|s[1],V=8191&W,K=W>>>13,H=0|s[2],$=8191&H,Y=H>>>13,G=0|s[3],Q=8191&G,Z=G>>>13,X=0|s[4],J=8191&X,ee=X>>>13,te=0|s[5],ne=8191&te,re=te>>>13,ie=0|s[6],oe=8191&ie,ae=ie>>>13,se=0|s[7],ue=8191&se,le=se>>>13,ce=0|s[8],de=8191&ce,fe=ce>>>13,he=0|s[9],pe=8191&he,me=he>>>13;n.negative=e.negative^t.negative,n.length=19;var ge=(l+(r=Math.imul(d,F))|0)+((8191&(i=(i=Math.imul(d,q))+Math.imul(f,F)|0))<<13)|0;l=((o=Math.imul(f,q))+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,r=Math.imul(p,F),i=(i=Math.imul(p,q))+Math.imul(m,F)|0,o=Math.imul(m,q);var ve=(l+(r=r+Math.imul(d,V)|0)|0)+((8191&(i=(i=i+Math.imul(d,K)|0)+Math.imul(f,V)|0))<<13)|0;l=((o=o+Math.imul(f,K)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,r=Math.imul(v,F),i=(i=Math.imul(v,q))+Math.imul(y,F)|0,o=Math.imul(y,q),r=r+Math.imul(p,V)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,K)|0;var ye=(l+(r=r+Math.imul(d,$)|0)|0)+((8191&(i=(i=i+Math.imul(d,Y)|0)+Math.imul(f,$)|0))<<13)|0;l=((o=o+Math.imul(f,Y)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,r=Math.imul(w,F),i=(i=Math.imul(w,q))+Math.imul(A,F)|0,o=Math.imul(A,q),r=r+Math.imul(v,V)|0,i=(i=i+Math.imul(v,K)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,K)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,Y)|0;var be=(l+(r=r+Math.imul(d,Q)|0)|0)+((8191&(i=(i=i+Math.imul(d,Z)|0)+Math.imul(f,Q)|0))<<13)|0;l=((o=o+Math.imul(f,Z)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(E,F),i=(i=Math.imul(E,q))+Math.imul(S,F)|0,o=Math.imul(S,q),r=r+Math.imul(w,V)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(A,V)|0,o=o+Math.imul(A,K)|0,r=r+Math.imul(v,$)|0,i=(i=i+Math.imul(v,Y)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,Y)|0,r=r+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,Z)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,Z)|0;var we=(l+(r=r+Math.imul(d,J)|0)|0)+((8191&(i=(i=i+Math.imul(d,ee)|0)+Math.imul(f,J)|0))<<13)|0;l=((o=o+Math.imul(f,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(M,F),i=(i=Math.imul(M,q))+Math.imul(C,F)|0,o=Math.imul(C,q),r=r+Math.imul(E,V)|0,i=(i=i+Math.imul(E,K)|0)+Math.imul(S,V)|0,o=o+Math.imul(S,K)|0,r=r+Math.imul(w,$)|0,i=(i=i+Math.imul(w,Y)|0)+Math.imul(A,$)|0,o=o+Math.imul(A,Y)|0,r=r+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,Z)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,Z)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,ee)|0;var Ae=(l+(r=r+Math.imul(d,ne)|0)|0)+((8191&(i=(i=i+Math.imul(d,re)|0)+Math.imul(f,ne)|0))<<13)|0;l=((o=o+Math.imul(f,re)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(R,F),i=(i=Math.imul(R,q))+Math.imul(O,F)|0,o=Math.imul(O,q),r=r+Math.imul(M,V)|0,i=(i=i+Math.imul(M,K)|0)+Math.imul(C,V)|0,o=o+Math.imul(C,K)|0,r=r+Math.imul(E,$)|0,i=(i=i+Math.imul(E,Y)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,Y)|0,r=r+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,Z)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,Z)|0,r=r+Math.imul(v,J)|0,i=(i=i+Math.imul(v,ee)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,ee)|0,r=r+Math.imul(p,ne)|0,i=(i=i+Math.imul(p,re)|0)+Math.imul(m,ne)|0,o=o+Math.imul(m,re)|0;var _e=(l+(r=r+Math.imul(d,oe)|0)|0)+((8191&(i=(i=i+Math.imul(d,ae)|0)+Math.imul(f,oe)|0))<<13)|0;l=((o=o+Math.imul(f,ae)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,r=Math.imul(P,F),i=(i=Math.imul(P,q))+Math.imul(L,F)|0,o=Math.imul(L,q),r=r+Math.imul(R,V)|0,i=(i=i+Math.imul(R,K)|0)+Math.imul(O,V)|0,o=o+Math.imul(O,K)|0,r=r+Math.imul(M,$)|0,i=(i=i+Math.imul(M,Y)|0)+Math.imul(C,$)|0,o=o+Math.imul(C,Y)|0,r=r+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,Z)|0)+Math.imul(S,Q)|0,o=o+Math.imul(S,Z)|0,r=r+Math.imul(w,J)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(A,J)|0,o=o+Math.imul(A,ee)|0,r=r+Math.imul(v,ne)|0,i=(i=i+Math.imul(v,re)|0)+Math.imul(y,ne)|0,o=o+Math.imul(y,re)|0,r=r+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,ae)|0)+Math.imul(m,oe)|0,o=o+Math.imul(m,ae)|0;var Ee=(l+(r=r+Math.imul(d,ue)|0)|0)+((8191&(i=(i=i+Math.imul(d,le)|0)+Math.imul(f,ue)|0))<<13)|0;l=((o=o+Math.imul(f,le)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(N,F),i=(i=Math.imul(N,q))+Math.imul(D,F)|0,o=Math.imul(D,q),r=r+Math.imul(P,V)|0,i=(i=i+Math.imul(P,K)|0)+Math.imul(L,V)|0,o=o+Math.imul(L,K)|0,r=r+Math.imul(R,$)|0,i=(i=i+Math.imul(R,Y)|0)+Math.imul(O,$)|0,o=o+Math.imul(O,Y)|0,r=r+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,Z)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,Z)|0,r=r+Math.imul(E,J)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(S,J)|0,o=o+Math.imul(S,ee)|0,r=r+Math.imul(w,ne)|0,i=(i=i+Math.imul(w,re)|0)+Math.imul(A,ne)|0,o=o+Math.imul(A,re)|0,r=r+Math.imul(v,oe)|0,i=(i=i+Math.imul(v,ae)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,ae)|0,r=r+Math.imul(p,ue)|0,i=(i=i+Math.imul(p,le)|0)+Math.imul(m,ue)|0,o=o+Math.imul(m,le)|0;var Se=(l+(r=r+Math.imul(d,de)|0)|0)+((8191&(i=(i=i+Math.imul(d,fe)|0)+Math.imul(f,de)|0))<<13)|0;l=((o=o+Math.imul(f,fe)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(j,F),i=(i=Math.imul(j,q))+Math.imul(U,F)|0,o=Math.imul(U,q),r=r+Math.imul(N,V)|0,i=(i=i+Math.imul(N,K)|0)+Math.imul(D,V)|0,o=o+Math.imul(D,K)|0,r=r+Math.imul(P,$)|0,i=(i=i+Math.imul(P,Y)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,Y)|0,r=r+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,Z)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,Z)|0,r=r+Math.imul(M,J)|0,i=(i=i+Math.imul(M,ee)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,ee)|0,r=r+Math.imul(E,ne)|0,i=(i=i+Math.imul(E,re)|0)+Math.imul(S,ne)|0,o=o+Math.imul(S,re)|0,r=r+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,ae)|0)+Math.imul(A,oe)|0,o=o+Math.imul(A,ae)|0,r=r+Math.imul(v,ue)|0,i=(i=i+Math.imul(v,le)|0)+Math.imul(y,ue)|0,o=o+Math.imul(y,le)|0,r=r+Math.imul(p,de)|0,i=(i=i+Math.imul(p,fe)|0)+Math.imul(m,de)|0,o=o+Math.imul(m,fe)|0;var ke=(l+(r=r+Math.imul(d,pe)|0)|0)+((8191&(i=(i=i+Math.imul(d,me)|0)+Math.imul(f,pe)|0))<<13)|0;l=((o=o+Math.imul(f,me)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(j,V),i=(i=Math.imul(j,K))+Math.imul(U,V)|0,o=Math.imul(U,K),r=r+Math.imul(N,$)|0,i=(i=i+Math.imul(N,Y)|0)+Math.imul(D,$)|0,o=o+Math.imul(D,Y)|0,r=r+Math.imul(P,Q)|0,i=(i=i+Math.imul(P,Z)|0)+Math.imul(L,Q)|0,o=o+Math.imul(L,Z)|0,r=r+Math.imul(R,J)|0,i=(i=i+Math.imul(R,ee)|0)+Math.imul(O,J)|0,o=o+Math.imul(O,ee)|0,r=r+Math.imul(M,ne)|0,i=(i=i+Math.imul(M,re)|0)+Math.imul(C,ne)|0,o=o+Math.imul(C,re)|0,r=r+Math.imul(E,oe)|0,i=(i=i+Math.imul(E,ae)|0)+Math.imul(S,oe)|0,o=o+Math.imul(S,ae)|0,r=r+Math.imul(w,ue)|0,i=(i=i+Math.imul(w,le)|0)+Math.imul(A,ue)|0,o=o+Math.imul(A,le)|0,r=r+Math.imul(v,de)|0,i=(i=i+Math.imul(v,fe)|0)+Math.imul(y,de)|0,o=o+Math.imul(y,fe)|0;var Me=(l+(r=r+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;l=((o=o+Math.imul(m,me)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,r=Math.imul(j,$),i=(i=Math.imul(j,Y))+Math.imul(U,$)|0,o=Math.imul(U,Y),r=r+Math.imul(N,Q)|0,i=(i=i+Math.imul(N,Z)|0)+Math.imul(D,Q)|0,o=o+Math.imul(D,Z)|0,r=r+Math.imul(P,J)|0,i=(i=i+Math.imul(P,ee)|0)+Math.imul(L,J)|0,o=o+Math.imul(L,ee)|0,r=r+Math.imul(R,ne)|0,i=(i=i+Math.imul(R,re)|0)+Math.imul(O,ne)|0,o=o+Math.imul(O,re)|0,r=r+Math.imul(M,oe)|0,i=(i=i+Math.imul(M,ae)|0)+Math.imul(C,oe)|0,o=o+Math.imul(C,ae)|0,r=r+Math.imul(E,ue)|0,i=(i=i+Math.imul(E,le)|0)+Math.imul(S,ue)|0,o=o+Math.imul(S,le)|0,r=r+Math.imul(w,de)|0,i=(i=i+Math.imul(w,fe)|0)+Math.imul(A,de)|0,o=o+Math.imul(A,fe)|0;var Ce=(l+(r=r+Math.imul(v,pe)|0)|0)+((8191&(i=(i=i+Math.imul(v,me)|0)+Math.imul(y,pe)|0))<<13)|0;l=((o=o+Math.imul(y,me)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,r=Math.imul(j,Q),i=(i=Math.imul(j,Z))+Math.imul(U,Q)|0,o=Math.imul(U,Z),r=r+Math.imul(N,J)|0,i=(i=i+Math.imul(N,ee)|0)+Math.imul(D,J)|0,o=o+Math.imul(D,ee)|0,r=r+Math.imul(P,ne)|0,i=(i=i+Math.imul(P,re)|0)+Math.imul(L,ne)|0,o=o+Math.imul(L,re)|0,r=r+Math.imul(R,oe)|0,i=(i=i+Math.imul(R,ae)|0)+Math.imul(O,oe)|0,o=o+Math.imul(O,ae)|0,r=r+Math.imul(M,ue)|0,i=(i=i+Math.imul(M,le)|0)+Math.imul(C,ue)|0,o=o+Math.imul(C,le)|0,r=r+Math.imul(E,de)|0,i=(i=i+Math.imul(E,fe)|0)+Math.imul(S,de)|0,o=o+Math.imul(S,fe)|0;var xe=(l+(r=r+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,me)|0)+Math.imul(A,pe)|0))<<13)|0;l=((o=o+Math.imul(A,me)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(j,J),i=(i=Math.imul(j,ee))+Math.imul(U,J)|0,o=Math.imul(U,ee),r=r+Math.imul(N,ne)|0,i=(i=i+Math.imul(N,re)|0)+Math.imul(D,ne)|0,o=o+Math.imul(D,re)|0,r=r+Math.imul(P,oe)|0,i=(i=i+Math.imul(P,ae)|0)+Math.imul(L,oe)|0,o=o+Math.imul(L,ae)|0,r=r+Math.imul(R,ue)|0,i=(i=i+Math.imul(R,le)|0)+Math.imul(O,ue)|0,o=o+Math.imul(O,le)|0,r=r+Math.imul(M,de)|0,i=(i=i+Math.imul(M,fe)|0)+Math.imul(C,de)|0,o=o+Math.imul(C,fe)|0;var Re=(l+(r=r+Math.imul(E,pe)|0)|0)+((8191&(i=(i=i+Math.imul(E,me)|0)+Math.imul(S,pe)|0))<<13)|0;l=((o=o+Math.imul(S,me)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,r=Math.imul(j,ne),i=(i=Math.imul(j,re))+Math.imul(U,ne)|0,o=Math.imul(U,re),r=r+Math.imul(N,oe)|0,i=(i=i+Math.imul(N,ae)|0)+Math.imul(D,oe)|0,o=o+Math.imul(D,ae)|0,r=r+Math.imul(P,ue)|0,i=(i=i+Math.imul(P,le)|0)+Math.imul(L,ue)|0,o=o+Math.imul(L,le)|0,r=r+Math.imul(R,de)|0,i=(i=i+Math.imul(R,fe)|0)+Math.imul(O,de)|0,o=o+Math.imul(O,fe)|0;var Oe=(l+(r=r+Math.imul(M,pe)|0)|0)+((8191&(i=(i=i+Math.imul(M,me)|0)+Math.imul(C,pe)|0))<<13)|0;l=((o=o+Math.imul(C,me)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,r=Math.imul(j,oe),i=(i=Math.imul(j,ae))+Math.imul(U,oe)|0,o=Math.imul(U,ae),r=r+Math.imul(N,ue)|0,i=(i=i+Math.imul(N,le)|0)+Math.imul(D,ue)|0,o=o+Math.imul(D,le)|0,r=r+Math.imul(P,de)|0,i=(i=i+Math.imul(P,fe)|0)+Math.imul(L,de)|0,o=o+Math.imul(L,fe)|0;var Te=(l+(r=r+Math.imul(R,pe)|0)|0)+((8191&(i=(i=i+Math.imul(R,me)|0)+Math.imul(O,pe)|0))<<13)|0;l=((o=o+Math.imul(O,me)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(j,ue),i=(i=Math.imul(j,le))+Math.imul(U,ue)|0,o=Math.imul(U,le),r=r+Math.imul(N,de)|0,i=(i=i+Math.imul(N,fe)|0)+Math.imul(D,de)|0,o=o+Math.imul(D,fe)|0;var Pe=(l+(r=r+Math.imul(P,pe)|0)|0)+((8191&(i=(i=i+Math.imul(P,me)|0)+Math.imul(L,pe)|0))<<13)|0;l=((o=o+Math.imul(L,me)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,r=Math.imul(j,de),i=(i=Math.imul(j,fe))+Math.imul(U,de)|0,o=Math.imul(U,fe);var Le=(l+(r=r+Math.imul(N,pe)|0)|0)+((8191&(i=(i=i+Math.imul(N,me)|0)+Math.imul(D,pe)|0))<<13)|0;l=((o=o+Math.imul(D,me)|0)+(i>>>13)|0)+(Le>>>26)|0,Le&=67108863;var Ie=(l+(r=Math.imul(j,pe))|0)+((8191&(i=(i=Math.imul(j,me))+Math.imul(U,pe)|0))<<13)|0;return l=((o=Math.imul(U,me))+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,u[0]=ge,u[1]=ve,u[2]=ye,u[3]=be,u[4]=we,u[5]=Ae,u[6]=_e,u[7]=Ee,u[8]=Se,u[9]=ke,u[10]=Me,u[11]=Ce,u[12]=xe,u[13]=Re,u[14]=Oe,u[15]=Te,u[16]=Pe,u[17]=Le,u[18]=Ie,0!==l&&(u[19]=l,n.length++),n};function g(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o<n.length-1;o++){var a=i;i=0;for(var s=67108863&r,u=Math.min(o,t.length-1),l=Math.max(0,o-e.length+1);l<=u;l++){var c=o-l,d=(0|e.words[c])*(0|t.words[l]),f=67108863&d;s=67108863&(f=f+s|0),i+=(a=(a=a+(d/67108864|0)|0)+(f>>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function v(e,t,n){return g(e,t,n)}Math.imul||(m=p),i.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?m(this,e,t):n<63?p(this,e,t):n<1024?g(this,e,t):v(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),v(this,e,t)},i.prototype.imul=function(e){return this.clone().mulTo(e,this)},i.prototype.imuln=function(e){var t=e<0;t&&(e=-e),n("number"==typeof e),n(e<67108864);for(var r=0,i=0;i<this.length;i++){var o=(0|this.words[i])*e,a=(67108863&o)+(67108863&r);r>>=26,r+=o/67108864|0,r+=a>>>26,this.words[i]=67108863&a}return 0!==r&&(this.words[i]=r,this.length++),t?this.ineg():this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n<t.length;n++){var r=n/26|0,i=n%26;t[n]=e.words[r]>>>i&1}return t}(e);if(0===t.length)return new i(1);for(var n=this,r=0;r<t.length&&0===t[r];r++,n=n.sqr());if(++r<t.length)for(var o=n.sqr();r<t.length;r++,o=o.sqr())0!==t[r]&&(n=n.mul(o));return n},i.prototype.iushln=function(e){n("number"==typeof e&&e>=0);var t,r=e%26,i=(e-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(t=0;t<this.length;t++){var s=this.words[t]&o,u=(0|this.words[t])-s<<r;this.words[t]=u|a,a=s>>>26-r}a&&(this.words[t]=a,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this._strip()},i.prototype.ishln=function(e){return n(0===this.negative),this.iushln(e)},i.prototype.iushrn=function(e,t,r){var i;n("number"==typeof e&&e>=0),i=t?(t-t%26)/26:0;var o=e%26,a=Math.min((e-o)/26,this.length),s=67108863^67108863>>>o<<o,u=r;if(i-=a,i=Math.max(0,i),u){for(var l=0;l<a;l++)u.words[l]=this.words[l];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,l=0;l<this.length;l++)this.words[l]=this.words[l+a];else this.words[0]=0,this.length=1;var c=0;for(l=this.length-1;l>=0&&(0!==c||l>=i);l--){var d=0|this.words[l];this.words[l]=c<<26-o|d>>>o,c=d&s}return u&&0!==c&&(u.words[u.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,i=1<<t;return!(this.length<=r||!(this.words[r]&i))},i.prototype.imaskn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,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 n("number"==typeof e),n(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(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<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,r){var i,o,a=e.length+r;this._expand(a);var s=0;for(i=0;i<e.length;i++){o=(0|this.words[i+r])+s;var u=(0|e.words[i])*t;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)s=(o=(0|this.words[i+r])+s)>>26,this.words[i+r]=67108863&o;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),o=e,a=0|o.words[o.length-1];0!=(n=26-this._countBits(a))&&(o=o.ushln(n),r.iushln(n),a=0|o.words[o.length-1]);var s,u=r.length-o.length;if("mod"!==t){(s=new i(null)).length=u+1,s.words=new Array(s.length);for(var l=0;l<s.length;l++)s.words[l]=0}var c=r.clone()._ishlnsubmul(o,1,u);0===c.negative&&(r=c,s&&(s.words[u]=1));for(var d=u-1;d>=0;d--){var f=67108864*(0|r.words[o.length+d])+(0|r.words[o.length+d-1]);for(f=Math.min(f/a|0,67108863),r._ishlnsubmul(o,f,d);0!==r.negative;)f--,r.negative=0,r._ishlnsubmul(o,1,d),r.isZero()||(r.negative^=1);s&&(s.words[d]=f)}return s&&s._strip(),r._strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(o=s.div.neg()),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(e)),{div:o,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||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,a,s},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modrn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=(1<<26)%e,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%e;return t?-i:i},i.prototype.modn=function(e){return this.modrn(e)},i.prototype.idivn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/e|0,r=o%e}return this._strip(),t?this.ineg():this},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o=new i(1),a=new i(0),s=new i(0),u=new i(1),l=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++l;for(var c=r.clone(),d=t.clone();!t.isZero();){for(var f=0,h=1;0==(t.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(t.iushrn(f);f-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(c),a.isub(d)),o.iushrn(1),a.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(c),u.isub(d)),s.iushrn(1),u.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(s),a.isub(u)):(r.isub(t),s.isub(o),u.isub(a))}return{a:s,b:u,gcd:r.iushln(l)}},i.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o,a=new i(1),s=new i(0),u=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var l=0,c=1;0==(t.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(t.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var d=0,f=1;0==(r.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(r.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(s)):(r.isub(t),s.isub(a))}return(o=0===t.cmpn(1)?a:s).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(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var o=i,a=r;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0: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,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){r<i?t=-1:r>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 n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var y={k256:null,p224:null,p192:null,p25519:null};function b(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function A(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){b.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 n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function k(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)}b.prototype._tmp=function(){var e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},b.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},b.prototype.split=function(e,t){e.iushrn(this.n,0,t)},b.prototype.imulK=function(e){return e.imul(this.k)},r(w,b),w.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i<r;i++)t.words[i]=e.words[i];if(t.length=r,e.length<=9)return e.words[0]=0,void(e.length=1);var o=e.words[9];for(t.words[t.length++]=o&n,i=10;i<e.length;i++){var a=0|e.words[i];e.words[i-10]=(a&n)<<4|o>>>22,o=a}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,n=0;n<e.length;n++){var r=0|e.words[n];t+=977*r,e.words[n]=67108863&t,t=64*r+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},r(A,b),r(_,b),r(E,b),E.prototype.imulK=function(e){for(var t=0,n=0;n<e.length;n++){var r=19*(0|e.words[n])+t,i=67108863&r;r>>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(y[e])return y[e];var t;if("k256"===e)t=new w;else if("p224"===e)t=new A;else if("p192"===e)t=new _;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new E}return y[e]=t,t},S.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},S.prototype._verify2=function(e,t){n(0==(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},S.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(l(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 n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},S.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},S.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},S.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},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(n(t%2==1),3===t){var r=this.m.add(new i(1)).iushrn(2);return this.pow(e,r)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);n(!o.isZero());var s=new i(1).toRed(this),u=s.redNeg(),l=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new i(2*c*c).toRed(this);0!==this.pow(c,l).cmp(u);)c.redIAdd(u);for(var d=this.pow(c,o),f=this.pow(e,o.addn(1).iushrn(1)),h=this.pow(e,o),p=a;0!==h.cmp(s);){for(var m=h,g=0;0!==m.cmp(s);g++)m=m.redSqr();n(g<p);var v=this.pow(d,new i(1).iushln(p-g-1));f=f.redMul(v),d=v.redSqr(),h=h.redMul(d),p=g}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 n=new Array(16);n[0]=new i(1).toRed(this),n[1]=e;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],e);var o=n[0],a=0,s=0,u=t.bitLength()%26;for(0===u&&(u=26),r=t.length-1;r>=0;r--){for(var l=t.words[r],c=u-1;c>=0;c--){var d=l>>c&1;o!==n[0]&&(o=this.sqr(o)),0!==d||0!==a?(a<<=1,a|=d,(4==++s||0===r&&0===c)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}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 k(e)},r(k,S),k.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},k.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},k.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},k.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(r).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},k.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(Rh,hr);var Oh=Rh.exports,Th=Zr;function Ph(e){var t,n=e.modulus.byteLength();do{t=new Oh(Th(n))}while(t.cmp(e.modulus)>=0||!t.umod(e.prime1)||!t.umod(e.prime2));return t}function Lh(e,t){var n=function(e){var t=Ph(e);return{blinder:t.toRed(Oh.mont(e.modulus)).redPow(new Oh(e.publicExponent)).fromRed(),unblinder:t.invm(e.modulus)}}(t),r=t.modulus.byteLength(),i=new Oh(e).mul(n.blinder).umod(t.modulus),o=i.toRed(Oh.mont(t.prime1)),a=i.toRed(Oh.mont(t.prime2)),s=t.coefficient,u=t.prime1,l=t.prime2,c=o.redPow(t.exponent1).fromRed(),d=a.redPow(t.exponent2).fromRed(),f=c.isub(d).imul(s).umod(u).imul(l);return d.iadd(f).imul(n.unblinder).umod(t.modulus).toArrayLike(xn,"be",r)}Lh.getr=Ph;var Ih=Lh,Nh={},Dh={name:"elliptic",version:"6.5.4",description:"EC cryptography",main:"lib/elliptic.js",files:["lib"],scripts:{lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository:{type:"git",url:"git@github.com:indutny/elliptic"},keywords:["EC","Elliptic","curve","Cryptography"],author:"Fedor Indutny <fedor@indutny.com>",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}},Bh={},jh={};!function(e){var t=jh;function n(e){return 1===e.length?"0"+e:e}function r(e){for(var t="",r=0;r<e.length;r++)t+=n(e[r].toString(16));return t}t.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if("string"!=typeof e){for(var r=0;r<e.length;r++)n[r]=0|e[r];return n}if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),r=0;r<e.length;r+=2)n.push(parseInt(e[r]+e[r+1],16));else for(r=0;r<e.length;r++){var i=e.charCodeAt(r),o=i>>8,a=255&i;o?n.push(o,a):n.push(a)}return n},t.zero2=n,t.toHex=r,t.encode=function(e,t){return"hex"===t?r(e):e}}(),function(e){var t=Bh,n=vf,r=Gl,i=jh;t.assert=r,t.toArray=i.toArray,t.zero2=i.zero2,t.toHex=i.toHex,t.encode=i.encode,t.getNAF=function(e,t,n){var r=new Array(Math.max(e.bitLength(),n)+1);r.fill(0);for(var i=1<<t+1,o=e.clone(),a=0;a<r.length;a++){var s,u=o.andln(i-1);o.isOdd()?(s=u>(i>>1)-1?(i>>1)-u:u,o.isubn(s)):s=0,r[a]=s,o.iushrn(1)}return r},t.getJSF=function(e,t){var n=[[],[]];e=e.clone(),t=t.clone();for(var r,i=0,o=0;e.cmpn(-i)>0||t.cmpn(-o)>0;){var a,s,u=e.andln(3)+i&3,l=t.andln(3)+o&3;3===u&&(u=-1),3===l&&(l=-1),a=0==(1&u)?0:3!=(r=e.andln(7)+i&7)&&5!==r||2!==l?u:-u,n[0].push(a),s=0==(1&l)?0:3!=(r=t.andln(7)+o&7)&&5!==r||2!==u?l:-l,n[1].push(s),2*i===a+1&&(i=1-i),2*o===s+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return n},t.cachedProperty=function(e,t,n){var r="_"+t;e.prototype[t]=function(){return void 0!==this[r]?this[r]:this[r]=n.call(this)}},t.parseBytes=function(e){return"string"==typeof e?t.toArray(e,"hex"):e},t.intFromLE=function(e){return new n(e,"hex","le")}}();var Uh={},zh=vf,Fh=Bh,qh=Fh.getNAF,Wh=Fh.getJSF,Vh=Fh.assert;function Kh(e,t){this.type=e,this.p=new zh(t.p,16),this.red=t.prime?zh.red(t.prime):zh.mont(this.p),this.zero=new zh(0).toRed(this.red),this.one=new zh(1).toRed(this.red),this.two=new zh(2).toRed(this.red),this.n=t.n&&new zh(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Hh=Kh;function $h(e,t){this.curve=e,this.type=t,this.precomputed=null}Kh.prototype.point=function(){throw new Error("Not implemented")},Kh.prototype.validate=function(){throw new Error("Not implemented")},Kh.prototype._fixedNafMul=function(e,t){Vh(e.precomputed);var n=e._getDoubles(),r=qh(t,1,this._bitLength),i=(1<<n.step+1)-(n.step%2==0?2:1);i/=3;var o,a,s=[];for(o=0;o<r.length;o+=n.step){a=0;for(var u=o+n.step-1;u>=o;u--)a=(a<<1)+r[u];s.push(a)}for(var l=this.jpoint(null,null,null),c=this.jpoint(null,null,null),d=i;d>0;d--){for(o=0;o<s.length;o++)(a=s[o])===d?c=c.mixedAdd(n.points[o]):a===-d&&(c=c.mixedAdd(n.points[o].neg()));l=l.add(c)}return l.toP()},Kh.prototype._wnafMul=function(e,t){var n=4,r=e._getNAFPoints(n);n=r.wnd;for(var i=r.points,o=qh(t,n,this._bitLength),a=this.jpoint(null,null,null),s=o.length-1;s>=0;s--){for(var u=0;s>=0&&0===o[s];s--)u++;if(s>=0&&u++,a=a.dblp(u),s<0)break;var l=o[s];Vh(0!==l),a="affine"===e.type?l>0?a.mixedAdd(i[l-1>>1]):a.mixedAdd(i[-l-1>>1].neg()):l>0?a.add(i[l-1>>1]):a.add(i[-l-1>>1].neg())}return"affine"===e.type?a.toP():a},Kh.prototype._wnafMulAdd=function(e,t,n,r,i){var o,a,s,u=this._wnafT1,l=this._wnafT2,c=this._wnafT3,d=0;for(o=0;o<r;o++){var f=(s=t[o])._getNAFPoints(e);u[o]=f.wnd,l[o]=f.points}for(o=r-1;o>=1;o-=2){var h=o-1,p=o;if(1===u[h]&&1===u[p]){var m=[t[h],null,null,t[p]];0===t[h].y.cmp(t[p].y)?(m[1]=t[h].add(t[p]),m[2]=t[h].toJ().mixedAdd(t[p].neg())):0===t[h].y.cmp(t[p].y.redNeg())?(m[1]=t[h].toJ().mixedAdd(t[p]),m[2]=t[h].add(t[p].neg())):(m[1]=t[h].toJ().mixedAdd(t[p]),m[2]=t[h].toJ().mixedAdd(t[p].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],v=Wh(n[h],n[p]);for(d=Math.max(v[0].length,d),c[h]=new Array(d),c[p]=new Array(d),a=0;a<d;a++){var y=0|v[0][a],b=0|v[1][a];c[h][a]=g[3*(y+1)+(b+1)],c[p][a]=0,l[h]=m}}else c[h]=qh(n[h],u[h],this._bitLength),c[p]=qh(n[p],u[p],this._bitLength),d=Math.max(c[h].length,d),d=Math.max(c[p].length,d)}var w=this.jpoint(null,null,null),A=this._wnafT4;for(o=d;o>=0;o--){for(var _=0;o>=0;){var E=!0;for(a=0;a<r;a++)A[a]=0|c[a][o],0!==A[a]&&(E=!1);if(!E)break;_++,o--}if(o>=0&&_++,w=w.dblp(_),o<0)break;for(a=0;a<r;a++){var S=A[a];0!==S&&(S>0?s=l[a][S-1>>1]:S<0&&(s=l[a][-S-1>>1].neg()),w="affine"===s.type?w.mixedAdd(s):w.add(s))}}for(o=0;o<r;o++)l[o]=null;return i?w:w.toP()},Kh.BasePoint=$h,$h.prototype.eq=function(){throw new Error("Not implemented")},$h.prototype.validate=function(){return this.curve.validate(this)},Kh.prototype.decodePoint=function(e,t){e=Fh.toArray(e,t);var n=this.p.byteLength();if((4===e[0]||6===e[0]||7===e[0])&&e.length-1==2*n)return 6===e[0]?Vh(e[e.length-1]%2==0):7===e[0]&&Vh(e[e.length-1]%2==1),this.point(e.slice(1,1+n),e.slice(1+n,1+2*n));if((2===e[0]||3===e[0])&&e.length-1===n)return this.pointFromX(e.slice(1,1+n),3===e[0]);throw new Error("Unknown point format")},$h.prototype.encodeCompressed=function(e){return this.encode(e,!0)},$h.prototype._encode=function(e){var t=this.curve.p.byteLength(),n=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray("be",t))},$h.prototype.encode=function(e,t){return Fh.encode(this._encode(t),e)},$h.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},$h.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)},$h.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i<t;i+=e){for(var o=0;o<e;o++)r=r.dbl();n.push(r)}return{step:e,points:n}},$h.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],n=(1<<e)-1,r=1===n?null:this.dbl(),i=1;i<n;i++)t[i]=t[i-1].add(r);return{wnd:e,points:t}},$h.prototype._getBeta=function(){return null},$h.prototype.dblp=function(e){for(var t=this,n=0;n<e;n++)t=t.dbl();return t};var Yh=vf,Gh=Jr,Qh=Hh,Zh=Bh.assert;function Xh(e){Qh.call(this,"short",e),this.a=new Yh(e.a,16).toRed(this.red),this.b=new Yh(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}Gh(Xh,Qh);var Jh=Xh;function ep(e,t,n,r){Qh.BasePoint.call(this,e,"affine"),null===t&&null===n?(this.x=null,this.y=null,this.inf=!0):(this.x=new Yh(t,16),this.y=new Yh(n,16),r&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function tp(e,t,n,r){Qh.BasePoint.call(this,e,"jacobian"),null===t&&null===n&&null===r?(this.x=this.curve.one,this.y=this.curve.one,this.z=new Yh(0)):(this.x=new Yh(t,16),this.y=new Yh(n,16),this.z=new Yh(r,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Xh.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,n;if(e.beta)t=new Yh(e.beta,16).toRed(this.red);else{var r=this._getEndoRoots(this.p);t=(t=r[0].cmp(r[1])<0?r[0]:r[1]).toRed(this.red)}if(e.lambda)n=new Yh(e.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(t))?n=i[0]:(n=i[1],Zh(0===this.g.mul(n).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:n,basis:e.basis?e.basis.map((function(e){return{a:new Yh(e.a,16),b:new Yh(e.b,16)}})):this._getEndoBasis(n)}}},Xh.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:Yh.mont(e),n=new Yh(2).toRed(t).redInvm(),r=n.redNeg(),i=new Yh(3).toRed(t).redNeg().redSqrt().redMul(n);return[r.redAdd(i).fromRed(),r.redSub(i).fromRed()]},Xh.prototype._getEndoBasis=function(e){for(var t,n,r,i,o,a,s,u,l,c=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=e,f=this.n.clone(),h=new Yh(1),p=new Yh(0),m=new Yh(0),g=new Yh(1),v=0;0!==d.cmpn(0);){var y=f.div(d);u=f.sub(y.mul(d)),l=m.sub(y.mul(h));var b=g.sub(y.mul(p));if(!r&&u.cmp(c)<0)t=s.neg(),n=h,r=u.neg(),i=l;else if(r&&2==++v)break;s=u,f=d,d=u,m=h,h=l,g=p,p=b}o=u.neg(),a=l;var w=r.sqr().add(i.sqr());return o.sqr().add(a.sqr()).cmp(w)>=0&&(o=t,a=n),r.negative&&(r=r.neg(),i=i.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:r,b:i},{a:o,b:a}]},Xh.prototype._endoSplit=function(e){var t=this.endo.basis,n=t[0],r=t[1],i=r.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=i.mul(n.a),s=o.mul(r.a),u=i.mul(n.b),l=o.mul(r.b);return{k1:e.sub(a).sub(s),k2:u.add(l).neg()}},Xh.prototype.pointFromX=function(e,t){(e=new Yh(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),r=n.redSqrt();if(0!==r.redSqr().redSub(n).cmp(this.zero))throw new Error("invalid point");var i=r.fromRed().isOdd();return(t&&!i||!t&&i)&&(r=r.redNeg()),this.point(e,r)},Xh.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,n=e.y,r=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(r).redIAdd(this.b);return 0===n.redSqr().redISub(i).cmpn(0)},Xh.prototype._endoWnafMulAdd=function(e,t,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,o=0;o<e.length;o++){var a=this._endoSplit(t[o]),s=e[o],u=s._getBeta();a.k1.negative&&(a.k1.ineg(),s=s.neg(!0)),a.k2.negative&&(a.k2.ineg(),u=u.neg(!0)),r[2*o]=s,r[2*o+1]=u,i[2*o]=a.k1,i[2*o+1]=a.k2}for(var l=this._wnafMulAdd(1,r,i,2*o,n),c=0;c<2*o;c++)r[c]=null,i[c]=null;return l},Gh(ep,Qh.BasePoint),Xh.prototype.point=function(e,t,n){return new ep(this,e,t,n)},Xh.prototype.pointFromJSON=function(e,t){return ep.fromJSON(this,e,t)},ep.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var n=this.curve,r=function(e){return n.point(e.x.redMul(n.endo.beta),e.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(r)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(r)}}}return t}},ep.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},ep.fromJSON=function(e,t,n){"string"==typeof t&&(t=JSON.parse(t));var r=e.point(t[0],t[1],n);if(!t[2])return r;function i(t){return e.point(t[0],t[1],n)}var o=t[2];return r.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[r].concat(o.doubles.points.map(i))},naf:o.naf&&{wnd:o.naf.wnd,points:[r].concat(o.naf.points.map(i))}},r},ep.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},ep.prototype.isInfinity=function(){return this.inf},ep.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var n=t.redSqr().redISub(this.x).redISub(e.x),r=t.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},ep.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,n=this.x.redSqr(),r=e.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(t).redMul(r),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},ep.prototype.getX=function(){return this.x.fromRed()},ep.prototype.getY=function(){return this.y.fromRed()},ep.prototype.mul=function(e){return e=new Yh(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},ep.prototype.mulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},ep.prototype.jmulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},ep.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},ep.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,r=function(e){return e.neg()};t.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return t},ep.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},Gh(tp,Qh.BasePoint),Xh.prototype.jpoint=function(e,t,n){return new tp(this,e,t,n)},tp.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),n=this.x.redMul(t),r=this.y.redMul(t).redMul(e);return this.curve.point(n,r)},tp.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},tp.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(t),i=e.x.redMul(n),o=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),s=r.redSub(i),u=o.redSub(a);if(0===s.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var l=s.redSqr(),c=l.redMul(s),d=r.redMul(l),f=u.redSqr().redIAdd(c).redISub(d).redISub(d),h=u.redMul(d.redISub(f)).redISub(o.redMul(c)),p=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(f,h,p)},tp.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),n=this.x,r=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z),a=n.redSub(r),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),l=u.redMul(a),c=n.redMul(u),d=s.redSqr().redIAdd(l).redISub(c).redISub(c),f=s.redMul(c.redISub(d)).redISub(i.redMul(l)),h=this.z.redMul(a);return this.curve.jpoint(d,f,h)},tp.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var n=this;for(t=0;t<e;t++)n=n.dbl();return n}var r=this.curve.a,i=this.curve.tinv,o=this.x,a=this.y,s=this.z,u=s.redSqr().redSqr(),l=a.redAdd(a);for(t=0;t<e;t++){var c=o.redSqr(),d=l.redSqr(),f=d.redSqr(),h=c.redAdd(c).redIAdd(c).redIAdd(r.redMul(u)),p=o.redMul(d),m=h.redSqr().redISub(p.redAdd(p)),g=p.redISub(m),v=h.redMul(g);v=v.redIAdd(v).redISub(f);var y=l.redMul(s);t+1<e&&(u=u.redMul(f)),o=m,s=y,l=v}return this.curve.jpoint(o,l.redMul(i),s)},tp.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},tp.prototype._zeroDbl=function(){var e,t,n;if(this.zOne){var r=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),a=this.x.redAdd(i).redSqr().redISub(r).redISub(o);a=a.redIAdd(a);var s=r.redAdd(r).redIAdd(r),u=s.redSqr().redISub(a).redISub(a),l=o.redIAdd(o);l=(l=l.redIAdd(l)).redIAdd(l),e=u,t=s.redMul(a.redISub(u)).redISub(l),n=this.y.redAdd(this.y)}else{var c=this.x.redSqr(),d=this.y.redSqr(),f=d.redSqr(),h=this.x.redAdd(d).redSqr().redISub(c).redISub(f);h=h.redIAdd(h);var p=c.redAdd(c).redIAdd(c),m=p.redSqr(),g=f.redIAdd(f);g=(g=g.redIAdd(g)).redIAdd(g),e=m.redISub(h).redISub(h),t=p.redMul(h.redISub(e)).redISub(g),n=(n=this.y.redMul(this.z)).redIAdd(n)}return this.curve.jpoint(e,t,n)},tp.prototype._threeDbl=function(){var e,t,n;if(this.zOne){var r=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),a=this.x.redAdd(i).redSqr().redISub(r).redISub(o);a=a.redIAdd(a);var s=r.redAdd(r).redIAdd(r).redIAdd(this.curve.a),u=s.redSqr().redISub(a).redISub(a);e=u;var l=o.redIAdd(o);l=(l=l.redIAdd(l)).redIAdd(l),t=s.redMul(a.redISub(u)).redISub(l),n=this.y.redAdd(this.y)}else{var c=this.z.redSqr(),d=this.y.redSqr(),f=this.x.redMul(d),h=this.x.redSub(c).redMul(this.x.redAdd(c));h=h.redAdd(h).redIAdd(h);var p=f.redIAdd(f),m=(p=p.redIAdd(p)).redAdd(p);e=h.redSqr().redISub(m),n=this.y.redAdd(this.z).redSqr().redISub(d).redISub(c);var g=d.redSqr();g=(g=(g=g.redIAdd(g)).redIAdd(g)).redIAdd(g),t=h.redMul(p.redISub(e)).redISub(g)}return this.curve.jpoint(e,t,n)},tp.prototype._dbl=function(){var e=this.curve.a,t=this.x,n=this.y,r=this.z,i=r.redSqr().redSqr(),o=t.redSqr(),a=n.redSqr(),s=o.redAdd(o).redIAdd(o).redIAdd(e.redMul(i)),u=t.redAdd(t),l=(u=u.redIAdd(u)).redMul(a),c=s.redSqr().redISub(l.redAdd(l)),d=l.redISub(c),f=a.redSqr();f=(f=(f=f.redIAdd(f)).redIAdd(f)).redIAdd(f);var h=s.redMul(d).redISub(f),p=n.redAdd(n).redMul(r);return this.curve.jpoint(c,h,p)},tp.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr(),r=t.redSqr(),i=e.redAdd(e).redIAdd(e),o=i.redSqr(),a=this.x.redAdd(t).redSqr().redISub(e).redISub(r),s=(a=(a=(a=a.redIAdd(a)).redAdd(a).redIAdd(a)).redISub(o)).redSqr(),u=r.redIAdd(r);u=(u=(u=u.redIAdd(u)).redIAdd(u)).redIAdd(u);var l=i.redIAdd(a).redSqr().redISub(o).redISub(s).redISub(u),c=t.redMul(l);c=(c=c.redIAdd(c)).redIAdd(c);var d=this.x.redMul(s).redISub(c);d=(d=d.redIAdd(d)).redIAdd(d);var f=this.y.redMul(l.redMul(u.redISub(l)).redISub(a.redMul(s)));f=(f=(f=f.redIAdd(f)).redIAdd(f)).redIAdd(f);var h=this.z.redAdd(a).redSqr().redISub(n).redISub(s);return this.curve.jpoint(d,f,h)},tp.prototype.mul=function(e,t){return e=new Yh(e,t),this.curve._wnafMul(this,e)},tp.prototype.eq=function(e){if("affine"===e.type)return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),n=e.z.redSqr();if(0!==this.x.redMul(n).redISub(e.x.redMul(t)).cmpn(0))return!1;var r=t.redMul(this.z),i=n.redMul(e.z);return 0===this.y.redMul(i).redISub(e.y.redMul(r)).cmpn(0)},tp.prototype.eqXToP=function(e){var t=this.z.redSqr(),n=e.toRed(this.curve.red).redMul(t);if(0===this.x.cmp(n))return!0;for(var r=e.clone(),i=this.curve.redN.redMul(t);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(n.redIAdd(i),0===this.x.cmp(n))return!0}},tp.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},tp.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var np=vf,rp=Jr,ip=Hh,op=Bh;function ap(e){ip.call(this,"mont",e),this.a=new np(e.a,16).toRed(this.red),this.b=new np(e.b,16).toRed(this.red),this.i4=new np(4).toRed(this.red).redInvm(),this.two=new np(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}rp(ap,ip);var sp=ap;function up(e,t,n){ip.BasePoint.call(this,e,"projective"),null===t&&null===n?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new np(t,16),this.z=new np(n,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}ap.prototype.validate=function(e){var t=e.normalize().x,n=t.redSqr(),r=n.redMul(t).redAdd(n.redMul(this.a)).redAdd(t);return 0===r.redSqrt().redSqr().cmp(r)},rp(up,ip.BasePoint),ap.prototype.decodePoint=function(e,t){return this.point(op.toArray(e,t),1)},ap.prototype.point=function(e,t){return new up(this,e,t)},ap.prototype.pointFromJSON=function(e){return up.fromJSON(this,e)},up.prototype.precompute=function(){},up.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},up.fromJSON=function(e,t){return new up(e,t[0],t[1]||e.one)},up.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},up.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},up.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),n=e.redSub(t),r=e.redMul(t),i=n.redMul(t.redAdd(this.curve.a24.redMul(n)));return this.curve.point(r,i)},up.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},up.prototype.diffAdd=function(e,t){var n=this.x.redAdd(this.z),r=this.x.redSub(this.z),i=e.x.redAdd(e.z),o=e.x.redSub(e.z).redMul(n),a=i.redMul(r),s=t.z.redMul(o.redAdd(a).redSqr()),u=t.x.redMul(o.redISub(a).redSqr());return this.curve.point(s,u)},up.prototype.mul=function(e){for(var t=e.clone(),n=this,r=this.curve.point(null,null),i=[];0!==t.cmpn(0);t.iushrn(1))i.push(t.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(n=n.diffAdd(r,this),r=r.dbl()):(r=n.diffAdd(r,this),n=n.dbl());return r},up.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},up.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},up.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},up.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},up.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var lp=vf,cp=Jr,dp=Hh,fp=Bh.assert;function hp(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,dp.call(this,"edwards",e),this.a=new lp(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new lp(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new lp(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),fp(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}cp(hp,dp);var pp=hp;function mp(e,t,n,r,i){dp.BasePoint.call(this,e,"projective"),null===t&&null===n&&null===r?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new lp(t,16),this.y=new lp(n,16),this.z=r?new lp(r,16):this.curve.one,this.t=i&&new lp(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}hp.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},hp.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},hp.prototype.jpoint=function(e,t,n,r){return this.point(e,t,n,r)},hp.prototype.pointFromX=function(e,t){(e=new lp(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr(),r=this.c2.redSub(this.a.redMul(n)),i=this.one.redSub(this.c2.redMul(this.d).redMul(n)),o=r.redMul(i.redInvm()),a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");var s=a.fromRed().isOdd();return(t&&!s||!t&&s)&&(a=a.redNeg()),this.point(e,a)},hp.prototype.pointFromY=function(e,t){(e=new lp(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr(),r=n.redSub(this.c2),i=n.redMul(this.d).redMul(this.c2).redSub(this.a),o=r.redMul(i.redInvm());if(0===o.cmp(this.zero)){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");return a.fromRed().isOdd()!==t&&(a=a.redNeg()),this.point(a,e)},hp.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),n=e.y.redSqr(),r=t.redMul(this.a).redAdd(n),i=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(n)));return 0===r.cmp(i)},cp(mp,dp.BasePoint),hp.prototype.pointFromJSON=function(e){return mp.fromJSON(this,e)},hp.prototype.point=function(e,t,n,r){return new mp(this,e,t,n,r)},mp.fromJSON=function(e,t){return new mp(e,t[0],t[1],t[2])},mp.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},mp.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},mp.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var r=this.curve._mulA(e),i=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),o=r.redAdd(t),a=o.redSub(n),s=r.redSub(t),u=i.redMul(a),l=o.redMul(s),c=i.redMul(s),d=a.redMul(o);return this.curve.point(u,l,d,c)},mp.prototype._projDbl=function(){var e,t,n,r,i,o,a=this.x.redAdd(this.y).redSqr(),s=this.x.redSqr(),u=this.y.redSqr();if(this.curve.twisted){var l=(r=this.curve._mulA(s)).redAdd(u);this.zOne?(e=a.redSub(s).redSub(u).redMul(l.redSub(this.curve.two)),t=l.redMul(r.redSub(u)),n=l.redSqr().redSub(l).redSub(l)):(i=this.z.redSqr(),o=l.redSub(i).redISub(i),e=a.redSub(s).redISub(u).redMul(o),t=l.redMul(r.redSub(u)),n=l.redMul(o))}else r=s.redAdd(u),i=this.curve._mulC(this.z).redSqr(),o=r.redSub(i).redSub(i),e=this.curve._mulC(a.redISub(r)).redMul(o),t=this.curve._mulC(r).redMul(s.redISub(u)),n=r.redMul(o);return this.curve.point(e,t,n)},mp.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},mp.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),r=this.t.redMul(this.curve.dd).redMul(e.t),i=this.z.redMul(e.z.redAdd(e.z)),o=n.redSub(t),a=i.redSub(r),s=i.redAdd(r),u=n.redAdd(t),l=o.redMul(a),c=s.redMul(u),d=o.redMul(u),f=a.redMul(s);return this.curve.point(l,c,f,d)},mp.prototype._projAdd=function(e){var t,n,r=this.z.redMul(e.z),i=r.redSqr(),o=this.x.redMul(e.x),a=this.y.redMul(e.y),s=this.curve.d.redMul(o).redMul(a),u=i.redSub(s),l=i.redAdd(s),c=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(o).redISub(a),d=r.redMul(u).redMul(c);return this.curve.twisted?(t=r.redMul(l).redMul(a.redSub(this.curve._mulA(o))),n=u.redMul(l)):(t=r.redMul(l).redMul(a.redSub(o)),n=this.curve._mulC(u).redMul(l)),this.curve.point(d,t,n)},mp.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},mp.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},mp.prototype.mulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!1)},mp.prototype.jmulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!0)},mp.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},mp.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},mp.prototype.getX=function(){return this.normalize(),this.x.fromRed()},mp.prototype.getY=function(){return this.normalize(),this.y.fromRed()},mp.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},mp.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var n=e.clone(),r=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(r),0===this.x.cmp(t))return!0}},mp.prototype.toP=mp.prototype.normalize,mp.prototype.mixedAdd=mp.prototype.add,function(e){var t=e;t.base=Hh,t.short=Jh,t.mont=sp,t.edwards=pp}(Uh);var gp={},vp={},yp={},bp=Gl,wp=Jr;function Ap(e,t){return 55296==(64512&e.charCodeAt(t))&&!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1))}function _p(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function Ep(e){return 1===e.length?"0"+e:e}function Sp(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}yp.inherits=wp,yp.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),i=0;i<e.length;i+=2)n.push(parseInt(e[i]+e[i+1],16))}else for(var r=0,i=0;i<e.length;i++){var o=e.charCodeAt(i);o<128?n[r++]=o:o<2048?(n[r++]=o>>6|192,n[r++]=63&o|128):Ap(e,i)?(o=65536+((1023&o)<<10)+(1023&e.charCodeAt(++i)),n[r++]=o>>18|240,n[r++]=o>>12&63|128,n[r++]=o>>6&63|128,n[r++]=63&o|128):(n[r++]=o>>12|224,n[r++]=o>>6&63|128,n[r++]=63&o|128)}else for(i=0;i<e.length;i++)n[i]=0|e[i];return n},yp.toHex=function(e){for(var t="",n=0;n<e.length;n++)t+=Ep(e[n].toString(16));return t},yp.htonl=_p,yp.toHex32=function(e,t){for(var n="",r=0;r<e.length;r++){var i=e[r];"little"===t&&(i=_p(i)),n+=Sp(i.toString(16))}return n},yp.zero2=Ep,yp.zero8=Sp,yp.join32=function(e,t,n,r){var i=n-t;bp(i%4==0);for(var o=new Array(i/4),a=0,s=t;a<o.length;a++,s+=4){var u;u="big"===r?e[s]<<24|e[s+1]<<16|e[s+2]<<8|e[s+3]:e[s+3]<<24|e[s+2]<<16|e[s+1]<<8|e[s],o[a]=u>>>0}return o},yp.split32=function(e,t){for(var n=new Array(4*e.length),r=0,i=0;r<e.length;r++,i+=4){var o=e[r];"big"===t?(n[i]=o>>>24,n[i+1]=o>>>16&255,n[i+2]=o>>>8&255,n[i+3]=255&o):(n[i+3]=o>>>24,n[i+2]=o>>>16&255,n[i+1]=o>>>8&255,n[i]=255&o)}return n},yp.rotr32=function(e,t){return e>>>t|e<<32-t},yp.rotl32=function(e,t){return e<<t|e>>>32-t},yp.sum32=function(e,t){return e+t>>>0},yp.sum32_3=function(e,t,n){return e+t+n>>>0},yp.sum32_4=function(e,t,n,r){return e+t+n+r>>>0},yp.sum32_5=function(e,t,n,r,i){return e+t+n+r+i>>>0},yp.sum64=function(e,t,n,r){var i=e[t],o=r+e[t+1]>>>0,a=(o<r?1:0)+n+i;e[t]=a>>>0,e[t+1]=o},yp.sum64_hi=function(e,t,n,r){return(t+r>>>0<t?1:0)+e+n>>>0},yp.sum64_lo=function(e,t,n,r){return t+r>>>0},yp.sum64_4_hi=function(e,t,n,r,i,o,a,s){var u=0,l=t;return u+=(l=l+r>>>0)<t?1:0,u+=(l=l+o>>>0)<o?1:0,e+n+i+a+(u+=(l=l+s>>>0)<s?1:0)>>>0},yp.sum64_4_lo=function(e,t,n,r,i,o,a,s){return t+r+o+s>>>0},yp.sum64_5_hi=function(e,t,n,r,i,o,a,s,u,l){var c=0,d=t;return c+=(d=d+r>>>0)<t?1:0,c+=(d=d+o>>>0)<o?1:0,c+=(d=d+s>>>0)<s?1:0,e+n+i+a+u+(c+=(d=d+l>>>0)<l?1:0)>>>0},yp.sum64_5_lo=function(e,t,n,r,i,o,a,s,u,l){return t+r+o+s+l>>>0},yp.rotr64_hi=function(e,t,n){return(t<<32-n|e>>>n)>>>0},yp.rotr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0},yp.shr64_hi=function(e,t,n){return e>>>n},yp.shr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0};var kp={},Mp=yp,Cp=Gl;function xp(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}kp.BlockHash=xp,xp.prototype.update=function(e,t){if(e=Mp.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var n=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-n,e.length),0===this.pending.length&&(this.pending=null),e=Mp.join32(e,0,e.length-n,this.endian);for(var r=0;r<e.length;r+=this._delta32)this._update(e,r,r+this._delta32)}return this},xp.prototype.digest=function(e){return this.update(this._pad()),Cp(null===this.pending),this._digest(e)},xp.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,n=t-(e+this.padLength)%t,r=new Array(n+this.padLength);r[0]=128;for(var i=1;i<n;i++)r[i]=0;if(e<<=3,"big"===this.endian){for(var o=8;o<this.padLength;o++)r[i++]=0;r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=e>>>24&255,r[i++]=e>>>16&255,r[i++]=e>>>8&255,r[i++]=255&e}else for(r[i++]=255&e,r[i++]=e>>>8&255,r[i++]=e>>>16&255,r[i++]=e>>>24&255,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,o=8;o<this.padLength;o++)r[i++]=0;return r};var Rp={},Op={},Tp=yp.rotr32;function Pp(e,t,n){return e&t^~e&n}function Lp(e,t,n){return e&t^e&n^t&n}function Ip(e,t,n){return e^t^n}Op.ft_1=function(e,t,n,r){return 0===e?Pp(t,n,r):1===e||3===e?Ip(t,n,r):2===e?Lp(t,n,r):void 0},Op.ch32=Pp,Op.maj32=Lp,Op.p32=Ip,Op.s0_256=function(e){return Tp(e,2)^Tp(e,13)^Tp(e,22)},Op.s1_256=function(e){return Tp(e,6)^Tp(e,11)^Tp(e,25)},Op.g0_256=function(e){return Tp(e,7)^Tp(e,18)^e>>>3},Op.g1_256=function(e){return Tp(e,17)^Tp(e,19)^e>>>10};var Np=yp,Dp=kp,Bp=Op,jp=Np.rotl32,Up=Np.sum32,zp=Np.sum32_5,Fp=Bp.ft_1,qp=Dp.BlockHash,Wp=[1518500249,1859775393,2400959708,3395469782];function Vp(){if(!(this instanceof Vp))return new Vp;qp.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}Np.inherits(Vp,qp);var Kp=Vp;Vp.blockSize=512,Vp.outSize=160,Vp.hmacStrength=80,Vp.padLength=64,Vp.prototype._update=function(e,t){for(var n=this.W,r=0;r<16;r++)n[r]=e[t+r];for(;r<n.length;r++)n[r]=jp(n[r-3]^n[r-8]^n[r-14]^n[r-16],1);var i=this.h[0],o=this.h[1],a=this.h[2],s=this.h[3],u=this.h[4];for(r=0;r<n.length;r++){var l=~~(r/20),c=zp(jp(i,5),Fp(l,o,a,s),u,n[r],Wp[l]);u=s,s=a,a=jp(o,30),o=i,i=c}this.h[0]=Up(this.h[0],i),this.h[1]=Up(this.h[1],o),this.h[2]=Up(this.h[2],a),this.h[3]=Up(this.h[3],s),this.h[4]=Up(this.h[4],u)},Vp.prototype._digest=function(e){return"hex"===e?Np.toHex32(this.h,"big"):Np.split32(this.h,"big")};var Hp=yp,$p=kp,Yp=Op,Gp=Gl,Qp=Hp.sum32,Zp=Hp.sum32_4,Xp=Hp.sum32_5,Jp=Yp.ch32,em=Yp.maj32,tm=Yp.s0_256,nm=Yp.s1_256,rm=Yp.g0_256,im=Yp.g1_256,om=$p.BlockHash,am=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function sm(){if(!(this instanceof sm))return new sm;om.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=am,this.W=new Array(64)}Hp.inherits(sm,om);var um=sm;sm.blockSize=512,sm.outSize=256,sm.hmacStrength=192,sm.padLength=64,sm.prototype._update=function(e,t){for(var n=this.W,r=0;r<16;r++)n[r]=e[t+r];for(;r<n.length;r++)n[r]=Zp(im(n[r-2]),n[r-7],rm(n[r-15]),n[r-16]);var i=this.h[0],o=this.h[1],a=this.h[2],s=this.h[3],u=this.h[4],l=this.h[5],c=this.h[6],d=this.h[7];for(Gp(this.k.length===n.length),r=0;r<n.length;r++){var f=Xp(d,nm(u),Jp(u,l,c),this.k[r],n[r]),h=Qp(tm(i),em(i,o,a));d=c,c=l,l=u,u=Qp(s,f),s=a,a=o,o=i,i=Qp(f,h)}this.h[0]=Qp(this.h[0],i),this.h[1]=Qp(this.h[1],o),this.h[2]=Qp(this.h[2],a),this.h[3]=Qp(this.h[3],s),this.h[4]=Qp(this.h[4],u),this.h[5]=Qp(this.h[5],l),this.h[6]=Qp(this.h[6],c),this.h[7]=Qp(this.h[7],d)},sm.prototype._digest=function(e){return"hex"===e?Hp.toHex32(this.h,"big"):Hp.split32(this.h,"big")};var lm=yp,cm=um;function dm(){if(!(this instanceof dm))return new dm;cm.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}lm.inherits(dm,cm);var fm=dm;dm.blockSize=512,dm.outSize=224,dm.hmacStrength=192,dm.padLength=64,dm.prototype._digest=function(e){return"hex"===e?lm.toHex32(this.h.slice(0,7),"big"):lm.split32(this.h.slice(0,7),"big")};var hm=yp,pm=kp,mm=Gl,gm=hm.rotr64_hi,vm=hm.rotr64_lo,ym=hm.shr64_hi,bm=hm.shr64_lo,wm=hm.sum64,Am=hm.sum64_hi,_m=hm.sum64_lo,Em=hm.sum64_4_hi,Sm=hm.sum64_4_lo,km=hm.sum64_5_hi,Mm=hm.sum64_5_lo,Cm=pm.BlockHash,xm=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Rm(){if(!(this instanceof Rm))return new Rm;Cm.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=xm,this.W=new Array(160)}hm.inherits(Rm,Cm);var Om=Rm;function Tm(e,t,n,r,i){var o=e&n^~e&i;return o<0&&(o+=4294967296),o}function Pm(e,t,n,r,i,o){var a=t&r^~t&o;return a<0&&(a+=4294967296),a}function Lm(e,t,n,r,i){var o=e&n^e&i^n&i;return o<0&&(o+=4294967296),o}function Im(e,t,n,r,i,o){var a=t&r^t&o^r&o;return a<0&&(a+=4294967296),a}function Nm(e,t){var n=gm(e,t,28)^gm(t,e,2)^gm(t,e,7);return n<0&&(n+=4294967296),n}function Dm(e,t){var n=vm(e,t,28)^vm(t,e,2)^vm(t,e,7);return n<0&&(n+=4294967296),n}function Bm(e,t){var n=gm(e,t,14)^gm(e,t,18)^gm(t,e,9);return n<0&&(n+=4294967296),n}function jm(e,t){var n=vm(e,t,14)^vm(e,t,18)^vm(t,e,9);return n<0&&(n+=4294967296),n}function Um(e,t){var n=gm(e,t,1)^gm(e,t,8)^ym(e,t,7);return n<0&&(n+=4294967296),n}function zm(e,t){var n=vm(e,t,1)^vm(e,t,8)^bm(e,t,7);return n<0&&(n+=4294967296),n}function Fm(e,t){var n=gm(e,t,19)^gm(t,e,29)^ym(e,t,6);return n<0&&(n+=4294967296),n}function qm(e,t){var n=vm(e,t,19)^vm(t,e,29)^bm(e,t,6);return n<0&&(n+=4294967296),n}Rm.blockSize=1024,Rm.outSize=512,Rm.hmacStrength=192,Rm.padLength=128,Rm.prototype._prepareBlock=function(e,t){for(var n=this.W,r=0;r<32;r++)n[r]=e[t+r];for(;r<n.length;r+=2){var i=Fm(n[r-4],n[r-3]),o=qm(n[r-4],n[r-3]),a=n[r-14],s=n[r-13],u=Um(n[r-30],n[r-29]),l=zm(n[r-30],n[r-29]),c=n[r-32],d=n[r-31];n[r]=Em(i,o,a,s,u,l,c,d),n[r+1]=Sm(i,o,a,s,u,l,c,d)}},Rm.prototype._update=function(e,t){this._prepareBlock(e,t);var n=this.W,r=this.h[0],i=this.h[1],o=this.h[2],a=this.h[3],s=this.h[4],u=this.h[5],l=this.h[6],c=this.h[7],d=this.h[8],f=this.h[9],h=this.h[10],p=this.h[11],m=this.h[12],g=this.h[13],v=this.h[14],y=this.h[15];mm(this.k.length===n.length);for(var b=0;b<n.length;b+=2){var w=v,A=y,_=Bm(d,f),E=jm(d,f),S=Tm(d,0,h,0,m),k=Pm(0,f,0,p,0,g),M=this.k[b],C=this.k[b+1],x=n[b],R=n[b+1],O=km(w,A,_,E,S,k,M,C,x,R),T=Mm(w,A,_,E,S,k,M,C,x,R);w=Nm(r,i),A=Dm(r,i),_=Lm(r,0,o,0,s),E=Im(0,i,0,a,0,u);var P=Am(w,A,_,E),L=_m(w,A,_,E);v=m,y=g,m=h,g=p,h=d,p=f,d=Am(l,c,O,T),f=_m(c,c,O,T),l=s,c=u,s=o,u=a,o=r,a=i,r=Am(O,T,P,L),i=_m(O,T,P,L)}wm(this.h,0,r,i),wm(this.h,2,o,a),wm(this.h,4,s,u),wm(this.h,6,l,c),wm(this.h,8,d,f),wm(this.h,10,h,p),wm(this.h,12,m,g),wm(this.h,14,v,y)},Rm.prototype._digest=function(e){return"hex"===e?hm.toHex32(this.h,"big"):hm.split32(this.h,"big")};var Wm=yp,Vm=Om;function Km(){if(!(this instanceof Km))return new Km;Vm.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}Wm.inherits(Km,Vm);var Hm=Km;Km.blockSize=1024,Km.outSize=384,Km.hmacStrength=192,Km.padLength=128,Km.prototype._digest=function(e){return"hex"===e?Wm.toHex32(this.h.slice(0,12),"big"):Wm.split32(this.h.slice(0,12),"big")},Rp.sha1=Kp,Rp.sha224=fm,Rp.sha256=um,Rp.sha384=Hm,Rp.sha512=Om;var $m={},Ym=yp,Gm=kp,Qm=Ym.rotl32,Zm=Ym.sum32,Xm=Ym.sum32_3,Jm=Ym.sum32_4,eg=Gm.BlockHash;function tg(){if(!(this instanceof tg))return new tg;eg.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function ng(e,t,n,r){return e<=15?t^n^r:e<=31?t&n|~t&r:e<=47?(t|~n)^r:e<=63?t&r|n&~r:t^(n|~r)}function rg(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function ig(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}Ym.inherits(tg,eg),$m.ripemd160=tg,tg.blockSize=512,tg.outSize=160,tg.hmacStrength=192,tg.padLength=64,tg.prototype._update=function(e,t){for(var n=this.h[0],r=this.h[1],i=this.h[2],o=this.h[3],a=this.h[4],s=n,u=r,l=i,c=o,d=a,f=0;f<80;f++){var h=Zm(Qm(Jm(n,ng(f,r,i,o),e[og[f]+t],rg(f)),sg[f]),a);n=a,a=o,o=Qm(i,10),i=r,r=h,h=Zm(Qm(Jm(s,ng(79-f,u,l,c),e[ag[f]+t],ig(f)),ug[f]),d),s=d,d=c,c=Qm(l,10),l=u,u=h}h=Xm(this.h[1],i,c),this.h[1]=Xm(this.h[2],o,d),this.h[2]=Xm(this.h[3],a,s),this.h[3]=Xm(this.h[4],n,u),this.h[4]=Xm(this.h[0],r,l),this.h[0]=h},tg.prototype._digest=function(e){return"hex"===e?Ym.toHex32(this.h,"little"):Ym.split32(this.h,"little")};var og=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],ag=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],sg=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],ug=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],lg=yp,cg=Gl;function dg(e,t,n){if(!(this instanceof dg))return new dg(e,t,n);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(lg.toArray(t,n))}var fg,hg,pg=dg;dg.prototype._init=function(e){e.length>this.blockSize&&(e=(new this.Hash).update(e).digest()),cg(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=(new this.Hash).update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=(new this.Hash).update(e)},dg.prototype.update=function(e,t){return this.inner.update(e,t),this},dg.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)},function(e){var t=vp;t.utils=yp,t.common=kp,t.sha=Rp,t.ripemd=$m,t.hmac=pg,t.sha1=t.sha.sha1,t.sha256=t.sha.sha256,t.sha224=t.sha.sha224,t.sha384=t.sha.sha384,t.sha512=t.sha.sha512,t.ripemd160=t.ripemd.ripemd160}(),function(e){var t,n=gp,r=vp,i=Uh,o=Bh.assert;function a(e){"short"===e.type?this.curve=new i.short(e):"edwards"===e.type?this.curve=new i.edwards(e):this.curve=new i.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,o(this.g.validate(),"Invalid curve"),o(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function s(e,t){Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:function(){var r=new a(t);return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=a,s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:r.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:r.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:r.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:r.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:r.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{t=hg?fg:(hg=1,fg={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}})}catch(e){t=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:r.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",t]})}();var mg=vp,gg=jh,vg=Gl;function yg(e){if(!(this instanceof yg))return new yg(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=gg.toArray(e.entropy,e.entropyEnc||"hex"),n=gg.toArray(e.nonce,e.nonceEnc||"hex"),r=gg.toArray(e.pers,e.persEnc||"hex");vg(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,n,r)}var bg=yg;yg.prototype._init=function(e,t,n){var r=e.concat(t).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i<this.V.length;i++)this.K[i]=0,this.V[i]=1;this._update(r),this._reseed=1,this.reseedInterval=281474976710656},yg.prototype._hmac=function(){return new mg.hmac(this.hash,this.K)},yg.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},yg.prototype.reseed=function(e,t,n,r){"string"!=typeof t&&(r=n,n=t,t=null),e=gg.toArray(e,t),n=gg.toArray(n,r),vg(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},yg.prototype.generate=function(e,t,n,r){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(r=n,n=t,t=null),n&&(n=gg.toArray(n,r||"hex"),this._update(n));for(var i=[];i.length<e;)this.V=this._hmac().update(this.V).digest(),i=i.concat(this.V);var o=i.slice(0,e);return this._update(n),this._reseed++,gg.encode(o,t)};var wg=vf,Ag=Bh.assert;function _g(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}var Eg=_g;_g.fromPublic=function(e,t,n){return t instanceof _g?t:new _g(e,{pub:t,pubEnc:n})},_g.fromPrivate=function(e,t,n){return t instanceof _g?t:new _g(e,{priv:t,privEnc:n})},_g.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},_g.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},_g.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},_g.prototype._importPrivate=function(e,t){this.priv=new wg(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},_g.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?Ag(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||Ag(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},_g.prototype.derive=function(e){return e.validate()||Ag(e.validate(),"public point not validated"),e.mul(this.priv).getX()},_g.prototype.sign=function(e,t,n){return this.ec.sign(e,this,t,n)},_g.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},_g.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var Sg=vf,kg=Bh,Mg=kg.assert;function Cg(e,t){if(e instanceof Cg)return e;this._importDER(e,t)||(Mg(e.r&&e.s,"Signature without r or s"),this.r=new Sg(e.r,16),this.s=new Sg(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var xg,Rg,Og=Cg;function Tg(){this.place=0}function Pg(e,t){var n=e[t.place++];if(!(128&n))return n;var r=15&n;if(0===r||r>4)return!1;for(var i=0,o=0,a=t.place;o<r;o++,a++)i<<=8,i|=e[a],i>>>=0;return!(i<=127)&&(t.place=a,i)}function Lg(e){for(var t=0,n=e.length-1;!e[t]&&!(128&e[t+1])&&t<n;)t++;return 0===t?e:e.slice(t)}function Ig(e,t){if(t<128)e.push(t);else{var n=1+(Math.log(t)/Math.LN2>>>3);for(e.push(128|n);--n;)e.push(t>>>(n<<3)&255);e.push(t)}}Cg.prototype._importDER=function(e,t){e=kg.toArray(e,t);var n=new Tg;if(48!==e[n.place++])return!1;var r=Pg(e,n);if(!1===r)return!1;if(r+n.place!==e.length)return!1;if(2!==e[n.place++])return!1;var i=Pg(e,n);if(!1===i)return!1;var o=e.slice(n.place,i+n.place);if(n.place+=i,2!==e[n.place++])return!1;var a=Pg(e,n);if(!1===a)return!1;if(e.length!==a+n.place)return!1;var s=e.slice(n.place,a+n.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}return this.r=new Sg(o),this.s=new Sg(s),this.recoveryParam=null,!0},Cg.prototype.toDER=function(e){var t=this.r.toArray(),n=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&n[0]&&(n=[0].concat(n)),t=Lg(t),n=Lg(n);!(n[0]||128&n[1]);)n=n.slice(1);var r=[2];Ig(r,t.length),(r=r.concat(t)).push(2),Ig(r,n.length);var i=r.concat(n),o=[48];return Ig(o,i.length),o=o.concat(i),kg.encode(o,e)};var Ng=Bh,Dg=Ng.assert,Bg=Ng.parseBytes,jg=Ng.cachedProperty;function Ug(e,t){this.eddsa=e,this._secret=Bg(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=Bg(t.pub)}Ug.fromPublic=function(e,t){return t instanceof Ug?t:new Ug(e,{pub:t})},Ug.fromSecret=function(e,t){return t instanceof Ug?t:new Ug(e,{secret:t})},Ug.prototype.secret=function(){return this._secret},jg(Ug,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),jg(Ug,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),jg(Ug,"privBytes",(function(){var e=this.eddsa,t=this.hash(),n=e.encodingLength-1,r=t.slice(0,e.encodingLength);return r[0]&=248,r[n]&=127,r[n]|=64,r})),jg(Ug,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),jg(Ug,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),jg(Ug,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),Ug.prototype.sign=function(e){return Dg(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},Ug.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},Ug.prototype.getSecret=function(e){return Dg(this._secret,"KeyPair is public only"),Ng.encode(this.secret(),e)},Ug.prototype.getPublic=function(e){return Ng.encode(this.pubBytes(),e)};var zg=Ug,Fg=vf,qg=Bh,Wg=qg.assert,Vg=qg.cachedProperty,Kg=qg.parseBytes;function Hg(e,t){this.eddsa=e,"object"!=typeof t&&(t=Kg(t)),Array.isArray(t)&&(t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),Wg(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof Fg&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}Vg(Hg,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),Vg(Hg,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),Vg(Hg,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),Vg(Hg,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),Hg.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},Hg.prototype.toHex=function(){return qg.encode(this.toBytes(),"hex").toUpperCase()};var $g=Hg,Yg=vp,Gg=gp,Qg=Bh,Zg=Qg.assert,Xg=Qg.parseBytes,Jg=zg,ev=$g;function tv(e){if(Zg("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof tv))return new tv(e);e=Gg[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=Yg.sha512}var nv,rv=tv;function iv(){return nv||(nv=1,function(e){var t=Nh;t.version=Dh.version,t.utils=Bh,t.rand=bf(),t.curve=Uh,t.curves=gp,t.ec=function(){if(Rg)return xg;Rg=1;var e=vf,t=bg,n=Bh,r=gp,i=bf(),o=n.assert,a=Eg,s=Og;function u(e){if(!(this instanceof u))return new u(e);"string"==typeof e&&(o(Object.prototype.hasOwnProperty.call(r,e),"Unknown curve "+e),e=r[e]),e instanceof r.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}return xg=u,u.prototype.keyPair=function(e){return new a(this,e)},u.prototype.keyFromPrivate=function(e,t){return a.fromPrivate(this,e,t)},u.prototype.keyFromPublic=function(e,t){return a.fromPublic(this,e,t)},u.prototype.genKeyPair=function(n){n||(n={});for(var r=new t({hash:this.hash,pers:n.pers,persEnc:n.persEnc||"utf8",entropy:n.entropy||i(this.hash.hmacStrength),entropyEnc:n.entropy&&n.entropyEnc||"utf8",nonce:this.n.toArray()}),o=this.n.byteLength(),a=this.n.sub(new e(2));;){var s=new e(r.generate(o));if(!(s.cmp(a)>0))return s.iaddn(1),this.keyFromPrivate(s)}},u.prototype._truncateToN=function(e,t){var n=8*e.byteLength()-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},u.prototype.sign=function(n,r,i,o){"object"==typeof i&&(o=i,i=null),o||(o={}),r=this.keyFromPrivate(r,i),n=this._truncateToN(new e(n,16));for(var a=this.n.byteLength(),u=r.getPrivate().toArray("be",a),l=n.toArray("be",a),c=new t({hash:this.hash,entropy:u,nonce:l,pers:o.pers,persEnc:o.persEnc||"utf8"}),d=this.n.sub(new e(1)),f=0;;f++){var h=o.k?o.k(f):new e(c.generate(this.n.byteLength()));if(!((h=this._truncateToN(h,!0)).cmpn(1)<=0||h.cmp(d)>=0)){var p=this.g.mul(h);if(!p.isInfinity()){var m=p.getX(),g=m.umod(this.n);if(0!==g.cmpn(0)){var v=h.invm(this.n).mul(g.mul(r.getPrivate()).iadd(n));if(0!==(v=v.umod(this.n)).cmpn(0)){var y=(p.getY().isOdd()?1:0)|(0!==m.cmp(g)?2:0);return o.canonical&&v.cmp(this.nh)>0&&(v=this.n.sub(v),y^=1),new s({r:g,s:v,recoveryParam:y})}}}}}},u.prototype.verify=function(t,n,r,i){t=this._truncateToN(new e(t,16)),r=this.keyFromPublic(r,i);var o=(n=new s(n,"hex")).r,a=n.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var u,l=a.invm(this.n),c=l.mul(t).umod(this.n),d=l.mul(o).umod(this.n);return this.curve._maxwellTrick?!(u=this.g.jmulAdd(c,r.getPublic(),d)).isInfinity()&&u.eqXToP(o):!(u=this.g.mulAdd(c,r.getPublic(),d)).isInfinity()&&0===u.getX().umod(this.n).cmp(o)},u.prototype.recoverPubKey=function(t,n,r,i){o((3&r)===r,"The recovery param is more than two bits"),n=new s(n,i);var a=this.n,u=new e(t),l=n.r,c=n.s,d=1&r,f=r>>1;if(l.cmp(this.curve.p.umod(this.curve.n))>=0&&f)throw new Error("Unable to find sencond key candinate");l=f?this.curve.pointFromX(l.add(this.curve.n),d):this.curve.pointFromX(l,d);var h=n.r.invm(a),p=a.sub(u).mul(h).umod(a),m=c.mul(h).umod(a);return this.g.mulAdd(p,l,m)},u.prototype.getKeyRecoveryParam=function(e,t,n,r){if(null!==(t=new s(t,r)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(e,t,i)}catch(e){continue}if(o.eq(n))return i}throw new Error("Unable to find valid recovery factor")},xg}(),t.eddsa=rv}()),Nh}tv.prototype.sign=function(e,t){e=Xg(e);var n=this.keyFromSecret(t),r=this.hashInt(n.messagePrefix(),e),i=this.g.mul(r),o=this.encodePoint(i),a=this.hashInt(o,n.pubBytes(),e).mul(n.priv()),s=r.add(a).umod(this.curve.n);return this.makeSignature({R:i,S:s,Rencoded:o})},tv.prototype.verify=function(e,t,n){e=Xg(e),t=this.makeSignature(t);var r=this.keyFromPublic(n),i=this.hashInt(t.Rencoded(),r.pubBytes(),e),o=this.g.mul(t.S());return t.R().add(r.pub().mul(i)).eq(o)},tv.prototype.hashInt=function(){for(var e=this.hash(),t=0;t<arguments.length;t++)e.update(arguments[t]);return Qg.intFromLE(e.digest()).umod(this.curve.n)},tv.prototype.keyFromPublic=function(e){return Jg.fromPublic(this,e)},tv.prototype.keyFromSecret=function(e){return Jg.fromSecret(this,e)},tv.prototype.makeSignature=function(e){return e instanceof ev?e:new ev(this,e)},tv.prototype.encodePoint=function(e){var t=e.getY().toArray("le",this.encodingLength);return t[this.encodingLength-1]|=e.getX().isOdd()?128:0,t},tv.prototype.decodePoint=function(e){var t=(e=Qg.parseBytes(e)).length-1,n=e.slice(0,t).concat(-129&e[t]),r=0!=(128&e[t]),i=Qg.intFromLE(n);return this.curve.pointFromY(i,r)},tv.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)},tv.prototype.decodeInt=function(e){return Qg.intFromLE(e)},tv.prototype.isPoint=function(e){return e instanceof this.pointClass};var ov={exports:{}};!function(e,t){function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function r(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function i(e,t,n){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}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:yr.Buffer}catch(e){}function a(e,t){var r=e.charCodeAt(t);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+e)}function s(e,t,n){var r=a(e,n);return n-1>=t&&(r|=a(e,n-1)<<4),r}function u(e,t,r,i){for(var o=0,a=0,s=Math.min(e.length,r),u=t;u<s;u++){var l=e.charCodeAt(u)-48;o*=i,a=l>=49?l-49+10:l>=17?l-17+10:l,n(l>=0&&a<i,"Invalid character"),o+=a}return o}function l(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,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<e.length&&(16===t?this._parseHex(e,i,r):(this._parseBase(e,t,i),"le"===r&&this._initArray(this.toArray(),t,r)))},i.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(n(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},i.prototype._initArray=function(e,t,r){if(n("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===r)for(i=e.length-1,o=0;i>=0;i-=3)a=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i<e.length;i+=3)a=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},i.prototype._parseHex=function(e,t,n){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 i,o=0,a=0;if("be"===n)for(r=e.length-1;r>=t;r-=2)i=s(e,t,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(e.length-t)%2==0?t+1:t;r<e.length;r+=2)i=s(e,t,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,a=o%r,s=Math.min(o,o-a)+n,l=0,c=n;c<s;c+=r)l=u(e,c,c+r,t),this.imuln(i),this.words[0]+l<67108864?this.words[0]+=l:this._iaddn(l);if(0!==a){var d=1;for(l=u(e,c,e.length,t),c=0;c<a;c++)d*=t;this.imuln(d),this.words[0]+l<67108864?this.words[0]+=l:this._iaddn(l)}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){l(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")]=c}catch(e){i.prototype.inspect=c}else i.prototype.inspect=c;function c(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function p(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var l=1;l<r;l++){for(var c=u>>>26,d=67108863&u,f=Math.min(l,t.length-1),h=Math.max(0,l-e.length+1);h<=f;h++){var p=l-h|0;c+=(a=(i=0|e.words[p])*(o=0|t.words[h])+d)/67108864|0,d=67108863&a}n.words[l]=0|d,u=0|c}return 0!==u?n.words[l]=0|u:n.length--,n._strip()}i.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<i|o)).toString(16);o=s>>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),r=0!==o||a!==this.length-1?d[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=f[e],c=h[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modrn(c).toString(e);r=(p=p.idivn(c)).isZero()?m+r:d[l-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16,2)},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,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var a=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,o);return this["_toArrayLike"+("le"===t?"LE":"BE")](a,i),a},i.prototype._toArrayLikeLE=function(e,t){for(var n=0,r=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|r;e[n++]=255&a,n<e.length&&(e[n++]=a>>8&255),n<e.length&&(e[n++]=a>>16&255),6===o?(n<e.length&&(e[n++]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n<e.length)for(e[n++]=r;n<e.length;)e[n++]=0},i.prototype._toArrayLikeBE=function(e,t){for(var n=e.length-1,r=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|r;e[n--]=255&a,n>=0&&(e[n--]=a>>8&255),n>=0&&(e[n--]=a>>16&255),6===o?(n>=0&&(e[n--]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n>=0)for(e[n--]=r;n>=0;)e[n--]=0},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var n=this._zeroBits(this.words[t]);if(e+=n,26!==n)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 n(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 n=0;n<t.length;n++)this.words[n]=this.words[n]&e.words[n];return this.length=t.length,this._strip()},i.prototype.iand=function(e){return n(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,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;r<n.length;r++)this.words[r]=t.words[r]^n.words[r];if(this!==t)for(;r<t.length;r++)this.words[r]=t.words[r];return this.length=t.length,this._strip()},i.prototype.ixor=function(e){return n(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){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i<t;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<<i:this.words[r]&~(1<<i),this._strip()},i.prototype.iadd=function(e){var t,n,r;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?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o<r.length;o++)t=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&t,i=t>>>26;for(;0!==i&&o<n.length;o++)t=(0|n.words[o])+i,this.words[o]=67108863&t,i=t>>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;o<n.length;o++)this.words[o]=n.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 n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,a=0;a<r.length;a++)o=(t=(0|n.words[a])-(0|r.words[a])+o)>>26,this.words[a]=67108863&t;for(;0!==o&&a<n.length;a++)o=(t=(0|n.words[a])+o)>>26,this.words[a]=67108863&t;if(0===o&&a<n.length&&n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this.length=Math.max(this.length,a),n!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(e){return this.clone().isub(e)};var m=function(e,t,n){var r,i,o,a=e.words,s=t.words,u=n.words,l=0,c=0|a[0],d=8191&c,f=c>>>13,h=0|a[1],p=8191&h,m=h>>>13,g=0|a[2],v=8191&g,y=g>>>13,b=0|a[3],w=8191&b,A=b>>>13,_=0|a[4],E=8191&_,S=_>>>13,k=0|a[5],M=8191&k,C=k>>>13,x=0|a[6],R=8191&x,O=x>>>13,T=0|a[7],P=8191&T,L=T>>>13,I=0|a[8],N=8191&I,D=I>>>13,B=0|a[9],j=8191&B,U=B>>>13,z=0|s[0],F=8191&z,q=z>>>13,W=0|s[1],V=8191&W,K=W>>>13,H=0|s[2],$=8191&H,Y=H>>>13,G=0|s[3],Q=8191&G,Z=G>>>13,X=0|s[4],J=8191&X,ee=X>>>13,te=0|s[5],ne=8191&te,re=te>>>13,ie=0|s[6],oe=8191&ie,ae=ie>>>13,se=0|s[7],ue=8191&se,le=se>>>13,ce=0|s[8],de=8191&ce,fe=ce>>>13,he=0|s[9],pe=8191&he,me=he>>>13;n.negative=e.negative^t.negative,n.length=19;var ge=(l+(r=Math.imul(d,F))|0)+((8191&(i=(i=Math.imul(d,q))+Math.imul(f,F)|0))<<13)|0;l=((o=Math.imul(f,q))+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,r=Math.imul(p,F),i=(i=Math.imul(p,q))+Math.imul(m,F)|0,o=Math.imul(m,q);var ve=(l+(r=r+Math.imul(d,V)|0)|0)+((8191&(i=(i=i+Math.imul(d,K)|0)+Math.imul(f,V)|0))<<13)|0;l=((o=o+Math.imul(f,K)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,r=Math.imul(v,F),i=(i=Math.imul(v,q))+Math.imul(y,F)|0,o=Math.imul(y,q),r=r+Math.imul(p,V)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,K)|0;var ye=(l+(r=r+Math.imul(d,$)|0)|0)+((8191&(i=(i=i+Math.imul(d,Y)|0)+Math.imul(f,$)|0))<<13)|0;l=((o=o+Math.imul(f,Y)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,r=Math.imul(w,F),i=(i=Math.imul(w,q))+Math.imul(A,F)|0,o=Math.imul(A,q),r=r+Math.imul(v,V)|0,i=(i=i+Math.imul(v,K)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,K)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,Y)|0;var be=(l+(r=r+Math.imul(d,Q)|0)|0)+((8191&(i=(i=i+Math.imul(d,Z)|0)+Math.imul(f,Q)|0))<<13)|0;l=((o=o+Math.imul(f,Z)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(E,F),i=(i=Math.imul(E,q))+Math.imul(S,F)|0,o=Math.imul(S,q),r=r+Math.imul(w,V)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(A,V)|0,o=o+Math.imul(A,K)|0,r=r+Math.imul(v,$)|0,i=(i=i+Math.imul(v,Y)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,Y)|0,r=r+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,Z)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,Z)|0;var we=(l+(r=r+Math.imul(d,J)|0)|0)+((8191&(i=(i=i+Math.imul(d,ee)|0)+Math.imul(f,J)|0))<<13)|0;l=((o=o+Math.imul(f,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(M,F),i=(i=Math.imul(M,q))+Math.imul(C,F)|0,o=Math.imul(C,q),r=r+Math.imul(E,V)|0,i=(i=i+Math.imul(E,K)|0)+Math.imul(S,V)|0,o=o+Math.imul(S,K)|0,r=r+Math.imul(w,$)|0,i=(i=i+Math.imul(w,Y)|0)+Math.imul(A,$)|0,o=o+Math.imul(A,Y)|0,r=r+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,Z)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,Z)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,ee)|0;var Ae=(l+(r=r+Math.imul(d,ne)|0)|0)+((8191&(i=(i=i+Math.imul(d,re)|0)+Math.imul(f,ne)|0))<<13)|0;l=((o=o+Math.imul(f,re)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(R,F),i=(i=Math.imul(R,q))+Math.imul(O,F)|0,o=Math.imul(O,q),r=r+Math.imul(M,V)|0,i=(i=i+Math.imul(M,K)|0)+Math.imul(C,V)|0,o=o+Math.imul(C,K)|0,r=r+Math.imul(E,$)|0,i=(i=i+Math.imul(E,Y)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,Y)|0,r=r+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,Z)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,Z)|0,r=r+Math.imul(v,J)|0,i=(i=i+Math.imul(v,ee)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,ee)|0,r=r+Math.imul(p,ne)|0,i=(i=i+Math.imul(p,re)|0)+Math.imul(m,ne)|0,o=o+Math.imul(m,re)|0;var _e=(l+(r=r+Math.imul(d,oe)|0)|0)+((8191&(i=(i=i+Math.imul(d,ae)|0)+Math.imul(f,oe)|0))<<13)|0;l=((o=o+Math.imul(f,ae)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,r=Math.imul(P,F),i=(i=Math.imul(P,q))+Math.imul(L,F)|0,o=Math.imul(L,q),r=r+Math.imul(R,V)|0,i=(i=i+Math.imul(R,K)|0)+Math.imul(O,V)|0,o=o+Math.imul(O,K)|0,r=r+Math.imul(M,$)|0,i=(i=i+Math.imul(M,Y)|0)+Math.imul(C,$)|0,o=o+Math.imul(C,Y)|0,r=r+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,Z)|0)+Math.imul(S,Q)|0,o=o+Math.imul(S,Z)|0,r=r+Math.imul(w,J)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(A,J)|0,o=o+Math.imul(A,ee)|0,r=r+Math.imul(v,ne)|0,i=(i=i+Math.imul(v,re)|0)+Math.imul(y,ne)|0,o=o+Math.imul(y,re)|0,r=r+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,ae)|0)+Math.imul(m,oe)|0,o=o+Math.imul(m,ae)|0;var Ee=(l+(r=r+Math.imul(d,ue)|0)|0)+((8191&(i=(i=i+Math.imul(d,le)|0)+Math.imul(f,ue)|0))<<13)|0;l=((o=o+Math.imul(f,le)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(N,F),i=(i=Math.imul(N,q))+Math.imul(D,F)|0,o=Math.imul(D,q),r=r+Math.imul(P,V)|0,i=(i=i+Math.imul(P,K)|0)+Math.imul(L,V)|0,o=o+Math.imul(L,K)|0,r=r+Math.imul(R,$)|0,i=(i=i+Math.imul(R,Y)|0)+Math.imul(O,$)|0,o=o+Math.imul(O,Y)|0,r=r+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,Z)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,Z)|0,r=r+Math.imul(E,J)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(S,J)|0,o=o+Math.imul(S,ee)|0,r=r+Math.imul(w,ne)|0,i=(i=i+Math.imul(w,re)|0)+Math.imul(A,ne)|0,o=o+Math.imul(A,re)|0,r=r+Math.imul(v,oe)|0,i=(i=i+Math.imul(v,ae)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,ae)|0,r=r+Math.imul(p,ue)|0,i=(i=i+Math.imul(p,le)|0)+Math.imul(m,ue)|0,o=o+Math.imul(m,le)|0;var Se=(l+(r=r+Math.imul(d,de)|0)|0)+((8191&(i=(i=i+Math.imul(d,fe)|0)+Math.imul(f,de)|0))<<13)|0;l=((o=o+Math.imul(f,fe)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(j,F),i=(i=Math.imul(j,q))+Math.imul(U,F)|0,o=Math.imul(U,q),r=r+Math.imul(N,V)|0,i=(i=i+Math.imul(N,K)|0)+Math.imul(D,V)|0,o=o+Math.imul(D,K)|0,r=r+Math.imul(P,$)|0,i=(i=i+Math.imul(P,Y)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,Y)|0,r=r+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,Z)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,Z)|0,r=r+Math.imul(M,J)|0,i=(i=i+Math.imul(M,ee)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,ee)|0,r=r+Math.imul(E,ne)|0,i=(i=i+Math.imul(E,re)|0)+Math.imul(S,ne)|0,o=o+Math.imul(S,re)|0,r=r+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,ae)|0)+Math.imul(A,oe)|0,o=o+Math.imul(A,ae)|0,r=r+Math.imul(v,ue)|0,i=(i=i+Math.imul(v,le)|0)+Math.imul(y,ue)|0,o=o+Math.imul(y,le)|0,r=r+Math.imul(p,de)|0,i=(i=i+Math.imul(p,fe)|0)+Math.imul(m,de)|0,o=o+Math.imul(m,fe)|0;var ke=(l+(r=r+Math.imul(d,pe)|0)|0)+((8191&(i=(i=i+Math.imul(d,me)|0)+Math.imul(f,pe)|0))<<13)|0;l=((o=o+Math.imul(f,me)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(j,V),i=(i=Math.imul(j,K))+Math.imul(U,V)|0,o=Math.imul(U,K),r=r+Math.imul(N,$)|0,i=(i=i+Math.imul(N,Y)|0)+Math.imul(D,$)|0,o=o+Math.imul(D,Y)|0,r=r+Math.imul(P,Q)|0,i=(i=i+Math.imul(P,Z)|0)+Math.imul(L,Q)|0,o=o+Math.imul(L,Z)|0,r=r+Math.imul(R,J)|0,i=(i=i+Math.imul(R,ee)|0)+Math.imul(O,J)|0,o=o+Math.imul(O,ee)|0,r=r+Math.imul(M,ne)|0,i=(i=i+Math.imul(M,re)|0)+Math.imul(C,ne)|0,o=o+Math.imul(C,re)|0,r=r+Math.imul(E,oe)|0,i=(i=i+Math.imul(E,ae)|0)+Math.imul(S,oe)|0,o=o+Math.imul(S,ae)|0,r=r+Math.imul(w,ue)|0,i=(i=i+Math.imul(w,le)|0)+Math.imul(A,ue)|0,o=o+Math.imul(A,le)|0,r=r+Math.imul(v,de)|0,i=(i=i+Math.imul(v,fe)|0)+Math.imul(y,de)|0,o=o+Math.imul(y,fe)|0;var Me=(l+(r=r+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;l=((o=o+Math.imul(m,me)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,r=Math.imul(j,$),i=(i=Math.imul(j,Y))+Math.imul(U,$)|0,o=Math.imul(U,Y),r=r+Math.imul(N,Q)|0,i=(i=i+Math.imul(N,Z)|0)+Math.imul(D,Q)|0,o=o+Math.imul(D,Z)|0,r=r+Math.imul(P,J)|0,i=(i=i+Math.imul(P,ee)|0)+Math.imul(L,J)|0,o=o+Math.imul(L,ee)|0,r=r+Math.imul(R,ne)|0,i=(i=i+Math.imul(R,re)|0)+Math.imul(O,ne)|0,o=o+Math.imul(O,re)|0,r=r+Math.imul(M,oe)|0,i=(i=i+Math.imul(M,ae)|0)+Math.imul(C,oe)|0,o=o+Math.imul(C,ae)|0,r=r+Math.imul(E,ue)|0,i=(i=i+Math.imul(E,le)|0)+Math.imul(S,ue)|0,o=o+Math.imul(S,le)|0,r=r+Math.imul(w,de)|0,i=(i=i+Math.imul(w,fe)|0)+Math.imul(A,de)|0,o=o+Math.imul(A,fe)|0;var Ce=(l+(r=r+Math.imul(v,pe)|0)|0)+((8191&(i=(i=i+Math.imul(v,me)|0)+Math.imul(y,pe)|0))<<13)|0;l=((o=o+Math.imul(y,me)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,r=Math.imul(j,Q),i=(i=Math.imul(j,Z))+Math.imul(U,Q)|0,o=Math.imul(U,Z),r=r+Math.imul(N,J)|0,i=(i=i+Math.imul(N,ee)|0)+Math.imul(D,J)|0,o=o+Math.imul(D,ee)|0,r=r+Math.imul(P,ne)|0,i=(i=i+Math.imul(P,re)|0)+Math.imul(L,ne)|0,o=o+Math.imul(L,re)|0,r=r+Math.imul(R,oe)|0,i=(i=i+Math.imul(R,ae)|0)+Math.imul(O,oe)|0,o=o+Math.imul(O,ae)|0,r=r+Math.imul(M,ue)|0,i=(i=i+Math.imul(M,le)|0)+Math.imul(C,ue)|0,o=o+Math.imul(C,le)|0,r=r+Math.imul(E,de)|0,i=(i=i+Math.imul(E,fe)|0)+Math.imul(S,de)|0,o=o+Math.imul(S,fe)|0;var xe=(l+(r=r+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,me)|0)+Math.imul(A,pe)|0))<<13)|0;l=((o=o+Math.imul(A,me)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(j,J),i=(i=Math.imul(j,ee))+Math.imul(U,J)|0,o=Math.imul(U,ee),r=r+Math.imul(N,ne)|0,i=(i=i+Math.imul(N,re)|0)+Math.imul(D,ne)|0,o=o+Math.imul(D,re)|0,r=r+Math.imul(P,oe)|0,i=(i=i+Math.imul(P,ae)|0)+Math.imul(L,oe)|0,o=o+Math.imul(L,ae)|0,r=r+Math.imul(R,ue)|0,i=(i=i+Math.imul(R,le)|0)+Math.imul(O,ue)|0,o=o+Math.imul(O,le)|0,r=r+Math.imul(M,de)|0,i=(i=i+Math.imul(M,fe)|0)+Math.imul(C,de)|0,o=o+Math.imul(C,fe)|0;var Re=(l+(r=r+Math.imul(E,pe)|0)|0)+((8191&(i=(i=i+Math.imul(E,me)|0)+Math.imul(S,pe)|0))<<13)|0;l=((o=o+Math.imul(S,me)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,r=Math.imul(j,ne),i=(i=Math.imul(j,re))+Math.imul(U,ne)|0,o=Math.imul(U,re),r=r+Math.imul(N,oe)|0,i=(i=i+Math.imul(N,ae)|0)+Math.imul(D,oe)|0,o=o+Math.imul(D,ae)|0,r=r+Math.imul(P,ue)|0,i=(i=i+Math.imul(P,le)|0)+Math.imul(L,ue)|0,o=o+Math.imul(L,le)|0,r=r+Math.imul(R,de)|0,i=(i=i+Math.imul(R,fe)|0)+Math.imul(O,de)|0,o=o+Math.imul(O,fe)|0;var Oe=(l+(r=r+Math.imul(M,pe)|0)|0)+((8191&(i=(i=i+Math.imul(M,me)|0)+Math.imul(C,pe)|0))<<13)|0;l=((o=o+Math.imul(C,me)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,r=Math.imul(j,oe),i=(i=Math.imul(j,ae))+Math.imul(U,oe)|0,o=Math.imul(U,ae),r=r+Math.imul(N,ue)|0,i=(i=i+Math.imul(N,le)|0)+Math.imul(D,ue)|0,o=o+Math.imul(D,le)|0,r=r+Math.imul(P,de)|0,i=(i=i+Math.imul(P,fe)|0)+Math.imul(L,de)|0,o=o+Math.imul(L,fe)|0;var Te=(l+(r=r+Math.imul(R,pe)|0)|0)+((8191&(i=(i=i+Math.imul(R,me)|0)+Math.imul(O,pe)|0))<<13)|0;l=((o=o+Math.imul(O,me)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(j,ue),i=(i=Math.imul(j,le))+Math.imul(U,ue)|0,o=Math.imul(U,le),r=r+Math.imul(N,de)|0,i=(i=i+Math.imul(N,fe)|0)+Math.imul(D,de)|0,o=o+Math.imul(D,fe)|0;var Pe=(l+(r=r+Math.imul(P,pe)|0)|0)+((8191&(i=(i=i+Math.imul(P,me)|0)+Math.imul(L,pe)|0))<<13)|0;l=((o=o+Math.imul(L,me)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,r=Math.imul(j,de),i=(i=Math.imul(j,fe))+Math.imul(U,de)|0,o=Math.imul(U,fe);var Le=(l+(r=r+Math.imul(N,pe)|0)|0)+((8191&(i=(i=i+Math.imul(N,me)|0)+Math.imul(D,pe)|0))<<13)|0;l=((o=o+Math.imul(D,me)|0)+(i>>>13)|0)+(Le>>>26)|0,Le&=67108863;var Ie=(l+(r=Math.imul(j,pe))|0)+((8191&(i=(i=Math.imul(j,me))+Math.imul(U,pe)|0))<<13)|0;return l=((o=Math.imul(U,me))+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,u[0]=ge,u[1]=ve,u[2]=ye,u[3]=be,u[4]=we,u[5]=Ae,u[6]=_e,u[7]=Ee,u[8]=Se,u[9]=ke,u[10]=Me,u[11]=Ce,u[12]=xe,u[13]=Re,u[14]=Oe,u[15]=Te,u[16]=Pe,u[17]=Le,u[18]=Ie,0!==l&&(u[19]=l,n.length++),n};function g(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o<n.length-1;o++){var a=i;i=0;for(var s=67108863&r,u=Math.min(o,t.length-1),l=Math.max(0,o-e.length+1);l<=u;l++){var c=o-l,d=(0|e.words[c])*(0|t.words[l]),f=67108863&d;s=67108863&(f=f+s|0),i+=(a=(a=a+(d/67108864|0)|0)+(f>>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function v(e,t,n){return g(e,t,n)}Math.imul||(m=p),i.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?m(this,e,t):n<63?p(this,e,t):n<1024?g(this,e,t):v(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),v(this,e,t)},i.prototype.imul=function(e){return this.clone().mulTo(e,this)},i.prototype.imuln=function(e){var t=e<0;t&&(e=-e),n("number"==typeof e),n(e<67108864);for(var r=0,i=0;i<this.length;i++){var o=(0|this.words[i])*e,a=(67108863&o)+(67108863&r);r>>=26,r+=o/67108864|0,r+=a>>>26,this.words[i]=67108863&a}return 0!==r&&(this.words[i]=r,this.length++),t?this.ineg():this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n<t.length;n++){var r=n/26|0,i=n%26;t[n]=e.words[r]>>>i&1}return t}(e);if(0===t.length)return new i(1);for(var n=this,r=0;r<t.length&&0===t[r];r++,n=n.sqr());if(++r<t.length)for(var o=n.sqr();r<t.length;r++,o=o.sqr())0!==t[r]&&(n=n.mul(o));return n},i.prototype.iushln=function(e){n("number"==typeof e&&e>=0);var t,r=e%26,i=(e-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(t=0;t<this.length;t++){var s=this.words[t]&o,u=(0|this.words[t])-s<<r;this.words[t]=u|a,a=s>>>26-r}a&&(this.words[t]=a,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this._strip()},i.prototype.ishln=function(e){return n(0===this.negative),this.iushln(e)},i.prototype.iushrn=function(e,t,r){var i;n("number"==typeof e&&e>=0),i=t?(t-t%26)/26:0;var o=e%26,a=Math.min((e-o)/26,this.length),s=67108863^67108863>>>o<<o,u=r;if(i-=a,i=Math.max(0,i),u){for(var l=0;l<a;l++)u.words[l]=this.words[l];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,l=0;l<this.length;l++)this.words[l]=this.words[l+a];else this.words[0]=0,this.length=1;var c=0;for(l=this.length-1;l>=0&&(0!==c||l>=i);l--){var d=0|this.words[l];this.words[l]=c<<26-o|d>>>o,c=d&s}return u&&0!==c&&(u.words[u.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,i=1<<t;return!(this.length<=r||!(this.words[r]&i))},i.prototype.imaskn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,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 n("number"==typeof e),n(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(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<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,r){var i,o,a=e.length+r;this._expand(a);var s=0;for(i=0;i<e.length;i++){o=(0|this.words[i+r])+s;var u=(0|e.words[i])*t;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)s=(o=(0|this.words[i+r])+s)>>26,this.words[i+r]=67108863&o;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),o=e,a=0|o.words[o.length-1];0!=(n=26-this._countBits(a))&&(o=o.ushln(n),r.iushln(n),a=0|o.words[o.length-1]);var s,u=r.length-o.length;if("mod"!==t){(s=new i(null)).length=u+1,s.words=new Array(s.length);for(var l=0;l<s.length;l++)s.words[l]=0}var c=r.clone()._ishlnsubmul(o,1,u);0===c.negative&&(r=c,s&&(s.words[u]=1));for(var d=u-1;d>=0;d--){var f=67108864*(0|r.words[o.length+d])+(0|r.words[o.length+d-1]);for(f=Math.min(f/a|0,67108863),r._ishlnsubmul(o,f,d);0!==r.negative;)f--,r.negative=0,r._ishlnsubmul(o,1,d),r.isZero()||(r.negative^=1);s&&(s.words[d]=f)}return s&&s._strip(),r._strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(o=s.div.neg()),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(e)),{div:o,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||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,a,s},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modrn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=(1<<26)%e,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%e;return t?-i:i},i.prototype.modn=function(e){return this.modrn(e)},i.prototype.idivn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/e|0,r=o%e}return this._strip(),t?this.ineg():this},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o=new i(1),a=new i(0),s=new i(0),u=new i(1),l=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++l;for(var c=r.clone(),d=t.clone();!t.isZero();){for(var f=0,h=1;0==(t.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(t.iushrn(f);f-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(c),a.isub(d)),o.iushrn(1),a.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(c),u.isub(d)),s.iushrn(1),u.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(s),a.isub(u)):(r.isub(t),s.isub(o),u.isub(a))}return{a:s,b:u,gcd:r.iushln(l)}},i.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o,a=new i(1),s=new i(0),u=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var l=0,c=1;0==(t.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(t.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var d=0,f=1;0==(r.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(r.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(s)):(r.isub(t),s.isub(a))}return(o=0===t.cmpn(1)?a:s).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(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var o=i,a=r;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0: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,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){r<i?t=-1:r>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 n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var y={k256:null,p224:null,p192:null,p25519:null};function b(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function A(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){b.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 n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function k(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)}b.prototype._tmp=function(){var e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},b.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},b.prototype.split=function(e,t){e.iushrn(this.n,0,t)},b.prototype.imulK=function(e){return e.imul(this.k)},r(w,b),w.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i<r;i++)t.words[i]=e.words[i];if(t.length=r,e.length<=9)return e.words[0]=0,void(e.length=1);var o=e.words[9];for(t.words[t.length++]=o&n,i=10;i<e.length;i++){var a=0|e.words[i];e.words[i-10]=(a&n)<<4|o>>>22,o=a}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,n=0;n<e.length;n++){var r=0|e.words[n];t+=977*r,e.words[n]=67108863&t,t=64*r+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},r(A,b),r(_,b),r(E,b),E.prototype.imulK=function(e){for(var t=0,n=0;n<e.length;n++){var r=19*(0|e.words[n])+t,i=67108863&r;r>>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(y[e])return y[e];var t;if("k256"===e)t=new w;else if("p224"===e)t=new A;else if("p192"===e)t=new _;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new E}return y[e]=t,t},S.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},S.prototype._verify2=function(e,t){n(0==(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},S.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(l(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 n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},S.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},S.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},S.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},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(n(t%2==1),3===t){var r=this.m.add(new i(1)).iushrn(2);return this.pow(e,r)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);n(!o.isZero());var s=new i(1).toRed(this),u=s.redNeg(),l=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new i(2*c*c).toRed(this);0!==this.pow(c,l).cmp(u);)c.redIAdd(u);for(var d=this.pow(c,o),f=this.pow(e,o.addn(1).iushrn(1)),h=this.pow(e,o),p=a;0!==h.cmp(s);){for(var m=h,g=0;0!==m.cmp(s);g++)m=m.redSqr();n(g<p);var v=this.pow(d,new i(1).iushln(p-g-1));f=f.redMul(v),d=v.redSqr(),h=h.redMul(d),p=g}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 n=new Array(16);n[0]=new i(1).toRed(this),n[1]=e;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],e);var o=n[0],a=0,s=0,u=t.bitLength()%26;for(0===u&&(u=26),r=t.length-1;r>=0;r--){for(var l=t.words[r],c=u-1;c>=0;c--){var d=l>>c&1;o!==n[0]&&(o=this.sqr(o)),0!==d||0!==a?(a<<=1,a|=d,(4==++s||0===r&&0===c)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}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 k(e)},r(k,S),k.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},k.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},k.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},k.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(r).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},k.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(ov,hr);var av,sv=ov.exports,uv={},lv={},cv={},dv={},fv=yr,hv=fv.Buffer,pv={};for(av in fv)fv.hasOwnProperty(av)&&"SlowBuffer"!==av&&"Buffer"!==av&&(pv[av]=fv[av]);var mv=pv.Buffer={};for(av in hv)hv.hasOwnProperty(av)&&"allocUnsafe"!==av&&"allocUnsafeSlow"!==av&&(mv[av]=hv[av]);if(pv.Buffer.prototype=hv.prototype,mv.from&&mv.from!==Uint8Array.from||(mv.from=function(e,t,n){if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type '+typeof e);if(e&&void 0===e.length)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);return hv(e,t,n)}),mv.alloc||(mv.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError('The "size" argument must be of type number. Received type '+typeof e);if(e<0||e>=2*(1<<30))throw new RangeError('The value "'+e+'" is invalid for option "size"');var r=hv(e);return t&&0!==t.length?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r}),!pv.kStringMaxLength)try{pv.kStringMaxLength=Vr.binding("buffer").kStringMaxLength}catch(s){}pv.constants||(pv.constants={MAX_LENGTH:pv.kMaxLength},pv.kStringMaxLength&&(pv.constants.MAX_STRING_LENGTH=pv.kStringMaxLength));var gv=pv,vv={};const yv=Jr;function bv(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}function wv(e,t){this.path=e,this.rethrow(t)}vv.Reporter=bv,bv.prototype.isError=function(e){return e instanceof wv},bv.prototype.save=function(){const e=this._reporterState;return{obj:e.obj,pathLen:e.path.length}},bv.prototype.restore=function(e){const t=this._reporterState;t.obj=e.obj,t.path=t.path.slice(0,e.pathLen)},bv.prototype.enterKey=function(e){return this._reporterState.path.push(e)},bv.prototype.exitKey=function(e){const t=this._reporterState;t.path=t.path.slice(0,e-1)},bv.prototype.leaveKey=function(e,t,n){const r=this._reporterState;this.exitKey(e),null!==r.obj&&(r.obj[t]=n)},bv.prototype.path=function(){return this._reporterState.path.join("/")},bv.prototype.enterObject=function(){const e=this._reporterState,t=e.obj;return e.obj={},t},bv.prototype.leaveObject=function(e){const t=this._reporterState,n=t.obj;return t.obj=e,n},bv.prototype.error=function(e){let t;const n=this._reporterState,r=e instanceof wv;if(t=r?e:new wv(n.path.map((function(e){return"["+JSON.stringify(e)+"]"})).join(""),e.message||e,e.stack),!n.options.partial)throw t;return r||n.errors.push(t),t},bv.prototype.wrapResult=function(e){const t=this._reporterState;return t.options.partial?{result:this.isError(e)?null:e,errors:t.errors}:e},yv(wv,Error),wv.prototype.rethrow=function(e){if(this.message=e+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,wv),!this.stack)try{throw new Error(this.message)}catch(e){this.stack=e.stack}return this};var Av={};const _v=Jr,Ev=vv.Reporter,Sv=gv.Buffer;function kv(e,t){Ev.call(this,t),Sv.isBuffer(e)?(this.base=e,this.offset=0,this.length=e.length):this.error("Input not Buffer")}function Mv(e,t){if(Array.isArray(e))this.length=0,this.value=e.map((function(e){return Mv.isEncoderBuffer(e)||(e=new Mv(e,t)),this.length+=e.length,e}),this);else if("number"==typeof e){if(!(0<=e&&e<=255))return t.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if("string"==typeof e)this.value=e,this.length=Sv.byteLength(e);else{if(!Sv.isBuffer(e))return t.error("Unsupported type: "+typeof e);this.value=e,this.length=e.length}}_v(kv,Ev),Av.DecoderBuffer=kv,kv.isDecoderBuffer=function(e){return e instanceof kv||"object"==typeof e&&Sv.isBuffer(e.base)&&"DecoderBuffer"===e.constructor.name&&"number"==typeof e.offset&&"number"==typeof e.length&&"function"==typeof e.save&&"function"==typeof e.restore&&"function"==typeof e.isEmpty&&"function"==typeof e.readUInt8&&"function"==typeof e.skip&&"function"==typeof e.raw},kv.prototype.save=function(){return{offset:this.offset,reporter:Ev.prototype.save.call(this)}},kv.prototype.restore=function(e){const t=new kv(this.base);return t.offset=e.offset,t.length=this.offset,this.offset=e.offset,Ev.prototype.restore.call(this,e.reporter),t},kv.prototype.isEmpty=function(){return this.offset===this.length},kv.prototype.readUInt8=function(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||"DecoderBuffer overrun")},kv.prototype.skip=function(e,t){if(!(this.offset+e<=this.length))return this.error(t||"DecoderBuffer overrun");const n=new kv(this.base);return n._reporterState=this._reporterState,n.offset=this.offset,n.length=this.offset+e,this.offset+=e,n},kv.prototype.raw=function(e){return this.base.slice(e?e.offset:this.offset,this.length)},Av.EncoderBuffer=Mv,Mv.isEncoderBuffer=function(e){return e instanceof Mv||"object"==typeof e&&"EncoderBuffer"===e.constructor.name&&"number"==typeof e.length&&"function"==typeof e.join},Mv.prototype.join=function(e,t){return e||(e=Sv.alloc(this.length)),t||(t=0),0===this.length||(Array.isArray(this.value)?this.value.forEach((function(n){n.join(e,t),t+=n.length})):("number"==typeof this.value?e[t]=this.value:"string"==typeof this.value?e.write(this.value,t):Sv.isBuffer(this.value)&&this.value.copy(e,t),t+=this.length)),e};const Cv=vv.Reporter,xv=Av.EncoderBuffer,Rv=Av.DecoderBuffer,Ov=Gl,Tv=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],Pv=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(Tv);function Lv(e,t,n){const r={};this._baseState=r,r.name=n,r.enc=e,r.parent=t||null,r.children=null,r.tag=null,r.args=null,r.reverseArgs=null,r.choice=null,r.optional=!1,r.any=!1,r.obj=!1,r.use=null,r.useDecoder=null,r.key=null,r.default=null,r.explicit=null,r.implicit=null,r.contains=null,r.parent||(r.children=[],this._wrap())}var Iv=Lv;const Nv=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];Lv.prototype.clone=function(){const e=this._baseState,t={};Nv.forEach((function(n){t[n]=e[n]}));const n=new this.constructor(t.parent);return n._baseState=t,n},Lv.prototype._wrap=function(){const e=this._baseState;Pv.forEach((function(t){this[t]=function(){const n=new this.constructor(this);return e.children.push(n),n[t].apply(n,arguments)}}),this)},Lv.prototype._init=function(e){const t=this._baseState;Ov(null===t.parent),e.call(this),t.children=t.children.filter((function(e){return e._baseState.parent===this}),this),Ov.equal(t.children.length,1,"Root node can have only one child")},Lv.prototype._useArgs=function(e){const t=this._baseState,n=e.filter((function(e){return e instanceof this.constructor}),this);e=e.filter((function(e){return!(e instanceof this.constructor)}),this),0!==n.length&&(Ov(null===t.children),t.children=n,n.forEach((function(e){e._baseState.parent=this}),this)),0!==e.length&&(Ov(null===t.args),t.args=e,t.reverseArgs=e.map((function(e){if("object"!=typeof e||e.constructor!==Object)return e;const t={};return Object.keys(e).forEach((function(n){n==(0|n)&&(n|=0);const r=e[n];t[r]=n})),t})))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach((function(e){Lv.prototype[e]=function(){const t=this._baseState;throw new Error(e+" not implemented for encoding: "+t.enc)}})),Tv.forEach((function(e){Lv.prototype[e]=function(){const t=this._baseState,n=Array.prototype.slice.call(arguments);return Ov(null===t.tag),t.tag=e,this._useArgs(n),this}})),Lv.prototype.use=function(e){Ov(e);const t=this._baseState;return Ov(null===t.use),t.use=e,this},Lv.prototype.optional=function(){return this._baseState.optional=!0,this},Lv.prototype.def=function(e){const t=this._baseState;return Ov(null===t.default),t.default=e,t.optional=!0,this},Lv.prototype.explicit=function(e){const t=this._baseState;return Ov(null===t.explicit&&null===t.implicit),t.explicit=e,this},Lv.prototype.implicit=function(e){const t=this._baseState;return Ov(null===t.explicit&&null===t.implicit),t.implicit=e,this},Lv.prototype.obj=function(){const e=this._baseState,t=Array.prototype.slice.call(arguments);return e.obj=!0,0!==t.length&&this._useArgs(t),this},Lv.prototype.key=function(e){const t=this._baseState;return Ov(null===t.key),t.key=e,this},Lv.prototype.any=function(){return this._baseState.any=!0,this},Lv.prototype.choice=function(e){const t=this._baseState;return Ov(null===t.choice),t.choice=e,this._useArgs(Object.keys(e).map((function(t){return e[t]}))),this},Lv.prototype.contains=function(e){const t=this._baseState;return Ov(null===t.use),t.contains=e,this},Lv.prototype._decode=function(e,t){const n=this._baseState;if(null===n.parent)return e.wrapResult(n.children[0]._decode(e,t));let r,i=n.default,o=!0,a=null;if(null!==n.key&&(a=e.enterKey(n.key)),n.optional){let r=null;if(null!==n.explicit?r=n.explicit:null!==n.implicit?r=n.implicit:null!==n.tag&&(r=n.tag),null!==r||n.any){if(o=this._peekTag(e,r,n.any),e.isError(o))return o}else{const r=e.save();try{null===n.choice?this._decodeGeneric(n.tag,e,t):this._decodeChoice(e,t),o=!0}catch(e){o=!1}e.restore(r)}}if(n.obj&&o&&(r=e.enterObject()),o){if(null!==n.explicit){const t=this._decodeTag(e,n.explicit);if(e.isError(t))return t;e=t}const r=e.offset;if(null===n.use&&null===n.choice){let t;n.any&&(t=e.save());const r=this._decodeTag(e,null!==n.implicit?n.implicit:n.tag,n.any);if(e.isError(r))return r;n.any?i=e.raw(t):e=r}if(t&&t.track&&null!==n.tag&&t.track(e.path(),r,e.length,"tagged"),t&&t.track&&null!==n.tag&&t.track(e.path(),e.offset,e.length,"content"),n.any||(i=null===n.choice?this._decodeGeneric(n.tag,e,t):this._decodeChoice(e,t)),e.isError(i))return i;if(n.any||null!==n.choice||null===n.children||n.children.forEach((function(n){n._decode(e,t)})),n.contains&&("octstr"===n.tag||"bitstr"===n.tag)){const r=new Rv(i);i=this._getUse(n.contains,e._reporterState.obj)._decode(r,t)}}return n.obj&&o&&(i=e.leaveObject(r)),null===n.key||null===i&&!0!==o?null!==a&&e.exitKey(a):e.leaveKey(a,n.key,i),i},Lv.prototype._decodeGeneric=function(e,t,n){const r=this._baseState;return"seq"===e||"set"===e?null:"seqof"===e||"setof"===e?this._decodeList(t,e,r.args[0],n):/str$/.test(e)?this._decodeStr(t,e,n):"objid"===e&&r.args?this._decodeObjid(t,r.args[0],r.args[1],n):"objid"===e?this._decodeObjid(t,null,null,n):"gentime"===e||"utctime"===e?this._decodeTime(t,e,n):"null_"===e?this._decodeNull(t,n):"bool"===e?this._decodeBool(t,n):"objDesc"===e?this._decodeStr(t,e,n):"int"===e||"enum"===e?this._decodeInt(t,r.args&&r.args[0],n):null!==r.use?this._getUse(r.use,t._reporterState.obj)._decode(t,n):t.error("unknown tag: "+e)},Lv.prototype._getUse=function(e,t){const n=this._baseState;return n.useDecoder=this._use(e,t),Ov(null===n.useDecoder._baseState.parent),n.useDecoder=n.useDecoder._baseState.children[0],n.implicit!==n.useDecoder._baseState.implicit&&(n.useDecoder=n.useDecoder.clone(),n.useDecoder._baseState.implicit=n.implicit),n.useDecoder},Lv.prototype._decodeChoice=function(e,t){const n=this._baseState;let r=null,i=!1;return Object.keys(n.choice).some((function(o){const a=e.save(),s=n.choice[o];try{const n=s._decode(e,t);if(e.isError(n))return!1;r={type:o,value:n},i=!0}catch(t){return e.restore(a),!1}return!0}),this),i?r:e.error("Choice not matched")},Lv.prototype._createEncoderBuffer=function(e){return new xv(e,this.reporter)},Lv.prototype._encode=function(e,t,n){const r=this._baseState;if(null!==r.default&&r.default===e)return;const i=this._encodeValue(e,t,n);return void 0===i||this._skipDefault(i,t,n)?void 0:i},Lv.prototype._encodeValue=function(e,t,n){const r=this._baseState;if(null===r.parent)return r.children[0]._encode(e,t||new Cv);let i=null;if(this.reporter=t,r.optional&&void 0===e){if(null===r.default)return;e=r.default}let o=null,a=!1;if(r.any)i=this._createEncoderBuffer(e);else if(r.choice)i=this._encodeChoice(e,t);else if(r.contains)o=this._getUse(r.contains,n)._encode(e,t),a=!0;else if(r.children)o=r.children.map((function(n){if("null_"===n._baseState.tag)return n._encode(null,t,e);if(null===n._baseState.key)return t.error("Child should have a key");const r=t.enterKey(n._baseState.key);if("object"!=typeof e)return t.error("Child expected, but input is not object");const i=n._encode(e[n._baseState.key],t,e);return t.leaveKey(r),i}),this).filter((function(e){return e})),o=this._createEncoderBuffer(o);else if("seqof"===r.tag||"setof"===r.tag){if(!r.args||1!==r.args.length)return t.error("Too many args for : "+r.tag);if(!Array.isArray(e))return t.error("seqof/setof, but data is not Array");const n=this.clone();n._baseState.implicit=null,o=this._createEncoderBuffer(e.map((function(n){const r=this._baseState;return this._getUse(r.args[0],e)._encode(n,t)}),n))}else null!==r.use?i=this._getUse(r.use,n)._encode(e,t):(o=this._encodePrimitive(r.tag,e),a=!0);if(!r.any&&null===r.choice){const e=null!==r.implicit?r.implicit:r.tag,n=null===r.implicit?"universal":"context";null===e?null===r.use&&t.error("Tag could be omitted only for .use()"):null===r.use&&(i=this._encodeComposite(e,a,n,o))}return null!==r.explicit&&(i=this._encodeComposite(r.explicit,!1,"context",i)),i},Lv.prototype._encodeChoice=function(e,t){const n=this._baseState,r=n.choice[e.type];return r||Ov(!1,e.type+" not found in "+JSON.stringify(Object.keys(n.choice))),r._encode(e.value,t)},Lv.prototype._encodePrimitive=function(e,t){const n=this._baseState;if(/str$/.test(e))return this._encodeStr(t,e);if("objid"===e&&n.args)return this._encodeObjid(t,n.reverseArgs[0],n.args[1]);if("objid"===e)return this._encodeObjid(t,null,null);if("gentime"===e||"utctime"===e)return this._encodeTime(t,e);if("null_"===e)return this._encodeNull();if("int"===e||"enum"===e)return this._encodeInt(t,n.args&&n.reverseArgs[0]);if("bool"===e)return this._encodeBool(t);if("objDesc"===e)return this._encodeStr(t,e);throw new Error("Unsupported tag: "+e)},Lv.prototype._isNumstr=function(e){return/^[0-9 ]*$/.test(e)},Lv.prototype._isPrintstr=function(e){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(e)};var Dv={};!function(e){function t(e){const t={};return Object.keys(e).forEach((function(n){(0|n)==n&&(n|=0);const r=e[n];t[r]=n})),t}e.tagClass={0:"universal",1:"application",2:"context",3:"private"},e.tagClassByName=t(e.tagClass),e.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},e.tagByName=t(e.tag)}(Dv);const Bv=Jr,jv=gv.Buffer,Uv=Iv,zv=Dv;function Fv(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new Wv,this.tree._init(e.body)}var qv=Fv;function Wv(e){Uv.call(this,"der",e)}function Vv(e){return e<10?"0"+e:e}Fv.prototype.encode=function(e,t){return this.tree._encode(e,t).join()},Bv(Wv,Uv),Wv.prototype._encodeComposite=function(e,t,n,r){const i=function(e,t,n,r){let i;if("seqof"===e?e="seq":"setof"===e&&(e="set"),zv.tagByName.hasOwnProperty(e))i=zv.tagByName[e];else{if("number"!=typeof e||(0|e)!==e)return r.error("Unknown tag: "+e);i=e}return i>=31?r.error("Multi-octet tag encoding unsupported"):(t||(i|=32),i|=zv.tagClassByName[n||"universal"]<<6,i)}(e,t,n,this.reporter);if(r.length<128){const e=jv.alloc(2);return e[0]=i,e[1]=r.length,this._createEncoderBuffer([e,r])}let o=1;for(let e=r.length;e>=256;e>>=8)o++;const a=jv.alloc(2+o);a[0]=i,a[1]=128|o;for(let e=1+o,t=r.length;t>0;e--,t>>=8)a[e]=255&t;return this._createEncoderBuffer([a,r])},Wv.prototype._encodeStr=function(e,t){if("bitstr"===t)return this._createEncoderBuffer([0|e.unused,e.data]);if("bmpstr"===t){const t=jv.alloc(2*e.length);for(let n=0;n<e.length;n++)t.writeUInt16BE(e.charCodeAt(n),2*n);return this._createEncoderBuffer(t)}return"numstr"===t?this._isNumstr(e)?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: numstr supports only digits and space"):"printstr"===t?this._isPrintstr(e)?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark"):/str$/.test(t)||"objDesc"===t?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: "+t+" unsupported")},Wv.prototype._encodeObjid=function(e,t,n){if("string"==typeof e){if(!t)return this.reporter.error("string objid given, but no values map found");if(!t.hasOwnProperty(e))return this.reporter.error("objid not found in values map");e=t[e].split(/[\s.]+/g);for(let t=0;t<e.length;t++)e[t]|=0}else if(Array.isArray(e)){e=e.slice();for(let t=0;t<e.length;t++)e[t]|=0}if(!Array.isArray(e))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(e));if(!n){if(e[1]>=40)return this.reporter.error("Second objid identifier OOB");e.splice(0,2,40*e[0]+e[1])}let r=0;for(let t=0;t<e.length;t++){let n=e[t];for(r++;n>=128;n>>=7)r++}const i=jv.alloc(r);let o=i.length-1;for(let t=e.length-1;t>=0;t--){let n=e[t];for(i[o--]=127&n;(n>>=7)>0;)i[o--]=128|127&n}return this._createEncoderBuffer(i)},Wv.prototype._encodeTime=function(e,t){let n;const r=new Date(e);return"gentime"===t?n=[Vv(r.getUTCFullYear()),Vv(r.getUTCMonth()+1),Vv(r.getUTCDate()),Vv(r.getUTCHours()),Vv(r.getUTCMinutes()),Vv(r.getUTCSeconds()),"Z"].join(""):"utctime"===t?n=[Vv(r.getUTCFullYear()%100),Vv(r.getUTCMonth()+1),Vv(r.getUTCDate()),Vv(r.getUTCHours()),Vv(r.getUTCMinutes()),Vv(r.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+t+" time is not supported yet"),this._encodeStr(n,"octstr")},Wv.prototype._encodeNull=function(){return this._createEncoderBuffer("")},Wv.prototype._encodeInt=function(e,t){if("string"==typeof e){if(!t)return this.reporter.error("String int or enum given, but no values map");if(!t.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=t[e]}if("number"!=typeof e&&!jv.isBuffer(e)){const t=e.toArray();!e.sign&&128&t[0]&&t.unshift(0),e=jv.from(t)}if(jv.isBuffer(e)){let t=e.length;0===e.length&&t++;const n=jv.alloc(t);return e.copy(n),0===e.length&&(n[0]=0),this._createEncoderBuffer(n)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);let n=1;for(let t=e;t>=256;t>>=8)n++;const r=new Array(n);for(let t=r.length-1;t>=0;t--)r[t]=255&e,e>>=8;return 128&r[0]&&r.unshift(0),this._createEncoderBuffer(jv.from(r))},Wv.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},Wv.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getEncoder("der").tree},Wv.prototype._skipDefault=function(e,t,n){const r=this._baseState;let i;if(null===r.default)return!1;const o=e.join();if(void 0===r.defaultBuffer&&(r.defaultBuffer=this._encodeValue(r.default,t,n).join()),o.length!==r.defaultBuffer.length)return!1;for(i=0;i<o.length;i++)if(o[i]!==r.defaultBuffer[i])return!1;return!0};const Kv=qv;function Hv(e){Kv.call(this,e),this.enc="pem"}Jr(Hv,Kv);var $v=Hv;Hv.prototype.encode=function(e,t){const n=Kv.prototype.encode.call(this,e).toString("base64"),r=["-----BEGIN "+t.label+"-----"];for(let e=0;e<n.length;e+=64)r.push(n.slice(e,e+64));return r.push("-----END "+t.label+"-----"),r.join("\n")},function(e){const t=e;t.der=qv,t.pem=$v}(dv);var Yv={};const Gv=Jr,Qv=vf,Zv=Av.DecoderBuffer,Xv=Iv,Jv=Dv;function ey(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new ny,this.tree._init(e.body)}var ty=ey;function ny(e){Xv.call(this,"der",e)}function ry(e,t){let n=e.readUInt8(t);if(e.isError(n))return n;const r=Jv.tagClass[n>>6],i=0==(32&n);if(31==(31&n)){let r=n;for(n=0;128==(128&r);){if(r=e.readUInt8(t),e.isError(r))return r;n<<=7,n|=127&r}}else n&=31;return{cls:r,primitive:i,tag:n,tagStr:Jv.tag[n]}}function iy(e,t,n){let r=e.readUInt8(n);if(e.isError(r))return r;if(!t&&128===r)return null;if(0==(128&r))return r;const i=127&r;if(i>4)return e.error("length octect is too long");r=0;for(let t=0;t<i;t++){r<<=8;const t=e.readUInt8(n);if(e.isError(t))return t;r|=t}return r}ey.prototype.decode=function(e,t){return Zv.isDecoderBuffer(e)||(e=new Zv(e,t)),this.tree._decode(e,t)},Gv(ny,Xv),ny.prototype._peekTag=function(e,t,n){if(e.isEmpty())return!1;const r=e.save(),i=ry(e,'Failed to peek tag: "'+t+'"');return e.isError(i)?i:(e.restore(r),i.tag===t||i.tagStr===t||i.tagStr+"of"===t||n)},ny.prototype._decodeTag=function(e,t,n){const r=ry(e,'Failed to decode tag of "'+t+'"');if(e.isError(r))return r;let i=iy(e,r.primitive,'Failed to get length of "'+t+'"');if(e.isError(i))return i;if(!n&&r.tag!==t&&r.tagStr!==t&&r.tagStr+"of"!==t)return e.error('Failed to match tag: "'+t+'"');if(r.primitive||null!==i)return e.skip(i,'Failed to match body of: "'+t+'"');const o=e.save(),a=this._skipUntilEnd(e,'Failed to skip indefinite length body: "'+this.tag+'"');return e.isError(a)?a:(i=e.offset-o.offset,e.restore(o),e.skip(i,'Failed to match body of: "'+t+'"'))},ny.prototype._skipUntilEnd=function(e,t){for(;;){const n=ry(e,t);if(e.isError(n))return n;const r=iy(e,n.primitive,t);if(e.isError(r))return r;let i;if(i=n.primitive||null!==r?e.skip(r):this._skipUntilEnd(e,t),e.isError(i))return i;if("end"===n.tagStr)break}},ny.prototype._decodeList=function(e,t,n,r){const i=[];for(;!e.isEmpty();){const t=this._peekTag(e,"end");if(e.isError(t))return t;const o=n.decode(e,"der",r);if(e.isError(o)&&t)break;i.push(o)}return i},ny.prototype._decodeStr=function(e,t){if("bitstr"===t){const t=e.readUInt8();return e.isError(t)?t:{unused:t,data:e.raw()}}if("bmpstr"===t){const t=e.raw();if(t.length%2==1)return e.error("Decoding of string type: bmpstr length mismatch");let n="";for(let e=0;e<t.length/2;e++)n+=String.fromCharCode(t.readUInt16BE(2*e));return n}if("numstr"===t){const t=e.raw().toString("ascii");return this._isNumstr(t)?t:e.error("Decoding of string type: numstr unsupported characters")}if("octstr"===t)return e.raw();if("objDesc"===t)return e.raw();if("printstr"===t){const t=e.raw().toString("ascii");return this._isPrintstr(t)?t:e.error("Decoding of string type: printstr unsupported characters")}return/str$/.test(t)?e.raw().toString():e.error("Decoding of string type: "+t+" unsupported")},ny.prototype._decodeObjid=function(e,t,n){let r;const i=[];let o=0,a=0;for(;!e.isEmpty();)a=e.readUInt8(),o<<=7,o|=127&a,0==(128&a)&&(i.push(o),o=0);128&a&&i.push(o);const s=i[0]/40|0,u=i[0]%40;if(r=n?i:[s,u].concat(i.slice(1)),t){let e=t[r.join(" ")];void 0===e&&(e=t[r.join(".")]),void 0!==e&&(r=e)}return r},ny.prototype._decodeTime=function(e,t){const n=e.raw().toString();let r,i,o,a,s,u;if("gentime"===t)r=0|n.slice(0,4),i=0|n.slice(4,6),o=0|n.slice(6,8),a=0|n.slice(8,10),s=0|n.slice(10,12),u=0|n.slice(12,14);else{if("utctime"!==t)return e.error("Decoding "+t+" time is not supported yet");r=0|n.slice(0,2),i=0|n.slice(2,4),o=0|n.slice(4,6),a=0|n.slice(6,8),s=0|n.slice(8,10),u=0|n.slice(10,12),r=r<70?2e3+r:1900+r}return Date.UTC(r,i-1,o,a,s,u,0)},ny.prototype._decodeNull=function(){return null},ny.prototype._decodeBool=function(e){const t=e.readUInt8();return e.isError(t)?t:0!==t},ny.prototype._decodeInt=function(e,t){const n=e.raw();let r=new Qv(n);return t&&(r=t[r.toString(10)]||r),r},ny.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getDecoder("der").tree};const oy=Jr,ay=gv.Buffer,sy=ty;function uy(e){sy.call(this,e),this.enc="pem"}oy(uy,sy);var ly=uy;uy.prototype.decode=function(e,t){const n=e.toString().split(/[\r\n]+/g),r=t.label.toUpperCase(),i=/^-----(BEGIN|END) ([^-]+)-----$/;let o=-1,a=-1;for(let e=0;e<n.length;e++){const t=n[e].match(i);if(null!==t&&t[2]===r){if(-1!==o){if("END"!==t[1])break;a=e;break}if("BEGIN"!==t[1])break;o=e}}if(-1===o||-1===a)throw new Error("PEM section not found for: "+r);const s=n.slice(o+1,a).join("");s.replace(/[^a-z0-9+/=]+/gi,"");const u=ay.from(s,"base64");return sy.prototype.decode.call(this,u,t)},function(e){const t=e;t.der=ty,t.pem=ly}(Yv),function(e){const t=dv,n=Yv,r=Jr;function i(e,t){this.name=e,this.body=t,this.decoders={},this.encoders={}}e.define=function(e,t){return new i(e,t)},i.prototype._createNamed=function(e){const t=this.name;function n(e){this._initNamed(e,t)}return r(n,e),n.prototype._initNamed=function(t,n){e.call(this,t,n)},new n(this)},i.prototype._getDecoder=function(e){return e=e||"der",this.decoders.hasOwnProperty(e)||(this.decoders[e]=this._createNamed(n[e])),this.decoders[e]},i.prototype.decode=function(e,t,n){return this._getDecoder(t).decode(e,n)},i.prototype._getEncoder=function(e){return e=e||"der",this.encoders.hasOwnProperty(e)||(this.encoders[e]=this._createNamed(t[e])),this.encoders[e]},i.prototype.encode=function(e,t,n){return this._getEncoder(t).encode(e,n)}}(cv);var cy={};!function(e){const t=e;t.Reporter=vv.Reporter,t.DecoderBuffer=Av.DecoderBuffer,t.EncoderBuffer=Av.EncoderBuffer,t.Node=Iv}(cy);var dy={};!function(e){const t=e;t._reverse=function(e){const t={};return Object.keys(e).forEach((function(n){(0|n)==n&&(n|=0);const r=e[n];t[r]=n})),t},t.der=Dv}(dy),function(e){const t=lv;t.bignum=vf,t.define=cv.define,t.base=cy,t.constants=dy,t.decoders=Yv,t.encoders=dv}();var fy=lv,hy=fy.define("Time",(function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})})),py=fy.define("AttributeTypeValue",(function(){this.seq().obj(this.key("type").objid(),this.key("value").any())})),my=fy.define("AlgorithmIdentifier",(function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional(),this.key("curve").objid().optional())})),gy=fy.define("SubjectPublicKeyInfo",(function(){this.seq().obj(this.key("algorithm").use(my),this.key("subjectPublicKey").bitstr())})),vy=fy.define("RelativeDistinguishedName",(function(){this.setof(py)})),yy=fy.define("RDNSequence",(function(){this.seqof(vy)})),by=fy.define("Name",(function(){this.choice({rdnSequence:this.use(yy)})})),wy=fy.define("Validity",(function(){this.seq().obj(this.key("notBefore").use(hy),this.key("notAfter").use(hy))})),Ay=fy.define("Extension",(function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())})),_y=fy.define("TBSCertificate",(function(){this.seq().obj(this.key("version").explicit(0).int().optional(),this.key("serialNumber").int(),this.key("signature").use(my),this.key("issuer").use(by),this.key("validity").use(wy),this.key("subject").use(by),this.key("subjectPublicKeyInfo").use(gy),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(Ay).optional())})),Ey=fy.define("X509Certificate",(function(){this.seq().obj(this.key("tbsCertificate").use(_y),this.key("signatureAlgorithm").use(my),this.key("signatureValue").bitstr())})),Sy=lv;uv.certificate=Ey;var ky=Sy.define("RSAPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())}));uv.RSAPrivateKey=ky;var My=Sy.define("RSAPublicKey",(function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())}));uv.RSAPublicKey=My;var Cy=Sy.define("SubjectPublicKeyInfo",(function(){this.seq().obj(this.key("algorithm").use(xy),this.key("subjectPublicKey").bitstr())}));uv.PublicKey=Cy;var xy=Sy.define("AlgorithmIdentifier",(function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())})),Ry=Sy.define("PrivateKeyInfo",(function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(xy),this.key("subjectPrivateKey").octstr())}));uv.PrivateKey=Ry;var Oy=Sy.define("EncryptedPrivateKeyInfo",(function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())}));uv.EncryptedPrivateKey=Oy;var Ty=Sy.define("DSAPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())}));uv.DSAPrivateKey=Ty,uv.DSAparam=Sy.define("DSAparam",(function(){this.int()}));var Py=Sy.define("ECPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(Ly),this.key("publicKey").optional().explicit(1).bitstr())}));uv.ECPrivateKey=Py;var Ly=Sy.define("ECParameters",(function(){this.choice({namedCurve:this.objid()})}));uv.signature=Sy.define("signature",(function(){this.seq().obj(this.key("r").int(),this.key("s").int())}));var Iy=/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r+/=]+)[\n\r]+/m,Ny=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,Dy=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,By=Rd,jy=kc,Uy=$r.Buffer,zy=uv,Fy={"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"},qy=kc,Wy=pl,Vy=$r.Buffer,Ky=Hy;function Hy(e){var t;"object"!=typeof e||Vy.isBuffer(e)||(t=e.passphrase,e=e.key),"string"==typeof e&&(e=Vy.from(e));var n,r,i=function(e,t){var n,r=e.toString(),i=r.match(Iy);if(i){var o="aes"+i[1],a=Uy.from(i[2],"hex"),s=Uy.from(i[3].replace(/[\r\n]/g,""),"base64"),u=By(t,a.slice(0,8),parseInt(i[1],10)).key,l=[],c=jy.createDecipheriv(o,u,a);l.push(c.update(s)),l.push(c.final()),n=Uy.concat(l)}else{var d=r.match(Dy);n=Uy.from(d[2].replace(/[\r\n]/g,""),"base64")}return{tag:r.match(Ny)[1],data:n}}(e,t),o=i.tag,a=i.data;switch(o){case"CERTIFICATE":r=zy.certificate.decode(a,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(r||(r=zy.PublicKey.decode(a,"der")),n=r.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return zy.RSAPublicKey.decode(r.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return r.subjectPrivateKey=r.subjectPublicKey,{type:"ec",data:r};case"1.2.840.10040.4.1":return r.algorithm.params.pub_key=zy.DSAparam.decode(r.subjectPublicKey.data,"der"),{type:"dsa",data:r.algorithm.params};default:throw new Error("unknown key id "+n)}case"ENCRYPTED PRIVATE KEY":a=function(e,t){var n=e.algorithm.decrypt.kde.kdeparams.salt,r=parseInt(e.algorithm.decrypt.kde.kdeparams.iters.toString(),10),i=Fy[e.algorithm.decrypt.cipher.algo.join(".")],o=e.algorithm.decrypt.cipher.iv,a=e.subjectPrivateKey,s=parseInt(i.split("-")[1],10)/8,u=Wy.pbkdf2Sync(t,n,r,s,"sha1"),l=qy.createDecipheriv(i,u,o),c=[];return c.push(l.update(a)),c.push(l.final()),Vy.concat(c)}(a=zy.EncryptedPrivateKey.decode(a,"der"),t);case"PRIVATE KEY":switch(n=(r=zy.PrivateKey.decode(a,"der")).algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return zy.RSAPrivateKey.decode(r.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:r.algorithm.curve,privateKey:zy.ECPrivateKey.decode(r.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return r.algorithm.params.priv_key=zy.DSAparam.decode(r.subjectPrivateKey,"der"),{type:"dsa",params:r.algorithm.params};default:throw new Error("unknown key id "+n)}case"RSA PUBLIC KEY":return zy.RSAPublicKey.decode(a,"der");case"RSA PRIVATE KEY":return zy.RSAPrivateKey.decode(a,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:zy.DSAPrivateKey.decode(a,"der")};case"EC PRIVATE KEY":return{curve:(a=zy.ECPrivateKey.decode(a,"der")).parameters.value,privateKey:a.privateKey};default:throw new Error("unknown key type "+o)}}Hy.signature=zy.signature;var $y,Yy,Gy,Qy,Zy,Xy,Jy,eb={"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"},tb={},nb=$u,rb=$r.Buffer,ib=function(e,t){for(var n,r=rb.alloc(0),i=0;r.length<t;)n=ob(i++),r=rb.concat([r,nb("sha1").update(e).update(n).digest()]);return r.slice(0,t)};function ob(e){var t=rb.allocUnsafe(4);return t.writeUInt32BE(e,0),t}var ab=function(e,t){for(var n=e.length,r=-1;++r<n;)e[r]^=t[r];return e},sb=vf,ub=$r.Buffer,lb=function(e,t){return ub.from(e.toRed(sb.mont(t.modulus)).redPow(new sb(t.publicExponent)).fromRed().toArray())},cb=Ky,db=Zr,fb=$u,hb=ib,pb=ab,mb=vf,gb=lb,vb=Ih,yb=$r.Buffer,bb=function(e,t,n){var r;r=e.padding?e.padding:n?1:4;var i,o=cb(e);if(4===r)i=function(e,t){var n=e.modulus.byteLength(),r=t.length,i=fb("sha1").update(yb.alloc(0)).digest(),o=i.length,a=2*o;if(r>n-a-2)throw new Error("message too long");var s=yb.alloc(n-r-a-2),u=n-o-1,l=db(o),c=pb(yb.concat([i,s,yb.alloc(1,1),t],u),hb(l,u)),d=pb(l,hb(c,o));return new mb(yb.concat([yb.alloc(1),d,c],n))}(o,t);else if(1===r)i=function(e,t,n){var r,i=t.length,o=e.modulus.byteLength();if(i>o-11)throw new Error("message too long");return r=n?yb.alloc(o-i-3,255):function(e){for(var t,n=yb.allocUnsafe(e),r=0,i=db(2*e),o=0;r<e;)o===i.length&&(i=db(2*e),o=0),(t=i[o++])&&(n[r++]=t);return n}(o-i-3),new mb(yb.concat([yb.from([0,n?1:2]),r,yb.alloc(1),t],o))}(o,t,n);else{if(3!==r)throw new Error("unknown padding");if((i=new mb(t)).cmp(o.modulus)>=0)throw new Error("data too long for modulus")}return n?vb(i,o):gb(i,o)},wb=Ky,Ab=ib,_b=ab,Eb=vf,Sb=Ih,kb=$u,Mb=lb,Cb=$r.Buffer,xb=function(e,t,n){var r;r=e.padding?e.padding:n?1:4;var i,o=wb(e),a=o.modulus.byteLength();if(t.length>a||new Eb(t).cmp(o.modulus)>=0)throw new Error("decryption error");i=n?Mb(new Eb(t),o):Sb(t,o);var s=Cb.alloc(a-i.length);if(i=Cb.concat([s,i],a),4===r)return function(e,t){var n=e.modulus.byteLength(),r=kb("sha1").update(Cb.alloc(0)).digest(),i=r.length;if(0!==t[0])throw new Error("decryption error");var o=t.slice(1,i+1),a=t.slice(i+1),s=_b(o,Ab(a,i)),u=_b(a,Ab(s,n-i-1));if(function(e,t){e=Cb.from(e),t=Cb.from(t);var n=0,r=e.length;e.length!==t.length&&(n++,r=Math.min(e.length,t.length));for(var i=-1;++i<r;)n+=e[i]^t[i];return n}(r,u.slice(0,i)))throw new Error("decryption error");for(var l=i;0===u[l];)l++;if(1!==u[l++])throw new Error("decryption error");return u.slice(l)}(o,i);if(1===r)return function(e,t,n){for(var r=t.slice(0,2),i=2,o=0;0!==t[i++];)if(i>=t.length){o++;break}var a=t.slice(2,i-1);if(("0002"!==r.toString("hex")&&!n||"0001"!==r.toString("hex")&&n)&&o++,a.length<8&&o++,o)throw new Error("decryption error");return t.slice(i)}(0,i,n);if(3===r)return i;throw new Error("unknown padding")};!function(e){e.publicEncrypt=bb,e.privateDecrypt=xb,e.privateEncrypt=function(t,n){return e.publicEncrypt(t,n,!0)},e.publicDecrypt=function(t,n){return e.privateDecrypt(t,n,!0)}}(tb);var Rb={};function Ob(){throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}var Tb,Pb=$r,Lb=Pb.Buffer,Ib=Pb.kMaxLength,Nb=hr.crypto||hr.msCrypto,Db=Math.pow(2,32)-1;function Bb(e,t){if("number"!=typeof e||e!=e)throw new TypeError("offset must be a number");if(e>Db||e<0)throw new TypeError("offset must be a uint32");if(e>Ib||e>t)throw new RangeError("offset out of range")}function jb(e,t,n){if("number"!=typeof e||e!=e)throw new TypeError("size must be a number");if(e>Db||e<0)throw new TypeError("size must be a uint32");if(e+t>n||e>Ib)throw new RangeError("buffer too small")}function Ub(e,t,n,r){var i=e.buffer,o=new Uint8Array(i,t,n);return Nb.getRandomValues(o),r?void Tr((function(){r(null,e)})):e}function zb(){if(Tb)return br;Tb=1,br.randomBytes=br.rng=br.pseudoRandomBytes=br.prng=Zr,br.createHash=br.Hash=$u,br.createHmac=br.Hmac=dl;var e=hl,t=Object.keys(e),n=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(t);br.getHashes=function(){return n};var r=pl;br.pbkdf2=r.pbkdf2,br.pbkdf2Sync=r.pbkdf2Sync;var i=Wl;br.Cipher=i.Cipher,br.createCipher=i.createCipher,br.Cipheriv=i.Cipheriv,br.createCipheriv=i.createCipheriv,br.Decipher=i.Decipher,br.createDecipher=i.createDecipher,br.Decipheriv=i.Decipheriv,br.createDecipheriv=i.createDecipheriv,br.getCiphers=i.getCiphers,br.listCiphers=i.listCiphers;var o=function(){if(Sf)return cf;Sf=1;var e=Af(),t=Cf,n=function(){if(Ef)return _f;Ef=1;var e=vf,t=new(wf()),n=new e(24),r=new e(11),i=new e(10),o=new e(3),a=new e(7),s=Af(),u=Zr;function l(t,n){return n=n||"utf8",dr(t)||(t=new xn(t,n)),this._pub=new e(t),this}function c(t,n){return n=n||"utf8",dr(t)||(t=new xn(t,n)),this._priv=new e(t),this}_f=f;var d={};function f(t,n,r){this.setGenerator(n),this.__prime=new e(t),this._prime=e.mont(this.__prime),this._primeLen=t.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,r?(this.setPublicKey=l,this.setPrivateKey=c):this._primeCode=8}function h(e,t){var n=new xn(e.toArray());return t?n.toString(t):n}return Object.defineProperty(f.prototype,"verifyError",{enumerable:!0,get:function(){return"number"!=typeof this._primeCode&&(this._primeCode=function(e,u){var l=u.toString("hex"),c=[l,e.toString(16)].join("_");if(c in d)return d[c];var f,h=0;if(e.isEven()||!s.simpleSieve||!s.fermatTest(e)||!t.test(e))return h+=1,h+="02"===l||"05"===l?8:4,d[c]=h,h;switch(t.test(e.shrn(1))||(h+=2),l){case"02":e.mod(n).cmp(r)&&(h+=8);break;case"05":(f=e.mod(i)).cmp(o)&&f.cmp(a)&&(h+=8);break;default:h+=4}return d[c]=h,h}(this.__prime,this.__gen)),this._primeCode}}),f.prototype.generateKeys=function(){return this._priv||(this._priv=new e(u(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},f.prototype.computeSecret=function(t){var n=new xn((t=(t=new e(t)).toRed(this._prime)).redPow(this._priv).fromRed().toArray()),r=this.getPrime();if(n.length<r.length){var i=new xn(r.length-n.length);i.fill(0),n=xn.concat([i,n])}return n},f.prototype.getPublicKey=function(e){return h(this._pub,e)},f.prototype.getPrivateKey=function(e){return h(this._priv,e)},f.prototype.getPrime=function(e){return h(this.__prime,e)},f.prototype.getGenerator=function(e){return h(this._gen,e)},f.prototype.setGenerator=function(t,n){return n=n||"utf8",dr(t)||(t=new xn(t,n)),this.__gen=t,this._gen=new e(t),this},_f}(),r={binary:!0,hex:!0,base64:!0};return cf.DiffieHellmanGroup=cf.createDiffieHellmanGroup=cf.getDiffieHellman=function(e){var r=new xn(t[e].prime,"hex"),i=new xn(t[e].gen,"hex");return new n(r,i)},cf.createDiffieHellman=cf.DiffieHellman=function t(i,o,a,s){return dr(o)||void 0===r[o]?t(i,"binary",o,a):(o=o||"binary",s=s||"binary",dr(a=a||new xn([2]))||(a=new xn(a,s)),"number"==typeof i?new n(e(i,a),a,!0):(dr(i)||(i=new xn(i,o)),new n(i,a,!0)))},cf}();br.DiffieHellmanGroup=o.DiffieHellmanGroup,br.createDiffieHellmanGroup=o.createDiffieHellmanGroup,br.getDiffieHellman=o.getDiffieHellman,br.createDiffieHellman=o.createDiffieHellman,br.DiffieHellman=o.DiffieHellman;var a=function(){if(Zy)return Qy;Zy=1;var e=$r.Buffer,t=$u,n=Ch,r=Jr,i=function(){if($y)return xh.exports;$y=1;var e=$r.Buffer,t=dl,n=Ih,r=iv().ec,i=sv,o=Ky,a=eb;function s(n,r,i,o){if((n=e.from(n.toArray())).length<r.byteLength()){var a=e.alloc(r.byteLength()-n.length);n=e.concat([a,n])}var s=i.length,l=function(t,n){t=(t=u(t,n)).mod(n);var r=e.from(t.toArray());if(r.length<n.byteLength()){var i=e.alloc(n.byteLength()-r.length);r=e.concat([i,r])}return r}(i,r),c=e.alloc(s);c.fill(1);var d=e.alloc(s);return d=t(o,d).update(c).update(e.from([0])).update(n).update(l).digest(),c=t(o,d).update(c).digest(),{k:d=t(o,d).update(c).update(e.from([1])).update(n).update(l).digest(),v:c=t(o,d).update(c).digest()}}function u(e,t){var n=new i(e),r=(e.length<<3)-t.bitLength();return r>0&&n.ishrn(r),n}function l(n,r,i){var o,a;do{for(o=e.alloc(0);8*o.length<n.bitLength();)r.v=t(i,r.k).update(r.v).digest(),o=e.concat([o,r.v]);a=u(o,n),r.k=t(i,r.k).update(r.v).update(e.from([0])).digest(),r.v=t(i,r.k).update(r.v).digest()}while(-1!==a.cmp(n));return a}function c(e,t,n,r){return e.toRed(i.mont(n)).redPow(t).fromRed().mod(r)}return xh.exports=function(t,d,f,h,p){var m=o(d);if(m.curve){if("ecdsa"!==h&&"ecdsa/rsa"!==h)throw new Error("wrong private key type");return function(t,n){var i=a[n.curve.join(".")];if(!i)throw new Error("unknown curve "+n.curve.join("."));var o=new r(i).keyFromPrivate(n.privateKey).sign(t);return e.from(o.toDER())}(t,m)}if("dsa"===m.type){if("dsa"!==h)throw new Error("wrong private key type");return function(t,n,r){for(var o,a=n.params.priv_key,d=n.params.p,f=n.params.q,h=n.params.g,p=new i(0),m=u(t,f).mod(f),g=!1,v=s(a,f,t,r);!1===g;)p=c(h,o=l(f,v,r),d,f),0===(g=o.invm(f).imul(m.add(a.mul(p))).mod(f)).cmpn(0)&&(g=!1,p=new i(0));return function(t,n){t=t.toArray(),n=n.toArray(),128&t[0]&&(t=[0].concat(t)),128&n[0]&&(n=[0].concat(n));var r=[48,t.length+n.length+4,2,t.length];return r=r.concat(t,[2,n.length],n),e.from(r)}(p,g)}(t,m,f)}if("rsa"!==h&&"ecdsa/rsa"!==h)throw new Error("wrong private key type");t=e.concat([p,t]);for(var g=m.modulus.byteLength(),v=[0,1];t.length+v.length+1<g;)v.push(255);v.push(0);for(var y=-1;++y<t.length;)v.push(t[y]);return n(v,m)},xh.exports.getKey=s,xh.exports.makeKey=l,xh.exports}(),o=function(){if(Gy)return Yy;Gy=1;var e=$r.Buffer,t=sv,n=iv().ec,r=Ky,i=eb;function o(e,t){if(e.cmpn(0)<=0)throw new Error("invalid sig");if(e.cmp(t)>=t)throw new Error("invalid sig")}return Yy=function(a,s,u,l,c){var d=r(u);if("ec"===d.type){if("ecdsa"!==l&&"ecdsa/rsa"!==l)throw new Error("wrong public key type");return function(e,t,r){var o=i[r.data.algorithm.curve.join(".")];if(!o)throw new Error("unknown curve "+r.data.algorithm.curve.join("."));var a=new n(o),s=r.data.subjectPrivateKey.data;return a.verify(t,e,s)}(a,s,d)}if("dsa"===d.type){if("dsa"!==l)throw new Error("wrong public key type");return function(e,n,i){var a=i.data.p,s=i.data.q,u=i.data.g,l=i.data.pub_key,c=r.signature.decode(e,"der"),d=c.s,f=c.r;o(d,s),o(f,s);var h=t.mont(a),p=d.invm(s);return 0===u.toRed(h).redPow(new t(n).mul(p).mod(s)).fromRed().mul(l.toRed(h).redPow(f.mul(p).mod(s)).fromRed()).mod(a).mod(s).cmp(f)}(a,s,d)}if("rsa"!==l&&"ecdsa/rsa"!==l)throw new Error("wrong public key type");s=e.concat([c,s]);for(var f=d.modulus.byteLength(),h=[1],p=0;s.length+h.length+2<f;)h.push(255),p++;h.push(0);for(var m=-1;++m<s.length;)h.push(s[m]);h=e.from(h);var g=t.mont(d.modulus);a=(a=new t(a).toRed(g)).redPow(new t(d.publicExponent)),a=e.from(a.fromRed().toArray());var v=p<8?1:0;for(f=Math.min(a.length,h.length),a.length!==h.length&&(v=1),m=-1;++m<f;)v|=a[m]^h[m];return 0===v},Yy}(),a=fl;function s(e){n.Writable.call(this);var r=a[e];if(!r)throw new Error("Unknown message digest");this._hashType=r.hash,this._hash=t(r.hash),this._tag=r.id,this._signType=r.sign}function u(e){n.Writable.call(this);var r=a[e];if(!r)throw new Error("Unknown message digest");this._hash=t(r.hash),this._tag=r.id,this._signType=r.sign}function l(e){return new s(e)}function c(e){return new u(e)}return Object.keys(a).forEach((function(t){a[t].id=e.from(a[t].id,"hex"),a[t.toLowerCase()]=a[t]})),r(s,n.Writable),s.prototype._write=function(e,t,n){this._hash.update(e),n()},s.prototype.update=function(t,n){return"string"==typeof t&&(t=e.from(t,n)),this._hash.update(t),this},s.prototype.sign=function(e,t){this.end();var n=this._hash.digest(),r=i(n,e,this._hashType,this._signType,this._tag);return t?r.toString(t):r},r(u,n.Writable),u.prototype._write=function(e,t,n){this._hash.update(e),n()},u.prototype.update=function(t,n){return"string"==typeof t&&(t=e.from(t,n)),this._hash.update(t),this},u.prototype.verify=function(t,n,r){"string"==typeof n&&(n=e.from(n,r)),this.end();var i=this._hash.digest();return o(n,i,t,this._signType,this._tag)},Qy={Sign:l,Verify:c,createSign:l,createVerify:c}}();br.createSign=a.createSign,br.Sign=a.Sign,br.createVerify=a.createVerify,br.Verify=a.Verify,br.createECDH=function(){if(Jy)return Xy;Jy=1;var e=iv(),t=vf;Xy=function(e){return new r(e)};var n={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};function r(t){this.curveType=n[t],this.curveType||(this.curveType={name:t}),this.curve=new e.ec(this.curveType.name),this.keys=void 0}function i(e,t,n){Array.isArray(e)||(e=e.toArray());var r=new xn(e);if(n&&r.length<n){var i=new xn(n-r.length);i.fill(0),r=xn.concat([i,r])}return t?r.toString(t):r}return n.p224=n.secp224r1,n.p256=n.secp256r1=n.prime256v1,n.p192=n.secp192r1=n.prime192v1,n.p384=n.secp384r1,n.p521=n.secp521r1,r.prototype.generateKeys=function(e,t){return this.keys=this.curve.genKeyPair(),this.getPublicKey(e,t)},r.prototype.computeSecret=function(e,t,n){return t=t||"utf8",dr(e)||(e=new xn(e,t)),i(this.curve.keyFromPublic(e).getPublic().mul(this.keys.getPrivate()).getX(),n,this.curveType.byteLength)},r.prototype.getPublicKey=function(e,t){var n=this.keys.getPublic("compressed"===t,!0);return"hybrid"===t&&(n[n.length-1]%2?n[0]=7:n[0]=6),i(n,e)},r.prototype.getPrivateKey=function(e){return i(this.keys.getPrivate(),e)},r.prototype.setPublicKey=function(e,t){return t=t||"utf8",dr(e)||(e=new xn(e,t)),this.keys._importPublic(e),this},r.prototype.setPrivateKey=function(e,n){n=n||"utf8",dr(e)||(e=new xn(e,n));var r=new t(e);return r=r.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(r),this},Xy}();var s=tb;br.publicEncrypt=s.publicEncrypt,br.privateEncrypt=s.privateEncrypt,br.publicDecrypt=s.publicDecrypt,br.privateDecrypt=s.privateDecrypt;var u=Rb;return br.randomFill=u.randomFill,br.randomFillSync=u.randomFillSync,br.createCredentials=function(){throw new Error(["sorry, createCredentials is not implemented yet","we accept pull requests","https://github.com/crypto-browserify/crypto-browserify"].join("\n"))},br.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6},br}Nb&&Nb.getRandomValues?(Rb.randomFill=function(e,t,n,r){if(!(Lb.isBuffer(e)||e instanceof hr.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if("function"==typeof t)r=t,t=0,n=e.length;else if("function"==typeof n)r=n,n=e.length-t;else if("function"!=typeof r)throw new TypeError('"cb" argument must be a function');return Bb(t,e.length),jb(n,t,e.length),Ub(e,t,n,r)},Rb.randomFillSync=function(e,t,n){if(void 0===t&&(t=0),!(Lb.isBuffer(e)||e instanceof hr.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return Bb(t,e.length),void 0===n&&(n=e.length-t),jb(n,t,e.length),Ub(e,t,n)}):(Rb.randomFill=Ob,Rb.randomFillSync=Ob);const{Buffer:Fb}=yr,{createHash:qb,createHmac:Wb}=zb(),Vb={},Kb=e=>{switch(e){case"sha256":case"sha3-256":case"blake2s256":return 32;case"sha512":case"sha3-512":case"blake2b512":return 64;case"sha224":case"sha3-224":return 28;case"sha384":case"sha3-384":return 48;case"sha1":return 20;case"md5":return 16;default:{let t=Vb[e];return void 0===t&&(t=qb(e).digest().length,Vb[e]=t),t}}},Hb=(e,t,n,r)=>{const i=Fb.isBuffer(n)?n:Fb.from(n),o=r&&r.length?Fb.from(r):Fb.alloc(t,0);return Wb(e,o).update(i).digest()},$b=(e,t,n,r,i)=>{const o=Fb.isBuffer(i)?i:Fb.from(i||""),a=o.length,s=Math.ceil(r/t);if(s>255)throw new Error(`OKM length ${r} is too long for ${e} hash`);const u=Fb.alloc(t*s+a+1);for(let r=1,i=0,l=0;r<=s;++r)o.copy(u,l),u[l+a]=r,Wb(e,n).update(u.slice(i,l+a+1)).digest().copy(u,l),i=l,l+=t;return u.slice(0,r)};function Yb(e,t,{salt:n="",info:r="",hash:i="SHA-256"}={}){i=i.toLowerCase().replace("-","");const o=Kb(i),a=Hb(i,o,e,n);return $b(i,o,a,t,r)}Object.defineProperties(Yb,{hash_length:{configurable:!1,enumerable:!1,writable:!1,value:Kb},extract:{configurable:!1,enumerable:!1,writable:!1,value:Hb},expand:{configurable:!1,enumerable:!1,writable:!1,value:$b}});var Gb=Yb;const Qb="Impossible case. Please create issue.",Zb="The tweak was out of range or the resulted private key is invalid",Xb="The tweak was out of range or equal to zero",Jb="Public Key could not be parsed",ew="Public Key serialization error",tw="Signature could not be parsed";function nw(e,t){if(!e)throw new Error(t)}function rw(e,t,n){if(nw(t instanceof Uint8Array,`Expected ${e} to be an Uint8Array`),void 0!==n)if(Array.isArray(n)){const r=`Expected ${e} to be an Uint8Array with length [${n.join(", ")}]`;nw(n.includes(t.length),r)}else{const r=`Expected ${e} to be an Uint8Array with length ${n}`;nw(t.length===n,r)}}function iw(e){nw("Boolean"===aw(e),"Expected compressed to be a Boolean")}function ow(e=(e=>new Uint8Array(e)),t){return"function"==typeof e&&(e=e(t)),rw("output",e,t),e}function aw(e){return Object.prototype.toString.call(e).slice(8,-1)}const sw=new(iv().ec)("secp256k1"),uw=sw.curve,lw=uw.n.constructor;function cw(e){const t=e[0];switch(t){case 2:case 3:return 33!==e.length?null:function(e,t){let n=new lw(t);if(n.cmp(uw.p)>=0)return null;n=n.toRed(uw.red);let r=n.redSqr().redIMul(n).redIAdd(uw.b).redSqrt();return 3===e!==r.isOdd()&&(r=r.redNeg()),sw.keyPair({pub:{x:n,y:r}})}(t,e.subarray(1,33));case 4:case 6:case 7:return 65!==e.length?null:function(e,t,n){let r=new lw(t),i=new lw(n);if(r.cmp(uw.p)>=0||i.cmp(uw.p)>=0)return null;if(r=r.toRed(uw.red),i=i.toRed(uw.red),(6===e||7===e)&&i.isOdd()!==(7===e))return null;const o=r.redSqr().redIMul(r);return i.redSqr().redISub(o.redIAdd(uw.b)).isZero()?sw.keyPair({pub:{x:r,y:i}}):null}(t,e.subarray(1,33),e.subarray(33,65));default:return null}}function dw(e,t){const n=t.encode(null,33===e.length);for(let t=0;t<e.length;++t)e[t]=n[t]}var fw={contextRandomize:()=>0,privateKeyVerify(e){const t=new lw(e);return t.cmp(uw.n)<0&&!t.isZero()?0:1},privateKeyNegate(e){const t=new lw(e),n=uw.n.sub(t).umod(uw.n).toArrayLike(Uint8Array,"be",32);return e.set(n),0},privateKeyTweakAdd(e,t){const n=new lw(t);if(n.cmp(uw.n)>=0)return 1;if(n.iadd(new lw(e)),n.cmp(uw.n)>=0&&n.isub(uw.n),n.isZero())return 1;const r=n.toArrayLike(Uint8Array,"be",32);return e.set(r),0},privateKeyTweakMul(e,t){let n=new lw(t);if(n.cmp(uw.n)>=0||n.isZero())return 1;n.imul(new lw(e)),n.cmp(uw.n)>=0&&(n=n.umod(uw.n));const r=n.toArrayLike(Uint8Array,"be",32);return e.set(r),0},publicKeyVerify:e=>null===cw(e)?1:0,publicKeyCreate(e,t){const n=new lw(t);return n.cmp(uw.n)>=0||n.isZero()?1:(dw(e,sw.keyFromPrivate(t).getPublic()),0)},publicKeyConvert(e,t){const n=cw(t);return null===n?1:(dw(e,n.getPublic()),0)},publicKeyNegate(e,t){const n=cw(t);if(null===n)return 1;const r=n.getPublic();return r.y=r.y.redNeg(),dw(e,r),0},publicKeyCombine(e,t){const n=new Array(t.length);for(let e=0;e<t.length;++e)if(n[e]=cw(t[e]),null===n[e])return 1;let r=n[0].getPublic();for(let e=1;e<n.length;++e)r=r.add(n[e].pub);return r.isInfinity()?2:(dw(e,r),0)},publicKeyTweakAdd(e,t,n){const r=cw(t);if(null===r)return 1;if((n=new lw(n)).cmp(uw.n)>=0)return 2;const i=r.getPublic().add(uw.g.mul(n));return i.isInfinity()?2:(dw(e,i),0)},publicKeyTweakMul(e,t,n){const r=cw(t);return null===r?1:(n=new lw(n)).cmp(uw.n)>=0||n.isZero()?2:(dw(e,r.getPublic().mul(n)),0)},signatureNormalize(e){const t=new lw(e.subarray(0,32)),n=new lw(e.subarray(32,64));return t.cmp(uw.n)>=0||n.cmp(uw.n)>=0?1:(1===n.cmp(sw.nh)&&e.set(uw.n.sub(n).toArrayLike(Uint8Array,"be",32),32),0)},signatureExport(e,t){const n=t.subarray(0,32),r=t.subarray(32,64);if(new lw(n).cmp(uw.n)>=0)return 1;if(new lw(r).cmp(uw.n)>=0)return 1;const{output:i}=e;let o=i.subarray(4,37);o[0]=0,o.set(n,1);let a=33,s=0;for(;a>1&&0===o[s]&&!(128&o[s+1]);--a,++s);if(o=o.subarray(s),128&o[0])return 1;if(a>1&&0===o[0]&&!(128&o[1]))return 1;let u=i.subarray(39,72);u[0]=0,u.set(r,1);let l=33,c=0;for(;l>1&&0===u[c]&&!(128&u[c+1]);--l,++c);return u=u.subarray(c),128&u[0]||l>1&&0===u[0]&&!(128&u[1])?1:(e.outputlen=6+a+l,i[0]=48,i[1]=e.outputlen-2,i[2]=2,i[3]=o.length,i.set(o,4),i[4+a]=2,i[5+a]=u.length,i.set(u,6+a),0)},signatureImport(e,t){if(t.length<8)return 1;if(t.length>72)return 1;if(48!==t[0])return 1;if(t[1]!==t.length-2)return 1;if(2!==t[2])return 1;const n=t[3];if(0===n)return 1;if(5+n>=t.length)return 1;if(2!==t[4+n])return 1;const r=t[5+n];if(0===r)return 1;if(6+n+r!==t.length)return 1;if(128&t[4])return 1;if(n>1&&0===t[4]&&!(128&t[5]))return 1;if(128&t[n+6])return 1;if(r>1&&0===t[n+6]&&!(128&t[n+7]))return 1;let i=t.subarray(4,4+n);if(33===i.length&&0===i[0]&&(i=i.subarray(1)),i.length>32)return 1;let o=t.subarray(6+n);if(33===o.length&&0===o[0]&&(o=o.slice(1)),o.length>32)throw new Error("S length is too long");let a=new lw(i);a.cmp(uw.n)>=0&&(a=new lw(0));let s=new lw(t.subarray(6+n));return s.cmp(uw.n)>=0&&(s=new lw(0)),e.set(a.toArrayLike(Uint8Array,"be",32),0),e.set(s.toArrayLike(Uint8Array,"be",32),32),0},ecdsaSign(e,t,n,r,i){if(i){const e=i;i=i=>{const o=e(t,n,null,r,i);if(!(o instanceof Uint8Array&&32===o.length))throw new Error("This is the way");return new lw(o)}}const o=new lw(n);if(o.cmp(uw.n)>=0||o.isZero())return 1;let a;try{a=sw.sign(t,n,{canonical:!0,k:i,pers:r})}catch(e){return 1}return e.signature.set(a.r.toArrayLike(Uint8Array,"be",32),0),e.signature.set(a.s.toArrayLike(Uint8Array,"be",32),32),e.recid=a.recoveryParam,0},ecdsaVerify(e,t,n){const r={r:e.subarray(0,32),s:e.subarray(32,64)},i=new lw(r.r),o=new lw(r.s);if(i.cmp(uw.n)>=0||o.cmp(uw.n)>=0)return 1;if(1===o.cmp(sw.nh)||i.isZero()||o.isZero())return 3;const a=cw(n);if(null===a)return 2;const s=a.getPublic();return sw.verify(t,r,s)?0:3},ecdsaRecover(e,t,n,r){const i={r:t.slice(0,32),s:t.slice(32,64)},o=new lw(i.r),a=new lw(i.s);if(o.cmp(uw.n)>=0||a.cmp(uw.n)>=0)return 1;if(o.isZero()||a.isZero())return 2;let s;try{s=sw.recoverPubKey(r,i,n)}catch(e){return 2}return dw(e,s),0},ecdh(e,t,n,r,i,o,a){const s=cw(t);if(null===s)return 1;const u=new lw(n);if(u.cmp(uw.n)>=0||u.isZero())return 2;const l=s.getPublic().mul(u);if(void 0===i){const t=l.encode(null,!0),n=sw.hash().update(t).digest();for(let t=0;t<32;++t)e[t]=n[t]}else{o||(o=new Uint8Array(32));const t=l.getX().toArray("be",32);for(let e=0;e<32;++e)o[e]=t[e];a||(a=new Uint8Array(32));const n=l.getY().toArray("be",32);for(let e=0;e<32;++e)a[e]=n[e];const s=i(o,a,r);if(!(s instanceof Uint8Array&&s.length===e.length))return 2;e.set(s)}return 0}},hw=(e=>({contextRandomize(t){if(nw(null===t||t instanceof Uint8Array,"Expected seed to be an Uint8Array or null"),null!==t&&rw("seed",t,32),1===e.contextRandomize(t))throw new Error("Unknow error on context randomization")},privateKeyVerify:t=>(rw("private key",t,32),0===e.privateKeyVerify(t)),privateKeyNegate(t){switch(rw("private key",t,32),e.privateKeyNegate(t)){case 0:return t;case 1:throw new Error(Qb)}},privateKeyTweakAdd(t,n){switch(rw("private key",t,32),rw("tweak",n,32),e.privateKeyTweakAdd(t,n)){case 0:return t;case 1:throw new Error(Zb)}},privateKeyTweakMul(t,n){switch(rw("private key",t,32),rw("tweak",n,32),e.privateKeyTweakMul(t,n)){case 0:return t;case 1:throw new Error(Xb)}},publicKeyVerify:t=>(rw("public key",t,[33,65]),0===e.publicKeyVerify(t)),publicKeyCreate(t,n=!0,r){switch(rw("private key",t,32),iw(n),r=ow(r,n?33:65),e.publicKeyCreate(r,t)){case 0:return r;case 1:throw new Error("Private Key is invalid");case 2:throw new Error(ew)}},publicKeyConvert(t,n=!0,r){switch(rw("public key",t,[33,65]),iw(n),r=ow(r,n?33:65),e.publicKeyConvert(r,t)){case 0:return r;case 1:throw new Error(Jb);case 2:throw new Error(ew)}},publicKeyNegate(t,n=!0,r){switch(rw("public key",t,[33,65]),iw(n),r=ow(r,n?33:65),e.publicKeyNegate(r,t)){case 0:return r;case 1:throw new Error(Jb);case 2:throw new Error(Qb);case 3:throw new Error(ew)}},publicKeyCombine(t,n=!0,r){nw(Array.isArray(t),"Expected public keys to be an Array"),nw(t.length>0,"Expected public keys array will have more than zero items");for(const e of t)rw("public key",e,[33,65]);switch(iw(n),r=ow(r,n?33:65),e.publicKeyCombine(r,t)){case 0:return r;case 1:throw new Error(Jb);case 2:throw new Error("The sum of the public keys is not valid");case 3:throw new Error(ew)}},publicKeyTweakAdd(t,n,r=!0,i){switch(rw("public key",t,[33,65]),rw("tweak",n,32),iw(r),i=ow(i,r?33:65),e.publicKeyTweakAdd(i,t,n)){case 0:return i;case 1:throw new Error(Jb);case 2:throw new Error(Zb)}},publicKeyTweakMul(t,n,r=!0,i){switch(rw("public key",t,[33,65]),rw("tweak",n,32),iw(r),i=ow(i,r?33:65),e.publicKeyTweakMul(i,t,n)){case 0:return i;case 1:throw new Error(Jb);case 2:throw new Error(Xb)}},signatureNormalize(t){switch(rw("signature",t,64),e.signatureNormalize(t)){case 0:return t;case 1:throw new Error(tw)}},signatureExport(t,n){rw("signature",t,64);const r={output:n=ow(n,72),outputlen:72};switch(e.signatureExport(r,t)){case 0:return n.slice(0,r.outputlen);case 1:throw new Error(tw);case 2:throw new Error(Qb)}},signatureImport(t,n){switch(rw("signature",t),n=ow(n,64),e.signatureImport(n,t)){case 0:return n;case 1:throw new Error(tw);case 2:throw new Error(Qb)}},ecdsaSign(t,n,r={},i){rw("message",t,32),rw("private key",n,32),nw("Object"===aw(r),"Expected options to be an Object"),void 0!==r.data&&rw("options.data",r.data),void 0!==r.noncefn&&nw("Function"===aw(r.noncefn),"Expected options.noncefn to be a Function");const o={signature:i=ow(i,64),recid:null};switch(e.ecdsaSign(o,t,n,r.data,r.noncefn)){case 0:return o;case 1:throw new Error("The nonce generation function failed, or the private key was invalid");case 2:throw new Error(Qb)}},ecdsaVerify(t,n,r){switch(rw("signature",t,64),rw("message",n,32),rw("public key",r,[33,65]),e.ecdsaVerify(t,n,r)){case 0:return!0;case 3:return!1;case 1:throw new Error(tw);case 2:throw new Error(Jb)}},ecdsaRecover(t,n,r,i=!0,o){switch(rw("signature",t,64),nw("Number"===aw(n)&&n>=0&&n<=3,"Expected recovery id to be a Number within interval [0, 3]"),rw("message",r,32),iw(i),o=ow(o,i?33:65),e.ecdsaRecover(o,t,n,r)){case 0:return o;case 1:throw new Error(tw);case 2:throw new Error("Public key could not be recover");case 3:throw new Error(Qb)}},ecdh(t,n,r={},i){switch(rw("public key",t,[33,65]),rw("private key",n,32),nw("Object"===aw(r),"Expected options to be an Object"),void 0!==r.data&&rw("options.data",r.data),void 0!==r.hashfn?(nw("Function"===aw(r.hashfn),"Expected options.hashfn to be a Function"),void 0!==r.xbuf&&rw("options.xbuf",r.xbuf,32),void 0!==r.ybuf&&rw("options.ybuf",r.ybuf,32),rw("output",i)):i=ow(i,32),e.ecdh(i,t,n,r.data,r.hashfn,r.xbuf,r.ybuf)){case 0:return i;case 1:throw new Error(Jb);case 2:throw new Error("Scalar was invalid (zero or overflow)")}}}))(fw),pw={},mw={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SECRET_KEY_LENGTH=e.AES_IV_PLUS_TAG_LENGTH=e.AES_TAG_LENGTH=e.AES_IV_LENGTH=e.UNCOMPRESSED_PUBLIC_KEY_SIZE=void 0,e.UNCOMPRESSED_PUBLIC_KEY_SIZE=65,e.AES_IV_LENGTH=16,e.AES_TAG_LENGTH=16,e.AES_IV_PLUS_TAG_LENGTH=e.AES_IV_LENGTH+e.AES_TAG_LENGTH,e.SECRET_KEY_LENGTH=32}(mw);var gw=hr&&hr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(pw,"__esModule",{value:!0}),pw.aesDecrypt=pw.aesEncrypt=pw.getValidSecret=pw.decodeHex=pw.remove0x=void 0;var vw=zb(),yw=gw(hw),bw=mw;function ww(e){return e.startsWith("0x")||e.startsWith("0X")?e.slice(2):e}pw.remove0x=ww,pw.decodeHex=function(e){return xn.from(ww(e),"hex")},pw.getValidSecret=function(){var e;do{e=(0,vw.randomBytes)(bw.SECRET_KEY_LENGTH)}while(!yw.default.privateKeyVerify(e));return e},pw.aesEncrypt=function(e,t){var n=(0,vw.randomBytes)(bw.AES_IV_LENGTH),r=(0,vw.createCipheriv)("aes-256-gcm",e,n),i=xn.concat([r.update(t),r.final()]),o=r.getAuthTag();return xn.concat([n,o,i])},pw.aesDecrypt=function(e,t){var n=t.slice(0,bw.AES_IV_LENGTH),r=t.slice(bw.AES_IV_LENGTH,bw.AES_IV_PLUS_TAG_LENGTH),i=t.slice(bw.AES_IV_PLUS_TAG_LENGTH),o=(0,vw.createDecipheriv)("aes-256-gcm",e,n);return o.setAuthTag(r),xn.concat([o.update(i),o.final()])};var Aw={},_w=hr&&hr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Aw,"__esModule",{value:!0});var Ew=_w(Gb),Sw=_w(hw),kw=pw,Mw=mw,Cw=function(){function e(e){this.uncompressed=xn.from(Sw.default.publicKeyConvert(e,!1)),this.compressed=xn.from(Sw.default.publicKeyConvert(e,!0))}return e.fromHex=function(t){var n=(0,kw.decodeHex)(t);if(n.length===Mw.UNCOMPRESSED_PUBLIC_KEY_SIZE-1){var r=xn.from([4]);return new e(xn.concat([r,n]))}return new e(n)},e.prototype.toHex=function(e){return void 0===e&&(e=!0),e?this.compressed.toString("hex"):this.uncompressed.toString("hex")},e.prototype.decapsulate=function(e){var t=xn.concat([this.uncompressed,e.multiply(this)]);return(0,Ew.default)(t,32,{hash:"SHA-256"})},e.prototype.equals=function(e){return this.uncompressed.equals(e.uncompressed)},e}();Aw.default=Cw;var xw=hr&&hr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(vr,"__esModule",{value:!0});var Rw=xw(Gb),Ow=xw(hw),Tw=pw,Pw=xw(Aw),Lw=function(){function e(e){if(this.secret=e||(0,Tw.getValidSecret)(),!Ow.default.privateKeyVerify(this.secret))throw new Error("Invalid private key");this.publicKey=new Pw.default(xn.from(Ow.default.publicKeyCreate(this.secret)))}return e.fromHex=function(t){return new e((0,Tw.decodeHex)(t))},e.prototype.toHex=function(){return"0x".concat(this.secret.toString("hex"))},e.prototype.encapsulate=function(e){var t=xn.concat([this.publicKey.uncompressed,this.multiply(e)]);return(0,Rw.default)(t,32,{hash:"SHA-256"})},e.prototype.multiply=function(e){return xn.from(Ow.default.publicKeyTweakMul(e.compressed,this.secret,!1))},e.prototype.equals=function(e){return this.secret.equals(e.secret)},e}();vr.default=Lw,function(e){var t=hr&&hr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.PublicKey=e.PrivateKey=void 0;var n=vr;Object.defineProperty(e,"PrivateKey",{enumerable:!0,get:function(){return t(n).default}});var r=Aw;Object.defineProperty(e,"PublicKey",{enumerable:!0,get:function(){return t(r).default}})}(gr),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.utils=e.PublicKey=e.PrivateKey=e.decrypt=e.encrypt=void 0;var t=gr,n=pw,r=mw;e.encrypt=function(e,r){var i=new t.PrivateKey,o=e instanceof xn?new t.PublicKey(e):t.PublicKey.fromHex(e),a=i.encapsulate(o),s=(0,n.aesEncrypt)(a,r);return xn.concat([i.publicKey.uncompressed,s])},e.decrypt=function(e,i){var o=e instanceof xn?new t.PrivateKey(e):t.PrivateKey.fromHex(e),a=new t.PublicKey(i.slice(0,r.UNCOMPRESSED_PUBLIC_KEY_SIZE)),s=i.slice(r.UNCOMPRESSED_PUBLIC_KEY_SIZE),u=a.decapsulate(o);return(0,n.aesDecrypt)(u,s)};var i=gr;Object.defineProperty(e,"PrivateKey",{enumerable:!0,get:function(){return i.PrivateKey}}),Object.defineProperty(e,"PublicKey",{enumerable:!0,get:function(){return i.PublicKey}}),e.utils={aesDecrypt:n.aesDecrypt,aesEncrypt:n.aesEncrypt,decodeHex:n.decodeHex,getValidSecret:n.getValidSecret,remove0x:n.remove0x}}(mr);class Iw{constructor(e){this.enabled=!0,this.debug=!1,(null==e?void 0:e.debug)&&(this.debug=e.debug),(null==e?void 0:e.pkey)?this.ecies=mr.PrivateKey.fromHex(e.pkey):this.ecies=new mr.PrivateKey,this.debug&&(console.info("[ECIES] initialized secret: ",this.ecies.toHex()),console.info("[ECIES] initialized public: ",this.ecies.publicKey.toHex()),console.info("[ECIES] init with",this))}generateECIES(){this.ecies=new mr.PrivateKey}getPublicKey(){return this.ecies.publicKey.toHex()}encrypt(e,t){let n=e;if(this.enabled)try{this.debug&&console.debug("ECIES::encrypt() using otherPublicKey",t);const r=xn.from(e),i=mr.encrypt(t,r);n=xn.from(i).toString("base64")}catch(n){throw this.debug&&(console.error("error encrypt:",n),console.error("private: ",this.ecies.toHex()),console.error("data: ",e),console.error("otherkey: ",t)),n}return n}decrypt(e){let t=e;if(this.enabled)try{this.debug&&console.debug("ECIES::decrypt() using privateKey",this.ecies.toHex());const n=xn.from(e.toString(),"base64");t=mr.decrypt(this.ecies.toHex(),n).toString()}catch(t){throw this.debug&&(console.error("error decrypt",t),console.error("private: ",this.ecies.toHex()),console.error("encryptedData: ",e)),t}return t}getKeyInfo(){return{private:this.ecies.toHex(),public:this.ecies.publicKey.toHex()}}toString(){console.debug("ECIES::toString()",this.getKeyInfo())}}var Nw="0.14.1";const Dw="https://metamask-sdk-socket.metafi.codefi.network/",Bw=["polling","websocket"],jw=6048e5,Uw={METAMASK_GETPROVIDERSTATE:"metamask_getProviderState",ETH_REQUESTACCOUNTS:"eth_requestAccounts"};function zw(e){const{debug:t,context:n}=e;t&&console.debug(`RemoteCommunication::${n}::clean()`),e.channelConfig=void 0,e.ready=!1,e.originatorConnectStarted=!1}var Fw,qw;t.ConnectionStatus=void 0,t.EventType=void 0,t.MessageType=void 0,function(e){e.DISCONNECTED="disconnected",e.WAITING="waiting",e.TIMEOUT="timeout",e.LINKED="linked",e.PAUSED="paused",e.TERMINATED="terminated"}(t.ConnectionStatus||(t.ConnectionStatus={})),function(e){e.KEY_INFO="key_info",e.SERVICE_STATUS="service_status",e.PROVIDER_UPDATE="provider_update",e.RPC_UPDATE="rpc_update",e.KEYS_EXCHANGED="keys_exchanged",e.JOIN_CHANNEL="join_channel",e.CHANNEL_CREATED="channel_created",e.CLIENTS_CONNECTED="clients_connected",e.CLIENTS_DISCONNECTED="clients_disconnected",e.CLIENTS_WAITING="clients_waiting",e.CLIENTS_READY="clients_ready",e.SOCKET_DISCONNECTED="socket_disconnected",e.SOCKET_RECONNECT="socket_reconnect",e.OTP="otp",e.SDK_RPC_CALL="sdk_rpc_call",e.AUTHORIZED="authorized",e.CONNECTION_STATUS="connection_status",e.MESSAGE="message",e.TERMINATE="terminate"}(t.EventType||(t.EventType={})),function(e){e.KEY_EXCHANGE="key_exchange"}(Fw||(Fw={})),function(e){e.KEY_HANDSHAKE_START="key_handshake_start",e.KEY_HANDSHAKE_CHECK="key_handshake_check",e.KEY_HANDSHAKE_SYN="key_handshake_SYN",e.KEY_HANDSHAKE_SYNACK="key_handshake_SYNACK",e.KEY_HANDSHAKE_ACK="key_handshake_ACK",e.KEY_HANDSHAKE_NONE="none"}(qw||(qw={}));class Ww extends N.EventEmitter2{constructor({communicationLayer:e,otherPublicKey:t,context:n,ecies:r,logging:i}){super(),this.keysExchanged=!1,this.step=qw.KEY_HANDSHAKE_NONE,this.debug=!1,this.context=n,this.myECIES=new Iw(Object.assign(Object.assign({},r),{debug:null==i?void 0:i.eciesLayer})),this.communicationLayer=e,this.myPublicKey=this.myECIES.getPublicKey(),this.debug=!0===(null==i?void 0:i.keyExchangeLayer),t&&this.setOtherPublicKey(t),this.communicationLayer.on(Fw.KEY_EXCHANGE,this.onKeyExchangeMessage.bind(this))}onKeyExchangeMessage(e){this.debug&&console.debug(`KeyExchange::${this.context}::onKeyExchangeMessage() keysExchanged=${this.keysExchanged}`,e);const{message:n}=e;this.keysExchanged&&this.debug&&console.log(`KeyExchange::${this.context}::onKeyExchangeMessage received handshake while already exchanged. step=${this.step} otherPubKey=${this.otherPublicKey}`),this.emit(t.EventType.KEY_INFO,n.type),n.type===qw.KEY_HANDSHAKE_SYN?(this.checkStep([qw.KEY_HANDSHAKE_NONE,qw.KEY_HANDSHAKE_ACK]),this.debug&&console.debug("KeyExchange::KEY_HANDSHAKE_SYN",n),n.pubkey&&this.setOtherPublicKey(n.pubkey),this.communicationLayer.sendMessage({type:qw.KEY_HANDSHAKE_SYNACK,pubkey:this.myPublicKey}),this.setStep(qw.KEY_HANDSHAKE_ACK)):n.type===qw.KEY_HANDSHAKE_SYNACK?(this.checkStep([qw.KEY_HANDSHAKE_SYNACK,qw.KEY_HANDSHAKE_ACK,qw.KEY_HANDSHAKE_NONE]),this.debug&&console.debug("KeyExchange::KEY_HANDSHAKE_SYNACK"),n.pubkey&&this.setOtherPublicKey(n.pubkey),this.communicationLayer.sendMessage({type:qw.KEY_HANDSHAKE_ACK}),this.keysExchanged=!0,this.setStep(qw.KEY_HANDSHAKE_ACK),this.emit(t.EventType.KEYS_EXCHANGED)):n.type===qw.KEY_HANDSHAKE_ACK&&(this.debug&&console.debug("KeyExchange::KEY_HANDSHAKE_ACK set keysExchanged to true!"),this.checkStep([qw.KEY_HANDSHAKE_ACK,qw.KEY_HANDSHAKE_NONE]),this.keysExchanged=!0,this.setStep(qw.KEY_HANDSHAKE_ACK),this.emit(t.EventType.KEYS_EXCHANGED))}resetKeys(e){this.clean(),this.myECIES=new Iw(e)}clean(){this.debug&&console.debug(`KeyExchange::${this.context}::clean reset handshake state`),this.setStep(qw.KEY_HANDSHAKE_NONE),this.emit(t.EventType.KEY_INFO,this.step),this.keysExchanged=!1}start({isOriginator:e,force:t}){this.debug&&console.debug(`KeyExchange::${this.context}::start isOriginator=${e} step=${this.step} force=${t} keysExchanged=${this.keysExchanged}`),e?!(this.keysExchanged||this.step!==qw.KEY_HANDSHAKE_NONE&&this.step!==qw.KEY_HANDSHAKE_SYNACK)||t?(this.debug&&console.debug(`KeyExchange::${this.context}::start -- start key exchange (force=${t}) -- step=${this.step}`,this.step),this.clean(),this.setStep(qw.KEY_HANDSHAKE_SYNACK),this.communicationLayer.sendMessage({type:qw.KEY_HANDSHAKE_SYN,pubkey:this.myPublicKey})):this.debug&&console.debug(`KeyExchange::${this.context}::start -- key exchange already ${this.keysExchanged?"done":"in progress"} -- aborted.`,this.step):this.keysExchanged&&!0!==t?this.debug&&console.debug("KeyExchange::start don't send KEY_HANDSHAKE_START -- exchange already done."):(this.communicationLayer.sendMessage({type:qw.KEY_HANDSHAKE_START}),this.clean())}setStep(e){this.step=e,this.emit(t.EventType.KEY_INFO,e)}checkStep(e){e.length>0&&-1===e.indexOf(this.step.toString())&&console.warn(`[KeyExchange] Wrong Step "${this.step}" not within ${e}`)}setKeysExchanged(e){this.keysExchanged=e}areKeysExchanged(){return this.keysExchanged}getMyPublicKey(){return this.myPublicKey}getOtherPublicKey(){return this.otherPublicKey}setOtherPublicKey(e){this.debug&&console.debug("KeyExchange::setOtherPubKey()",e),this.otherPublicKey=e}encryptMessage(e){if(!this.otherPublicKey)throw new Error("encryptMessage: Keys not exchanged - missing otherPubKey");return this.myECIES.encrypt(e,this.otherPublicKey)}decryptMessage(e){if(!this.otherPublicKey)throw new Error("decryptMessage: Keys not exchanged - missing otherPubKey");return this.myECIES.decrypt(e)}getKeyInfo(){return{ecies:Object.assign(Object.assign({},this.myECIES.getKeyInfo()),{otherPubKey:this.otherPublicKey}),step:this.step,keysExchanged:this.areKeysExchanged()}}toString(){const e={keyInfo:this.getKeyInfo(),keysExchanged:this.keysExchanged,step:this.step};return JSON.stringify(e)}}!function(e){e.TERMINATE="terminate",e.ANSWER="answer",e.OFFER="offer",e.CANDIDATE="candidate",e.JSONRPC="jsonrpc",e.WALLET_INFO="wallet_info",e.ORIGINATOR_INFO="originator_info",e.PAUSE="pause",e.OTP="otp",e.AUTHORIZED="authorized",e.PING="ping",e.READY="ready"}(t.MessageType||(t.MessageType={}));const Vw=e=>new Promise((t=>{setTimeout(t,e)})),Kw=(e,t,n=200)=>dn(void 0,void 0,void 0,(function*(){let r;const i=Date.now();let o=!1;for(;!o;){if(o=Date.now()-i>3e5,r=t[e],void 0!==r.elapsedTime)return r;yield Vw(n)}throw new Error(`RPC ${e} timed out`)})),Hw=e=>dn(void 0,void 0,void 0,(function*(){var n,r,i,o,a;return e.state.debug&&console.debug(`SocketService::connectAgain instance.state.socket?.connected=${null===(n=e.state.socket)||void 0===n?void 0:n.connected} trying to reconnect after socketio disconnection`,e),yield Vw(200),(null===(r=e.state.socket)||void 0===r?void 0:r.connected)||(e.state.resumed=!0,null===(i=e.state.socket)||void 0===i||i.connect(),e.emit(t.EventType.SOCKET_RECONNECT),null===(o=e.state.socket)||void 0===o||o.emit(t.EventType.JOIN_CHANNEL,e.state.channelId,`${e.state.context}connect_again`)),yield Vw(100),null===(a=e.state.socket)||void 0===a?void 0:a.connected})),$w=[{event:"clients_connected",handler:function(e,n){return r=>dn(this,void 0,void 0,(function*(){var r,i,o,a,s,u,l,c;e.state.debug&&console.debug(`SocketService::${e.state.context}::setupChannelListener::on 'clients_connected-${n}' resumed=${e.state.resumed} clientsPaused=${e.state.clientsPaused} keysExchanged=${null===(r=e.state.keyExchange)||void 0===r?void 0:r.areKeysExchanged()} isOriginator=${e.state.isOriginator}`),e.emit(t.EventType.CLIENTS_CONNECTED,{isOriginator:e.state.isOriginator,keysExchanged:null===(i=e.state.keyExchange)||void 0===i?void 0:i.areKeysExchanged(),context:e.state.context}),e.state.resumed?(e.state.isOriginator||(e.state.debug&&console.debug(`SocketService::${e.state.context}::on 'clients_connected' / keysExchanged=${null===(o=e.state.keyExchange)||void 0===o?void 0:o.areKeysExchanged()} -- backward compatibility`),null===(a=e.state.keyExchange)||void 0===a||a.start({isOriginator:null!==(s=e.state.isOriginator)&&void 0!==s&&s})),e.state.resumed=!1):e.state.clientsPaused?console.debug("SocketService::on 'clients_connected' skip sending originatorInfo on pause"):e.state.isOriginator||(e.state.debug&&console.debug(`SocketService::${e.state.context}::on 'clients_connected' / keysExchanged=${null===(u=e.state.keyExchange)||void 0===u?void 0:u.areKeysExchanged()} -- backward compatibility`),null===(l=e.state.keyExchange)||void 0===l||l.start({isOriginator:null!==(c=e.state.isOriginator)&&void 0!==c&&c,force:!0})),e.state.clientsConnected=!0,e.state.clientsPaused=!1}))}},{event:"channel_created",handler:function(e,n){return r=>{e.state.debug&&console.debug(`SocketService::${e.state.context}::setupChannelListener::on 'channel_created-${n}'`,r),e.emit(t.EventType.CHANNEL_CREATED,r)}}},{event:"clients_disconnected",handler:function(e,n){return()=>{var r;e.state.clientsConnected=!1,e.state.debug&&console.debug(`SocketService::${e.state.context}::setupChannelListener::on 'clients_disconnected-${n}'`),e.state.isOriginator&&!e.state.clientsPaused&&(null===(r=e.state.keyExchange)||void 0===r||r.clean()),e.emit(t.EventType.CLIENTS_DISCONNECTED,n)}}},{event:"message",handler:function(e,n){return({id:r,message:i,error:o})=>{var a,s,u,l,c,d,f,h,p,m,g,v,y,b,w;if(e.state.debug&&console.debug(`SocketService::${e.state.context}::on 'message' ${n} keysExchanged=${null===(a=e.state.keyExchange)||void 0===a?void 0:a.areKeysExchanged()}`,i),o)throw e.state.debug&&console.debug(`\n SocketService::${e.state.context}::on 'message' error=${o}`),new Error(o);try{!function(e,t){if(t!==e.channelId)throw e.debug&&console.error(`Wrong id ${t} - should be ${e.channelId}`),new Error("Wrong id")}(e.state,r)}catch(e){return void console.error("ignore message --- wrong id ",i)}if(e.state.isOriginator&&(null==i?void 0:i.type)===qw.KEY_HANDSHAKE_START)return e.state.debug&&console.debug(`SocketService::${e.state.context}::on 'message' received HANDSHAKE_START isOriginator=${e.state.isOriginator}`,i),void(null===(s=e.state.keyExchange)||void 0===s||s.start({isOriginator:null!==(u=e.state.isOriginator)&&void 0!==u&&u,force:!0}));if((null==i?void 0:i.type)===t.MessageType.PING)return e.state.debug&&console.debug(`SocketService::${e.state.context}::on 'message' ping `),void e.emit(t.EventType.MESSAGE,{message:{type:"ping"}});if(e.state.debug&&console.debug(`SocketService::${e.state.context}::on 'message' originator=${e.state.isOriginator}, type=${null==i?void 0:i.type}, keysExchanged=${null===(l=e.state.keyExchange)||void 0===l?void 0:l.areKeysExchanged()}`),null===(c=null==i?void 0:i.type)||void 0===c?void 0:c.startsWith("key_handshake"))return e.state.debug&&console.debug(`SocketService::${e.state.context}::on 'message' emit KEY_EXCHANGE`,i),void e.emit(Fw.KEY_EXCHANGE,{message:i,context:e.state.context});if(null===(d=e.state.keyExchange)||void 0===d?void 0:d.areKeysExchanged()){if(-1!==i.toString().indexOf("type"))return console.warn("SocketService::on 'message' received non encrypted unkwown message"),void e.emit(t.EventType.MESSAGE,i)}else{let t=!1;try{null===(f=e.state.keyExchange)||void 0===f||f.decryptMessage(i),t=!0}catch(e){}if(!t)return e.state.isOriginator?null===(p=e.state.keyExchange)||void 0===p||p.start({isOriginator:null!==(m=e.state.isOriginator)&&void 0!==m&&m}):e.sendMessage({type:qw.KEY_HANDSHAKE_START}),void console.warn(`Message ignored because invalid key exchange status. step=${null===(g=e.state.keyExchange)||void 0===g?void 0:g.getKeyInfo().step}`,null===(v=e.state.keyExchange)||void 0===v?void 0:v.getKeyInfo(),i);console.warn("Invalid key exchange status detected --- updating it."),null===(h=e.state.keyExchange)||void 0===h||h.setKeysExchanged(!0)}const A=null===(y=e.state.keyExchange)||void 0===y?void 0:y.decryptMessage(i),_=JSON.parse(null!=A?A:"{}");if((null==_?void 0:_.type)===t.MessageType.PAUSE?e.state.clientsPaused=!0:e.state.clientsPaused=!1,e.state.isOriginator&&_.data){const n=_.data,r=e.state.rpcMethodTracker[n.id];if(r){const i=Date.now()-r.timestamp;e.state.debug&&console.debug(`SocketService::${e.state.context}::on 'message' received answer for id=${n.id} method=${r.method} responseTime=${i}`,_);const o=Object.assign(Object.assign({},r),{result:n.result,error:n.error?{code:null===(b=n.error)||void 0===b?void 0:b.code,message:null===(w=n.error)||void 0===w?void 0:w.message}:void 0,elapsedTime:i});e.state.rpcMethodTracker[n.id]=o,e.emit(t.EventType.RPC_UPDATE,o),e.state.debug&&console.debug("HACK (wallet <7.3) update rpcMethodTracker",o),e.emit(t.EventType.AUTHORIZED)}}e.emit(t.EventType.MESSAGE,{message:_})}}},{event:"clients_waiting_to_join",handler:function(e,n){return r=>{e.state.debug&&console.debug(`SocketService::${e.state.context}::setupChannelListener::on 'clients_waiting_to_join-${n}'`,r),e.emit(t.EventType.CLIENTS_WAITING,r)}}}],Yw=[{event:t.EventType.KEY_INFO,handler:function(e){return n=>{e.state.debug&&console.debug("SocketService::on 'KEY_INFO'",n),e.emit(t.EventType.KEY_INFO,n)}}},{event:t.EventType.KEYS_EXCHANGED,handler:function(e){return()=>{var n,r;e.state.debug&&console.debug(`SocketService::on 'keys_exchanged' keyschanged=${null===(n=e.state.keyExchange)||void 0===n?void 0:n.areKeysExchanged()}`),e.emit(t.EventType.KEYS_EXCHANGED,{keysExchanged:null===(r=e.state.keyExchange)||void 0===r?void 0:r.areKeysExchanged(),isOriginator:e.state.isOriginator});const i={keyInfo:e.getKeyInfo()};e.emit(t.EventType.SERVICE_STATUS,i)}}}];function Gw(e,n){e.state.debug&&console.debug(`SocketService::${e.state.context}::setupChannelListener setting socket listeners for channel ${n}...`);const{socket:r}=e.state,{keyExchange:i}=e.state;e.state.setupChannelListeners&&console.warn(`SocketService::${e.state.context}::setupChannelListener socket listeners already set up for channel ${n}`),r&&e.state.isOriginator&&(e.state.debug&&(null==r||r.io.on("error",(t=>{console.debug(`SocketService::${e.state.context}::setupChannelListener socket event=error`,t)})),null==r||r.io.on("reconnect",(t=>{console.debug(`SocketService::${e.state.context}::setupChannelListener socket event=reconnect`,t)})),null==r||r.io.on("reconnect_error",(t=>{console.debug(`SocketService::${e.state.context}::setupChannelListener socket event=reconnect_error`,t)})),null==r||r.io.on("reconnect_failed",(()=>{console.debug(`SocketService::${e.state.context}::setupChannelListener socket event=reconnect_failed`)})),null==r||r.io.on("ping",(()=>{console.debug(`SocketService::${e.state.context}::setupChannelListener socket event=ping`)}))),null==r||r.on("disconnect",(n=>(console.log(`MetaMaskSDK socket disconnected '${n}' begin recovery...`),function(e){return n=>{e.state.debug&&console.debug(`SocketService::on 'disconnect' manualDisconnect=${e.state.manualDisconnect}`,n),e.state.manualDisconnect||(e.emit(t.EventType.SOCKET_DISCONNECTED),function(e){"undefined"!=typeof window&&"undefined"!=typeof document&&(e.state.debug&&console.debug(`SocketService::checkFocus hasFocus=${document.hasFocus()}`,e),document.hasFocus()?Hw(e).then((t=>{e.state.debug&&console.debug(`SocketService::checkFocus reconnectSocket success=${t}`,e)})).catch((e=>{console.error("SocketService::checkFocus Error reconnecting socket",e)})):window.addEventListener("focus",(()=>{Hw(e).catch((e=>{console.error("SocketService::checkFocus Error reconnecting socket",e)}))}),{once:!0}))}(e))}}(e)(n))))),$w.forEach((({event:t,handler:i})=>{const o=`${t}-${n}`;null==r||r.on(o,i(e,n))})),Yw.forEach((({event:t,handler:n})=>{null==i||i.on(t,n(e))})),e.state.setupChannelListeners=!0}var Qw,Zw,Xw;function Jw(e,n){var r,i;if(!e.state.channelId)throw new Error("Create a channel first");e.state.debug&&console.debug(`SocketService::${e.state.context}::sendMessage() areKeysExchanged=${null===(r=e.state.keyExchange)||void 0===r?void 0:r.areKeysExchanged()}`,n),(null===(i=null==n?void 0:n.type)||void 0===i?void 0:i.startsWith("key_handshake"))?function(e,n){var r;e.state.debug&&console.debug(`SocketService::${e.state.context}::sendMessage()`,n),null===(r=e.state.socket)||void 0===r||r.emit(t.EventType.MESSAGE,{id:e.state.channelId,context:e.state.context,message:n})}(e,n):(function(e,t){var n;if(!(null===(n=e.state.keyExchange)||void 0===n?void 0:n.areKeysExchanged()))throw e.state.debug&&console.debug(`SocketService::${e.state.context}::sendMessage() ERROR keys not exchanged`,t),new Error("Keys not exchanged BBB")}(e,n),function(e,n){var r;const i=null!==(r=null==n?void 0:n.method)&&void 0!==r?r:"",o=null==n?void 0:n.id;e.state.isOriginator&&o&&(e.state.rpcMethodTracker[o]={id:o,timestamp:Date.now(),method:i},e.emit(t.EventType.RPC_UPDATE,e.state.rpcMethodTracker[o]))}(e,n),function(e,n){var r,i;const o=null===(r=e.state.keyExchange)||void 0===r?void 0:r.encryptMessage(JSON.stringify(n)),a={id:e.state.channelId,context:e.state.context,message:o,plaintext:e.state.hasPlaintext?JSON.stringify(n):void 0};e.state.debug&&console.debug(`SocketService::${e.state.context}::sendMessage()`,a),n.type===t.MessageType.TERMINATE&&(e.state.manualDisconnect=!0),null===(i=e.state.socket)||void 0===i||i.emit(t.EventType.MESSAGE,a)}(e,n),function(e,n){var r;return dn(this,void 0,void 0,(function*(){const i=null==n?void 0:n.id,o=null!==(r=null==n?void 0:n.method)&&void 0!==r?r:"";if(e.state.isOriginator&&i)try{const r=Kw(i,e.state.rpcMethodTracker,200).then((e=>({type:Qw.RPC_CHECK,result:e}))),a=(()=>dn(this,void 0,void 0,(function*(){const t=yield(({rpcId:e,instance:t})=>dn(void 0,void 0,void 0,(function*(){for(;t.state.lastRpcId===e||void 0===t.state.lastRpcId;)yield Vw(200);return t.state.lastRpcId})))({instance:e,rpcId:i}),n=yield Kw(t,e.state.rpcMethodTracker,200);return{type:Qw.SKIPPED_RPC,result:n}})))(),s=yield Promise.race([r,a]);if(s.type===Qw.RPC_CHECK){const t=s.result;e.state.debug&&console.debug(`SocketService::waitForRpc id=${n.id} ${o} ( ${t.elapsedTime} ms)`,t.result)}else{if(s.type!==Qw.SKIPPED_RPC)throw new Error(`Error handling RPC replies for ${i}`);{const{result:n}=s;console.warn(`[handleRpcReplies] RPC METHOD HAS BEEN SKIPPED rpcid=${i} method=${o}`,n);const r=Object.assign(Object.assign({},e.state.rpcMethodTracker[i]),{error:new Error("SDK_CONNECTION_ISSUE")});e.emit(t.EventType.RPC_UPDATE,r);const a={data:Object.assign(Object.assign({},r),{jsonrpc:"2.0"}),name:"metamask-provider"};e.emit(t.EventType.MESSAGE,{message:a})}}}catch(e){throw console.warn(`[handleRpcReplies] Error rpcId=${n.id} ${o}`,e),e}}))}(e,n).catch((e=>{console.warn("Error handleRpcReplies",e)})))}t.CommunicationLayerPreference=void 0,t.PlatformType=void 0,function(e){e.RPC_CHECK="rpcCheck",e.SKIPPED_RPC="skippedRpc"}(Qw||(Qw={}));class eA extends N.EventEmitter2{constructor({otherPublicKey:e,reconnect:t,communicationLayerPreference:n,transports:r,communicationServerUrl:i,context:o,ecies:a,logging:s}){super(),this.state={clientsConnected:!1,clientsPaused:!1,manualDisconnect:!1,lastRpcId:void 0,rpcMethodTracker:{},hasPlaintext:!1,communicationServerUrl:""},this.state.resumed=t,this.state.context=o,this.state.communicationLayerPreference=n,this.state.debug=!0===(null==s?void 0:s.serviceLayer),this.state.communicationServerUrl=i,this.state.hasPlaintext=this.state.communicationServerUrl!==Dw&&!0===(null==s?void 0:s.plaintext);const u={autoConnect:!1,transports:Bw};r&&(u.transports=r),this.state.debug&&console.debug(`SocketService::constructor() Socket IO url: ${this.state.communicationServerUrl}`),this.state.socket=cn(i,u);const l={communicationLayer:this,otherPublicKey:e,sendPublicKey:!1,context:this.state.context,ecies:a,logging:s};this.state.keyExchange=new Ww(l)}resetKeys(){return this.state.debug&&console.debug("SocketService::resetKeys()"),void(null===(e=this.state.keyExchange)||void 0===e||e.resetKeys());var e}createChannel(){return function(e){var n,r,i,o;e.state.debug&&console.debug(`SocketService::${e.state.context}::createChannel()`),(null===(n=e.state.socket)||void 0===n?void 0:n.connected)||null===(r=e.state.socket)||void 0===r||r.connect(),e.state.manualDisconnect=!1,e.state.isOriginator=!0;const a=q();return e.state.channelId=a,Gw(e,a),null===(i=e.state.socket)||void 0===i||i.emit(t.EventType.JOIN_CHANNEL,a,`${e.state.context}createChannel`),{channelId:a,pubKey:(null===(o=e.state.keyExchange)||void 0===o?void 0:o.getMyPublicKey())||""}}(this)}connectToChannel({channelId:e,isOriginator:n=!1,withKeyExchange:r=!1}){return function({options:e,instance:n}){var r,i,o,a;const{channelId:s,withKeyExchange:u,isOriginator:l}=e;if(n.state.debug&&console.debug(`SocketService::${n.state.context}::connectToChannel() channelId=${s} isOriginator=${l}`,null===(r=n.state.keyExchange)||void 0===r?void 0:r.toString()),null===(i=n.state.socket)||void 0===i?void 0:i.connected)throw new Error("socket already connected");n.state.manualDisconnect=!1,null===(o=n.state.socket)||void 0===o||o.connect(),n.state.withKeyExchange=u,n.state.isOriginator=l,n.state.channelId=s,Gw(n,s),null===(a=n.state.socket)||void 0===a||a.emit(t.EventType.JOIN_CHANNEL,s,`${n.state.context}_connectToChannel`)}({options:{channelId:e,isOriginator:n,withKeyExchange:r},instance:this})}getKeyInfo(){return this.state.keyExchange.getKeyInfo()}keyCheck(){var e,n;null===(n=(e=this).state.socket)||void 0===n||n.emit(t.EventType.MESSAGE,{id:e.state.channelId,context:e.state.context,message:{type:qw.KEY_HANDSHAKE_CHECK,pubkey:e.getKeyInfo().ecies.otherPubKey}})}getKeyExchange(){return this.state.keyExchange}sendMessage(e){return Jw(this,e)}ping(){return(e=this).state.debug&&console.debug(`SocketService::${e.state.context}::ping() originator=${e.state.isOriginator} keysExchanged=${null===(n=e.state.keyExchange)||void 0===n?void 0:n.areKeysExchanged()}`),e.state.isOriginator&&((null===(r=e.state.keyExchange)||void 0===r?void 0:r.areKeysExchanged())?(console.warn(`SocketService::${e.state.context}::ping() sending READY message`),e.sendMessage({type:t.MessageType.READY})):(console.warn(`SocketService::${e.state.context}::ping() starting key exchange`),null===(i=e.state.keyExchange)||void 0===i||i.start({isOriginator:null!==(o=e.state.isOriginator)&&void 0!==o&&o}))),void(null===(a=e.state.socket)||void 0===a||a.emit(t.EventType.MESSAGE,{id:e.state.channelId,context:e.state.context,message:{type:t.MessageType.PING}}));var e,n,r,i,o,a}pause(){return(e=this).state.debug&&console.debug(`SocketService::${e.state.context}::pause()`),e.state.manualDisconnect=!0,(null===(n=e.state.keyExchange)||void 0===n?void 0:n.areKeysExchanged())&&e.sendMessage({type:t.MessageType.PAUSE}),void(null===(r=e.state.socket)||void 0===r||r.disconnect());var e,n,r}isConnected(){var e;return null===(e=this.state.socket)||void 0===e?void 0:e.connected}resume(){return(e=this).state.debug&&console.debug(`SocketService::${e.state.context}::resume() connected=${null===(n=e.state.socket)||void 0===n?void 0:n.connected} manualDisconnect=${e.state.manualDisconnect} resumed=${e.state.resumed} keysExchanged=${null===(r=e.state.keyExchange)||void 0===r?void 0:r.areKeysExchanged()}`),(null===(i=e.state.socket)||void 0===i?void 0:i.connected)?e.state.debug&&console.debug("SocketService::resume() already connected."):(null===(o=e.state.socket)||void 0===o||o.connect(),e.state.debug&&console.debug(`SocketService::resume() after connecting socket --\x3e connected=${null===(a=e.state.socket)||void 0===a?void 0:a.connected}`),null===(s=e.state.socket)||void 0===s||s.emit(t.EventType.JOIN_CHANNEL,e.state.channelId,`${e.state.context}_resume`)),(null===(u=e.state.keyExchange)||void 0===u?void 0:u.areKeysExchanged())?e.state.isOriginator||e.sendMessage({type:t.MessageType.READY}):e.state.isOriginator||null===(l=e.state.keyExchange)||void 0===l||l.start({isOriginator:null!==(c=e.state.isOriginator)&&void 0!==c&&c}),e.state.manualDisconnect=!1,void(e.state.resumed=!0);var e,n,r,i,o,a,s,u,l,c}getRPCMethodTracker(){return this.state.rpcMethodTracker}disconnect(e){return function(e,t){var n,r;e.state.debug&&console.debug(`SocketService::${e.state.context}::disconnect()`,t),(null==t?void 0:t.terminate)&&(e.state.channelId=t.channelId,null===(n=e.state.keyExchange)||void 0===n||n.clean()),e.state.rpcMethodTracker={},e.state.manualDisconnect=!0,null===(r=e.state.socket)||void 0===r||r.disconnect()}(this,e)}}function tA(e){return()=>dn(this,void 0,void 0,(function*(){var n,r,i;const{state:o}=e;if(o.authorized)return;yield(()=>dn(this,void 0,void 0,(function*(){for(;!o.walletInfo;)yield Vw(500)})))();const a="7.3".localeCompare((null===(n=o.walletInfo)||void 0===n?void 0:n.version)||"");if(o.debug&&console.debug(`RemoteCommunication HACK 'authorized' version=${null===(r=o.walletInfo)||void 0===r?void 0:r.version} compareValue=${a}`),1!==a)return;const s=o.platformType===t.PlatformType.MobileWeb||o.platformType===t.PlatformType.ReactNative||o.platformType===t.PlatformType.MetaMaskMobileWebview;o.debug&&console.debug(`RemoteCommunication HACK 'authorized' platform=${o.platformType} secure=${s} channel=${o.channelId} walletVersion=${null===(i=o.walletInfo)||void 0===i?void 0:i.version}`),s&&(o.authorized=!0,e.emit(t.EventType.AUTHORIZED))}))}function nA(e){return n=>{const{state:r}=e;r.debug&&console.debug(`RemoteCommunication::${r.context}::on 'channel_created' channelId=${n}`),e.emit(t.EventType.CHANNEL_CREATED,n)}}function rA(e,n){return()=>{var r,i,o,a;const{state:s}=e;if(s.debug&&console.debug(`RemoteCommunication::on 'clients_connected' channel=${s.channelId} keysExchanged=${null===(i=null===(r=s.communicationLayer)||void 0===r?void 0:r.getKeyInfo())||void 0===i?void 0:i.keysExchanged}`),s.analytics){const e=s.isOriginator?Zw.REQUEST:Zw.REQUEST_MOBILE;fn(Object.assign(Object.assign({id:null!==(o=s.channelId)&&void 0!==o?o:"",event:s.reconnection?Zw.RECONNECT:e},s.originatorInfo),{commLayer:n,sdkVersion:s.sdkVersion,walletVersion:null===(a=s.walletInfo)||void 0===a?void 0:a.version,commLayerVersion:Nw}),s.communicationServerUrl).catch((e=>{console.error("Cannot send analytics",e)}))}s.clientsConnected=!0,s.originatorInfoSent=!1,e.emit(t.EventType.CLIENTS_CONNECTED)}}function iA(e,n){return r=>{var i;const{state:o}=e;o.debug&&console.debug(`RemoteCommunication::${o.context}]::on 'clients_disconnected' channelId=${r}`),o.clientsConnected=!1,e.emit(t.EventType.CLIENTS_DISCONNECTED,o.channelId),e.setConnectionStatus(t.ConnectionStatus.DISCONNECTED),o.ready=!1,o.authorized=!1,o.analytics&&o.channelId&&fn({id:o.channelId,event:Zw.DISCONNECTED,sdkVersion:o.sdkVersion,commLayer:n,commLayerVersion:Nw,walletVersion:null===(i=o.walletInfo)||void 0===i?void 0:i.version},o.communicationServerUrl).catch((e=>{console.error("Cannot send analytics",e)}))}}function oA(e){return n=>{var r;const{state:i}=e;if(i.debug&&console.debug(`RemoteCommunication::${i.context}::on 'clients_waiting' numberUsers=${n} ready=${i.ready} autoStarted=${i.originatorConnectStarted}`),e.setConnectionStatus(t.ConnectionStatus.WAITING),e.emit(t.EventType.CLIENTS_WAITING,n),i.originatorConnectStarted){i.debug&&console.debug(`RemoteCommunication::on 'clients_waiting' watch autoStarted=${i.originatorConnectStarted} timeout`,i.autoConnectOptions);const n=(null===(r=i.autoConnectOptions)||void 0===r?void 0:r.timeout)||3e3,o=setTimeout((()=>{i.debug&&console.debug(`RemoteCommunication::on setTimeout(${n}) terminate channelConfig`,i.autoConnectOptions),i.originatorConnectStarted=!1,i.ready||e.setConnectionStatus(t.ConnectionStatus.TIMEOUT),clearTimeout(o)}),n)}}}function aA(e,n){return r=>{var i,o,a,s,u;const{state:l}=e;l.debug&&console.debug(`RemoteCommunication::${l.context}::on commLayer.'keys_exchanged' channel=${l.channelId}`,r),(null===(o=null===(i=l.communicationLayer)||void 0===i?void 0:i.getKeyInfo())||void 0===o?void 0:o.keysExchanged)&&e.setConnectionStatus(t.ConnectionStatus.LINKED),function(e,t){var n,r,i,o;const{state:a}=e;a.debug&&console.debug(`RemoteCommunication::setLastActiveDate() channel=${a.channelId}`,t);const s={channelId:null!==(n=a.channelId)&&void 0!==n?n:"",validUntil:null!==(i=null===(r=a.channelConfig)||void 0===r?void 0:r.validUntil)&&void 0!==i?i:0,lastActive:t.getTime()};null===(o=a.storageManager)||void 0===o||o.persistChannelConfig(s)}(e,new Date),l.analytics&&l.channelId&&fn({id:l.channelId,event:r.isOriginator?Zw.CONNECTED:Zw.CONNECTED_MOBILE,sdkVersion:l.sdkVersion,commLayer:n,commLayerVersion:Nw,walletVersion:null===(a=l.walletInfo)||void 0===a?void 0:a.version},l.communicationServerUrl).catch((e=>{console.error("Cannot send analytics",e)})),l.isOriginator=r.isOriginator,r.isOriginator||(null===(s=l.communicationLayer)||void 0===s||s.sendMessage({type:t.MessageType.READY}),l.ready=!0,l.paused=!1),r.isOriginator&&!l.originatorInfoSent&&(null===(u=l.communicationLayer)||void 0===u||u.sendMessage({type:t.MessageType.ORIGINATOR_INFO,originatorInfo:l.originatorInfo,originator:l.originatorInfo}),l.originatorInfoSent=!0)}}function sA(e){return n=>{let r=n;n.message&&(r=r.message),function(e,n){const{state:r}=n;if(r.debug&&console.debug(`RemoteCommunication::${r.context}::on 'message' typeof=${typeof e}`,e),n.state.ready=!0,r.isOriginator||e.type!==t.MessageType.ORIGINATOR_INFO)if(r.isOriginator&&e.type===t.MessageType.WALLET_INFO)!function(e,t){const{state:n}=e;n.walletInfo=t.walletInfo,n.paused=!1}(n,e);else{if(e.type===t.MessageType.TERMINATE)!function(e){const{state:n}=e;n.isOriginator&&(cA({options:{terminate:!0,sendMessage:!1},instance:e}),console.debug(),e.emit(t.EventType.TERMINATE))}(n);else if(e.type===t.MessageType.PAUSE)!function(e){const{state:n}=e;n.paused=!0,e.setConnectionStatus(t.ConnectionStatus.PAUSED)}(n);else if(e.type===t.MessageType.READY&&r.isOriginator)!function(e){const{state:n}=e;e.setConnectionStatus(t.ConnectionStatus.LINKED);const r=n.paused;n.paused=!1,e.emit(t.EventType.CLIENTS_READY,{isOriginator:n.isOriginator,walletInfo:n.walletInfo}),r&&(n.authorized=!0,e.emit(t.EventType.AUTHORIZED))}(n);else{if(e.type===t.MessageType.OTP&&r.isOriginator)return void function(e,n){var r;const{state:i}=e;e.emit(t.EventType.OTP,n.otpAnswer),1==="6.6".localeCompare((null===(r=i.walletInfo)||void 0===r?void 0:r.version)||"")&&(console.warn("RemoteCommunication::on 'otp' -- backward compatibility <6.6 -- triger eth_requestAccounts"),e.emit(t.EventType.SDK_RPC_CALL,{method:Uw.ETH_REQUESTACCOUNTS,params:[]}))}(n,e);e.type===t.MessageType.AUTHORIZED&&r.isOriginator&&function(e){const{state:n}=e;n.authorized=!0,e.emit(t.EventType.AUTHORIZED)}(n)}n.emit(t.EventType.MESSAGE,e)}else!function(e,n){var r;const{state:i}=e;null===(r=i.communicationLayer)||void 0===r||r.sendMessage({type:t.MessageType.WALLET_INFO,walletInfo:i.walletInfo}),i.originatorInfo=n.originatorInfo||n.originator,e.emit(t.EventType.CLIENTS_READY,{isOriginator:i.isOriginator,originatorInfo:i.originatorInfo}),i.paused=!1}(n,e)}(r,e)}}function uA(e){return()=>{const{state:t}=e;t.debug&&console.debug("RemoteCommunication::on 'socket_reconnect' -- reset key exchange status / set ready to false"),t.ready=!1,t.authorized=!1,zw(t),e.emitServiceStatusEvent()}}function lA(e){return()=>{const{state:t}=e;t.debug&&console.debug("RemoteCommunication::on 'socket_Disconnected' set ready to false"),t.ready=!1}}function cA({options:e,instance:n}){var r,i,o,a,s,u;const{state:l}=n;l.debug&&console.debug(`RemoteCommunication::disconnect() channel=${l.channelId}`,e),l.ready=!1,l.paused=!1,(null==e?void 0:e.terminate)?(null===(r=l.storageManager)||void 0===r||r.terminate(null!==(i=l.channelId)&&void 0!==i?i:""),(null===(o=l.communicationLayer)||void 0===o?void 0:o.getKeyInfo().keysExchanged)&&(null==e?void 0:e.sendMessage)&&(null===(a=l.communicationLayer)||void 0===a||a.sendMessage({type:t.MessageType.TERMINATE})),l.channelId=q(),e.channelId=l.channelId,l.channelConfig=void 0,l.originatorConnectStarted=!1,null===(s=l.communicationLayer)||void 0===s||s.disconnect(e),n.setConnectionStatus(t.ConnectionStatus.TERMINATED)):(null===(u=l.communicationLayer)||void 0===u||u.disconnect(e),n.setConnectionStatus(t.ConnectionStatus.DISCONNECTED))}!function(e){e.SOCKET="socket"}(t.CommunicationLayerPreference||(t.CommunicationLayerPreference={})),function(e){e.NonBrowser="nodejs",e.MetaMaskMobileWebview="in-app-browser",e.DesktopWeb="web-desktop",e.MobileWeb="web-mobile",e.ReactNative="react-native"}(t.PlatformType||(t.PlatformType={})),function(e){e.REQUEST="sdk_connect_request_started",e.REQUEST_MOBILE="sdk_connect_request_started_mobile",e.RECONNECT="sdk_reconnect_request_started",e.CONNECTED="sdk_connection_established",e.CONNECTED_MOBILE="sdk_connection_established_mobile",e.AUTHORIZED="sdk_connection_authorized",e.REJECTED="sdk_connection_rejected",e.TERMINATED="sdk_connection_terminated",e.DISCONNECTED="sdk_disconnected",e.SDK_USE_EXTENSION="sdk_use_extension",e.SDK_EXTENSION_UTILIZED="sdk_extension_utilized",e.SDK_USE_INAPP_BROWSER="sdk_use_inapp_browser"}(Zw||(Zw={}));class dA extends N.EventEmitter2{constructor({platformType:e,communicationLayerPreference:n,otherPublicKey:r,reconnect:i,walletInfo:o,dappMetadata:a,transports:s,context:u,ecies:l,analytics:c=!1,storage:d,sdkVersion:f,communicationServerUrl:h=Dw,logging:p,autoConnect:m={timeout:3e3}}){super(),this.state={ready:!1,authorized:!1,isOriginator:!1,paused:!1,platformType:"metamask-mobile",analytics:!1,reconnection:!1,originatorInfoSent:!1,communicationServerUrl:Dw,context:"",clientsConnected:!1,sessionDuration:jw,originatorConnectStarted:!1,debug:!1,_connectionStatus:t.ConnectionStatus.DISCONNECTED},this.state.otherPublicKey=r,this.state.dappMetadata=a,this.state.walletInfo=o,this.state.transports=s,this.state.platformType=e,this.state.analytics=c,this.state.isOriginator=!r,this.state.communicationServerUrl=h,this.state.context=u,this.state.sdkVersion=f,this.setMaxListeners(50),this.setConnectionStatus(t.ConnectionStatus.DISCONNECTED),(null==d?void 0:d.duration)&&(this.state.sessionDuration=jw),this.state.storageOptions=d,this.state.autoConnectOptions=m,this.state.debug=!0===(null==p?void 0:p.remoteLayer),this.state.logging=p,(null==d?void 0:d.storageManager)&&(this.state.storageManager=d.storageManager),this.initCommunicationLayer({communicationLayerPreference:n,otherPublicKey:r,reconnect:i,ecies:l,communicationServerUrl:h}),this.emitServiceStatusEvent()}initCommunicationLayer({communicationLayerPreference:e,otherPublicKey:n,reconnect:r,ecies:i,communicationServerUrl:o=Dw}){return function({communicationLayerPreference:e,otherPublicKey:n,reconnect:r,ecies:i,communicationServerUrl:o=Dw,instance:a}){var s,u,l,c,d;const{state:f}=a;if(e!==t.CommunicationLayerPreference.SOCKET)throw new Error("Invalid communication protocol");f.communicationLayer=new eA({communicationLayerPreference:e,otherPublicKey:n,reconnect:r,transports:f.transports,communicationServerUrl:o,context:f.context,ecies:i,logging:f.logging});let h="undefined"!=typeof document&&document.URL||"",p="undefined"!=typeof document&&document.title||"";(null===(s=f.dappMetadata)||void 0===s?void 0:s.url)&&(h=f.dappMetadata.url),(null===(u=f.dappMetadata)||void 0===u?void 0:u.name)&&(p=f.dappMetadata.name);const m={url:h,title:p,source:null===(l=f.dappMetadata)||void 0===l?void 0:l.source,icon:(null===(c=f.dappMetadata)||void 0===c?void 0:c.iconUrl)||(null===(d=f.dappMetadata)||void 0===d?void 0:d.base64Icon),platform:f.platformType,apiVersion:Nw};f.originatorInfo=m;const g={[t.EventType.AUTHORIZED]:tA(a),[t.EventType.MESSAGE]:sA(a),[t.EventType.CLIENTS_CONNECTED]:rA(a,e),[t.EventType.KEYS_EXCHANGED]:aA(a,e),[t.EventType.SOCKET_DISCONNECTED]:lA(a),[t.EventType.SOCKET_RECONNECT]:uA(a),[t.EventType.CLIENTS_DISCONNECTED]:iA(a,e),[t.EventType.KEY_INFO]:()=>{a.emitServiceStatusEvent()},[t.EventType.CHANNEL_CREATED]:nA(a),[t.EventType.CLIENTS_WAITING]:oA(a),[t.EventType.RPC_UPDATE]:e=>{a.emit(t.EventType.RPC_UPDATE,e)}};for(const[e,t]of Object.entries(g))try{f.communicationLayer.on(e,t)}catch(n){console.error(`Error registering handler for ${e}:`,n)}}({communicationLayerPreference:e,otherPublicKey:n,reconnect:r,ecies:i,communicationServerUrl:o,instance:this})}originatorSessionConnect(){return dn(this,void 0,void 0,(function*(){const e=yield function(e){var t,n,r;return dn(this,void 0,void 0,(function*(){const{state:i}=e;if(!i.storageManager)return void(i.debug&&console.debug("RemoteCommunication::connect() no storage manager defined - skip"));const o=yield i.storageManager.getPersistedChannelConfig(null!==(t=i.channelId)&&void 0!==t?t:"");if(i.debug&&console.debug(`RemoteCommunication::connect() autoStarted=${i.originatorConnectStarted} channelConfig`,o),null===(n=i.communicationLayer)||void 0===n?void 0:n.isConnected())return i.debug&&console.debug("RemoteCommunication::connect() socket already connected - skip"),o;if(o){if(o.validUntil>Date.now())return i.channelConfig=o,i.originatorConnectStarted=!0,i.channelId=null==o?void 0:o.channelId,i.reconnection=!0,null===(r=i.communicationLayer)||void 0===r||r.connectToChannel({channelId:o.channelId,isOriginator:!0}),o;i.debug&&console.log("RemoteCommunication::autoConnect Session has expired")}i.originatorConnectStarted=!1}))}(this);return e}))}generateChannelIdConnect(){return dn(this,void 0,void 0,(function*(){return function(e){var t,n,r,i,o;if(!e.communicationLayer)throw new Error("communication layer not initialized");if(e.ready)throw new Error("Channel already connected");if(e.channelId&&(null===(t=e.communicationLayer)||void 0===t?void 0:t.isConnected()))return console.warn("Channel already exists -- interrupt generateChannelId",e.channelConfig),e.channelConfig={channelId:e.channelId,validUntil:Date.now()+e.sessionDuration},null===(n=e.storageManager)||void 0===n||n.persistChannelConfig(e.channelConfig),{channelId:e.channelId,pubKey:null===(i=null===(r=e.communicationLayer)||void 0===r?void 0:r.getKeyInfo())||void 0===i?void 0:i.ecies.public};e.debug&&console.debug("RemoteCommunication::generateChannelId()"),zw(e);const a=e.communicationLayer.createChannel();e.debug&&console.debug("RemoteCommunication::generateChannelId() channel created",a);const s={channelId:a.channelId,validUntil:Date.now()+e.sessionDuration};return e.channelId=a.channelId,e.channelConfig=s,null===(o=e.storageManager)||void 0===o||o.persistChannelConfig(s),{channelId:e.channelId,pubKey:a.pubKey}}(this.state)}))}clean(){return zw(this.state)}connectToChannel(e,t){return function({channelId:e,withKeyExchange:t,state:n}){var r,i,o;if(!U(e))throw console.debug(`RemoteCommunication::${n.context}::connectToChannel() invalid channel channelId=${e}`),new Error(`Invalid channel ${e}`);if(n.debug&&console.debug(`RemoteCommunication::${n.context}::connectToChannel() channelId=${e}`),null===(r=n.communicationLayer)||void 0===r?void 0:r.isConnected())return void console.debug(`RemoteCommunication::${n.context}::connectToChannel() already connected - interrup connection.`);n.channelId=e,null===(i=n.communicationLayer)||void 0===i||i.connectToChannel({channelId:e,withKeyExchange:t});const a={channelId:e,validUntil:Date.now()+n.sessionDuration};n.channelConfig=a,null===(o=n.storageManager)||void 0===o||o.persistChannelConfig(a)}({channelId:e,withKeyExchange:t,state:this.state})}sendMessage(e){return function(e,n){var r,i;return dn(this,void 0,void 0,(function*(){const{state:o}=e;o.debug&&console.log(`RemoteCommunication::${o.context}::sendMessage paused=${o.paused} ready=${o.ready} authorized=${o.authorized} socket=${null===(r=o.communicationLayer)||void 0===r?void 0:r.isConnected()} clientsConnected=${o.clientsConnected} status=${o._connectionStatus}`,n),!o.paused&&o.ready&&(null===(i=o.communicationLayer)||void 0===i?void 0:i.isConnected())&&o.clientsConnected||(o.debug&&console.log(`RemoteCommunication::${o.context}::sendMessage SKIP message waiting for MM mobile readiness.`),yield new Promise((n=>{e.once(t.EventType.CLIENTS_READY,n)})),o.debug&&console.log(`RemoteCommunication::${o.context}::sendMessage AFTER SKIP / READY -- sending pending message`));try{yield function(e,n){return dn(this,void 0,void 0,(function*(){return new Promise((r=>{var i,o,a,s;const{state:u}=e;if(u.debug&&console.log(`RemoteCommunication::${u.context}::sendMessage::handleAuthorization ready=${u.ready} authorized=${u.authorized} method=${n.method}`),1==="7.3".localeCompare((null===(i=u.walletInfo)||void 0===i?void 0:i.version)||""))return u.debug&&console.debug(`compatibility hack wallet version > ${null===(o=u.walletInfo)||void 0===o?void 0:o.version}`),null===(a=u.communicationLayer)||void 0===a||a.sendMessage(n),void r();!u.isOriginator||u.authorized?(null===(s=u.communicationLayer)||void 0===s||s.sendMessage(n),r()):e.once(t.EventType.AUTHORIZED,(()=>{var e;u.debug&&console.log(`RemoteCommunication::${u.context}::sendMessage AFTER SKIP / AUTHORIZED -- sending pending message`),null===(e=u.communicationLayer)||void 0===e||e.sendMessage(n),r()}))}))}))}(e,n)}catch(e){throw console.error(`RemoteCommunication::${o.context}::sendMessage ERROR`,e),e}}))}(this,e)}testStorage(){return dn(this,void 0,void 0,(function*(){return function(e){var t,n;return dn(this,void 0,void 0,(function*(){const r=yield null===(t=e.storageManager)||void 0===t?void 0:t.getPersistedChannelConfig(null!==(n=e.channelId)&&void 0!==n?n:"");console.debug("RemoteCommunication.testStorage() res",r)}))}(this.state)}))}getChannelConfig(){return this.state.channelConfig}isReady(){return this.state.ready}isConnected(){var e;return null===(e=this.state.communicationLayer)||void 0===e?void 0:e.isConnected()}isAuthorized(){return this.state.authorized}isPaused(){return this.state.paused}getCommunicationLayer(){return this.state.communicationLayer}ping(){var e;this.state.debug&&console.debug(`RemoteCommunication::ping() channel=${this.state.channelId}`),null===(e=this.state.communicationLayer)||void 0===e||e.ping()}keyCheck(){var e;this.state.debug&&console.debug(`RemoteCommunication::keyCheck() channel=${this.state.channelId}`),null===(e=this.state.communicationLayer)||void 0===e||e.keyCheck()}setConnectionStatus(e){this.state._connectionStatus!==e&&(this.state._connectionStatus=e,this.emit(t.EventType.CONNECTION_STATUS,e),this.emitServiceStatusEvent())}emitServiceStatusEvent(){this.emit(t.EventType.SERVICE_STATUS,this.getServiceStatus())}getConnectionStatus(){return this.state._connectionStatus}getServiceStatus(){return{originatorInfo:this.state.originatorInfo,keyInfo:this.getKeyInfo(),connectionStatus:this.state._connectionStatus,channelConfig:this.state.channelConfig,channelId:this.state.channelId}}getKeyInfo(){var e;return null===(e=this.state.communicationLayer)||void 0===e?void 0:e.getKeyInfo()}resetKeys(){var e;null===(e=this.state.communicationLayer)||void 0===e||e.resetKeys()}setOtherPublicKey(e){var t;const n=null===(t=this.state.communicationLayer)||void 0===t?void 0:t.getKeyExchange();if(!n)throw new Error("KeyExchange is not initialized.");n.getOtherPublicKey()!==e&&n.setOtherPublicKey(e)}pause(){var e;this.state.debug&&console.debug(`RemoteCommunication::pause() channel=${this.state.channelId}`),null===(e=this.state.communicationLayer)||void 0===e||e.pause(),this.setConnectionStatus(t.ConnectionStatus.PAUSED)}getVersion(){return Nw}resume(){return function(e){var n;const{state:r}=e;r.debug&&console.debug(`RemoteCommunication::resume() channel=${r.channelId}`),null===(n=r.communicationLayer)||void 0===n||n.resume(),e.setConnectionStatus(t.ConnectionStatus.LINKED)}(this)}getChannelId(){return this.state.channelId}getRPCMethodTracker(){var e;return null===(e=this.state.communicationLayer)||void 0===e?void 0:e.getRPCMethodTracker()}disconnect(e){return cA({options:e,instance:this})}}function fA(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(a,s)}u((r=r.apply(e,t||[])).next())}))}function hA(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}function pA(e,t,n,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(e,n):i?i.value=n:t.set(e,n),n}!function(e){e.RENEW="renew",e.LINK="link"}(Xw||(Xw={})),"function"==typeof SuppressedError&&SuppressedError;var mA={},gA={},vA={};function yA(){}function bA(){bA.init.call(this)}function wA(e){return void 0===e._maxListeners?bA.defaultMaxListeners:e._maxListeners}function AA(e,t,n,r){var i,o,a;if("function"!=typeof n)throw new TypeError('"listener" argument must be a function');if((o=e._events)?(o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),a=o[t]):(o=e._events=new yA,e._eventsCount=0),a){if("function"==typeof a?a=o[t]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),!a.warned&&(i=wA(e))&&i>0&&a.length>i){a.warned=!0;var s=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");s.name="MaxListenersExceededWarning",s.emitter=e,s.type=t,s.count=a.length,function(e){"function"==typeof console.warn?console.warn(e):console.log(e)}(s)}}else a=o[t]=n,++e._eventsCount;return e}function _A(e,t,n){var r=!1;function i(){e.removeListener(t,i),r||(r=!0,n.apply(e,arguments))}return i.listener=n,i}function EA(e){var t=this._events;if(t){var n=t[e];if("function"==typeof n)return 1;if(n)return n.length}return 0}function SA(e,t){for(var n=new Array(t);t--;)n[t]=e[t];return n}yA.prototype=Object.create(null),bA.EventEmitter=bA,bA.usingDomains=!1,bA.prototype.domain=void 0,bA.prototype._events=void 0,bA.prototype._maxListeners=void 0,bA.defaultMaxListeners=10,bA.init=function(){this.domain=null,bA.usingDomains&&(void 0).active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new yA,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},bA.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},bA.prototype.getMaxListeners=function(){return wA(this)},bA.prototype.emit=function(e){var t,n,r,i,o,a,s,u="error"===e;if(a=this._events)u=u&&null==a.error;else if(!u)return!1;if(s=this.domain,u){if(t=arguments[1],!s){if(t instanceof Error)throw t;var l=new Error('Uncaught, unspecified "error" event. ('+t+")");throw l.context=t,l}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=s,t.domainThrown=!1,s.emit("error",t),!1}if(!(n=a[e]))return!1;var c="function"==typeof n;switch(r=arguments.length){case 1:!function(e,t,n){if(t)e.call(n);else for(var r=e.length,i=SA(e,r),o=0;o<r;++o)i[o].call(n)}(n,c,this);break;case 2:!function(e,t,n,r){if(t)e.call(n,r);else for(var i=e.length,o=SA(e,i),a=0;a<i;++a)o[a].call(n,r)}(n,c,this,arguments[1]);break;case 3:!function(e,t,n,r,i){if(t)e.call(n,r,i);else for(var o=e.length,a=SA(e,o),s=0;s<o;++s)a[s].call(n,r,i)}(n,c,this,arguments[1],arguments[2]);break;case 4:!function(e,t,n,r,i,o){if(t)e.call(n,r,i,o);else for(var a=e.length,s=SA(e,a),u=0;u<a;++u)s[u].call(n,r,i,o)}(n,c,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(r-1),o=1;o<r;o++)i[o-1]=arguments[o];!function(e,t,n,r){if(t)e.apply(n,r);else for(var i=e.length,o=SA(e,i),a=0;a<i;++a)o[a].apply(n,r)}(n,c,this,i)}return!0},bA.prototype.addListener=function(e,t){return AA(this,e,t,!1)},bA.prototype.on=bA.prototype.addListener,bA.prototype.prependListener=function(e,t){return AA(this,e,t,!0)},bA.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,_A(this,e,t)),this},bA.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,_A(this,e,t)),this},bA.prototype.removeListener=function(e,t){var n,r,i,o,a;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(r=this._events))return this;if(!(n=r[e]))return this;if(n===t||n.listener&&n.listener===t)0==--this._eventsCount?this._events=new yA:(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,o=n.length;o-- >0;)if(n[o]===t||n[o].listener&&n[o].listener===t){a=n[o].listener,i=o;break}if(i<0)return this;if(1===n.length){if(n[0]=void 0,0==--this._eventsCount)return this._events=new yA,this;delete r[e]}else!function(e,t){for(var n=t,r=n+1,i=e.length;r<i;n+=1,r+=1)e[n]=e[r];e.pop()}(n,i);r.removeListener&&this.emit("removeListener",e,a||t)}return this},bA.prototype.removeAllListeners=function(e){var t,n;if(!(n=this._events))return this;if(!n.removeListener)return 0===arguments.length?(this._events=new yA,this._eventsCount=0):n[e]&&(0==--this._eventsCount?this._events=new yA:delete n[e]),this;if(0===arguments.length){for(var r,i=Object.keys(n),o=0;o<i.length;++o)"removeListener"!==(r=i[o])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=new yA,this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(t)do{this.removeListener(e,t[t.length-1])}while(t[0]);return this},bA.prototype.listeners=function(e){var t,n,r=this._events;return n=r&&(t=r[e])?"function"==typeof t?[t.listener||t]:function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(t):[],n},bA.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):EA.call(e,t)},bA.prototype.listenerCount=EA,bA.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};var kA=o(Object.freeze({__proto__:null,EventEmitter:bA,default:bA}));Object.defineProperty(vA,"__esModule",{value:!0});const MA=kA;function CA(e,t,n){try{Reflect.apply(e,t,n)}catch(e){setTimeout((()=>{throw e}))}}let xA=class extends MA.EventEmitter{emit(e,...t){let n="error"===e;const r=this._events;if(void 0!==r)n=n&&void 0===r.error;else if(!n)return!1;if(n){let e;if(t.length>0&&([e]=t),e instanceof Error)throw e;const n=new Error("Unhandled error."+(e?` (${e.message})`:""));throw n.context=e,n}const i=r[e];if(void 0===i)return!1;if("function"==typeof i)CA(i,this,t);else{const e=i.length,n=function(e){const t=e.length,n=new Array(t);for(let r=0;r<t;r+=1)n[r]=e[r];return n}(i);for(let r=0;r<e;r+=1)CA(n[r],this,t)}return!0}};vA.default=xA;var RA={},OA={},TA=BA;BA.default=BA,BA.stable=FA,BA.stableStringify=FA;var PA="[...]",LA="[Circular]",IA=[],NA=[];function DA(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function BA(e,t,n,r){var i;void 0===r&&(r=DA()),UA(e,"",0,[],void 0,0,r);try{i=0===NA.length?JSON.stringify(e,t,n):JSON.stringify(e,WA(t),n)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==IA.length;){var o=IA.pop();4===o.length?Object.defineProperty(o[0],o[1],o[3]):o[0][o[1]]=o[2]}}return i}function jA(e,t,n,r){var i=Object.getOwnPropertyDescriptor(r,n);void 0!==i.get?i.configurable?(Object.defineProperty(r,n,{value:e}),IA.push([r,n,t,i])):NA.push([t,n,e]):(r[n]=e,IA.push([r,n,t]))}function UA(e,t,n,r,i,o,a){var s;if(o+=1,"object"==typeof e&&null!==e){for(s=0;s<r.length;s++)if(r[s]===e)return void jA(LA,e,t,i);if(void 0!==a.depthLimit&&o>a.depthLimit)return void jA(PA,e,t,i);if(void 0!==a.edgesLimit&&n+1>a.edgesLimit)return void jA(PA,e,t,i);if(r.push(e),Array.isArray(e))for(s=0;s<e.length;s++)UA(e[s],s,s,r,e,o,a);else{var u=Object.keys(e);for(s=0;s<u.length;s++){var l=u[s];UA(e[l],l,s,r,e,o,a)}}r.pop()}}function zA(e,t){return e<t?-1:e>t?1:0}function FA(e,t,n,r){void 0===r&&(r=DA());var i,o=qA(e,"",0,[],void 0,0,r)||e;try{i=0===NA.length?JSON.stringify(o,t,n):JSON.stringify(o,WA(t),n)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==IA.length;){var a=IA.pop();4===a.length?Object.defineProperty(a[0],a[1],a[3]):a[0][a[1]]=a[2]}}return i}function qA(e,t,n,r,i,o,a){var s;if(o+=1,"object"==typeof e&&null!==e){for(s=0;s<r.length;s++)if(r[s]===e)return void jA(LA,e,t,i);try{if("function"==typeof e.toJSON)return}catch(e){return}if(void 0!==a.depthLimit&&o>a.depthLimit)return void jA(PA,e,t,i);if(void 0!==a.edgesLimit&&n+1>a.edgesLimit)return void jA(PA,e,t,i);if(r.push(e),Array.isArray(e))for(s=0;s<e.length;s++)qA(e[s],s,s,r,e,o,a);else{var u={},l=Object.keys(e).sort(zA);for(s=0;s<l.length;s++){var c=l[s];qA(e[c],c,s,r,e,o,a),u[c]=e[c]}if(void 0===i)return u;IA.push([i,t,e]),i[t]=u}r.pop()}}function WA(e){return e=void 0!==e?e:function(e,t){return t},function(t,n){if(NA.length>0)for(var r=0;r<NA.length;r++){var i=NA[r];if(i[1]===t&&i[0]===n){n=i[2],NA.splice(r,1);break}}return e.call(this,t,n)}}Object.defineProperty(OA,"__esModule",{value:!0}),OA.EthereumProviderError=OA.EthereumRpcError=void 0;const VA=TA;class KA extends Error{constructor(e,t,n){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!t||"string"!=typeof t)throw new Error('"message" must be a nonempty string.');super(t),this.code=e,void 0!==n&&(this.data=n)}serialize(){const e={code:this.code,message:this.message};return void 0!==this.data&&(e.data=this.data),this.stack&&(e.stack=this.stack),e}toString(){return VA.default(this.serialize(),HA,2)}}function HA(e,t){if("[Circular]"!==t)return t}OA.EthereumRpcError=KA,OA.EthereumProviderError=class extends KA{constructor(e,t,n){if(!function(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,t,n)}};var $A={},YA={};Object.defineProperty(YA,"__esModule",{value:!0}),YA.errorValues=YA.errorCodes=void 0,YA.errorCodes={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901}},YA.errorValues={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.serializeError=e.isValidCode=e.getMessageFromCode=e.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const t=YA,n=OA,r=t.errorCodes.rpc.internal,i="Unspecified error message. This is a bug, please report it.",o={code:r,message:a(r)};function a(n,r=i){if(Number.isInteger(n)){const r=n.toString();if(c(t.errorValues,r))return t.errorValues[r].message;if(u(n))return e.JSON_RPC_SERVER_ERROR_MESSAGE}return r}function s(e){if(!Number.isInteger(e))return!1;const n=e.toString();return!!t.errorValues[n]||!!u(e)}function u(e){return e>=-32099&&e<=-32e3}function l(e){return e&&"object"==typeof e&&!Array.isArray(e)?Object.assign({},e):e}function c(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.",e.getMessageFromCode=a,e.isValidCode=s,e.serializeError=function(e,{fallbackError:t=o,shouldIncludeStack:r=!1}={}){var i,u;if(!t||!Number.isInteger(t.code)||"string"!=typeof t.message)throw new Error("Must provide fallback error with integer number code and string message.");if(e instanceof n.EthereumRpcError)return e.serialize();const d={};if(e&&"object"==typeof e&&!Array.isArray(e)&&c(e,"code")&&s(e.code)){const t=e;d.code=t.code,t.message&&"string"==typeof t.message?(d.message=t.message,c(t,"data")&&(d.data=t.data)):(d.message=a(d.code),d.data={originalError:l(e)})}else{d.code=t.code;const n=null===(i=e)||void 0===i?void 0:i.message;d.message=n&&"string"==typeof n?n:t.message,d.data={originalError:l(e)}}const f=null===(u=e)||void 0===u?void 0:u.stack;return r&&e&&f&&"string"==typeof f&&(d.stack=f),d}}($A);var GA={};Object.defineProperty(GA,"__esModule",{value:!0}),GA.ethErrors=void 0;const QA=OA,ZA=$A,XA=YA;function JA(e,t){const[n,r]=t_(t);return new QA.EthereumRpcError(e,n||ZA.getMessageFromCode(e),r)}function e_(e,t){const[n,r]=t_(t);return new QA.EthereumProviderError(e,n||ZA.getMessageFromCode(e),r)}function t_(e){if(e){if("string"==typeof e)return[e];if("object"==typeof e&&!Array.isArray(e)){const{message:t,data:n}=e;if(t&&"string"!=typeof t)throw new Error("Must specify string message.");return[t||void 0,n]}}return[]}GA.ethErrors={rpc:{parse:e=>JA(XA.errorCodes.rpc.parse,e),invalidRequest:e=>JA(XA.errorCodes.rpc.invalidRequest,e),invalidParams:e=>JA(XA.errorCodes.rpc.invalidParams,e),methodNotFound:e=>JA(XA.errorCodes.rpc.methodNotFound,e),internal:e=>JA(XA.errorCodes.rpc.internal,e),server:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return JA(t,e)},invalidInput:e=>JA(XA.errorCodes.rpc.invalidInput,e),resourceNotFound:e=>JA(XA.errorCodes.rpc.resourceNotFound,e),resourceUnavailable:e=>JA(XA.errorCodes.rpc.resourceUnavailable,e),transactionRejected:e=>JA(XA.errorCodes.rpc.transactionRejected,e),methodNotSupported:e=>JA(XA.errorCodes.rpc.methodNotSupported,e),limitExceeded:e=>JA(XA.errorCodes.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>e_(XA.errorCodes.provider.userRejectedRequest,e),unauthorized:e=>e_(XA.errorCodes.provider.unauthorized,e),unsupportedMethod:e=>e_(XA.errorCodes.provider.unsupportedMethod,e),disconnected:e=>e_(XA.errorCodes.provider.disconnected,e),chainDisconnected:e=>e_(XA.errorCodes.provider.chainDisconnected,e),custom:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:t,message:n,data:r}=e;if(!n||"string"!=typeof n)throw new Error('"message" must be a nonempty string');return new QA.EthereumProviderError(t,n,r)}}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getMessageFromCode=e.serializeError=e.EthereumProviderError=e.EthereumRpcError=e.ethErrors=e.errorCodes=void 0;const t=OA;Object.defineProperty(e,"EthereumRpcError",{enumerable:!0,get:function(){return t.EthereumRpcError}}),Object.defineProperty(e,"EthereumProviderError",{enumerable:!0,get:function(){return t.EthereumProviderError}});const n=$A;Object.defineProperty(e,"serializeError",{enumerable:!0,get:function(){return n.serializeError}}),Object.defineProperty(e,"getMessageFromCode",{enumerable:!0,get:function(){return n.getMessageFromCode}});const r=GA;Object.defineProperty(e,"ethErrors",{enumerable:!0,get:function(){return r.ethErrors}});const i=YA;Object.defineProperty(e,"errorCodes",{enumerable:!0,get:function(){return i.errorCodes}})}(RA);var n_=Array.isArray,r_=Object.keys,i_=Object.prototype.hasOwnProperty,o_={},a_={},s_={};Object.defineProperty(s_,"__esModule",{value:!0}),s_.getUniqueId=void 0;const u_=4294967295;let l_=Math.floor(Math.random()*u_);s_.getUniqueId=function(){return l_=(l_+1)%u_,l_},Object.defineProperty(a_,"__esModule",{value:!0}),a_.createIdRemapMiddleware=void 0;const c_=s_;a_.createIdRemapMiddleware=function(){return(e,t,n,r)=>{const i=e.id,o=c_.getUniqueId();e.id=o,t.id=o,n((n=>{e.id=i,t.id=i,n()}))}};var d_={};Object.defineProperty(d_,"__esModule",{value:!0}),d_.createAsyncMiddleware=void 0,d_.createAsyncMiddleware=function(e){return async(t,n,r,i)=>{let o;const a=new Promise((e=>{o=e}));let s=null,u=!1;const l=async()=>{u=!0,r((e=>{s=e,o()})),await a};try{await e(t,n,l),u?(await a,s(null)):i(null)}catch(e){s?s(e):i(e)}}};var f_={};Object.defineProperty(f_,"__esModule",{value:!0}),f_.createScaffoldMiddleware=void 0,f_.createScaffoldMiddleware=function(e){return(t,n,r,i)=>{const o=e[t.method];return void 0===o?r():"function"==typeof o?o(t,n,r,i):(n.result=o,i())}};var h_={},p_=r&&r.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(h_,"__esModule",{value:!0}),h_.JsonRpcEngine=void 0;const m_=p_(vA),g_=RA;class v_ extends m_.default{constructor(){super(),this._middleware=[]}push(e){this._middleware.push(e)}handle(e,t){if(t&&"function"!=typeof t)throw new Error('"callback" must be a function if provided.');return Array.isArray(e)?t?this._handleBatch(e,t):this._handleBatch(e):t?this._handle(e,t):this._promiseHandle(e)}asMiddleware(){return async(e,t,n,r)=>{try{const[i,o,a]=await v_._runAllMiddleware(e,t,this._middleware);return o?(await v_._runReturnHandlers(a),r(i)):n((async e=>{try{await v_._runReturnHandlers(a)}catch(t){return e(t)}return e()}))}catch(e){return r(e)}}}async _handleBatch(e,t){try{const n=await Promise.all(e.map(this._promiseHandle.bind(this)));return t?t(null,n):n}catch(e){if(t)return t(e);throw e}}_promiseHandle(e){return new Promise((t=>{this._handle(e,((e,n)=>{t(n)}))}))}async _handle(e,t){if(!e||Array.isArray(e)||"object"!=typeof e){const n=new g_.EthereumRpcError(g_.errorCodes.rpc.invalidRequest,"Requests must be plain objects. Received: "+typeof e,{request:e});return t(n,{id:void 0,jsonrpc:"2.0",error:n})}if("string"!=typeof e.method){const n=new g_.EthereumRpcError(g_.errorCodes.rpc.invalidRequest,"Must specify a string method. Received: "+typeof e.method,{request:e});return t(n,{id:e.id,jsonrpc:"2.0",error:n})}const n=Object.assign({},e),r={id:n.id,jsonrpc:n.jsonrpc};let i=null;try{await this._processRequest(n,r)}catch(e){i=e}return i&&(delete r.result,r.error||(r.error=g_.serializeError(i))),t(i,r)}async _processRequest(e,t){const[n,r,i]=await v_._runAllMiddleware(e,t,this._middleware);if(v_._checkForCompletion(e,t,r),await v_._runReturnHandlers(i),n)throw n}static async _runAllMiddleware(e,t,n){const r=[];let i=null,o=!1;for(const a of n)if([i,o]=await v_._runMiddleware(e,t,a,r),o)break;return[i,o,r.reverse()]}static _runMiddleware(e,t,n,r){return new Promise((i=>{const o=e=>{const n=e||t.error;n&&(t.error=g_.serializeError(n)),i([n,!0])},a=n=>{t.error?o(t.error):(n&&("function"!=typeof n&&o(new g_.EthereumRpcError(g_.errorCodes.rpc.internal,`JsonRpcEngine: "next" return handlers must be functions. Received "${typeof n}" for request:\n${y_(e)}`,{request:e})),r.push(n)),i([null,!1]))};try{n(e,t,a,o)}catch(e){o(e)}}))}static async _runReturnHandlers(e){for(const t of e)await new Promise(((e,n)=>{t((t=>t?n(t):e()))}))}static _checkForCompletion(e,t,n){if(!("result"in t)&&!("error"in t))throw new g_.EthereumRpcError(g_.errorCodes.rpc.internal,`JsonRpcEngine: Response has no error or result for request:\n${y_(e)}`,{request:e});if(!n)throw new g_.EthereumRpcError(g_.errorCodes.rpc.internal,`JsonRpcEngine: Nothing ended request:\n${y_(e)}`,{request:e})}}function y_(e){return JSON.stringify(e,null,2)}h_.JsonRpcEngine=v_;var b_={};Object.defineProperty(b_,"__esModule",{value:!0}),b_.mergeMiddleware=void 0;const w_=h_;b_.mergeMiddleware=function(e){const t=new w_.JsonRpcEngine;return e.forEach((e=>t.push(e))),t.asMiddleware()},function(e){var t=r&&r.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),n=r&&r.__exportStar||function(e,n){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(n,r)||t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),n(a_,e),n(d_,e),n(f_,e),n(s_,e),n(h_,e),n(b_,e)}(o_);var A_={};Object.defineProperty(A_,"__esModule",{value:!0});const __={errors:{disconnected:()=>"MetaMask: Disconnected from chain. Attempting to connect.",permanentlyDisconnected:()=>"MetaMask: Disconnected from MetaMask background. Page reload required.",sendSiteMetadata:()=>"MetaMask: Failed to send site metadata. This is an internal error, please report this bug.",unsupportedSync:e=>`MetaMask: The MetaMask Ethereum provider does not support synchronous methods like ${e} without a callback parameter.`,invalidDuplexStream:()=>"Must provide a Node.js-style duplex stream.",invalidNetworkParams:()=>"MetaMask: Received invalid network parameters. Please report this bug.",invalidRequestArgs:()=>"Expected a single, non-array, object argument.",invalidRequestMethod:()=>"'args.method' must be a non-empty string.",invalidRequestParams:()=>"'args.params' must be an object or array if provided.",invalidLoggerObject:()=>"'args.logger' must be an object if provided.",invalidLoggerMethod:e=>`'args.logger' must include required method '${e}'.`},info:{connected:e=>`MetaMask: Connected to chain with ID "${e}".`},warnings:{enableDeprecation:"MetaMask: 'ethereum.enable()' is deprecated and may be removed in the future. Please use the 'eth_requestAccounts' RPC method instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1102",sendDeprecation:"MetaMask: 'ethereum.send(...)' is deprecated and may be removed in the future. Please use 'ethereum.sendAsync(...)' or 'ethereum.request(...)' instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1193",events:{close:"MetaMask: The event 'close' is deprecated and may be removed in the future. Please use 'disconnect' instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1193#disconnect",data:"MetaMask: The event 'data' is deprecated and will be removed in the future. Use 'message' instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1193#message",networkChanged:"MetaMask: The event 'networkChanged' is deprecated and may be removed in the future. Use 'chainChanged' instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1193#chainchanged",notification:"MetaMask: The event 'notification' is deprecated and may be removed in the future. Use 'message' instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1193#message"},rpc:{ethDecryptDeprecation:"MetaMask: The RPC method 'eth_decrypt' is deprecated and may be removed in the future.\nFor more information, see: https://medium.com/metamask/metamask-api-method-deprecation-2b0564a84686",ethGetEncryptionPublicKeyDeprecation:"MetaMask: The RPC method 'eth_getEncryptionPublicKey' is deprecated and may be removed in the future.\nFor more information, see: https://medium.com/metamask/metamask-api-method-deprecation-2b0564a84686"},experimentalMethods:"MetaMask: 'ethereum._metamask' exposes non-standard, experimental methods. They may be removed or changed without warning."}};A_.default=__;var E_={},S_={},k_=r&&r.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(S_,"__esModule",{value:!0}),S_.createRpcWarningMiddleware=void 0;const M_=k_(A_);S_.createRpcWarningMiddleware=function(e){const t={ethDecryptDeprecation:!1,ethGetEncryptionPublicKeyDeprecation:!1};return(n,r,i)=>{!1===t.ethDecryptDeprecation&&"eth_decrypt"===n.method?(e.warn(M_.default.warnings.rpc.ethDecryptDeprecation),t.ethDecryptDeprecation=!0):!1===t.ethGetEncryptionPublicKeyDeprecation&&"eth_getEncryptionPublicKey"===n.method&&(e.warn(M_.default.warnings.rpc.ethGetEncryptionPublicKeyDeprecation),t.ethGetEncryptionPublicKeyDeprecation=!0),i()}},Object.defineProperty(E_,"__esModule",{value:!0}),E_.NOOP=E_.isValidNetworkVersion=E_.isValidChainId=E_.getRpcPromiseCallback=E_.getDefaultExternalMiddleware=E_.EMITTED_NOTIFICATIONS=void 0;const C_=o_,x_=RA,R_=S_;function O_(e){return(t,n,r)=>{"string"==typeof t.method&&t.method||(n.error=x_.ethErrors.rpc.invalidRequest({message:"The request 'method' must be a non-empty string.",data:t})),r((t=>{const{error:r}=n;return r?(e.error(`MetaMask - RPC Error: ${r.message}`,r),t()):t()}))}}E_.EMITTED_NOTIFICATIONS=Object.freeze(["eth_subscription"]),E_.getDefaultExternalMiddleware=(e=console)=>[C_.createIdRemapMiddleware(),O_(e),R_.createRpcWarningMiddleware(e)],E_.getRpcPromiseCallback=(e,t,n=!0)=>(r,i)=>{r||i.error?t(r||i.error):!n||Array.isArray(i)?e(i):e(i.result)},E_.isValidChainId=e=>Boolean(e)&&"string"==typeof e&&e.startsWith("0x"),E_.isValidNetworkVersion=e=>Boolean(e)&&"string"==typeof e,E_.NOOP=()=>{};var T_=r&&r.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(gA,"__esModule",{value:!0}),gA.BaseProvider=void 0;const P_=T_(vA),L_=RA,I_=T_((function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){var r,i,o,a=n_(t),s=n_(n);if(a&&s){if((i=t.length)!=n.length)return!1;for(r=i;0!=r--;)if(!e(t[r],n[r]))return!1;return!0}if(a!=s)return!1;var u=t instanceof Date,l=n instanceof Date;if(u!=l)return!1;if(u&&l)return t.getTime()==n.getTime();var c=t instanceof RegExp,d=n instanceof RegExp;if(c!=d)return!1;if(c&&d)return t.toString()==n.toString();var f=r_(t);if((i=f.length)!==r_(n).length)return!1;for(r=i;0!=r--;)if(!i_.call(n,f[r]))return!1;for(r=i;0!=r--;)if(!e(t[o=f[r]],n[o]))return!1;return!0}return t!=t&&n!=n})),N_=o_,D_=T_(A_),B_=E_;class j_ extends P_.default{constructor({logger:e=console,maxEventListeners:t=100,rpcMiddleware:n=[]}={}){super(),this._log=e,this.setMaxListeners(t),this._state=Object.assign({},j_._defaultState),this.selectedAddress=null,this.chainId=null,this._handleAccountsChanged=this._handleAccountsChanged.bind(this),this._handleConnect=this._handleConnect.bind(this),this._handleChainChanged=this._handleChainChanged.bind(this),this._handleDisconnect=this._handleDisconnect.bind(this),this._handleUnlockStateChanged=this._handleUnlockStateChanged.bind(this),this._rpcRequest=this._rpcRequest.bind(this),this.request=this.request.bind(this);const r=new N_.JsonRpcEngine;n.forEach((e=>r.push(e))),this._rpcEngine=r}isConnected(){return this._state.isConnected}async request(e){if(!e||"object"!=typeof e||Array.isArray(e))throw L_.ethErrors.rpc.invalidRequest({message:D_.default.errors.invalidRequestArgs(),data:e});const{method:t,params:n}=e;if("string"!=typeof t||0===t.length)throw L_.ethErrors.rpc.invalidRequest({message:D_.default.errors.invalidRequestMethod(),data:e});if(void 0!==n&&!Array.isArray(n)&&("object"!=typeof n||null===n))throw L_.ethErrors.rpc.invalidRequest({message:D_.default.errors.invalidRequestParams(),data:e});return new Promise(((e,r)=>{this._rpcRequest({method:t,params:n},B_.getRpcPromiseCallback(e,r))}))}_initializeState(e){if(!0===this._state.initialized)throw new Error("Provider already initialized.");if(e){const{accounts:t,chainId:n,isUnlocked:r,networkVersion:i}=e;this._handleConnect(n),this._handleChainChanged({chainId:n,networkVersion:i}),this._handleUnlockStateChanged({accounts:t,isUnlocked:r}),this._handleAccountsChanged(t)}this._state.initialized=!0,this.emit("_initialized")}_rpcRequest(e,t){let n=t;return Array.isArray(e)||(e.jsonrpc||(e.jsonrpc="2.0"),"eth_accounts"!==e.method&&"eth_requestAccounts"!==e.method||(n=(n,r)=>{this._handleAccountsChanged(r.result||[],"eth_accounts"===e.method),t(n,r)})),this._rpcEngine.handle(e,n)}_handleConnect(e){this._state.isConnected||(this._state.isConnected=!0,this.emit("connect",{chainId:e}),this._log.debug(D_.default.info.connected(e)))}_handleDisconnect(e,t){if(this._state.isConnected||!this._state.isPermanentlyDisconnected&&!e){let n;this._state.isConnected=!1,e?(n=new L_.EthereumRpcError(1013,t||D_.default.errors.disconnected()),this._log.debug(n)):(n=new L_.EthereumRpcError(1011,t||D_.default.errors.permanentlyDisconnected()),this._log.error(n),this.chainId=null,this._state.accounts=null,this.selectedAddress=null,this._state.isUnlocked=!1,this._state.isPermanentlyDisconnected=!0),this.emit("disconnect",n)}}_handleChainChanged({chainId:e}={}){B_.isValidChainId(e)?(this._handleConnect(e),e!==this.chainId&&(this.chainId=e,this._state.initialized&&this.emit("chainChanged",this.chainId))):this._log.error(D_.default.errors.invalidNetworkParams(),{chainId:e})}_handleAccountsChanged(e,t=!1){let n=e;Array.isArray(e)||(this._log.error("MetaMask: Received invalid accounts parameter. Please report this bug.",e),n=[]);for(const t of e)if("string"!=typeof t){this._log.error("MetaMask: Received non-string account. Please report this bug.",e),n=[];break}I_.default(this._state.accounts,n)||(t&&null!==this._state.accounts&&this._log.error("MetaMask: 'eth_accounts' unexpectedly updated accounts. Please report this bug.",n),this._state.accounts=n,this.selectedAddress!==n[0]&&(this.selectedAddress=n[0]||null),this._state.initialized&&this.emit("accountsChanged",n))}_handleUnlockStateChanged({accounts:e,isUnlocked:t}={}){"boolean"==typeof t?t!==this._state.isUnlocked&&(this._state.isUnlocked=t,this._handleAccountsChanged(e||[])):this._log.error("MetaMask: Received invalid isUnlocked parameter. Please report this bug.")}}gA.BaseProvider=j_,j_._defaultState={accounts:null,isConnected:!1,isUnlocked:!1,initialized:!1,isPermanentlyDisconnected:!1};var U_={},z_={},F_="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e},q_=/%[sdj%]/g;function W_(e){if(!oE(e)){for(var t=[],n=0;n<arguments.length;n++)t.push(Y_(arguments[n]));return t.join(" ")}n=1;for(var r=arguments,i=r.length,o=String(e).replace(q_,(function(e){if("%%"===e)return"%";if(n>=i)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}})),a=r[n];n<i;a=r[++n])nE(a)||!lE(a)?o+=" "+a:o+=" "+Y_(a);return o}function V_(e,t){if(sE(n.process))return function(){return V_(e,t).apply(this,arguments)};if(!0===P.noDeprecation)return e;var r=!1;return function(){if(!r){if(P.throwDeprecation)throw new Error(t);P.traceDeprecation?console.trace(t):console.error(t),r=!0}return e.apply(this,arguments)}}var K_,H_={};function $_(e){return sE(K_)&&(K_=P.env.NODE_DEBUG||""),e=e.toUpperCase(),H_[e]||(new RegExp("\\b"+e+"\\b","i").test(K_)?H_[e]=function(){var t=W_.apply(null,arguments);console.error("%s %d: %s",e,0,t)}:H_[e]=function(){}),H_[e]}function Y_(e,t){var n={seen:[],stylize:Q_};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),tE(t)?n.showHidden=t:t&&bE(n,t),sE(n.showHidden)&&(n.showHidden=!1),sE(n.depth)&&(n.depth=2),sE(n.colors)&&(n.colors=!1),sE(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=G_),Z_(n,e,n.depth)}function G_(e,t){var n=Y_.styles[t];return n?"["+Y_.colors[n][0]+"m"+e+"["+Y_.colors[n][1]+"m":e}function Q_(e,t){return e}function Z_(e,t,n){if(e.customInspect&&t&&fE(t.inspect)&&t.inspect!==Y_&&(!t.constructor||t.constructor.prototype!==t)){var r=t.inspect(n,e);return oE(r)||(r=Z_(e,r,n)),r}var i=function(e,t){if(sE(t))return e.stylize("undefined","undefined");if(oE(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return iE(t)?e.stylize(""+t,"number"):tE(t)?e.stylize(""+t,"boolean"):nE(t)?e.stylize("null","null"):void 0}(e,t);if(i)return i;var o=Object.keys(t),a=function(e){var t={};return e.forEach((function(e,n){t[e]=!0})),t}(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(t)),dE(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return X_(t);if(0===o.length){if(fE(t)){var s=t.name?": "+t.name:"";return e.stylize("[Function"+s+"]","special")}if(uE(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(cE(t))return e.stylize(Date.prototype.toString.call(t),"date");if(dE(t))return X_(t)}var u,l="",c=!1,d=["{","}"];return eE(t)&&(c=!0,d=["[","]"]),fE(t)&&(l=" [Function"+(t.name?": "+t.name:"")+"]"),uE(t)&&(l=" "+RegExp.prototype.toString.call(t)),cE(t)&&(l=" "+Date.prototype.toUTCString.call(t)),dE(t)&&(l=" "+X_(t)),0!==o.length||c&&0!=t.length?n<0?uE(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),u=c?function(e,t,n,r,i){for(var o=[],a=0,s=t.length;a<s;++a)wE(t,String(a))?o.push(J_(e,t,n,r,String(a),!0)):o.push("");return i.forEach((function(i){i.match(/^\d+$/)||o.push(J_(e,t,n,r,i,!0))})),o}(e,t,n,a,o):o.map((function(r){return J_(e,t,n,a,r,c)})),e.seen.pop(),function(e,t,n){var r=e.reduce((function(e,t){return t.indexOf("\n"),e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0);return r>60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}(u,l,d)):d[0]+l+d[1]}function X_(e){return"["+Error.prototype.toString.call(e)+"]"}function J_(e,t,n,r,i,o){var a,s,u;if((u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?s=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(s=e.stylize("[Setter]","special")),wE(r,i)||(a="["+i+"]"),s||(e.seen.indexOf(u.value)<0?(s=nE(n)?Z_(e,u.value,null):Z_(e,u.value,n-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+s.split("\n").map((function(e){return" "+e})).join("\n")):s=e.stylize("[Circular]","special")),sE(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function eE(e){return Array.isArray(e)}function tE(e){return"boolean"==typeof e}function nE(e){return null===e}function rE(e){return null==e}function iE(e){return"number"==typeof e}function oE(e){return"string"==typeof e}function aE(e){return"symbol"==typeof e}function sE(e){return void 0===e}function uE(e){return lE(e)&&"[object RegExp]"===mE(e)}function lE(e){return"object"==typeof e&&null!==e}function cE(e){return lE(e)&&"[object Date]"===mE(e)}function dE(e){return lE(e)&&("[object Error]"===mE(e)||e instanceof Error)}function fE(e){return"function"==typeof e}function hE(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function pE(e){return xt(e)}function mE(e){return Object.prototype.toString.call(e)}function gE(e){return e<10?"0"+e.toString(10):e.toString(10)}Y_.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},Y_.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};var vE=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function yE(){console.log("%s - %s",function(){var e=new Date,t=[gE(e.getHours()),gE(e.getMinutes()),gE(e.getSeconds())].join(":");return[e.getDate(),vE[e.getMonth()],t].join(" ")}(),W_.apply(null,arguments))}function bE(e,t){if(!t||!lE(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}function wE(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var AE={inherits:F_,_extend:bE,log:yE,isBuffer:pE,isPrimitive:hE,isFunction:fE,isError:dE,isDate:cE,isObject:lE,isRegExp:uE,isUndefined:sE,isSymbol:aE,isString:oE,isNumber:iE,isNullOrUndefined:rE,isNull:nE,isBoolean:tE,isArray:eE,inspect:Y_,deprecate:V_,format:W_,debuglog:$_},_E=Object.freeze({__proto__:null,_extend:bE,debuglog:$_,default:AE,deprecate:V_,format:W_,inherits:F_,inspect:Y_,isArray:eE,isBoolean:tE,isBuffer:pE,isDate:cE,isError:dE,isFunction:fE,isNull:nE,isNullOrUndefined:rE,isNumber:iE,isObject:lE,isPrimitive:hE,isRegExp:uE,isString:oE,isSymbol:aE,isUndefined:sE,log:yE});function EE(){this.head=null,this.tail=null,this.length=0}EE.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},EE.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},EE.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},EE.prototype.clear=function(){this.head=this.tail=null,this.length=0},EE.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},EE.prototype.concat=function(e){if(0===this.length)return Ke.alloc(0);if(1===this.length)return this.head.data;for(var t=Ke.allocUnsafe(e>>>0),n=this.head,r=0;n;)n.data.copy(t,r),r+=n.data.length,n=n.next;return t};var SE=Ke.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function kE(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),function(e){if(e&&!SE(e))throw new Error("Unknown encoding: "+e)}(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=CE;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=xE;break;default:return void(this.write=ME)}this.charBuffer=new Ke(6),this.charReceived=0,this.charLength=0}function ME(e){return e.toString(this.encoding)}function CE(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function xE(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}kE.prototype.write=function(e){for(var t="";this.charLength;){var n=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived<this.charLength)return"";if(e=e.slice(n,e.length),!((r=(t=this.charBuffer.slice(0,this.charLength).toString(this.encoding)).charCodeAt(t.length-1))>=55296&&r<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var r,i=e.length;if(this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,i),i-=this.charReceived),i=(t+=e.toString(this.encoding,0,i)).length-1,(r=t.charCodeAt(i))>=55296&&r<=56319){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),e.copy(this.charBuffer,0,0,o),t.substring(0,i)}return t},kE.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var n=e[e.length-t];if(1==t&&n>>5==6){this.charLength=2;break}if(t<=2&&n>>4==14){this.charLength=3;break}if(t<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=t},kE.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;t+=r.slice(0,n).toString(i)}return t},TE.ReadableState=OE;var RE=$_("stream");function OE(e,t){e=e||{},this.objectMode=!!e.objectMode,t instanceof oS&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var n=e.highWaterMark,r=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:r,this.highWaterMark=~~this.highWaterMark,this.buffer=new EE,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(this.decoder=new kE(e.encoding),this.encoding=e.encoding)}function TE(e){if(!(this instanceof TE))return new TE(e);this._readableState=new OE(e,this),this.readable=!0,e&&"function"==typeof e.read&&(this._read=e.read),bA.call(this)}function PE(e,t,n,r,i){var o=function(e,t){var n=null;return xt(t)||"string"==typeof t||null==t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}(t,n);if(o)e.emit("error",o);else if(null===n)t.reading=!1,function(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,NE(e)}}(e,t);else if(t.objectMode||n&&n.length>0)if(t.ended&&!i){var a=new Error("stream.push() after EOF");e.emit("error",a)}else if(t.endEmitted&&i){var s=new Error("stream.unshift() after end event");e.emit("error",s)}else{var u;!t.decoder||i||r||(n=t.decoder.write(n),u=!t.objectMode&&0===n.length),i||(t.reading=!1),u||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&NE(e))),function(e,t){t.readingMore||(t.readingMore=!0,b(BE,e,t))}(e,t)}else i||(t.reading=!1);return function(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}(t)}F_(TE,bA),TE.prototype.push=function(e,t){var n=this._readableState;return n.objectMode||"string"!=typeof e||(t=t||n.defaultEncoding)!==n.encoding&&(e=Ke.from(e,t),t=""),PE(this,n,e,t,!1)},TE.prototype.unshift=function(e){return PE(this,this._readableState,e,"",!0)},TE.prototype.isPaused=function(){return!1===this._readableState.flowing},TE.prototype.setEncoding=function(e){return this._readableState.decoder=new kE(e),this._readableState.encoding=e,this};var LE=8388608;function IE(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>=LE?e=LE:(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 NE(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(RE("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?b(DE,e):DE(e))}function DE(e){RE("emit readable"),e.emit("readable"),zE(e)}function BE(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(RE("maybeReadMore read 0"),e.read(0),n!==t.length);)n=t.length;t.readingMore=!1}function jE(e){RE("readable nexttick read 0"),e.read(0)}function UE(e,t){t.reading||(RE("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),zE(e),t.flowing&&!t.reading&&e.read(0)}function zE(e){var t=e._readableState;for(RE("flow",t.flowing);t.flowing&&null!==e.read(););}function FE(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=function(e,t,n){var r;return e<t.head.data.length?(r=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):r=e===t.head.data.length?t.shift():n?function(e,t){var n=t.head,r=1,i=n.data;for(e-=i.length;n=n.next;){var o=n.data,a=e>o.length?o.length:e;if(a===o.length?i+=o:i+=o.slice(0,e),0==(e-=a)){a===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(a));break}++r}return t.length-=r,i}(e,t):function(e,t){var n=Ke.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,a=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,a),0==(e-=a)){a===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(a));break}++i}return t.length-=i,n}(e,t),r}(e,t.buffer,t.decoder),n);var n}function qE(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,b(WE,t,e))}function WE(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function VE(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}function KE(){}function HE(e,t,n){this.chunk=e,this.encoding=t,this.callback=n,this.next=null}function $E(e,t){Object.defineProperty(this,"buffer",{get:V_((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")}),e=e||{},this.objectMode=!!e.objectMode,t instanceof oS&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var n=e.highWaterMark,r=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:r,this.highWaterMark=~~this.highWaterMark,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var i=!1===e.decodeStrings;this.decodeStrings=!i,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,i=n.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,i){--t.pendingcb,n?b(i,r):i(r),e._writableState.errorEmitted=!0,e.emit("error",r)}(e,n,r,t,i);else{var o=XE(n);o||n.corked||n.bufferProcessing||!n.bufferedRequest||ZE(e,n),r?b(QE,e,n,o,i):QE(e,n,o,i)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new tS(this)}function YE(e){if(!(this instanceof YE||this instanceof oS))return new YE(e);this._writableState=new $E(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev)),bA.call(this)}function GE(e,t,n,r,i,o,a){t.writelen=r,t.writecb=a,t.writing=!0,t.sync=!0,n?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function QE(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),eS(e,t)}function ZE(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,i=new Array(r),o=t.corkedRequestsFree;o.entry=n;for(var a=0;n;)i[a]=n,n=n.next,a+=1;GE(e,t,!0,t.length,i,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new tS(t)}else{for(;n;){var s=n.chunk,u=n.encoding,l=n.callback;if(GE(e,t,!1,t.objectMode?1:s.length,s,u,l),n=n.next,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequestCount=0,t.bufferedRequest=n,t.bufferProcessing=!1}function XE(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function JE(e,t){t.prefinished||(t.prefinished=!0,e.emit("prefinish"))}function eS(e,t){var n=XE(t);return n&&(0===t.pendingcb?(JE(e,t),t.finished=!0,e.emit("finish")):JE(e,t)),n}function tS(e){var t=this;this.next=null,this.entry=null,this.finish=function(n){var r=t.entry;for(t.entry=null;r;){var i=r.callback;e.pendingcb--,i(n),r=r.next}e.corkedRequestsFree?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}}TE.prototype.read=function(e){RE("read",e),e=parseInt(e,10);var t=this._readableState,n=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return RE("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?qE(this):NE(this),null;if(0===(e=IE(e,t))&&t.ended)return 0===t.length&&qE(this),null;var r,i=t.needReadable;return RE("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&RE("length less than watermark",i=!0),t.ended||t.reading?RE("reading or ended",i=!1):i&&(RE("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=IE(n,t))),null===(r=e>0?FE(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&qE(this)),null!==r&&this.emit("data",r),r},TE.prototype._read=function(e){this.emit("error",new Error("not implemented"))},TE.prototype.pipe=function(e,t){var n=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=e;break;case 1:r.pipes=[r.pipes,e];break;default:r.pipes.push(e)}r.pipesCount+=1,RE("pipe count=%d opts=%j",r.pipesCount,t);var i=t&&!1===t.end?l:a;function o(e){RE("onunpipe"),e===n&&l()}function a(){RE("onend"),e.end()}r.endEmitted?b(i):n.once("end",i),e.on("unpipe",o);var s=function(e){return function(){var t=e._readableState;RE("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&e.listeners("data").length&&(t.flowing=!0,zE(e))}}(n);e.on("drain",s);var u=!1;function l(){RE("cleanup"),e.removeListener("close",h),e.removeListener("finish",p),e.removeListener("drain",s),e.removeListener("error",f),e.removeListener("unpipe",o),n.removeListener("end",a),n.removeListener("end",l),n.removeListener("data",d),u=!0,!r.awaitDrain||e._writableState&&!e._writableState.needDrain||s()}var c=!1;function d(t){RE("ondata"),c=!1,!1!==e.write(t)||c||((1===r.pipesCount&&r.pipes===e||r.pipesCount>1&&-1!==VE(r.pipes,e))&&!u&&(RE("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,c=!0),n.pause())}function f(t){var n;RE("onerror",t),m(),e.removeListener("error",f),0===(n="error",e.listeners(n).length)&&e.emit("error",t)}function h(){e.removeListener("finish",p),m()}function p(){RE("onfinish"),e.removeListener("close",h),m()}function m(){RE("unpipe"),n.unpipe(e)}return n.on("data",d),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",f),e.once("close",h),e.once("finish",p),e.emit("pipe",n),r.flowing||(RE("pipe resume"),n.resume()),e},TE.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this)),this;if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i<r;i++)n[i].emit("unpipe",this);return this}var o=VE(t.pipes,e);return-1===o||(t.pipes.splice(o,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this)),this},TE.prototype.on=function(e,t){var n=bA.prototype.on.call(this,e,t);if("data"===e)!1!==this._readableState.flowing&&this.resume();else if("readable"===e){var r=this._readableState;r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.emittedReadable=!1,r.reading?r.length&&NE(this):b(jE,this))}return n},TE.prototype.addListener=TE.prototype.on,TE.prototype.resume=function(){var e=this._readableState;return e.flowing||(RE("resume"),e.flowing=!0,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,b(UE,e,t))}(this,e)),this},TE.prototype.pause=function(){return RE("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(RE("pause"),this._readableState.flowing=!1,this.emit("pause")),this},TE.prototype.wrap=function(e){var t=this._readableState,n=!1,r=this;for(var i in e.on("end",(function(){if(RE("wrapped end"),t.decoder&&!t.ended){var e=t.decoder.end();e&&e.length&&r.push(e)}r.push(null)})),e.on("data",(function(i){RE("wrapped data"),t.decoder&&(i=t.decoder.write(i)),t.objectMode&&null==i||(t.objectMode||i&&i.length)&&(r.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));return function(e,t){for(var n=0,r=e.length;n<r;n++)t(e[n],n)}(["error","close","destroy","pause","resume"],(function(t){e.on(t,r.emit.bind(r,t))})),r._read=function(t){RE("wrapped _read",t),n&&(n=!1,e.resume())},r},TE._fromList=FE,YE.WritableState=$E,F_(YE,bA),$E.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},YE.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},YE.prototype.write=function(e,t,n){var r=this._writableState,i=!1;return"function"==typeof t&&(n=t,t=null),Ke.isBuffer(e)?t="buffer":t||(t=r.defaultEncoding),"function"!=typeof n&&(n=KE),r.ended?function(e,t){var n=new Error("write after end");e.emit("error",n),b(t,n)}(this,n):function(e,t,n,r){var i=!0,o=!1;return null===n?o=new TypeError("May not write null values to stream"):Ke.isBuffer(n)||"string"==typeof n||void 0===n||t.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(e.emit("error",o),b(r,o),i=!1),i}(this,r,e,n)&&(r.pendingcb++,i=function(e,t,n,r,i){n=function(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=Ke.from(t,n)),t}(t,n,r),Ke.isBuffer(n)&&(r="buffer");var o=t.objectMode?1:n.length;t.length+=o;var a=t.length<t.highWaterMark;if(a||(t.needDrain=!0),t.writing||t.corked){var s=t.lastBufferedRequest;t.lastBufferedRequest=new HE(n,r,i),s?s.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else GE(e,t,!1,o,n,r,i);return a}(this,r,e,t,n)),i},YE.prototype.cork=function(){this._writableState.corked++},YE.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||ZE(this,e))},YE.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 TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},YE.prototype._write=function(e,t,n){n(new Error("not implemented"))},YE.prototype._writev=null,YE.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(e,t,n){t.ending=!0,eS(e,t),n&&(t.finished?b(n):e.once("finish",n)),t.ended=!0,e.writable=!1}(this,r,n)},F_(oS,TE);for(var nS=Object.keys(YE.prototype),rS=0;rS<nS.length;rS++){var iS=nS[rS];oS.prototype[iS]||(oS.prototype[iS]=YE.prototype[iS])}function oS(e){if(!(this instanceof oS))return new oS(e);TE.call(this,e),YE.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",aS)}function aS(){this.allowHalfOpen||this._writableState.ended||b(sS,this)}function sS(e){e.end()}function uS(e){this.afterTransform=function(t,n){return function(e,t,n){var r=e._transformState;r.transforming=!1;var i=r.writecb;if(!i)return e.emit("error",new Error("no writecb in Transform class"));r.writechunk=null,r.writecb=null,null!=n&&e.push(n),i(t);var o=e._readableState;o.reading=!1,(o.needReadable||o.length<o.highWaterMark)&&e._read(o.highWaterMark)}(e,t,n)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null,this.writeencoding=null}function lS(e){if(!(this instanceof lS))return new lS(e);oS.call(this,e),this._transformState=new uS(this);var t=this;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.once("prefinish",(function(){"function"==typeof this._flush?this._flush((function(e){cS(t,e)})):cS(t)}))}function cS(e,t){if(t)return e.emit("error",t);var n=e._writableState,r=e._transformState;if(n.length)throw new Error("Calling transform done when ws.length != 0");if(r.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}function dS(e){if(!(this instanceof dS))return new dS(e);lS.call(this,e)}function fS(){bA.call(this)}F_(lS,oS),lS.prototype.push=function(e,t){return this._transformState.needTransform=!1,oS.prototype.push.call(this,e,t)},lS.prototype._transform=function(e,t,n){throw new Error("Not implemented")},lS.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},lS.prototype._read=function(e){var t=this._transformState;null!==t.writechunk&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0},F_(dS,lS),dS.prototype._transform=function(e,t,n){n(null,e)},F_(fS,bA),fS.Readable=TE,fS.Writable=YE,fS.Duplex=oS,fS.Transform=lS,fS.PassThrough=dS,fS.Stream=fS,fS.prototype.pipe=function(e,t){var n=this;function r(t){e.writable&&!1===e.write(t)&&n.pause&&n.pause()}function i(){n.readable&&n.resume&&n.resume()}n.on("data",r),e.on("drain",i),e._isStdio||t&&!1===t.end||(n.on("end",a),n.on("close",s));var o=!1;function a(){o||(o=!0,e.end())}function s(){o||(o=!0,"function"==typeof e.destroy&&e.destroy())}function u(e){if(l(),0===bA.listenerCount(this,"error"))throw e}function l(){n.removeListener("data",r),e.removeListener("drain",i),n.removeListener("end",a),n.removeListener("close",s),n.removeListener("error",u),e.removeListener("error",u),n.removeListener("end",l),n.removeListener("close",l),e.removeListener("close",l)}return n.on("error",u),e.on("error",u),n.on("end",l),n.on("close",l),e.on("close",l),e.emit("pipe",n),e};var hS=o(Object.freeze({__proto__:null,Duplex:oS,PassThrough:dS,Readable:TE,Stream:fS,Transform:lS,Writable:YE,default:fS}));Object.defineProperty(z_,"__esModule",{value:!0});const pS=hS;class mS extends pS.Duplex{constructor(e){super({objectMode:!0}),this._port=e,this._port.onMessage.addListener((e=>this._onMessage(e))),this._port.onDisconnect.addListener((()=>this._onDisconnect())),this._log=()=>null}_onMessage(e){if(xt(e)){const t=Ke.from(e);this._log(t,!1),this.push(t)}else this._log(e,!1),this.push(e)}_onDisconnect(){this.destroy()}_read(){}_write(e,t,n){try{if(xt(e)){const t=e.toJSON();t._isBuffer=!0,this._log(t,!0),this._port.postMessage(t)}else this._log(e,!0),this._port.postMessage(e)}catch(e){return n(new Error("PortDuplexStream - disconnected"))}return n()}_setLogger(e){this._log=e}}z_.default=mS;var gS=function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))},vS=function(e,t,n){this.name=e,this.version=t,this.os=n,this.type="browser"},yS=function(e){this.version=e,this.type="node",this.name="node",this.os=P.platform},bS=function(e,t,n,r){this.name=e,this.version=t,this.os=n,this.bot=r,this.type="bot-device"},wS=function(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null},AS=function(){this.type="react-native",this.name="react-native",this.version=null,this.os=null},_S=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,ES=3,SS=[["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|$)/],["pie",/^Microsoft Pocket Internet Explorer\/(\d+\.\d+)$/],["pie",/^Mozilla\/\d\.\d+\s\(compatible;\s(?:MSP?IE|MSInternet Explorer) (\d+\.\d+);.*Windows CE.*\)$/],["netfront",/^Mozilla\/\d\.\d+.*NetFront\/(\d.\d)/],["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",/FB[AS]V\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["curl",/^curl\/([0-9\.]+)$/],["searchbot",/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/]],kS=[["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/],["Windows CE",/Windows CE|WinCE|Microsoft Pocket Internet Explorer/],["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 MS(e){return""!==e&&SS.reduce((function(t,n){var r=n[0],i=n[1];if(t)return t;var o=i.exec(e);return!!o&&[r,o]}),!1)}function CS(e){var t=MS(e);if(!t)return null;var n=t[0],r=t[1];if("searchbot"===n)return new wS;var i=r[1]&&r[1].split(".").join("_").split("_").slice(0,3);i?i.length<ES&&(i=gS(gS([],i,!0),function(e){for(var t=[],n=0;n<e;n++)t.push("0");return t}(ES-i.length),!0)):i=[];var o=i.join("."),a=xS(e),s=_S.exec(e);return s&&s[1]?new bS(n,o,a,s[1]):new vS(n,o,a)}function xS(e){for(var t=0,n=kS.length;t<n;t++){var r=kS[t],i=r[0];if(r[1].exec(e))return i}return null}function RS(){return void 0!==P&&P.version?new yS(P.version.slice(1)):null}var OS=Object.freeze({__proto__:null,BotInfo:wS,BrowserInfo:vS,NodeInfo:yS,ReactNativeInfo:AS,SearchBotDeviceInfo:bS,browserName:function(e){var t=MS(e);return t?t[0]:null},detect:function(e){return e?CS(e):"undefined"==typeof document&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product?new AS:"undefined"!=typeof navigator?CS(navigator.userAgent):RS()},detectOS:xS,getNodeVersion:RS,parseUserAgent:CS}),TS=o(OS),PS={},LS={},IS=r&&r.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(LS,"__esModule",{value:!0}),LS.sendSiteMetadata=void 0;const NS=IS(A_),DS=E_;function BS(e){const{document:t}=e,n=t.querySelector('head > meta[property="og:site_name"]');if(n)return n.content;const r=t.querySelector('head > meta[name="title"]');return r?r.content:t.title&&t.title.length>0?t.title:window.location.hostname}async function jS(e){const{document:t}=e,n=t.querySelectorAll('head > link[rel~="icon"]');for(const e of n)if(e&&await US(e.href))return e.href;return null}function US(e){return new Promise(((t,n)=>{try{const n=document.createElement("img");n.onload=()=>t(!0),n.onerror=()=>t(!1),n.src=e}catch(e){n(e)}}))}LS.sendSiteMetadata=async function(e,t){try{const t=await async function(){return{name:BS(window),icon:await jS(window)}}();e.handle({jsonrpc:"2.0",id:1,method:"metamask_sendDomainMetadata",params:t},DS.NOOP)}catch(e){t.error({message:NS.default.errors.sendSiteMetadata(),originalError:e})}};var zS={},FS={},qS={exports:{}},WS={exports:{}};void 0===P||!P.version||0===P.version.indexOf("v0.")||0===P.version.indexOf("v1.")&&0!==P.version.indexOf("v1.8.")?WS.exports={nextTick:function(e,t,n,r){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var i,o,a=arguments.length;switch(a){case 0:case 1:return b(e);case 2:return b((function(){e.call(null,t)}));case 3:return b((function(){e.call(null,t,n)}));case 4:return b((function(){e.call(null,t,n,r)}));default:for(i=new Array(a-1),o=0;o<i.length;)i[o++]=arguments[o];return b((function(){e.apply(null,i)}))}}}:WS.exports=P;var VS=WS.exports,KS={}.toString,HS=Array.isArray||function(e){return"[object Array]"==KS.call(e)},$S=kA.EventEmitter,YS={exports:{}},GS=o(Ot);!function(e,t){var n=GS,r=n.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}function o(e,t,n){return r(e,t,n)}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?e.exports=n:(i(n,t),t.Buffer=o),i(r,o),o.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return r(e,t,n)},o.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=r(e);return void 0!==t?"string"==typeof n?i.fill(t,n):i.fill(t):i.fill(0),i},o.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}}(YS,YS.exports);var QS=YS.exports,ZS={};function XS(e){return Object.prototype.toString.call(e)}ZS.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===XS(e)},ZS.isBoolean=function(e){return"boolean"==typeof e},ZS.isNull=function(e){return null===e},ZS.isNullOrUndefined=function(e){return null==e},ZS.isNumber=function(e){return"number"==typeof e},ZS.isString=function(e){return"string"==typeof e},ZS.isSymbol=function(e){return"symbol"==typeof e},ZS.isUndefined=function(e){return void 0===e},ZS.isRegExp=function(e){return"[object RegExp]"===XS(e)},ZS.isObject=function(e){return"object"==typeof e&&null!==e},ZS.isDate=function(e){return"[object Date]"===XS(e)},ZS.isError=function(e){return"[object Error]"===XS(e)||e instanceof Error},ZS.isFunction=function(e){return"function"==typeof e},ZS.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},ZS.isBuffer=GS.Buffer.isBuffer;var JS={exports:{}};"function"==typeof Object.create?JS.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:JS.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}};var ek,tk=JS.exports,nk=o(_E),rk={exports:{}};function ik(){return ek||(ek=1,function(e){var t=QS.Buffer,n=nk;e.exports=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}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},e.prototype.concat=function(e){if(0===this.length)return t.alloc(0);for(var n,r,i=t.allocUnsafe(e>>>0),o=this.head,a=0;o;)n=i,r=a,o.data.copy(n,r),a+=o.data.length,o=o.next;return i},e}(),n&&n.inspect&&n.inspect.custom&&(e.exports.prototype[n.inspect.custom]=function(){var e=n.inspect({length:this.length});return this.constructor.name+" "+e})}(rk)),rk.exports}var ok=VS;function ak(e,t){e.emit("error",t)}var sk,uk,lk,ck,dk={destroy:function(e,t){var n=this,r=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return r||i?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,ok.nextTick(ak,this,e)):ok.nextTick(ak,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?n._writableState?n._writableState.errorEmitted||(n._writableState.errorEmitted=!0,ok.nextTick(ak,n,e)):ok.nextTick(ak,n,e):t&&t(e)})),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)}},fk=function(e,t){if(hk("noDeprecation"))return e;var n=!1;return function(){if(!n){if(hk("throwDeprecation"))throw new Error(t);hk("traceDeprecation")?console.trace(t):console.warn(t),n=!0}return e.apply(this,arguments)}};function hk(e){try{if(!r.localStorage)return!1}catch(e){return!1}var t=r.localStorage[e];return null!=t&&"true"===String(t).toLowerCase()}function pk(){if(uk)return sk;uk=1;var e=VS;function t(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,n){var r=e.entry;for(e.entry=null;r;){var i=r.callback;t.pendingcb--,i(n),r=r.next}t.corkedRequestsFree.next=e}(t,e)}}sk=p;var n,i=e.nextTick;p.WritableState=h;var o=Object.create(ZS);o.inherits=tk;var a,s={deprecate:fk},u=$S,l=QS.Buffer,c=(void 0!==r?r:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},d=dk;function f(){}function h(r,o){n=n||mk(),r=r||{};var a=o instanceof n;this.objectMode=!!r.objectMode,a&&(this.objectMode=this.objectMode||!!r.writableObjectMode);var s=r.highWaterMark,u=r.writableHighWaterMark,l=this.objectMode?16:16384;this.highWaterMark=s||0===s?s:a&&(u||0===u)?u:l,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var c=!1===r.decodeStrings;this.decodeStrings=!c,this.defaultEncoding=r.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,n){var r=t._writableState,o=r.sync,a=r.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),n)!function(t,n,r,i,o){--n.pendingcb,r?(e.nextTick(o,i),e.nextTick(w,t,n),t._writableState.errorEmitted=!0,t.emit("error",i)):(o(i),t._writableState.errorEmitted=!0,t.emit("error",i),w(t,n))}(t,r,o,n,a);else{var s=y(r);s||r.corked||r.bufferProcessing||!r.bufferedRequest||v(t,r),o?i(g,t,r,s,a):g(t,r,s,a)}}(o,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new t(this)}function p(e){if(n=n||mk(),!(a.call(p,this)||this instanceof n))return new p(e);this._writableState=new h(e,this),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)),u.call(this)}function m(e,t,n,r,i,o,a){t.writelen=r,t.writecb=a,t.writing=!0,t.sync=!0,n?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function g(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),w(e,t)}function v(e,n){n.bufferProcessing=!0;var r=n.bufferedRequest;if(e._writev&&r&&r.next){var i=n.bufferedRequestCount,o=new Array(i),a=n.corkedRequestsFree;a.entry=r;for(var s=0,u=!0;r;)o[s]=r,r.isBuf||(u=!1),r=r.next,s+=1;o.allBuffers=u,m(e,n,!0,n.length,o,"",a.finish),n.pendingcb++,n.lastBufferedRequest=null,a.next?(n.corkedRequestsFree=a.next,a.next=null):n.corkedRequestsFree=new t(n),n.bufferedRequestCount=0}else{for(;r;){var l=r.chunk,c=r.encoding,d=r.callback;if(m(e,n,!1,n.objectMode?1:l.length,l,c,d),r=r.next,n.bufferedRequestCount--,n.writing)break}null===r&&(n.lastBufferedRequest=null)}n.bufferedRequest=r,n.bufferProcessing=!1}function y(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function b(e,t){e._final((function(n){t.pendingcb--,n&&e.emit("error",n),t.prefinished=!0,e.emit("prefinish"),w(e,t)}))}function w(t,n){var r=y(n);return r&&(function(t,n){n.prefinished||n.finalCalled||("function"==typeof t._final?(n.pendingcb++,n.finalCalled=!0,e.nextTick(b,t,n)):(n.prefinished=!0,t.emit("prefinish")))}(t,n),0===n.pendingcb&&(n.finished=!0,t.emit("finish"))),r}return o.inherits(p,u),h.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(h.prototype,"buffer",{get:s.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(p,Symbol.hasInstance,{value:function(e){return!!a.call(this,e)||this===p&&e&&e._writableState instanceof h}})):a=function(e){return e instanceof this},p.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},p.prototype.write=function(t,n,r){var i,o=this._writableState,a=!1,s=!o.objectMode&&(i=t,l.isBuffer(i)||i instanceof c);return s&&!l.isBuffer(t)&&(t=function(e){return l.from(e)}(t)),"function"==typeof n&&(r=n,n=null),s?n="buffer":n||(n=o.defaultEncoding),"function"!=typeof r&&(r=f),o.ended?function(t,n){var r=new Error("write after end");t.emit("error",r),e.nextTick(n,r)}(this,r):(s||function(t,n,r,i){var o=!0,a=!1;return null===r?a=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||n.objectMode||(a=new TypeError("Invalid non-string/buffer chunk")),a&&(t.emit("error",a),e.nextTick(i,a),o=!1),o}(this,o,t,r))&&(o.pendingcb++,a=function(e,t,n,r,i,o){if(!n){var a=function(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=l.from(t,n)),t}(t,r,i);r!==a&&(n=!0,i="buffer",r=a)}var s=t.objectMode?1:r.length;t.length+=s;var u=t.length<t.highWaterMark;if(u||(t.needDrain=!0),t.writing||t.corked){var c=t.lastBufferedRequest;t.lastBufferedRequest={chunk:r,encoding:i,isBuf:n,callback:o,next:null},c?c.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else m(e,t,!1,s,r,i,o);return u}(this,o,s,t,n,r)),a},p.prototype.cork=function(){this._writableState.corked++},p.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||v(this,e))},p.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 TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(p.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),p.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},p.prototype._writev=null,p.prototype.end=function(t,n,r){var i=this._writableState;"function"==typeof t?(r=t,t=null,n=null):"function"==typeof n&&(r=n,n=null),null!=t&&this.write(t,n),i.corked&&(i.corked=1,this.uncork()),i.ending||function(t,n,r){n.ending=!0,w(t,n),r&&(n.finished?e.nextTick(r):t.once("finish",r)),n.ended=!0,t.writable=!1}(this,i,r)},Object.defineProperty(p.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),p.prototype.destroy=d.destroy,p.prototype._undestroy=d.undestroy,p.prototype._destroy=function(e,t){this.end(),t(e)},sk}function mk(){if(ck)return lk;ck=1;var e=VS,t=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};lk=u;var n=Object.create(ZS);n.inherits=tk;var r=Ak(),i=pk();n.inherits(u,r);for(var o=t(i.prototype),a=0;a<o.length;a++){var s=o[a];u.prototype[s]||(u.prototype[s]=i.prototype[s])}function u(e){if(!(this instanceof u))return new u(e);r.call(this,e),i.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",l)}function l(){this.allowHalfOpen||this._writableState.ended||e.nextTick(c,this)}function c(e){e.end()}return Object.defineProperty(u.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(u.prototype,"destroyed",{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)}}),u.prototype._destroy=function(t,n){this.push(null),this.end(),e.nextTick(n,t)},lk}var gk,vk,yk,bk={};function wk(){if(gk)return bk;gk=1;var e=QS.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 n(n){var r;switch(this.encoding=function(n){var r=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}}(n);if("string"!=typeof r&&(e.isEncoding===t||!t(n)))throw new Error("Unknown encoding: "+n);return r||n}(n),this.encoding){case"utf16le":this.text=o,this.end=a,r=4;break;case"utf8":this.fillLast=i,r=4;break;case"base64":this.text=s,this.end=u,r=3;break;default:return this.write=l,void(this.end=c)}this.lastNeed=0,this.lastTotal=0,this.lastChar=e.allocUnsafe(r)}function r(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,n=function(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function o(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function a(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function s(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function u(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 c(e){return e&&e.length?this.write(e):""}return bk.StringDecoder=n,n.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||""},n.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},n.prototype.text=function(e,t){var n=function(e,t,n){var i=t.length-1;if(i<n)return 0;var o=r(t[i]);return o>=0?(o>0&&(e.lastNeed=o-1),o):--i<n||-2===o?0:(o=r(t[i]))>=0?(o>0&&(e.lastNeed=o-2),o):--i<n||-2===o?0:(o=r(t[i]))>=0?(o>0&&(2===o?o=0:e.lastNeed=o-3),o):0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var i=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,i),e.toString("utf8",t,i)},n.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length},bk}function Ak(){if(yk)return vk;yk=1;var e=VS;vk=g;var t,n=HS;g.ReadableState=m,kA.EventEmitter;var i=function(e,t){return e.listeners(t).length},o=$S,a=QS.Buffer,s=(void 0!==r?r:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},u=Object.create(ZS);u.inherits=tk;var l=nk,c=void 0;c=l&&l.debuglog?l.debuglog("stream"):function(){};var d,f=ik(),h=dk;u.inherits(g,o);var p=["error","close","destroy","pause","resume"];function m(e,n){e=e||{};var r=n instanceof(t=t||mk());this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,o=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new f,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.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(d||(d=wk().StringDecoder),this.decoder=new d(e.encoding),this.encoding=e.encoding)}function g(e){if(t=t||mk(),!(this instanceof g))return new g(e);this._readableState=new m(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),o.call(this)}function v(e,t,n,r,i){var o,u=e._readableState;return null===t?(u.reading=!1,function(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,A(e)}}(e,u)):(i||(o=function(e,t){var n,r;return r=t,a.isBuffer(r)||r instanceof s||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}(u,t)),o?e.emit("error",o):u.objectMode||t&&t.length>0?("string"==typeof t||u.objectMode||Object.getPrototypeOf(t)===a.prototype||(t=function(e){return a.from(e)}(t)),r?u.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):y(e,u,t,!0):u.ended?e.emit("error",new Error("stream.push() after EOF")):(u.reading=!1,u.decoder&&!n?(t=u.decoder.write(t),u.objectMode||0!==t.length?y(e,u,t,!1):E(e,u)):y(e,u,t,!1))):r||(u.reading=!1)),function(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}(u)}function y(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&A(e)),E(e,t)}Object.defineProperty(g.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),g.prototype.destroy=h.destroy,g.prototype._undestroy=h.undestroy,g.prototype._destroy=function(e,t){this.push(null),t(e)},g.prototype.push=function(e,t){var n,r=this._readableState;return r.objectMode?n=!0:"string"==typeof e&&((t=t||r.defaultEncoding)!==r.encoding&&(e=a.from(e,t),t=""),n=!0),v(this,e,t,!1,n)},g.prototype.unshift=function(e){return v(this,e,null,!0,!1)},g.prototype.isPaused=function(){return!1===this._readableState.flowing},g.prototype.setEncoding=function(e){return d||(d=wk().StringDecoder),this._readableState.decoder=new d(e),this._readableState.encoding=e,this};var b=8388608;function w(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>=b?e=b:(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 A(t){var n=t._readableState;n.needReadable=!1,n.emittedReadable||(c("emitReadable",n.flowing),n.emittedReadable=!0,n.sync?e.nextTick(_,t):_(t))}function _(e){c("emit readable"),e.emit("readable"),C(e)}function E(t,n){n.readingMore||(n.readingMore=!0,e.nextTick(S,t,n))}function S(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(c("maybeReadMore read 0"),e.read(0),n!==t.length);)n=t.length;t.readingMore=!1}function k(e){c("readable nexttick read 0"),e.read(0)}function M(e,t){t.reading||(c("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),C(e),t.flowing&&!t.reading&&e.read(0)}function C(e){var t=e._readableState;for(c("flow",t.flowing);t.flowing&&null!==e.read(););}function x(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=function(e,t,n){var r;return e<t.head.data.length?(r=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):r=e===t.head.data.length?t.shift():n?function(e,t){var n=t.head,r=1,i=n.data;for(e-=i.length;n=n.next;){var o=n.data,a=e>o.length?o.length:e;if(a===o.length?i+=o:i+=o.slice(0,e),0==(e-=a)){a===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(a));break}++r}return t.length-=r,i}(e,t):function(e,t){var n=a.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,s),0==(e-=s)){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}(e,t),r}(e,t.buffer,t.decoder),n);var n}function R(t){var n=t._readableState;if(n.length>0)throw new Error('"endReadable()" called on non-empty stream');n.endEmitted||(n.ended=!0,e.nextTick(O,n,t))}function O(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function T(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}return g.prototype.read=function(e){c("read",e),e=parseInt(e,10);var t=this._readableState,n=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return c("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?R(this):A(this),null;if(0===(e=w(e,t))&&t.ended)return 0===t.length&&R(this),null;var r,i=t.needReadable;return c("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&c("length less than watermark",i=!0),t.ended||t.reading?c("reading or ended",i=!1):i&&(c("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=w(n,t))),null===(r=e>0?x(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&R(this)),null!==r&&this.emit("data",r),r},g.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},g.prototype.pipe=function(t,r){var o=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=t;break;case 1:a.pipes=[a.pipes,t];break;default:a.pipes.push(t)}a.pipesCount+=1,c("pipe count=%d opts=%j",a.pipesCount,r);var s=r&&!1===r.end||t===P.stdout||t===P.stderr?y:l;function u(e,n){c("onunpipe"),e===o&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,c("cleanup"),t.removeListener("close",g),t.removeListener("finish",v),t.removeListener("drain",d),t.removeListener("error",m),t.removeListener("unpipe",u),o.removeListener("end",l),o.removeListener("end",y),o.removeListener("data",p),f=!0,!a.awaitDrain||t._writableState&&!t._writableState.needDrain||d())}function l(){c("onend"),t.end()}a.endEmitted?e.nextTick(s):o.once("end",s),t.on("unpipe",u);var d=function(e){return function(){var t=e._readableState;c("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&i(e,"data")&&(t.flowing=!0,C(e))}}(o);t.on("drain",d);var f=!1,h=!1;function p(e){c("ondata"),h=!1,!1!==t.write(e)||h||((1===a.pipesCount&&a.pipes===t||a.pipesCount>1&&-1!==T(a.pipes,t))&&!f&&(c("false write response, pause",a.awaitDrain),a.awaitDrain++,h=!0),o.pause())}function m(e){c("onerror",e),y(),t.removeListener("error",m),0===i(t,"error")&&t.emit("error",e)}function g(){t.removeListener("finish",v),y()}function v(){c("onfinish"),t.removeListener("close",g),y()}function y(){c("unpipe"),o.unpipe(t)}return o.on("data",p),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?n(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(t,"error",m),t.once("close",g),t.once("finish",v),t.emit("pipe",o),a.flowing||(c("pipe resume"),o.resume()),t},g.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n)),this;if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<i;o++)r[o].emit("unpipe",this,{hasUnpiped:!1});return this}var a=T(t.pipes,e);return-1===a||(t.pipes.splice(a,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,n)),this},g.prototype.on=function(t,n){var r=o.prototype.on.call(this,t,n);if("data"===t)!1!==this._readableState.flowing&&this.resume();else if("readable"===t){var i=this._readableState;i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.emittedReadable=!1,i.reading?i.length&&A(this):e.nextTick(k,this))}return r},g.prototype.addListener=g.prototype.on,g.prototype.resume=function(){var t=this._readableState;return t.flowing||(c("resume"),t.flowing=!0,function(t,n){n.resumeScheduled||(n.resumeScheduled=!0,e.nextTick(M,t,n))}(this,t)),this},g.prototype.pause=function(){return c("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(c("pause"),this._readableState.flowing=!1,this.emit("pause")),this},g.prototype.wrap=function(e){var t=this,n=this._readableState,r=!1;for(var i in e.on("end",(function(){if(c("wrapped end"),n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(i){c("wrapped data"),n.decoder&&(i=n.decoder.write(i)),n.objectMode&&null==i||(n.objectMode||i&&i.length)&&(t.push(i)||(r=!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 o=0;o<p.length;o++)e.on(p[o],this.emit.bind(this,p[o]));return this._read=function(t){c("wrapped _read",t),r&&(r=!1,e.resume())},this},Object.defineProperty(g.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),g._fromList=x,vk}var _k=Mk,Ek=mk(),Sk=Object.create(ZS);function kk(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function Mk(e){if(!(this instanceof Mk))return new Mk(e);Ek.call(this,e),this._transformState={afterTransform:kk.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",Ck)}function Ck(){var e=this;"function"==typeof this._flush?this._flush((function(t,n){xk(e,t,n)})):xk(this,null,null)}function xk(e,t,n){if(t)return e.emit("error",t);if(null!=n&&e.push(n),e._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(e._transformState.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}Sk.inherits=tk,Sk.inherits(Mk,Ek),Mk.prototype.push=function(e,t){return this._transformState.needTransform=!1,Ek.prototype.push.call(this,e,t)},Mk.prototype._transform=function(e,t,n){throw new Error("_transform() is not implemented")},Mk.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},Mk.prototype._read=function(e){var t=this._transformState;null!==t.writechunk&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0},Mk.prototype._destroy=function(e,t){var n=this;Ek.prototype._destroy.call(this,e,(function(e){t(e),n.emit("close")}))};var Rk=Pk,Ok=_k,Tk=Object.create(ZS);function Pk(e){if(!(this instanceof Pk))return new Pk(e);Ok.call(this,e)}Tk.inherits=tk,Tk.inherits(Pk,Ok),Pk.prototype._transform=function(e,t,n){n(null,e)},function(e,t){(t=e.exports=Ak()).Stream=t,t.Readable=t,t.Writable=pk(),t.Duplex=mk(),t.Transform=_k,t.PassThrough=Rk}(qS,qS.exports);var Lk=qS.exports,Ik={exports:{}},Nk=function e(t,n){if(t&&n)return e(t)(n);if("function"!=typeof t)throw new TypeError("need wrapper function");return Object.keys(t).forEach((function(e){r[e]=t[e]})),r;function r(){for(var e=new Array(arguments.length),n=0;n<e.length;n++)e[n]=arguments[n];var r=t.apply(this,e),i=e[e.length-1];return"function"==typeof r&&r!==i&&Object.keys(i).forEach((function(e){r[e]=i[e]})),r}},Dk=Nk;function Bk(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function jk(e){var t=function(){if(t.called)throw new Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)},n=e.name||"Function wrapped with `once`";return t.onceError=n+" shouldn't be called more than once",t.called=!1,t}Ik.exports=Dk(Bk),Ik.exports.strict=Dk(jk),Bk.proto=Bk((function(){Object.defineProperty(Function.prototype,"once",{value:function(){return Bk(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return jk(this)},configurable:!0})}));var Uk=Ik.exports,zk=Uk,Fk=function(){},qk=function(e,t,n){if("function"==typeof t)return qk(e,null,t);t||(t={}),n=zk(n||Fk);var r=e._writableState,i=e._readableState,o=t.readable||!1!==t.readable&&e.readable,a=t.writable||!1!==t.writable&&e.writable,s=!1,u=function(){e.writable||l()},l=function(){a=!1,o||n.call(e)},c=function(){o=!1,a||n.call(e)},d=function(t){n.call(e,t?new Error("exited with error code: "+t):null)},f=function(t){n.call(e,t)},h=function(){b(p)},p=function(){if(!s)return(!o||i&&i.ended&&!i.destroyed)&&(!a||r&&r.ended&&!r.destroyed)?void 0:n.call(e,new Error("premature close"))},m=function(){e.req.on("finish",l)};return function(e){return e.setHeader&&"function"==typeof e.abort}(e)?(e.on("complete",l),e.on("abort",h),e.req?m():e.on("request",m)):a&&!r&&(e.on("end",u),e.on("close",u)),function(e){return e.stdio&&Array.isArray(e.stdio)&&3===e.stdio.length}(e)&&e.on("exit",d),e.on("end",c),e.on("finish",l),!1!==t.error&&e.on("error",f),e.on("close",h),function(){s=!0,e.removeListener("complete",l),e.removeListener("abort",h),e.removeListener("request",m),e.req&&e.req.removeListener("finish",l),e.removeListener("end",u),e.removeListener("close",u),e.removeListener("finish",l),e.removeListener("exit",d),e.removeListener("end",c),e.removeListener("error",f),e.removeListener("close",h)}},Wk=qk,Vk={};Object.defineProperty(Vk,"__esModule",{value:!0}),Vk.Substream=void 0;const Kk=Lk;class Hk extends Kk.Duplex{constructor({parent:e,name:t}){super({objectMode:!0}),this._parent=e,this._name=t}_read(){}_write(e,t,n){this._parent.push({name:this._name,data:e}),n()}}Vk.Substream=Hk;var $k=r&&r.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(FS,"__esModule",{value:!0}),FS.ObjectMultiplex=void 0;const Yk=Lk,Gk=$k(Wk),Qk=$k(Uk),Zk=Vk,Xk=Symbol("IGNORE_SUBSTREAM");class Jk extends Yk.Duplex{constructor(e={}){super(Object.assign(Object.assign({},e),{objectMode:!0})),this._substreams={}}createStream(e){if(this.destroyed)throw new Error(`ObjectMultiplex - parent stream for name "${e}" already destroyed`);if(this._readableState.ended||this._writableState.ended)throw new Error(`ObjectMultiplex - parent stream for name "${e}" already ended`);if(!e)throw new Error("ObjectMultiplex - name must not be empty");if(this._substreams[e])throw new Error(`ObjectMultiplex - Substream for name "${e}" already exists`);const t=new Zk.Substream({parent:this,name:e});return this._substreams[e]=t,function(e,t){const n=Qk.default(t);Gk.default(e,{readable:!1},n),Gk.default(e,{writable:!1},n)}(this,(e=>t.destroy(e||void 0))),t}ignoreStream(e){if(!e)throw new Error("ObjectMultiplex - name must not be empty");if(this._substreams[e])throw new Error(`ObjectMultiplex - Substream for name "${e}" already exists`);this._substreams[e]=Xk}_read(){}_write(e,t,n){const{name:r,data:i}=e;if(!r)return console.warn(`ObjectMultiplex - malformed chunk without name "${e}"`),n();const o=this._substreams[r];return o?(o!==Xk&&o.push(i),n()):(console.warn(`ObjectMultiplex - orphaned data for stream "${r}"`),n())}}FS.ObjectMultiplex=Jk;var eM=FS.ObjectMultiplex;const tM=e=>null!==e&&"object"==typeof e&&"function"==typeof e.pipe;tM.writable=e=>tM(e)&&!1!==e.writable&&"function"==typeof e._write&&"object"==typeof e._writableState,tM.readable=e=>tM(e)&&!1!==e.readable&&"function"==typeof e._read&&"object"==typeof e._readableState,tM.duplex=e=>tM.writable(e)&&tM.readable(e),tM.transform=e=>tM.duplex(e)&&"function"==typeof e._transform;var nM=tM,rM={},iM={};Object.defineProperty(iM,"__esModule",{value:!0});const oM=Lk;iM.default=function(e){if(!e||!e.engine)throw new Error("Missing engine parameter!");const{engine:t}=e,n=new oM.Duplex({objectMode:!0,read:()=>{},write:function(e,r,i){t.handle(e,((e,t)=>{n.push(t)})),i()}});return t.on&&t.on("notification",(e=>{n.push(e)})),n};var aM={},sM={};Object.defineProperty(sM,"__esModule",{value:!0});const uM=kA;function lM(e,t,n){try{Reflect.apply(e,t,n)}catch(e){setTimeout((()=>{throw e}))}}class cM extends uM.EventEmitter{emit(e,...t){let n="error"===e;const r=this._events;if(void 0!==r)n=n&&void 0===r.error;else if(!n)return!1;if(n){let e;if(t.length>0&&([e]=t),e instanceof Error)throw e;const n=new Error("Unhandled error."+(e?` (${e.message})`:""));throw n.context=e,n}const i=r[e];if(void 0===i)return!1;if("function"==typeof i)lM(i,this,t);else{const e=i.length,n=function(e){const t=e.length,n=new Array(t);for(let r=0;r<t;r+=1)n[r]=e[r];return n}(i);for(let r=0;r<e;r+=1)lM(n[r],this,t)}return!0}}sM.default=cM;var dM=r&&r.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(aM,"__esModule",{value:!0});const fM=dM(sM),hM=Lk;aM.default=function(e={}){const t={},n=new hM.Duplex({objectMode:!0,read:()=>{},write:function(n,o,a){let s=null;try{n.id?function(e){const n=t[e.id];n?(delete t[e.id],Object.assign(n.res,e),setTimeout(n.end)):console.warn(`StreamMiddleware - Unknown response id "${e.id}"`)}(n):function(n){(null==e?void 0:e.retryOnMessage)&&n.method===e.retryOnMessage&&Object.values(t).forEach((({req:e,retryCount:n=0})=>{if(e.id){if(n>=3)throw new Error(`StreamMiddleware - Retry limit exceeded for request id "${e.id}"`);t[e.id].retryCount=n+1,i(e)}})),r.emit("notification",n)}(n)}catch(e){s=e}a(s)}}),r=new fM.default;return{events:r,middleware:(e,n,r,o)=>{t[e.id]={req:e,res:n,next:r,end:o},i(e)},stream:n};function i(e){n.push(e)}};var pM=r&&r.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(rM,"__esModule",{value:!0}),rM.createStreamMiddleware=rM.createEngineStream=void 0;const mM=pM(iM);rM.createEngineStream=mM.default;const gM=pM(aM);rM.createStreamMiddleware=gM.default;var vM=Uk,yM=Wk,bM=o(Object.freeze({__proto__:null,default:{}})),wM=function(){},AM=/^v?\.0/.test(P.version),_M=function(e){return"function"==typeof e},EM=function(e,t,n,r){r=vM(r);var i=!1;e.on("close",(function(){i=!0})),yM(e,{readable:t,writable:n},(function(e){if(e)return r(e);i=!0,r()}));var o=!1;return function(t){if(!i&&!o)return o=!0,function(e){return!!AM&&!!bM&&(e instanceof(bM.ReadStream||wM)||e instanceof(bM.WriteStream||wM))&&_M(e.close)}(e)?e.close(wM):function(e){return e.setHeader&&_M(e.abort)}(e)?e.abort():_M(e.destroy)?e.destroy():void r(t||new Error("stream was destroyed"))}},SM=function(e){e()},kM=function(e,t){return e.pipe(t)},MM=function(){var e,t=Array.prototype.slice.call(arguments),n=_M(t[t.length-1]||wM)&&t.pop()||wM;if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new Error("pump requires two streams per minimum");var r=t.map((function(i,o){var a=o<t.length-1;return EM(i,a,o>0,(function(t){e||(e=t),t&&r.forEach(SM),a||(r.forEach(SM),n(e))}))}));return t.reduce(kM)},CM=r&&r.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(zS,"__esModule",{value:!0}),zS.StreamProvider=zS.AbstractStreamProvider=void 0;const xM=CM(eM),RM=nM,OM=rM,TM=CM(MM),PM=CM(A_),LM=E_,IM=gA;class NM extends IM.BaseProvider{constructor(e,{jsonRpcStreamName:t,logger:n,maxEventListeners:r,rpcMiddleware:i}){if(super({logger:n,maxEventListeners:r,rpcMiddleware:i}),!RM.duplex(e))throw new Error(PM.default.errors.invalidDuplexStream());this._handleStreamDisconnect=this._handleStreamDisconnect.bind(this);const o=new xM.default;TM.default(e,o,e,this._handleStreamDisconnect.bind(this,"MetaMask")),this._jsonRpcConnection=OM.createStreamMiddleware({retryOnMessage:"METAMASK_EXTENSION_CONNECT_CAN_RETRY"}),TM.default(this._jsonRpcConnection.stream,o.createStream(t),this._jsonRpcConnection.stream,this._handleStreamDisconnect.bind(this,"MetaMask RpcProvider")),this._rpcEngine.push(this._jsonRpcConnection.middleware),this._jsonRpcConnection.events.on("notification",(t=>{const{method:n,params:r}=t;"metamask_accountsChanged"===n?this._handleAccountsChanged(r):"metamask_unlockStateChanged"===n?this._handleUnlockStateChanged(r):"metamask_chainChanged"===n?this._handleChainChanged(r):LM.EMITTED_NOTIFICATIONS.includes(n)?this.emit("message",{type:n,data:r}):"METAMASK_STREAM_FAILURE"===n&&e.destroy(new Error(PM.default.errors.permanentlyDisconnected()))}))}async _initializeStateAsync(){let e;try{e=await this.request({method:"metamask_getProviderState"})}catch(e){this._log.error("MetaMask: Failed to get initial state. Please report this bug.",e)}this._initializeState(e)}_handleStreamDisconnect(e,t){let n=`MetaMask: Lost connection to "${e}".`;(null==t?void 0:t.stack)&&(n+=`\n${t.stack}`),this._log.warn(n),this.listenerCount("error")>0&&this.emit("error",n),this._handleDisconnect(!1,t?t.message:void 0)}_handleChainChanged({chainId:e,networkVersion:t}={}){LM.isValidChainId(e)&&LM.isValidNetworkVersion(t)?"loading"===t?this._handleDisconnect(!0):super._handleChainChanged({chainId:e}):this._log.error(PM.default.errors.invalidNetworkParams(),{chainId:e,networkVersion:t})}}zS.AbstractStreamProvider=NM,zS.StreamProvider=class extends NM{async initialize(){return this._initializeStateAsync()}},function(e){var t=r&&r.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.MetaMaskInpageProvider=e.MetaMaskInpageProviderStreamName=void 0;const n=RA,i=LS,o=t(A_),a=E_,s=zS;e.MetaMaskInpageProviderStreamName="metamask-provider";class u extends s.AbstractStreamProvider{constructor(t,{jsonRpcStreamName:n=e.MetaMaskInpageProviderStreamName,logger:r=console,maxEventListeners:o,shouldSendMetadata:s}={}){if(super(t,{jsonRpcStreamName:n,logger:r,maxEventListeners:o,rpcMiddleware:a.getDefaultExternalMiddleware(r)}),this._sentWarnings={enable:!1,experimentalMethods:!1,send:!1,events:{close:!1,data:!1,networkChanged:!1,notification:!1}},this._initializeStateAsync(),this.networkVersion=null,this.isMetaMask=!0,this._sendSync=this._sendSync.bind(this),this.enable=this.enable.bind(this),this.send=this.send.bind(this),this.sendAsync=this.sendAsync.bind(this),this._warnOfDeprecation=this._warnOfDeprecation.bind(this),this._metamask=this._getExperimentalApi(),this._jsonRpcConnection.events.on("notification",(e=>{const{method:t}=e;a.EMITTED_NOTIFICATIONS.includes(t)&&(this.emit("data",e),this.emit("notification",e.params.result))})),s)if("complete"===document.readyState)i.sendSiteMetadata(this._rpcEngine,this._log);else{const e=()=>{i.sendSiteMetadata(this._rpcEngine,this._log),window.removeEventListener("DOMContentLoaded",e)};window.addEventListener("DOMContentLoaded",e)}}sendAsync(e,t){this._rpcRequest(e,t)}addListener(e,t){return this._warnOfDeprecation(e),super.addListener(e,t)}on(e,t){return this._warnOfDeprecation(e),super.on(e,t)}once(e,t){return this._warnOfDeprecation(e),super.once(e,t)}prependListener(e,t){return this._warnOfDeprecation(e),super.prependListener(e,t)}prependOnceListener(e,t){return this._warnOfDeprecation(e),super.prependOnceListener(e,t)}_handleDisconnect(e,t){super._handleDisconnect(e,t),this.networkVersion&&!e&&(this.networkVersion=null)}_warnOfDeprecation(e){var t;!1===(null===(t=this._sentWarnings)||void 0===t?void 0:t.events[e])&&(this._log.warn(o.default.warnings.events[e]),this._sentWarnings.events[e]=!0)}enable(){return this._sentWarnings.enable||(this._log.warn(o.default.warnings.enableDeprecation),this._sentWarnings.enable=!0),new Promise(((e,t)=>{try{this._rpcRequest({method:"eth_requestAccounts",params:[]},a.getRpcPromiseCallback(e,t))}catch(e){t(e)}}))}send(e,t){return this._sentWarnings.send||(this._log.warn(o.default.warnings.sendDeprecation),this._sentWarnings.send=!0),"string"!=typeof e||t&&!Array.isArray(t)?e&&"object"==typeof e&&"function"==typeof t?this._rpcRequest(e,t):this._sendSync(e):new Promise(((n,r)=>{try{this._rpcRequest({method:e,params:t},a.getRpcPromiseCallback(n,r,!1))}catch(e){r(e)}}))}_sendSync(e){let t;switch(e.method){case"eth_accounts":t=this.selectedAddress?[this.selectedAddress]:[];break;case"eth_coinbase":t=this.selectedAddress||null;break;case"eth_uninstallFilter":this._rpcRequest(e,a.NOOP),t=!0;break;case"net_version":t=this.networkVersion||null;break;default:throw new Error(o.default.errors.unsupportedSync(e.method))}return{id:e.id,jsonrpc:e.jsonrpc,result:t}}_getExperimentalApi(){return new Proxy({isUnlocked:async()=>(this._state.initialized||await new Promise((e=>{this.on("_initialized",(()=>e()))})),this._state.isUnlocked),requestBatch:async e=>{if(!Array.isArray(e))throw n.ethErrors.rpc.invalidRequest({message:"Batch requests must be made with an array of request objects.",data:e});return new Promise(((t,n)=>{this._rpcRequest(e,a.getRpcPromiseCallback(t,n))}))}},{get:(e,t,...n)=>(this._sentWarnings.experimentalMethods||(this._log.warn(o.default.warnings.experimentalMethods),this._sentWarnings.experimentalMethods=!0),Reflect.get(e,t,...n))})}_handleChainChanged({chainId:e,networkVersion:t}={}){super._handleChainChanged({chainId:e,networkVersion:t}),this._state.isConnected&&t!==this.networkVersion&&(this.networkVersion=t,this._state.initialized&&this.emit("networkChanged",this.networkVersion))}}e.MetaMaskInpageProvider=u}(PS);var DM={CHROME_ID:"nkbihfbeogaeaoehlefnkodbefgpgknn",FIREFOX_ID:"webextension@metamask.io"},BM=r&&r.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(U_,"__esModule",{value:!0}),U_.createExternalExtensionProvider=void 0;const jM=BM(z_),UM=TS,zM=PS,FM=zS,qM=E_,WM=BM(DM),VM=UM.detect();U_.createExternalExtensionProvider=function(){let e;try{const t=function(){switch(null==VM?void 0:VM.name){case"chrome":default:return WM.default.CHROME_ID;case"firefox":return WM.default.FIREFOX_ID}}(),n=chrome.runtime.connect(t),r=new jM.default(n);e=new FM.StreamProvider(r,{jsonRpcStreamName:zM.MetaMaskInpageProviderStreamName,logger:console,rpcMiddleware:qM.getDefaultExternalMiddleware(console)}),e.initialize()}catch(e){throw console.dir("MetaMask connect error.",e),e}return e};var KM={},HM={};Object.defineProperty(HM,"__esModule",{value:!0}),HM.shimWeb3=void 0,HM.shimWeb3=function(e,t=console){let n=!1,r=!1;if(!window.web3){const i="__isMetaMaskShim__";let o={currentProvider:e};Object.defineProperty(o,i,{value:!0,enumerable:!0,configurable:!1,writable:!1}),o=new Proxy(o,{get:(o,a,...s)=>("currentProvider"!==a||n?"currentProvider"===a||a===i||r||(r=!0,t.error("MetaMask no longer injects web3. For details, see: https://docs.metamask.io/guide/provider-migration.html#replacing-window-web3"),e.request({method:"metamask_logWeb3ShimUsage"}).catch((e=>{t.debug("MetaMask: Failed to log web3 shim usage.",e)}))):(n=!0,t.warn("You are accessing the MetaMask window.web3.currentProvider shim. This property is deprecated; use window.ethereum instead. For details, see: https://docs.metamask.io/guide/provider-migration.html#replacing-window-web3")),Reflect.get(o,a,...s)),set:(...e)=>(t.warn("You are accessing the MetaMask window.web3 shim. This object is deprecated; use window.ethereum instead. For details, see: https://docs.metamask.io/guide/provider-migration.html#replacing-window-web3"),Reflect.set(...e))}),Object.defineProperty(window,"web3",{value:o,enumerable:!1,configurable:!0,writable:!0})}},Object.defineProperty(KM,"__esModule",{value:!0}),KM.setGlobalProvider=KM.initializeProvider=void 0;const $M=PS,YM=HM;function GM(e){window.ethereum=e,window.dispatchEvent(new Event("ethereum#initialized"))}KM.initializeProvider=function({connectionStream:e,jsonRpcStreamName:t,logger:n=console,maxEventListeners:r=100,shouldSendMetadata:i=!0,shouldSetOnWindow:o=!0,shouldShimWeb3:a=!1}){const s=new $M.MetaMaskInpageProvider(e,{jsonRpcStreamName:t,logger:n,maxEventListeners:r,shouldSendMetadata:i}),u=new Proxy(s,{deleteProperty:()=>!0});return o&&GM(u),a&&YM.shimWeb3(u,n),u},KM.setGlobalProvider=GM,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.StreamProvider=e.shimWeb3=e.setGlobalProvider=e.MetaMaskInpageProvider=e.MetaMaskInpageProviderStreamName=e.initializeProvider=e.createExternalExtensionProvider=e.BaseProvider=void 0;const t=gA;Object.defineProperty(e,"BaseProvider",{enumerable:!0,get:function(){return t.BaseProvider}});const n=U_;Object.defineProperty(e,"createExternalExtensionProvider",{enumerable:!0,get:function(){return n.createExternalExtensionProvider}});const r=KM;Object.defineProperty(e,"initializeProvider",{enumerable:!0,get:function(){return r.initializeProvider}}),Object.defineProperty(e,"setGlobalProvider",{enumerable:!0,get:function(){return r.setGlobalProvider}});const i=PS;Object.defineProperty(e,"MetaMaskInpageProvider",{enumerable:!0,get:function(){return i.MetaMaskInpageProvider}}),Object.defineProperty(e,"MetaMaskInpageProviderStreamName",{enumerable:!0,get:function(){return i.MetaMaskInpageProviderStreamName}});const o=HM;Object.defineProperty(e,"shimWeb3",{enumerable:!0,get:function(){return o.shimWeb3}});const a=zS;Object.defineProperty(e,"StreamProvider",{enumerable:!0,get:function(){return a.StreamProvider}})}(mA);class QM extends mA.MetaMaskInpageProvider{constructor({connectionStream:e,shouldSendMetadata:t,debug:n=!1,autoRequestAccounts:r=!1}){super(e,{logger:console,maxEventListeners:100,shouldSendMetadata:t}),this.state={debug:!1,autoRequestAccounts:!1,providerStateRequested:!1},n&&console.debug(`SDKProvider::constructor debug=${n} autoRequestAccounts=${r}`),this.state.autoRequestAccounts=r,this.state.debug=n}forceInitializeState(){return fA(this,void 0,void 0,(function*(){return this.state.debug&&console.debug(`SDKProvider::forceInitializeState() autoRequestAccounts=${this.state.autoRequestAccounts}`),this._initializeStateAsync()}))}_setConnected(){this.state.debug&&console.debug("SDKProvider::_setConnected()"),this._state.isConnected=!0}getState(){return this._state}getSDKProviderState(){return this.state}setSDKProviderState(e){this.state=Object.assign(Object.assign({},this.state),e)}handleDisconnect({terminate:e=!1}){!function({terminate:e=!1,instance:t}){const{state:n}=t;t.isConnected()?(n.debug&&console.debug(`SDKProvider::handleDisconnect() cleaning up provider state terminate=${e}`,t),e&&(t.chainId=null,t._state.accounts=null,t.selectedAddress=null,t._state.isUnlocked=!1,t._state.isPermanentlyDisconnected=!0,t._state.initialized=!1),t._handleAccountsChanged([]),t._state.isConnected=!1,t.emit("disconnect",RA.ethErrors.provider.disconnected()),n.providerStateRequested=!1):n.debug&&console.debug("SDKProvider::handleDisconnect() not connected --- interrup disconnection")}({terminate:e,instance:this})}_initializeStateAsync(){return fA(this,void 0,void 0,(function*(){return function(e){var t;return fA(this,void 0,void 0,(function*(){void 0===e.state&&(e.state={debug:!1,autoRequestAccounts:!1,providerStateRequested:!1});const{state:n}=e;if(n.debug&&console.debug("SDKProvider::_initializeStateAsync()"),n.providerStateRequested)n.debug&&console.debug("SDKProvider::_initializeStateAsync() initialization already in progress");else{let r;n.providerStateRequested=!0;try{r=yield e.request({method:"metamask_getProviderState"})}catch(t){return e._log.error("MetaMask: Failed to get initial state. Please report this bug.",t),void(n.providerStateRequested=!1)}if(n.debug&&console.debug(`SDKProvider::_initializeStateAsync state selectedAddress=${e.selectedAddress} `,r),0===(null===(t=null==r?void 0:r.accounts)||void 0===t?void 0:t.length))if(n.debug&&console.debug("SDKProvider::_initializeStateAsync initial state doesn't contain accounts"),e.selectedAddress)n.debug&&console.debug("SDKProvider::_initializeStateAsync using instance.selectedAddress instead"),r.accounts=[e.selectedAddress];else{n.debug&&console.debug("SDKProvider::_initializeStateAsync Fetch accounts remotely.");const t=yield e.request({method:"eth_requestAccounts",params:[]});r.accounts=t}e._initializeState(r),n.providerStateRequested=!1}}))}(this)}))}_initializeState(e){return function(e,t,n){const{state:r}=e;return r.debug&&console.debug("SDKProvider::_initializeState() set state._initialized to false"),e._state.initialized=!1,t(n)}(this,super._initializeState.bind(this),e)}_handleChainChanged({chainId:e,networkVersion:t}={}){!function({instance:e,chainId:t,networkVersion:n,superHandleChainChanged:r}){const{state:i}=e;i.debug&&console.debug(`SDKProvider::_handleChainChanged chainId=${t} networkVersion=${n}`);let o=n;n||(console.info("forced network version to prevent provider error"),o="1"),e._state.isConnected=!0,e.emit("connect",{chainId:t}),r({chainId:t,networkVersion:o})}({instance:this,chainId:e,networkVersion:t,superHandleChainChanged:super._handleChainChanged.bind(this)})}}var ZM={exports:{}};!function(e,t){!function(t){var n=Object.hasOwnProperty,r=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},i="object"==typeof P&&!0,o="function"==typeof Symbol,a="object"==typeof Reflect,s="function"==typeof setImmediate?setImmediate:setTimeout,u=o?a&&"function"==typeof Reflect.ownKeys?Reflect.ownKeys:function(e){var t=Object.getOwnPropertyNames(e);return t.push.apply(t,Object.getOwnPropertySymbols(e)),t}:Object.keys;function l(){this._events={},this._conf&&c.call(this,this._conf)}function c(e){e&&(this._conf=e,e.delimiter&&(this.delimiter=e.delimiter),e.maxListeners!==t&&(this._maxListeners=e.maxListeners),e.wildcard&&(this.wildcard=e.wildcard),e.newListener&&(this._newListener=e.newListener),e.removeListener&&(this._removeListener=e.removeListener),e.verboseMemoryLeak&&(this.verboseMemoryLeak=e.verboseMemoryLeak),e.ignoreErrors&&(this.ignoreErrors=e.ignoreErrors),this.wildcard&&(this.listenerTree={}))}function d(e,t){var n="(node) warning: possible EventEmitter memory leak detected. "+e+" listeners added. Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak&&(n+=" Event name: "+t+"."),void 0!==P&&P.emitWarning){var r=new Error(n);r.name="MaxListenersExceededWarning",r.emitter=this,r.count=e,P.emitWarning(r)}else console.error(n),console.trace&&console.trace()}var f=function(e,t,n){var r=arguments.length;switch(r){case 0:return[];case 1:return[e];case 2:return[e,t];case 3:return[e,t,n];default:for(var i=new Array(r);r--;)i[r]=arguments[r];return i}};function h(e,n){for(var r={},i=e.length,o=n?n.length:0,a=0;a<i;a++)r[e[a]]=a<o?n[a]:t;return r}function p(e,t,n){var r,i;if(this._emitter=e,this._target=t,this._listeners={},this._listenersCount=0,(n.on||n.off)&&(r=n.on,i=n.off),t.addEventListener?(r=t.addEventListener,i=t.removeEventListener):t.addListener?(r=t.addListener,i=t.removeListener):t.on&&(r=t.on,i=t.off),!r&&!i)throw Error("target does not implement any known event API");if("function"!=typeof r)throw TypeError("on method must be a function");if("function"!=typeof i)throw TypeError("off method must be a function");this._on=r,this._off=i;var o=e._observers;o?o.push(this):e._observers=[this]}function m(e,r,i,o){var a=Object.assign({},r);if(!e)return a;if("object"!=typeof e)throw TypeError("options must be an object");var s,u,l,c=Object.keys(e),d=c.length;function f(e){throw Error('Invalid "'+s+'" option value'+(e?". Reason: "+e:""))}for(var h=0;h<d;h++){if(s=c[h],!o&&!n.call(r,s))throw Error('Unknown "'+s+'" option');(u=e[s])!==t&&(l=i[s],a[s]=l?l(u,f):u)}return a}function g(e,t){return"function"==typeof e&&e.hasOwnProperty("prototype")||t("value must be a constructor"),e}function v(e){var t="value must be type of "+e.join("|"),n=e.length,r=e[0],i=e[1];return 1===n?function(e,n){if(typeof e===r)return e;n(t)}:2===n?function(e,n){var o=typeof e;if(o===r||o===i)return e;n(t)}:function(r,i){for(var o=typeof r,a=n;a-- >0;)if(o===e[a])return r;i(t)}}Object.assign(p.prototype,{subscribe:function(e,t,n){var r=this,i=this._target,o=this._emitter,a=this._listeners,s=function(){var r=f.apply(null,arguments),a={data:r,name:t,original:e};n?!1!==n.call(i,a)&&o.emit.apply(o,[a.name].concat(r)):o.emit.apply(o,[t].concat(r))};if(a[e])throw Error("Event '"+e+"' is already listening");this._listenersCount++,o._newListener&&o._removeListener&&!r._onNewListener?(this._onNewListener=function(n){n===t&&null===a[e]&&(a[e]=s,r._on.call(i,e,s))},o.on("newListener",this._onNewListener),this._onRemoveListener=function(n){n===t&&!o.hasListeners(n)&&a[e]&&(a[e]=null,r._off.call(i,e,s))},a[e]=null,o.on("removeListener",this._onRemoveListener)):(a[e]=s,r._on.call(i,e,s))},unsubscribe:function(e){var t,n,r,i=this,o=this._listeners,a=this._emitter,s=this._off,l=this._target;if(e&&"string"!=typeof e)throw TypeError("event must be a string");function c(){i._onNewListener&&(a.off("newListener",i._onNewListener),a.off("removeListener",i._onRemoveListener),i._onNewListener=null,i._onRemoveListener=null);var e=_.call(a,i);a._observers.splice(e,1)}if(e){if(!(t=o[e]))return;s.call(l,e,t),delete o[e],--this._listenersCount||c()}else{for(r=(n=u(o)).length;r-- >0;)e=n[r],s.call(l,e,o[e]);this._listeners={},this._listenersCount=0,c()}}});var y=v(["function"]),w=v(["object","function"]);function A(e,t,n){var r,i,o,a=0,s=new e((function(u,l,c){function d(){i&&(i=null),a&&(clearTimeout(a),a=0)}n=m(n,{timeout:0,overload:!1},{timeout:function(e,t){return("number"!=typeof(e*=1)||e<0||!Number.isFinite(e))&&t("timeout must be a positive number"),e}}),r=!n.overload&&"function"==typeof e.prototype.cancel&&"function"==typeof c;var f=function(e){d(),u(e)},h=function(e){d(),l(e)};r?t(f,h,c):(i=[function(e){h(e||Error("canceled"))}],t(f,h,(function(e){if(o)throw Error("Unable to subscribe on cancel event asynchronously");if("function"!=typeof e)throw TypeError("onCancel callback must be a function");i.push(e)})),o=!0),n.timeout>0&&(a=setTimeout((function(){var e=Error("timeout");e.code="ETIMEDOUT",a=0,s.cancel(e),l(e)}),n.timeout))}));return r||(s.cancel=function(e){if(i){for(var t=i.length,n=1;n<t;n++)i[n](e);i[0](e),i=null}}),s}function _(e){var t=this._observers;if(!t)return-1;for(var n=t.length,r=0;r<n;r++)if(t[r]._target===e)return r;return-1}function E(e,t,n,r,i){if(!n)return null;if(0===r){var o=typeof t;if("string"===o){var a,s,l=0,c=0,d=this.delimiter,f=d.length;if(-1!==(s=t.indexOf(d))){a=new Array(5);do{a[l++]=t.slice(c,s),c=s+f}while(-1!==(s=t.indexOf(d,c)));a[l++]=t.slice(c),t=a,i=l}else t=[t],i=1}else"object"===o?i=t.length:(t=[t],i=1)}var h,p,m,g,v,y,b,w=null,A=t[r],_=t[r+1];if(r===i)n._listeners&&("function"==typeof n._listeners?(e&&e.push(n._listeners),w=[n]):(e&&e.push.apply(e,n._listeners),w=[n]));else{if("*"===A){for(s=(y=u(n)).length;s-- >0;)"_listeners"!==(h=y[s])&&(b=E(e,t,n[h],r+1,i))&&(w?w.push.apply(w,b):w=b);return w}if("**"===A){for((v=r+1===i||r+2===i&&"*"===_)&&n._listeners&&(w=E(e,t,n,i,i)),s=(y=u(n)).length;s-- >0;)"_listeners"!==(h=y[s])&&("*"===h||"**"===h?(n[h]._listeners&&!v&&(b=E(e,t,n[h],i,i))&&(w?w.push.apply(w,b):w=b),b=E(e,t,n[h],r,i)):b=E(e,t,n[h],h===_?r+2:r,i),b&&(w?w.push.apply(w,b):w=b));return w}n[A]&&(w=E(e,t,n[A],r+1,i))}if((p=n["*"])&&E(e,t,p,r+1,i),m=n["**"])if(r<i)for(m._listeners&&E(e,t,m,i,i),s=(y=u(m)).length;s-- >0;)"_listeners"!==(h=y[s])&&(h===_?E(e,t,m[h],r+2,i):h===A?E(e,t,m[h],r+1,i):((g={})[h]=m[h],E(e,t,{"**":g},r+1,i)));else m._listeners?E(e,t,m,i,i):m["*"]&&m["*"]._listeners&&E(e,t,m["*"],i,i);return w}function S(e,t,n){var r,i,o=0,a=0,s=this.delimiter,u=s.length;if("string"==typeof e)if(-1!==(r=e.indexOf(s))){i=new Array(5);do{i[o++]=e.slice(a,r),a=r+u}while(-1!==(r=e.indexOf(s,a)));i[o++]=e.slice(a)}else i=[e],o=1;else i=e,o=e.length;if(o>1)for(r=0;r+1<o;r++)if("**"===i[r]&&"**"===i[r+1])return;var l,c=this.listenerTree;for(r=0;r<o;r++)if(c=c[l=i[r]]||(c[l]={}),r===o-1)return c._listeners?("function"==typeof c._listeners&&(c._listeners=[c._listeners]),n?c._listeners.unshift(t):c._listeners.push(t),!c._listeners.warned&&this._maxListeners>0&&c._listeners.length>this._maxListeners&&(c._listeners.warned=!0,d.call(this,c._listeners.length,l))):c._listeners=t,!0;return!0}function k(e,t,n,r){for(var i,o,a,s,l=u(e),c=l.length,d=e._listeners;c-- >0;)i=e[o=l[c]],a="_listeners"===o?n:n?n.concat(o):[o],s=r||"symbol"==typeof o,d&&t.push(s?a:a.join(this.delimiter)),"object"==typeof i&&k.call(this,i,t,a,s);return t}function M(e){for(var t,n,r,i=u(e),o=i.length;o-- >0;)(t=e[n=i[o]])&&(r=!0,"_listeners"===n||M(t)||delete e[n]);return r}function C(e,t,n){this.emitter=e,this.event=t,this.listener=n}function x(e,n,r){if(!0===r)a=!0;else if(!1===r)o=!0;else{if(!r||"object"!=typeof r)throw TypeError("options should be an object or true");var o=r.async,a=r.promisify,u=r.nextTick,l=r.objectify}if(o||u||a){var c=n,d=n._origin||n;if(u&&!i)throw Error("process.nextTick is not supported");a===t&&(a="AsyncFunction"===n.constructor.name),n=function(){var e=arguments,t=this,n=this.event;return a?u?Promise.resolve():new Promise((function(e){s(e)})).then((function(){return t.event=n,c.apply(t,e)})):(u?b:s)((function(){t.event=n,c.apply(t,e)}))},n._async=!0,n._origin=d}return[n,l?new C(this,e,n):this]}function R(e){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,c.call(this,e)}C.prototype.off=function(){return this.emitter.off(this.event,this.listener),this},R.EventEmitter2=R,R.prototype.listenTo=function(e,n,i){if("object"!=typeof e)throw TypeError("target musts be an object");var o=this;function a(t){if("object"!=typeof t)throw TypeError("events must be an object");var n,r=i.reducers,a=_.call(o,e);n=-1===a?new p(o,e,i):o._observers[a];for(var s,l=u(t),c=l.length,d="function"==typeof r,f=0;f<c;f++)s=l[f],n.subscribe(s,t[s]||s,d?r:r&&r[s])}return i=m(i,{on:t,off:t,reducers:t},{on:y,off:y,reducers:w}),r(n)?a(h(n)):a("string"==typeof n?h(n.split(/\s+/)):n),this},R.prototype.stopListeningTo=function(e,t){var n=this._observers;if(!n)return!1;var r,i=n.length,o=!1;if(e&&"object"!=typeof e)throw TypeError("target should be an object");for(;i-- >0;)r=n[i],e&&r._target!==e||(r.unsubscribe(t),o=!0);return o},R.prototype.delimiter=".",R.prototype.setMaxListeners=function(e){e!==t&&(this._maxListeners=e,this._conf||(this._conf={}),this._conf.maxListeners=e)},R.prototype.getMaxListeners=function(){return this._maxListeners},R.prototype.event="",R.prototype.once=function(e,t,n){return this._once(e,t,!1,n)},R.prototype.prependOnceListener=function(e,t,n){return this._once(e,t,!0,n)},R.prototype._once=function(e,t,n,r){return this._many(e,1,t,n,r)},R.prototype.many=function(e,t,n,r){return this._many(e,t,n,!1,r)},R.prototype.prependMany=function(e,t,n,r){return this._many(e,t,n,!0,r)},R.prototype._many=function(e,t,n,r,i){var o=this;if("function"!=typeof n)throw new Error("many only accepts instances of Function");function a(){return 0==--t&&o.off(e,a),n.apply(this,arguments)}return a._origin=n,this._on(e,a,r,i)},R.prototype.emit=function(){if(!this._events&&!this._all)return!1;this._events||l.call(this);var e,t,n,r,i,a,s=arguments[0],u=this.wildcard;if("newListener"===s&&!this._newListener&&!this._events.newListener)return!1;if(u&&(e=s,"newListener"!==s&&"removeListener"!==s&&"object"==typeof s)){if(n=s.length,o)for(r=0;r<n;r++)if("symbol"==typeof s[r]){a=!0;break}a||(s=s.join(this.delimiter))}var c,d=arguments.length;if(this._all&&this._all.length)for(r=0,n=(c=this._all.slice()).length;r<n;r++)switch(this.event=s,d){case 1:c[r].call(this,s);break;case 2:c[r].call(this,s,arguments[1]);break;case 3:c[r].call(this,s,arguments[1],arguments[2]);break;default:c[r].apply(this,arguments)}if(u)c=[],E.call(this,c,e,this.listenerTree,0,n);else{if("function"==typeof(c=this._events[s])){switch(this.event=s,d){case 1:c.call(this);break;case 2:c.call(this,arguments[1]);break;case 3:c.call(this,arguments[1],arguments[2]);break;default:for(t=new Array(d-1),i=1;i<d;i++)t[i-1]=arguments[i];c.apply(this,t)}return!0}c&&(c=c.slice())}if(c&&c.length){if(d>3)for(t=new Array(d-1),i=1;i<d;i++)t[i-1]=arguments[i];for(r=0,n=c.length;r<n;r++)switch(this.event=s,d){case 1:c[r].call(this);break;case 2:c[r].call(this,arguments[1]);break;case 3:c[r].call(this,arguments[1],arguments[2]);break;default:c[r].apply(this,t)}return!0}if(!this.ignoreErrors&&!this._all&&"error"===s)throw arguments[1]instanceof Error?arguments[1]:new Error("Uncaught, unspecified 'error' event.");return!!this._all},R.prototype.emitAsync=function(){if(!this._events&&!this._all)return!1;this._events||l.call(this);var e,t,n,r,i,a,s=arguments[0],u=this.wildcard;if("newListener"===s&&!this._newListener&&!this._events.newListener)return Promise.resolve([!1]);if(u&&(e=s,"newListener"!==s&&"removeListener"!==s&&"object"==typeof s)){if(r=s.length,o)for(i=0;i<r;i++)if("symbol"==typeof s[i]){t=!0;break}t||(s=s.join(this.delimiter))}var c,d=[],f=arguments.length;if(this._all)for(i=0,r=this._all.length;i<r;i++)switch(this.event=s,f){case 1:d.push(this._all[i].call(this,s));break;case 2:d.push(this._all[i].call(this,s,arguments[1]));break;case 3:d.push(this._all[i].call(this,s,arguments[1],arguments[2]));break;default:d.push(this._all[i].apply(this,arguments))}if(u?(c=[],E.call(this,c,e,this.listenerTree,0)):c=this._events[s],"function"==typeof c)switch(this.event=s,f){case 1:d.push(c.call(this));break;case 2:d.push(c.call(this,arguments[1]));break;case 3:d.push(c.call(this,arguments[1],arguments[2]));break;default:for(n=new Array(f-1),a=1;a<f;a++)n[a-1]=arguments[a];d.push(c.apply(this,n))}else if(c&&c.length){if(c=c.slice(),f>3)for(n=new Array(f-1),a=1;a<f;a++)n[a-1]=arguments[a];for(i=0,r=c.length;i<r;i++)switch(this.event=s,f){case 1:d.push(c[i].call(this));break;case 2:d.push(c[i].call(this,arguments[1]));break;case 3:d.push(c[i].call(this,arguments[1],arguments[2]));break;default:d.push(c[i].apply(this,n))}}else if(!this.ignoreErrors&&!this._all&&"error"===s)return arguments[1]instanceof Error?Promise.reject(arguments[1]):Promise.reject("Uncaught, unspecified 'error' event.");return Promise.all(d)},R.prototype.on=function(e,t,n){return this._on(e,t,!1,n)},R.prototype.prependListener=function(e,t,n){return this._on(e,t,!0,n)},R.prototype.onAny=function(e){return this._onAny(e,!1)},R.prototype.prependAny=function(e){return this._onAny(e,!0)},R.prototype.addListener=R.prototype.on,R.prototype._onAny=function(e,t){if("function"!=typeof e)throw new Error("onAny only accepts instances of Function");return this._all||(this._all=[]),t?this._all.unshift(e):this._all.push(e),this},R.prototype._on=function(e,n,r,i){if("function"==typeof e)return this._onAny(e,n),this;if("function"!=typeof n)throw new Error("on only accepts instances of Function");this._events||l.call(this);var o,a=this;return i!==t&&(n=(o=x.call(this,e,n,i))[0],a=o[1]),this._newListener&&this.emit("newListener",e,n),this.wildcard?(S.call(this,e,n,r),a):(this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),r?this._events[e].unshift(n):this._events[e].push(n),!this._events[e].warned&&this._maxListeners>0&&this._events[e].length>this._maxListeners&&(this._events[e].warned=!0,d.call(this,this._events[e].length,e))):this._events[e]=n,a)},R.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var n,i=[];if(this.wildcard){var o="string"==typeof e?e.split(this.delimiter):e.slice();if(!(i=E.call(this,null,o,this.listenerTree,0)))return this}else{if(!this._events[e])return this;n=this._events[e],i.push({_listeners:n})}for(var a=0;a<i.length;a++){var s=i[a];if(n=s._listeners,r(n)){for(var u=-1,l=0,c=n.length;l<c;l++)if(n[l]===t||n[l].listener&&n[l].listener===t||n[l]._origin&&n[l]._origin===t){u=l;break}if(u<0)continue;return this.wildcard?s._listeners.splice(u,1):this._events[e].splice(u,1),0===n.length&&(this.wildcard?delete s._listeners:delete this._events[e]),this._removeListener&&this.emit("removeListener",e,t),this}(n===t||n.listener&&n.listener===t||n._origin&&n._origin===t)&&(this.wildcard?delete s._listeners:delete this._events[e],this._removeListener&&this.emit("removeListener",e,t))}return this.listenerTree&&M(this.listenerTree),this},R.prototype.offAny=function(e){var t,n=0,r=0;if(e&&this._all&&this._all.length>0){for(n=0,r=(t=this._all).length;n<r;n++)if(e===t[n])return t.splice(n,1),this._removeListener&&this.emit("removeListenerAny",e),this}else{if(t=this._all,this._removeListener)for(n=0,r=t.length;n<r;n++)this.emit("removeListenerAny",t[n]);this._all=[]}return this},R.prototype.removeListener=R.prototype.off,R.prototype.removeAllListeners=function(e){if(e===t)return!this._events||l.call(this),this;if(this.wildcard){var n,r=E.call(this,null,e,this.listenerTree,0);if(!r)return this;for(n=0;n<r.length;n++)r[n]._listeners=null;this.listenerTree&&M(this.listenerTree)}else this._events&&(this._events[e]=null);return this},R.prototype.listeners=function(e){var n,r,i,o,a,s=this._events;if(e===t){if(this.wildcard)throw Error("event name required for wildcard emitter");if(!s)return[];for(o=(n=u(s)).length,i=[];o-- >0;)"function"==typeof(r=s[n[o]])?i.push(r):i.push.apply(i,r);return i}if(this.wildcard){if(!(a=this.listenerTree))return[];var l=[],c="string"==typeof e?e.split(this.delimiter):e.slice();return E.call(this,l,c,a,0),l}return s&&(r=s[e])?"function"==typeof r?[r]:r:[]},R.prototype.eventNames=function(e){var t=this._events;return this.wildcard?k.call(this,this.listenerTree,[],null,e):t?u(t):[]},R.prototype.listenerCount=function(e){return this.listeners(e).length},R.prototype.hasListeners=function(e){if(this.wildcard){var n=[],r="string"==typeof e?e.split(this.delimiter):e.slice();return E.call(this,n,r,this.listenerTree,0),n.length>0}var i=this._events,o=this._all;return!!(o&&o.length||i&&(e===t?u(i).length:i[e]))},R.prototype.listenersAny=function(){return this._all?this._all:[]},R.prototype.waitFor=function(e,n){var r=this,i=typeof n;return"number"===i?n={timeout:n}:"function"===i&&(n={filter:n}),A((n=m(n,{timeout:0,filter:t,handleError:!1,Promise:Promise,overload:!1},{filter:y,Promise:g})).Promise,(function(t,i,o){function a(){var o=n.filter;if(!o||o.apply(r,arguments))if(r.off(e,a),n.handleError){var s=arguments[0];s?i(s):t(f.apply(null,arguments).slice(1))}else t(f.apply(null,arguments))}o((function(){r.off(e,a)})),r._on(e,a,!1)}),{timeout:n.timeout,overload:n.overload})};var O=R.prototype;Object.defineProperties(R,{defaultMaxListeners:{get:function(){return O._maxListeners},set:function(e){if("number"!=typeof e||e<0||Number.isNaN(e))throw TypeError("n must be a non-negative number");O._maxListeners=e},enumerable:!0},once:{value:function(e,t,n){return A((n=m(n,{Promise:Promise,timeout:0,overload:!1},{Promise:g})).Promise,(function(n,r,i){var o;if("function"==typeof e.addEventListener)return o=function(){n(f.apply(null,arguments))},i((function(){e.removeEventListener(t,o)})),void e.addEventListener(t,o,{once:!0});var a,s=function(){a&&e.removeListener("error",a),n(f.apply(null,arguments))};"error"!==t&&(a=function(n){e.removeListener(t,s),r(n)},e.once("error",a)),i((function(){a&&e.removeListener("error",a),e.removeListener(t,s)})),e.once(t,s)}),{timeout:n.timeout,overload:n.overload})},writable:!0,configurable:!0}}),Object.defineProperties(O,{_maxListeners:{value:10,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),"function"==typeof t&&t.amd?t((function(){return R})):e.exports=R}()}(ZM);var XM=i(ZM.exports);function JM(e){return JM="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},JM(e)}function eC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function tC(e){var t=function(e,t){if("object"!==JM(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==JM(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===JM(t)?t:String(t)}function nC(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,tC(r.key),r)}}function rC(e,t,n){return t&&nC(e.prototype,t),n&&nC(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function iC(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function oC(e,t){return oC=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},oC(e,t)}function aC(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&oC(e,t)}function sC(e,t){if(t&&("object"===JM(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return iC(e)}function uC(e){return uC=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},uC(e)}function lC(e,t,n){return(t=tC(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function cC(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function dC(e){return function(e){if(Array.isArray(e))return e}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return cC(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?cC(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function fC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function hC(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?fC(Object(n),!0).forEach((function(t){lC(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fC(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var pC={type:"logger",log:function(e){this.output("log",e)},warn:function(e){this.output("warn",e)},error:function(e){this.output("error",e)},output:function(e,t){console&&console[e]&&console[e].apply(console,t)}},mC=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};eC(this,e),this.init(t,n)}return rC(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||pC,this.options=t,this.debug=t.debug}},{key:"setDebug",value:function(e){this.debug=e}},{key:"log",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"log","",!0)}},{key:"warn",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","",!0)}},{key:"error",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"error","")}},{key:"deprecate",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}},{key:"forward",value:function(e,t,n,r){return r&&!this.debug?null:("string"==typeof e[0]&&(e[0]="".concat(n).concat(this.prefix," ").concat(e[0])),this.logger[t](e))}},{key:"create",value:function(t){return new e(this.logger,hC(hC({},{prefix:"".concat(this.prefix,":").concat(t,":")}),this.options))}},{key:"clone",value:function(t){return(t=t||this.options).prefix=t.prefix||this.prefix,new e(this.logger,t)}}]),e}(),gC=new mC,vC=function(){function e(){eC(this,e),this.observers={}}return rC(e,[{key:"on",value:function(e,t){var n=this;return e.split(" ").forEach((function(e){n.observers[e]=n.observers[e]||[],n.observers[e].push(t)})),this}},{key:"off",value:function(e,t){this.observers[e]&&(t?this.observers[e]=this.observers[e].filter((function(e){return e!==t})):delete this.observers[e])}},{key:"emit",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];this.observers[e]&&[].concat(this.observers[e]).forEach((function(e){e.apply(void 0,n)})),this.observers["*"]&&[].concat(this.observers["*"]).forEach((function(t){t.apply(t,[e].concat(n))}))}}]),e}();function yC(){var e,t,n=new Promise((function(n,r){e=n,t=r}));return n.resolve=e,n.reject=t,n}function bC(e){return null==e?"":""+e}function wC(e,t,n){function r(e){return e&&e.indexOf("###")>-1?e.replace(/###/g,"."):e}function i(){return!e||"string"==typeof e}for(var o="string"!=typeof t?[].concat(t):t.split(".");o.length>1;){if(i())return{};var a=r(o.shift());!e[a]&&n&&(e[a]=new n),e=Object.prototype.hasOwnProperty.call(e,a)?e[a]:{}}return i()?{}:{obj:e,k:r(o.shift())}}function AC(e,t,n){var r=wC(e,t,Object);r.obj[r.k]=n}function _C(e,t){var n=wC(e,t),r=n.obj,i=n.k;if(r)return r[i]}function EC(e,t,n){for(var r in t)"__proto__"!==r&&"constructor"!==r&&(r in e?"string"==typeof e[r]||e[r]instanceof String||"string"==typeof t[r]||t[r]instanceof String?n&&(e[r]=t[r]):EC(e[r],t[r],n):e[r]=t[r]);return e}function SC(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var kC={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function MC(e){return"string"==typeof e?e.replace(/[&<>"'\/]/g,(function(e){return kC[e]})):e}var CC="undefined"!=typeof window&&window.navigator&&void 0===window.navigator.userAgentData&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,xC=[" ",",","?","!",";"];function RC(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".";if(e){if(e[t])return e[t];for(var r=t.split(n),i=e,o=0;o<r.length;++o){if(!i)return;if("string"==typeof i[r[o]]&&o+1<r.length)return;if(void 0===i[r[o]]){for(var a=2,s=r.slice(o,o+a).join(n),u=i[s];void 0===u&&r.length>o+a;)a++,u=i[s=r.slice(o,o+a).join(n)];if(void 0===u)return;if(null===u)return null;if(t.endsWith(s)){if("string"==typeof u)return u;if(s&&"string"==typeof u[s])return u[s]}var l=r.slice(o+a).join(n);return l?RC(u,l,n):void 0}i=i[r[o]]}return i}}function OC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function TC(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?OC(Object(n),!0).forEach((function(t){lC(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):OC(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function PC(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=uC(e);if(t){var i=uC(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return sC(this,n)}}var LC=function(e){aC(n,e);var t=PC(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};return eC(this,n),r=t.call(this),CC&&vC.call(iC(r)),r.data=e||{},r.options=i,void 0===r.options.keySeparator&&(r.options.keySeparator="."),void 0===r.options.ignoreJSONStructure&&(r.options.ignoreJSONStructure=!0),r}return rC(n,[{key:"addNamespaces",value:function(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}},{key:"removeNamespaces",value:function(e){var t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}},{key:"getResource",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator,o=void 0!==r.ignoreJSONStructure?r.ignoreJSONStructure:this.options.ignoreJSONStructure,a=[e,t];n&&"string"!=typeof n&&(a=a.concat(n)),n&&"string"==typeof n&&(a=a.concat(i?n.split(i):n)),e.indexOf(".")>-1&&(a=e.split("."));var s=_C(this.data,a);return s||!o||"string"!=typeof n?s:RC(this.data&&this.data[e]&&this.data[e][t],n,i)}},{key:"addResource",value:function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1},o=void 0!==i.keySeparator?i.keySeparator:this.options.keySeparator,a=[e,t];n&&(a=a.concat(o?n.split(o):n)),e.indexOf(".")>-1&&(r=t,t=(a=e.split("."))[1]),this.addNamespaces(t),AC(this.data,a,r),i.silent||this.emit("added",e,t,n,r)}},{key:"addResources",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(var i in n)"string"!=typeof n[i]&&"[object Array]"!==Object.prototype.toString.apply(n[i])||this.addResource(e,t,i,n[i],{silent:!0});r.silent||this.emit("added",e,t,n)}},{key:"addResourceBundle",value:function(e,t,n,r,i){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1},a=[e,t];e.indexOf(".")>-1&&(r=n,n=t,t=(a=e.split("."))[1]),this.addNamespaces(t);var s=_C(this.data,a)||{};r?EC(s,n,i):s=TC(TC({},s),n),AC(this.data,a,s),o.silent||this.emit("added",e,t,n)}},{key:"removeResourceBundle",value:function(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}},{key:"hasResourceBundle",value:function(e,t){return void 0!==this.getResource(e,t)}},{key:"getResourceBundle",value:function(e,t){return t||(t=this.options.defaultNS),"v1"===this.options.compatibilityAPI?TC(TC({},{}),this.getResource(e,t)):this.getResource(e,t)}},{key:"getDataByLanguage",value:function(e){return this.data[e]}},{key:"hasLanguageSomeTranslations",value:function(e){var t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find((function(e){return t[e]&&Object.keys(t[e]).length>0}))}},{key:"toJSON",value:function(){return this.data}}]),n}(vC),IC={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,t,n,r,i){var o=this;return e.forEach((function(e){o.processors[e]&&(t=o.processors[e].process(t,n,r,i))})),t}};function NC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function DC(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?NC(Object(n),!0).forEach((function(t){lC(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):NC(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function BC(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=uC(e);if(t){var i=uC(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return sC(this,n)}}var jC={},UC=function(e){aC(n,e);var t=BC(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return eC(this,n),r=t.call(this),CC&&vC.call(iC(r)),function(e,t,n){e.forEach((function(e){t[e]&&(n[e]=t[e])}))}(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,iC(r)),r.options=i,void 0===r.options.keySeparator&&(r.options.keySeparator="."),r.logger=gC.create("translator"),r}return rC(n,[{key:"changeLanguage",value:function(e){e&&(this.language=e)}},{key:"exists",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};if(null==e)return!1;var n=this.resolve(e,t);return n&&void 0!==n.res}},{key:"extractFromKey",value:function(e,t){var n=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===n&&(n=":");var r=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,i=t.ns||this.options.defaultNS||[],o=n&&e.indexOf(n)>-1,a=!(this.options.userDefinedKeySeparator||t.keySeparator||this.options.userDefinedNsSeparator||t.nsSeparator||function(e,t,n){t=t||"",n=n||"";var r=xC.filter((function(e){return t.indexOf(e)<0&&n.indexOf(e)<0}));if(0===r.length)return!0;var i=new RegExp("(".concat(r.map((function(e){return"?"===e?"\\?":e})).join("|"),")")),o=!i.test(e);if(!o){var a=e.indexOf(n);a>0&&!i.test(e.substring(0,a))&&(o=!0)}return o}(e,n,r));if(o&&!a){var s=e.match(this.interpolator.nestingRegexp);if(s&&s.length>0)return{key:e,namespaces:i};var u=e.split(n);(n!==r||n===r&&this.options.ns.indexOf(u[0])>-1)&&(i=u.shift()),e=u.join(r)}return"string"==typeof i&&(i=[i]),{key:e,namespaces:i}}},{key:"translate",value:function(e,t,r){var i=this;if("object"!==JM(t)&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),"object"===JM(t)&&(t=DC({},t)),t||(t={}),null==e)return"";Array.isArray(e)||(e=[String(e)]);var o=void 0!==t.returnDetails?t.returnDetails:this.options.returnDetails,a=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,s=this.extractFromKey(e[e.length-1],t),u=s.key,l=s.namespaces,c=l[l.length-1],d=t.lng||this.language,f=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d&&"cimode"===d.toLowerCase()){if(f){var h=t.nsSeparator||this.options.nsSeparator;return o?{res:"".concat(c).concat(h).concat(u),usedKey:u,exactUsedKey:u,usedLng:d,usedNS:c}:"".concat(c).concat(h).concat(u)}return o?{res:u,usedKey:u,exactUsedKey:u,usedLng:d,usedNS:c}:u}var p=this.resolve(e,t),m=p&&p.res,g=p&&p.usedKey||u,v=p&&p.exactUsedKey||u,y=Object.prototype.toString.apply(m),b=void 0!==t.joinArrays?t.joinArrays:this.options.joinArrays,w=!this.i18nFormat||this.i18nFormat.handleAsObject;if(w&&m&&"string"!=typeof m&&"boolean"!=typeof m&&"number"!=typeof m&&["[object Number]","[object Function]","[object RegExp]"].indexOf(y)<0&&("string"!=typeof b||"[object Array]"!==y)){if(!t.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");var A=this.options.returnedObjectHandler?this.options.returnedObjectHandler(g,m,DC(DC({},t),{},{ns:l})):"key '".concat(u," (").concat(this.language,")' returned an object instead of string.");return o?(p.res=A,p):A}if(a){var _="[object Array]"===y,E=_?[]:{},S=_?v:g;for(var k in m)if(Object.prototype.hasOwnProperty.call(m,k)){var M="".concat(S).concat(a).concat(k);E[k]=this.translate(M,DC(DC({},t),{joinArrays:!1,ns:l})),E[k]===M&&(E[k]=m[k])}m=E}}else if(w&&"string"==typeof b&&"[object Array]"===y)(m=m.join(b))&&(m=this.extendTranslation(m,e,t,r));else{var C=!1,x=!1,R=void 0!==t.count&&"string"!=typeof t.count,O=n.hasDefaultValue(t),T=R?this.pluralResolver.getSuffix(d,t.count,t):"",P=t["defaultValue".concat(T)]||t.defaultValue;!this.isValidLookup(m)&&O&&(C=!0,m=P),this.isValidLookup(m)||(x=!0,m=u);var L=(t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&x?void 0:m,I=O&&P!==m&&this.options.updateMissing;if(x||C||I){if(this.logger.log(I?"updateKey":"missingKey",d,c,u,I?P:m),a){var N=this.resolve(u,DC(DC({},t),{},{keySeparator:!1}));N&&N.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}var D=[],B=this.languageUtils.getFallbackCodes(this.options.fallbackLng,t.lng||this.language);if("fallback"===this.options.saveMissingTo&&B&&B[0])for(var j=0;j<B.length;j++)D.push(B[j]);else"all"===this.options.saveMissingTo?D=this.languageUtils.toResolveHierarchy(t.lng||this.language):D.push(t.lng||this.language);var U=function(e,n,r){var o=O&&r!==m?r:L;i.options.missingKeyHandler?i.options.missingKeyHandler(e,c,n,o,I,t):i.backendConnector&&i.backendConnector.saveMissing&&i.backendConnector.saveMissing(e,c,n,o,I,t),i.emit("missingKey",e,c,n,m)};this.options.saveMissing&&(this.options.saveMissingPlurals&&R?D.forEach((function(e){i.pluralResolver.getSuffixes(e,t).forEach((function(n){U([e],u+n,t["defaultValue".concat(n)]||P)}))})):U(D,u,P))}m=this.extendTranslation(m,e,t,p,r),x&&m===u&&this.options.appendNamespaceToMissingKey&&(m="".concat(c,":").concat(u)),(x||C)&&this.options.parseMissingKeyHandler&&(m="v1"!==this.options.compatibilityAPI?this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?"".concat(c,":").concat(u):u,C?m:void 0):this.options.parseMissingKeyHandler(m))}return o?(p.res=m,p):m}},{key:"extendTranslation",value:function(e,t,n,r,i){var o=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,DC(DC({},this.options.interpolation.defaultVariables),n),r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init(DC(DC({},n),{interpolation:DC(DC({},this.options.interpolation),n.interpolation)}));var a,s="string"==typeof e&&(n&&n.interpolation&&void 0!==n.interpolation.skipOnVariables?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);if(s){var u=e.match(this.interpolator.nestingRegexp);a=u&&u.length}var l=n.replace&&"string"!=typeof n.replace?n.replace:n;if(this.options.interpolation.defaultVariables&&(l=DC(DC({},this.options.interpolation.defaultVariables),l)),e=this.interpolator.interpolate(e,l,n.lng||this.language,n),s){var c=e.match(this.interpolator.nestingRegexp);a<(c&&c.length)&&(n.nest=!1)}!n.lng&&"v1"!==this.options.compatibilityAPI&&r&&r.res&&(n.lng=r.usedLng),!1!==n.nest&&(e=this.interpolator.nest(e,(function(){for(var e=arguments.length,r=new Array(e),a=0;a<e;a++)r[a]=arguments[a];return i&&i[0]===r[0]&&!n.context?(o.logger.warn("It seems you are nesting recursively key: ".concat(r[0]," in key: ").concat(t[0])),null):o.translate.apply(o,r.concat([t]))}),n)),n.interpolation&&this.interpolator.reset()}var d=n.postProcess||this.options.postProcess,f="string"==typeof d?[d]:d;return null!=e&&f&&f.length&&!1!==n.applyPostProcessor&&(e=IC.handle(f,e,t,this.options&&this.options.postProcessPassResolved?DC({i18nResolved:r},n):n,this)),e}},{key:"resolve",value:function(e){var t,n,r,i,o,a=this,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return"string"==typeof e&&(e=[e]),e.forEach((function(e){if(!a.isValidLookup(t)){var u=a.extractFromKey(e,s),l=u.key;n=l;var c=u.namespaces;a.options.fallbackNS&&(c=c.concat(a.options.fallbackNS));var d=void 0!==s.count&&"string"!=typeof s.count,f=d&&!s.ordinal&&0===s.count&&a.pluralResolver.shouldUseIntlApi(),h=void 0!==s.context&&("string"==typeof s.context||"number"==typeof s.context)&&""!==s.context,p=s.lngs?s.lngs:a.languageUtils.toResolveHierarchy(s.lng||a.language,s.fallbackLng);c.forEach((function(e){a.isValidLookup(t)||(o=e,!jC["".concat(p[0],"-").concat(e)]&&a.utils&&a.utils.hasLoadedNamespace&&!a.utils.hasLoadedNamespace(o)&&(jC["".concat(p[0],"-").concat(e)]=!0,a.logger.warn('key "'.concat(n,'" for languages "').concat(p.join(", "),'" won\'t get resolved as namespace "').concat(o,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),p.forEach((function(n){if(!a.isValidLookup(t)){i=n;var o,u=[l];if(a.i18nFormat&&a.i18nFormat.addLookupKeys)a.i18nFormat.addLookupKeys(u,l,n,e,s);else{var c;d&&(c=a.pluralResolver.getSuffix(n,s.count,s));var p="".concat(a.options.pluralSeparator,"zero");if(d&&(u.push(l+c),f&&u.push(l+p)),h){var m="".concat(l).concat(a.options.contextSeparator).concat(s.context);u.push(m),d&&(u.push(m+c),f&&u.push(m+p))}}for(;o=u.pop();)a.isValidLookup(t)||(r=o,t=a.getResource(n,e,o,s))}})))}))}})),{res:t,usedKey:n,exactUsedKey:r,usedLng:i,usedNS:o}}},{key:"isValidLookup",value:function(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}},{key:"getResource",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,n,r):this.resourceStore.getResource(e,t,n,r)}}],[{key:"hasDefaultValue",value:function(e){var t="defaultValue";for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t===n.substring(0,12)&&void 0!==e[n])return!0;return!1}}]),n}(vC);function zC(e){return e.charAt(0).toUpperCase()+e.slice(1)}var FC=function(){function e(t){eC(this,e),this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=gC.create("languageUtils")}return rC(e,[{key:"getScriptPartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return null;var t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}},{key:"getLanguagePartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return e;var t=e.split("-");return this.formatLanguageCode(t[0])}},{key:"formatLanguageCode",value:function(e){if("string"==typeof e&&e.indexOf("-")>-1){var t=["hans","hant","latn","cyrl","cans","mong","arab"],n=e.split("-");return this.options.lowerCaseLng?n=n.map((function(e){return e.toLowerCase()})):2===n.length?(n[0]=n[0].toLowerCase(),n[1]=n[1].toUpperCase(),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=zC(n[1].toLowerCase()))):3===n.length&&(n[0]=n[0].toLowerCase(),2===n[1].length&&(n[1]=n[1].toUpperCase()),"sgn"!==n[0]&&2===n[2].length&&(n[2]=n[2].toUpperCase()),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=zC(n[1].toLowerCase())),t.indexOf(n[2].toLowerCase())>-1&&(n[2]=zC(n[2].toLowerCase()))),n.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}},{key:"isSupportedCode",value:function(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}},{key:"getBestMatchFromCodes",value:function(e){var t,n=this;return e?(e.forEach((function(e){if(!t){var r=n.formatLanguageCode(e);n.options.supportedLngs&&!n.isSupportedCode(r)||(t=r)}})),!t&&this.options.supportedLngs&&e.forEach((function(e){if(!t){var r=n.getLanguagePartFromCode(e);if(n.isSupportedCode(r))return t=r;t=n.options.supportedLngs.find((function(e){return e===r?e:e.indexOf("-")<0&&r.indexOf("-")<0?void 0:0===e.indexOf(r)?e:void 0}))}})),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t):null}},{key:"getFallbackCodes",value:function(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),"string"==typeof e&&(e=[e]),"[object Array]"===Object.prototype.toString.apply(e))return e;if(!t)return e.default||[];var n=e[t];return n||(n=e[this.getScriptPartFromCode(t)]),n||(n=e[this.formatLanguageCode(t)]),n||(n=e[this.getLanguagePartFromCode(t)]),n||(n=e.default),n||[]}},{key:"toResolveHierarchy",value:function(e,t){var n=this,r=this.getFallbackCodes(t||this.options.fallbackLng||[],e),i=[],o=function(e){e&&(n.isSupportedCode(e)?i.push(e):n.logger.warn("rejecting language code not found in supportedLngs: ".concat(e)))};return"string"==typeof e&&e.indexOf("-")>-1?("languageOnly"!==this.options.load&&o(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&o(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&o(this.getLanguagePartFromCode(e))):"string"==typeof e&&o(this.formatLanguageCode(e)),r.forEach((function(e){i.indexOf(e)<0&&o(n.formatLanguageCode(e))})),i}}]),e}(),qC=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],WC={1:function(e){return Number(e>1)},2:function(e){return Number(1!=e)},3:function(e){return 0},4:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},5:function(e){return Number(0==e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5)},6:function(e){return Number(1==e?0:e>=2&&e<=4?1:2)},7:function(e){return Number(1==e?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},8:function(e){return Number(1==e?0:2==e?1:8!=e&&11!=e?2:3)},9:function(e){return Number(e>=2)},10:function(e){return Number(1==e?0:2==e?1:e<7?2:e<11?3:4)},11:function(e){return Number(1==e||11==e?0:2==e||12==e?1:e>2&&e<20?2:3)},12:function(e){return Number(e%10!=1||e%100==11)},13:function(e){return Number(0!==e)},14:function(e){return Number(1==e?0:2==e?1:3==e?2:3)},15:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2)},16:function(e){return Number(e%10==1&&e%100!=11?0:0!==e?1:2)},17:function(e){return Number(1==e||e%10==1&&e%100!=11?0:1)},18:function(e){return Number(0==e?0:1==e?1:2)},19:function(e){return Number(1==e?0:0==e||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3)},20:function(e){return Number(1==e?0:0==e||e%100>0&&e%100<20?1:2)},21:function(e){return Number(e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0)},22:function(e){return Number(1==e?0:2==e?1:(e<0||e>10)&&e%10==0?2:3)}},VC=["v1","v2","v3"],KC={zero:0,one:1,two:2,few:3,many:4,other:5},HC=function(){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};eC(this,e),this.languageUtils=t,this.options=r,this.logger=gC.create("pluralResolver"),this.options.compatibilityJSON&&"v4"!==this.options.compatibilityJSON||"undefined"!=typeof Intl&&Intl.PluralRules||(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=(n={},qC.forEach((function(e){e.lngs.forEach((function(t){n[t]={numbers:e.nr,plurals:WC[e.fc]}}))})),n)}return rC(e,[{key:"addRule",value:function(e,t){this.rules[e]=t}},{key:"getRule",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(e,{type:t.ordinal?"ordinal":"cardinal"})}catch(e){return}return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}},{key:"needsPlural",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.getRule(e,t);return this.shouldUseIntlApi()?n&&n.resolvedOptions().pluralCategories.length>1:n&&n.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.getSuffixes(e,n).map((function(e){return"".concat(t).concat(e)}))}},{key:"getSuffixes",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this.getRule(e,n);return r?this.shouldUseIntlApi()?r.resolvedOptions().pluralCategories.sort((function(e,t){return KC[e]-KC[t]})).map((function(e){return"".concat(t.options.prepend).concat(e)})):r.numbers.map((function(r){return t.getSuffix(e,r,n)})):[]}},{key:"getSuffix",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=this.getRule(e,n);return r?this.shouldUseIntlApi()?"".concat(this.options.prepend).concat(r.select(t)):this.getSuffixRetroCompatible(r,t):(this.logger.warn("no plural rule found for: ".concat(e)),"")}},{key:"getSuffixRetroCompatible",value:function(e,t){var n=this,r=e.noAbs?e.plurals(t):e.plurals(Math.abs(t)),i=e.numbers[r];this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]&&(2===i?i="plural":1===i&&(i=""));var o=function(){return n.options.prepend&&i.toString()?n.options.prepend+i.toString():i.toString()};return"v1"===this.options.compatibilityJSON?1===i?"":"number"==typeof i?"_plural_".concat(i.toString()):o():"v2"===this.options.compatibilityJSON||this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]?o():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}},{key:"shouldUseIntlApi",value:function(){return!VC.includes(this.options.compatibilityJSON)}}]),e}();function $C(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function YC(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?$C(Object(n),!0).forEach((function(t){lC(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$C(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function GC(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:".",i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],o=function(e,t,n){var r=_C(e,n);return void 0!==r?r:_C(t,n)}(e,t,n);return!o&&i&&"string"==typeof n&&void 0===(o=RC(e,n,r))&&(o=RC(t,n,r)),o}var QC=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};eC(this,e),this.logger=gC.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||function(e){return e},this.init(t)}return rC(e,[{key:"init",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});var t=e.interpolation;this.escape=void 0!==t.escape?t.escape:MC,this.escapeValue=void 0===t.escapeValue||t.escapeValue,this.useRawValueToEscape=void 0!==t.useRawValueToEscape&&t.useRawValueToEscape,this.prefix=t.prefix?SC(t.prefix):t.prefixEscaped||"{{",this.suffix=t.suffix?SC(t.suffix):t.suffixEscaped||"}}",this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||",",this.unescapePrefix=t.unescapeSuffix?"":t.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":t.unescapeSuffix||"",this.nestingPrefix=t.nestingPrefix?SC(t.nestingPrefix):t.nestingPrefixEscaped||SC("$t("),this.nestingSuffix=t.nestingSuffix?SC(t.nestingSuffix):t.nestingSuffixEscaped||SC(")"),this.nestingOptionsSeparator=t.nestingOptionsSeparator?t.nestingOptionsSeparator:t.nestingOptionsSeparator||",",this.maxReplaces=t.maxReplaces?t.maxReplaces:1e3,this.alwaysFormat=void 0!==t.alwaysFormat&&t.alwaysFormat,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var e="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(e,"g");var t="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(t,"g");var n="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(n,"g")}},{key:"interpolate",value:function(e,t,n,r){var i,o,a,s=this,u=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function l(e){return e.replace(/\$/g,"$$$$")}var c=function(e){if(e.indexOf(s.formatSeparator)<0){var i=GC(t,u,e,s.options.keySeparator,s.options.ignoreJSONStructure);return s.alwaysFormat?s.format(i,void 0,n,YC(YC(YC({},r),t),{},{interpolationkey:e})):i}var o=e.split(s.formatSeparator),a=o.shift().trim(),l=o.join(s.formatSeparator).trim();return s.format(GC(t,u,a,s.options.keySeparator,s.options.ignoreJSONStructure),l,n,YC(YC(YC({},r),t),{},{interpolationkey:a}))};this.resetRegExp();var d=r&&r.missingInterpolationHandler||this.options.missingInterpolationHandler,f=r&&r.interpolation&&void 0!==r.interpolation.skipOnVariables?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:function(e){return l(e)}},{regex:this.regexp,safeValue:function(e){return s.escapeValue?l(s.escape(e)):l(e)}}].forEach((function(t){for(a=0;i=t.regex.exec(e);){var n=i[1].trim();if(void 0===(o=c(n)))if("function"==typeof d){var u=d(e,i,r);o="string"==typeof u?u:""}else if(r&&Object.prototype.hasOwnProperty.call(r,n))o="";else{if(f){o=i[0];continue}s.logger.warn("missed to pass in variable ".concat(n," for interpolating ").concat(e)),o=""}else"string"==typeof o||s.useRawValueToEscape||(o=bC(o));var l=t.safeValue(o);if(e=e.replace(i[0],l),f?(t.regex.lastIndex+=o.length,t.regex.lastIndex-=i[0].length):t.regex.lastIndex=0,++a>=s.maxReplaces)break}})),e}},{key:"nest",value:function(e,t){var n,r,i,o=this,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};function s(e,t){var n=this.nestingOptionsSeparator;if(e.indexOf(n)<0)return e;var r=e.split(new RegExp("".concat(n,"[ ]*{"))),o="{".concat(r[1]);e=r[0];var a=(o=this.interpolate(o,i)).match(/'/g),s=o.match(/"/g);(a&&a.length%2==0&&!s||s.length%2!=0)&&(o=o.replace(/'/g,'"'));try{i=JSON.parse(o),t&&(i=YC(YC({},t),i))}catch(t){return this.logger.warn("failed parsing options string in nesting for key ".concat(e),t),"".concat(e).concat(n).concat(o)}return delete i.defaultValue,e}for(;n=this.nestingRegexp.exec(e);){var u=[];(i=(i=YC({},a)).replace&&"string"!=typeof i.replace?i.replace:i).applyPostProcessor=!1,delete i.defaultValue;var l=!1;if(-1!==n[0].indexOf(this.formatSeparator)&&!/{.*}/.test(n[1])){var c=n[1].split(this.formatSeparator).map((function(e){return e.trim()}));n[1]=c.shift(),u=c,l=!0}if((r=t(s.call(this,n[1].trim(),i),i))&&n[0]===e&&"string"!=typeof r)return r;"string"!=typeof r&&(r=bC(r)),r||(this.logger.warn("missed to resolve ".concat(n[1]," for nesting ").concat(e)),r=""),l&&(r=u.reduce((function(e,t){return o.format(e,t,a.lng,YC(YC({},a),{},{interpolationkey:n[1].trim()}))}),r.trim())),e=e.replace(n[0],r),this.regexp.lastIndex=0}return e}}]),e}();function ZC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function XC(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ZC(Object(n),!0).forEach((function(t){lC(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ZC(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function JC(e){var t={};return function(n,r,i){var o=r+JSON.stringify(i),a=t[o];return a||(a=e(r,i),t[o]=a),a(n)}}var ex=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};eC(this,e),this.logger=gC.create("formatter"),this.options=t,this.formats={number:JC((function(e,t){var n=new Intl.NumberFormat(e,XC({},t));return function(e){return n.format(e)}})),currency:JC((function(e,t){var n=new Intl.NumberFormat(e,XC(XC({},t),{},{style:"currency"}));return function(e){return n.format(e)}})),datetime:JC((function(e,t){var n=new Intl.DateTimeFormat(e,XC({},t));return function(e){return n.format(e)}})),relativetime:JC((function(e,t){var n=new Intl.RelativeTimeFormat(e,XC({},t));return function(e){return n.format(e,t.range||"day")}})),list:JC((function(e,t){var n=new Intl.ListFormat(e,XC({},t));return function(e){return n.format(e)}}))},this.init(t)}return rC(e,[{key:"init",value:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||","}},{key:"add",value:function(e,t){this.formats[e.toLowerCase().trim()]=t}},{key:"addCached",value:function(e,t){this.formats[e.toLowerCase().trim()]=JC(t)}},{key:"format",value:function(e,t,n){var r=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=t.split(this.formatSeparator).reduce((function(e,t){var o=function(e){var t=e.toLowerCase().trim(),n={};if(e.indexOf("(")>-1){var r=e.split("(");t=r[0].toLowerCase().trim();var i=r[1].substring(0,r[1].length-1);"currency"===t&&i.indexOf(":")<0?n.currency||(n.currency=i.trim()):"relativetime"===t&&i.indexOf(":")<0?n.range||(n.range=i.trim()):i.split(";").forEach((function(e){if(e){var t=dC(e.split(":")),r=t[0],i=t.slice(1).join(":").trim().replace(/^'+|'+$/g,"");n[r.trim()]||(n[r.trim()]=i),"false"===i&&(n[r.trim()]=!1),"true"===i&&(n[r.trim()]=!0),isNaN(i)||(n[r.trim()]=parseInt(i,10))}}))}return{formatName:t,formatOptions:n}}(t),a=o.formatName,s=o.formatOptions;if(r.formats[a]){var u=e;try{var l=i&&i.formatParams&&i.formatParams[i.interpolationkey]||{},c=l.locale||l.lng||i.locale||i.lng||n;u=r.formats[a](e,c,XC(XC(XC({},s),i),l))}catch(e){r.logger.warn(e)}return u}return r.logger.warn("there was no format function for ".concat(a)),e}),e);return o}}]),e}();function tx(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function nx(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?tx(Object(n),!0).forEach((function(t){lC(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tx(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function rx(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=uC(e);if(t){var i=uC(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return sC(this,n)}}var ix=function(e){aC(n,e);var t=rx(n);function n(e,r,i){var o,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return eC(this,n),o=t.call(this),CC&&vC.call(iC(o)),o.backend=e,o.store=r,o.services=i,o.languageUtils=i.languageUtils,o.options=a,o.logger=gC.create("backendConnector"),o.waitingReads=[],o.maxParallelReads=a.maxParallelReads||10,o.readingCalls=0,o.maxRetries=a.maxRetries>=0?a.maxRetries:5,o.retryTimeout=a.retryTimeout>=1?a.retryTimeout:350,o.state={},o.queue=[],o.backend&&o.backend.init&&o.backend.init(i,a.backend,a),o}return rC(n,[{key:"queueLoad",value:function(e,t,n,r){var i=this,o={},a={},s={},u={};return e.forEach((function(e){var r=!0;t.forEach((function(t){var s="".concat(e,"|").concat(t);!n.reload&&i.store.hasResourceBundle(e,t)?i.state[s]=2:i.state[s]<0||(1===i.state[s]?void 0===a[s]&&(a[s]=!0):(i.state[s]=1,r=!1,void 0===a[s]&&(a[s]=!0),void 0===o[s]&&(o[s]=!0),void 0===u[t]&&(u[t]=!0)))})),r||(s[e]=!0)})),(Object.keys(o).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(o),pending:Object.keys(a),toLoadLanguages:Object.keys(s),toLoadNamespaces:Object.keys(u)}}},{key:"loaded",value:function(e,t,n){var r=e.split("|"),i=r[0],o=r[1];t&&this.emit("failedLoading",i,o,t),n&&this.store.addResourceBundle(i,o,n),this.state[e]=t?-1:2;var a={};this.queue.forEach((function(n){!function(e,t,n,r){var i=wC(e,t,Object),o=i.obj,a=i.k;o[a]=o[a]||[],r&&(o[a]=o[a].concat(n)),r||o[a].push(n)}(n.loaded,[i],o),function(e,t){void 0!==e.pending[t]&&(delete e.pending[t],e.pendingCount--)}(n,e),t&&n.errors.push(t),0!==n.pendingCount||n.done||(Object.keys(n.loaded).forEach((function(e){a[e]||(a[e]={});var t=n.loaded[e];t.length&&t.forEach((function(t){void 0===a[e][t]&&(a[e][t]=!0)}))})),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())})),this.emit("loaded",a),this.queue=this.queue.filter((function(e){return!e.done}))}},{key:"read",value:function(e,t,n){var r=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.retryTimeout,a=arguments.length>5?arguments[5]:void 0;if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads)this.waitingReads.push({lng:e,ns:t,fcName:n,tried:i,wait:o,callback:a});else{this.readingCalls++;var s=function(s,u){if(r.readingCalls--,r.waitingReads.length>0){var l=r.waitingReads.shift();r.read(l.lng,l.ns,l.fcName,l.tried,l.wait,l.callback)}s&&u&&i<r.maxRetries?setTimeout((function(){r.read.call(r,e,t,n,i+1,2*o,a)}),o):a(s,u)},u=this.backend[n].bind(this.backend);if(2!==u.length)return u(e,t,s);try{var l=u(e,t);l&&"function"==typeof l.then?l.then((function(e){return s(null,e)})).catch(s):s(null,l)}catch(e){s(e)}}}},{key:"prepareLoading",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();"string"==typeof e&&(e=this.languageUtils.toResolveHierarchy(e)),"string"==typeof t&&(t=[t]);var o=this.queueLoad(e,t,r,i);if(!o.toLoad.length)return o.pending.length||i(),null;o.toLoad.forEach((function(e){n.loadOne(e)}))}},{key:"load",value:function(e,t,n){this.prepareLoading(e,t,{},n)}},{key:"reload",value:function(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}},{key:"loadOne",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=e.split("|"),i=r[0],o=r[1];this.read(i,o,"read",void 0,void 0,(function(r,a){r&&t.logger.warn("".concat(n,"loading namespace ").concat(o," for language ").concat(i," failed"),r),!r&&a&&t.logger.log("".concat(n,"loaded namespace ").concat(o," for language ").concat(i),a),t.loaded(e,r,a)}))}},{key:"saveMissing",value:function(e,t,n,r,i){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:function(){};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(t))this.logger.warn('did not save key "'.concat(n,'" as the namespace "').concat(t,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");else if(null!=n&&""!==n){if(this.backend&&this.backend.create){var s=nx(nx({},o),{},{isUpdate:i}),u=this.backend.create.bind(this.backend);if(u.length<6)try{var l;(l=5===u.length?u(e,t,n,r,s):u(e,t,n,r))&&"function"==typeof l.then?l.then((function(e){return a(null,e)})).catch(a):a(null,l)}catch(e){a(e)}else u(e,t,n,r,a,s)}e&&e[0]&&this.store.addResource(e[0],t,n,r)}}}]),n}(vC);function ox(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){var t={};if("object"===JM(e[1])&&(t=e[1]),"string"==typeof e[1]&&(t.defaultValue=e[1]),"string"==typeof e[2]&&(t.tDescription=e[2]),"object"===JM(e[2])||"object"===JM(e[3])){var n=e[3]||e[2];Object.keys(n).forEach((function(e){t[e]=n[e]}))}return t},interpolation:{escapeValue:!0,format:function(e,t,n,r){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function ax(e){return"string"==typeof e.ns&&(e.ns=[e.ns]),"string"==typeof e.fallbackLng&&(e.fallbackLng=[e.fallbackLng]),"string"==typeof e.fallbackNS&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function sx(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ux(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?sx(Object(n),!0).forEach((function(t){lC(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sx(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function lx(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=uC(e);if(t){var i=uC(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return sC(this,n)}}function cx(){}var dx=function(e){aC(n,e);var t=lx(n);function n(){var e,r,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1?arguments[1]:void 0;if(eC(this,n),e=t.call(this),CC&&vC.call(iC(e)),e.options=ax(i),e.services={},e.logger=gC,e.modules={external:[]},r=iC(e),Object.getOwnPropertyNames(Object.getPrototypeOf(r)).forEach((function(e){"function"==typeof r[e]&&(r[e]=r[e].bind(r))})),o&&!e.isInitialized&&!i.isClone){if(!e.options.initImmediate)return e.init(i,o),sC(e,iC(e));setTimeout((function(){e.init(i,o)}),0)}return e}return rC(n,[{key:"init",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;"function"==typeof t&&(n=t,t={}),!t.defaultNS&&!1!==t.defaultNS&&t.ns&&("string"==typeof t.ns?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));var r=ox();function i(e){return e?"function"==typeof e?new e:e:null}if(this.options=ux(ux(ux({},r),this.options),ax(t)),"v1"!==this.options.compatibilityAPI&&(this.options.interpolation=ux(ux({},r.interpolation),this.options.interpolation)),void 0!==t.keySeparator&&(this.options.userDefinedKeySeparator=t.keySeparator),void 0!==t.nsSeparator&&(this.options.userDefinedNsSeparator=t.nsSeparator),!this.options.isClone){var o;this.modules.logger?gC.init(i(this.modules.logger),this.options):gC.init(null,this.options),this.modules.formatter?o=this.modules.formatter:"undefined"!=typeof Intl&&(o=ex);var a=new FC(this.options);this.store=new LC(this.options.resources,this.options);var s=this.services;s.logger=gC,s.resourceStore=this.store,s.languageUtils=a,s.pluralResolver=new HC(a,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),!o||this.options.interpolation.format&&this.options.interpolation.format!==r.interpolation.format||(s.formatter=i(o),s.formatter.init(s,this.options),this.options.interpolation.format=s.formatter.format.bind(s.formatter)),s.interpolator=new QC(this.options),s.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},s.backendConnector=new ix(i(this.modules.backend),s.resourceStore,s,this.options),s.backendConnector.on("*",(function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];e.emit.apply(e,[t].concat(r))})),this.modules.languageDetector&&(s.languageDetector=i(this.modules.languageDetector),s.languageDetector.init&&s.languageDetector.init(s,this.options.detection,this.options)),this.modules.i18nFormat&&(s.i18nFormat=i(this.modules.i18nFormat),s.i18nFormat.init&&s.i18nFormat.init(this)),this.translator=new UC(this.services,this.options),this.translator.on("*",(function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];e.emit.apply(e,[t].concat(r))})),this.modules.external.forEach((function(t){t.init&&t.init(e)}))}if(this.format=this.options.interpolation.format,n||(n=cx),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){var u=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);u.length>0&&"dev"!==u[0]&&(this.options.lng=u[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach((function(t){e[t]=function(){var n;return(n=e.store)[t].apply(n,arguments)}})),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach((function(t){e[t]=function(){var n;return(n=e.store)[t].apply(n,arguments),e}}));var l=yC(),c=function(){var t=function(t,r){e.isInitialized&&!e.initializedStoreOnce&&e.logger.warn("init: i18next is already initialized. You should call init just once!"),e.isInitialized=!0,e.options.isClone||e.logger.log("initialized",e.options),e.emit("initialized",e.options),l.resolve(r),n(t,r)};if(e.languages&&"v1"!==e.options.compatibilityAPI&&!e.isInitialized)return t(null,e.t.bind(e));e.changeLanguage(e.options.lng,t)};return this.options.resources||!this.options.initImmediate?c():setTimeout(c,0),l}},{key:"loadResources",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:cx,r="string"==typeof e?e:this.language;if("function"==typeof e&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if(r&&"cimode"===r.toLowerCase())return n();var i=[],o=function(e){e&&t.services.languageUtils.toResolveHierarchy(e).forEach((function(e){i.indexOf(e)<0&&i.push(e)}))};r?o(r):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((function(e){return o(e)})),this.options.preload&&this.options.preload.forEach((function(e){return o(e)})),this.services.backendConnector.load(i,this.options.ns,(function(e){e||t.resolvedLanguage||!t.language||t.setResolvedLanguage(t.language),n(e)}))}else n(null)}},{key:"reloadResources",value:function(e,t,n){var r=yC();return e||(e=this.languages),t||(t=this.options.ns),n||(n=cx),this.services.backendConnector.reload(e,t,(function(e){r.resolve(),n(e)})),r}},{key:"use",value:function(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&IC.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}},{key:"setResolvedLanguage",value:function(e){if(e&&this.languages&&!(["cimode","dev"].indexOf(e)>-1))for(var t=0;t<this.languages.length;t++){var n=this.languages[t];if(!(["cimode","dev"].indexOf(n)>-1)&&this.store.hasLanguageSomeTranslations(n)){this.resolvedLanguage=n;break}}}},{key:"changeLanguage",value:function(e,t){var n=this;this.isLanguageChangingTo=e;var r=yC();this.emit("languageChanging",e);var i=function(e){n.language=e,n.languages=n.services.languageUtils.toResolveHierarchy(e),n.resolvedLanguage=void 0,n.setResolvedLanguage(e)},o=function(o){e||o||!n.services.languageDetector||(o=[]);var a="string"==typeof o?o:n.services.languageUtils.getBestMatchFromCodes(o);a&&(n.language||i(a),n.translator.language||n.translator.changeLanguage(a),n.services.languageDetector&&n.services.languageDetector.cacheUserLanguage&&n.services.languageDetector.cacheUserLanguage(a)),n.loadResources(a,(function(e){!function(e,o){o?(i(o),n.translator.changeLanguage(o),n.isLanguageChangingTo=void 0,n.emit("languageChanged",o),n.logger.log("languageChanged",o)):n.isLanguageChangingTo=void 0,r.resolve((function(){return n.t.apply(n,arguments)})),t&&t(e,(function(){return n.t.apply(n,arguments)}))}(e,a)}))};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?0===this.services.languageDetector.detect.length?this.services.languageDetector.detect().then(o):this.services.languageDetector.detect(o):o(e):o(this.services.languageDetector.detect()),r}},{key:"getFixedT",value:function(e,t,n){var r=this,i=function e(t,i){var o;if("object"!==JM(i)){for(var a=arguments.length,s=new Array(a>2?a-2:0),u=2;u<a;u++)s[u-2]=arguments[u];o=r.options.overloadTranslationOptionHandler([t,i].concat(s))}else o=ux({},i);o.lng=o.lng||e.lng,o.lngs=o.lngs||e.lngs,o.ns=o.ns||e.ns,o.keyPrefix=o.keyPrefix||n||e.keyPrefix;var l,c=r.options.keySeparator||".";return l=o.keyPrefix&&Array.isArray(t)?t.map((function(e){return"".concat(o.keyPrefix).concat(c).concat(e)})):o.keyPrefix?"".concat(o.keyPrefix).concat(c).concat(t):t,r.t(l,o)};return"string"==typeof e?i.lng=e:i.lngs=e,i.ns=t,i.keyPrefix=n,i}},{key:"t",value:function(){var e;return this.translator&&(e=this.translator).translate.apply(e,arguments)}},{key:"exists",value:function(){var e;return this.translator&&(e=this.translator).exists.apply(e,arguments)}},{key:"setDefaultNamespace",value:function(e){this.options.defaultNS=e}},{key:"hasLoadedNamespace",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var r=n.lng||this.resolvedLanguage||this.languages[0],i=!!this.options&&this.options.fallbackLng,o=this.languages[this.languages.length-1];if("cimode"===r.toLowerCase())return!0;var a=function(e,n){var r=t.services.backendConnector.state["".concat(e,"|").concat(n)];return-1===r||2===r};if(n.precheck){var s=n.precheck(this,a);if(void 0!==s)return s}return!!this.hasResourceBundle(r,e)||!(this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages))||!(!a(r,e)||i&&!a(o,e))}},{key:"loadNamespaces",value:function(e,t){var n=this,r=yC();return this.options.ns?("string"==typeof e&&(e=[e]),e.forEach((function(e){n.options.ns.indexOf(e)<0&&n.options.ns.push(e)})),this.loadResources((function(e){r.resolve(),t&&t(e)})),r):(t&&t(),Promise.resolve())}},{key:"loadLanguages",value:function(e,t){var n=yC();"string"==typeof e&&(e=[e]);var r=this.options.preload||[],i=e.filter((function(e){return r.indexOf(e)<0}));return i.length?(this.options.preload=r.concat(i),this.loadResources((function(e){n.resolve(),t&&t(e)})),n):(t&&t(),Promise.resolve())}},{key:"dir",value:function(e){if(e||(e=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!e)return"rtl";var t=this.services&&this.services.languageUtils||new FC(ox());return["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(t.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}},{key:"cloneInstance",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:cx,i=ux(ux(ux({},this.options),t),{isClone:!0}),o=new n(i);return void 0===t.debug&&void 0===t.prefix||(o.logger=o.logger.clone(t)),["store","services","language"].forEach((function(t){o[t]=e[t]})),o.services=ux({},this.services),o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o.translator=new UC(o.services,o.options),o.translator.on("*",(function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];o.emit.apply(o,[e].concat(n))})),o.init(i,r),o.translator.options=o.options,o.translator.backendConnector.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o}},{key:"toJSON",value:function(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}]),n}(vC);lC(dx,"createInstance",(function(){return new dx(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},arguments.length>1?arguments[1]:void 0)}));var fx=dx.createInstance();fx.createInstance=dx.createInstance;var hx=fx.createInstance;fx.dir,fx.init,fx.loadResources,fx.reloadResources,fx.use,fx.changeLanguage,fx.getFixedT,fx.t,fx.exists,fx.setDefaultNamespace,fx.hasLoadedNamespace,fx.loadNamespaces,fx.loadLanguages;var px="0.14.1";const mx={eth_requestAccounts:!0,eth_sendTransaction:!0,eth_signTransaction:!0,eth_sign:!0,eth_accounts:!0,personal_sign:!0,eth_signTypedData:!0,eth_signTypedData_v3:!0,eth_signTypedData_v4:!0,wallet_watchAsset:!0,wallet_addEthereumChain:!0,wallet_switchEthereumChain:!0,metamask_connectSign:!0,metamask_connectWith:!0,metamask_batch:!0,metamask_open:!0},gx=".sdk-comm",vx="providerType",yx={METAMASK_GETPROVIDERSTATE:"metamask_getProviderState",METAMASK_CONNECTSIGN:"metamask_connectSign",METAMASK_CONNECTWITH:"metamask_connectWith",METAMASK_OPEN:"metamask_open",METAMASK_BATCH:"metamask_batch",PERSONAL_SIGN:"personal_sign",ETH_REQUESTACCOUNTS:"eth_requestAccounts",ETH_ACCOUNTS:"eth_accounts",ETH_CHAINID:"eth_chainId"},bx={CHAIN_CHANGED:"chainChanged",ACCOUNTS_CHANGED:"accountsChanged",DISCONNECT:"disconnect",CONNECT:"connect",CONNECTED:"connected"};var wx,Ax,_x,Ex,Sx;function kx(e){var n,r;return fA(this,void 0,void 0,(function*(){e.debug&&console.debug("SDK::connectWithExtensionProvider()",e),e.sdkProvider=e.activeProvider,e.activeProvider=window.extension,window.ethereum=window.extension;try{const t=yield null===(n=window.extension)||void 0===n?void 0:n.request({method:"eth_requestAccounts"});e.debug&&console.debug("SDK::connectWithExtensionProvider() accounts",t)}catch(e){return void console.warn("SDK::connectWithExtensionProvider() can't request accounts error",e)}localStorage.setItem(vx,"extension"),e.extensionActive=!0,e.emit(t.EventType.PROVIDER_UPDATE,t.PROVIDER_UPDATE_TYPE.EXTENSION),null===(r=e.analytics)||void 0===r||r.send({event:Zw.SDK_USE_EXTENSION})}))}t.PROVIDER_UPDATE_TYPE=void 0,(wx=t.PROVIDER_UPDATE_TYPE||(t.PROVIDER_UPDATE_TYPE={})).TERMINATE="terminate",wx.EXTENSION="extension",wx.INITIALIZED="initialized";const Mx={DEFAULT_ID:"sdk",NO_VERSION:"NONE"};class Cx{constructor(e){var t;Ax.set(this,void 0),_x.set(this,Dw),Ex.set(this,void 0),Sx.set(this,void 0),pA(this,Ax,e.debug,"f"),pA(this,_x,e.serverURL,"f"),pA(this,Sx,e.metadata||void 0,"f"),pA(this,Ex,null===(t=e.enabled)||void 0===t||t,"f")}send({event:e}){hA(this,Ex,"f")&&fn({id:Mx.DEFAULT_ID,event:e,commLayerVersion:Mx.NO_VERSION,originationInfo:hA(this,Sx,"f")},hA(this,_x,"f")).catch((e=>{hA(this,Ax,"f")&&console.error(e)}))}}var xx;Ax=new WeakMap,_x=new WeakMap,Ex=new WeakMap,Sx=new WeakMap,function(e){e.INPAGE="metamask-inpage",e.CONTENT_SCRIPT="metamask-contentscript",e.PROVIDER="metamask-provider"}(xx||(xx={}));const Rx="https://metamask.app.link/connect",Ox="metamask://connect",Tx={NAME:"MetaMask Main",RDNS:"io.metamask"},Px=/(?:^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}$)|(?:^0{8}-0{4}-0{4}-0{4}-0{12}$)/u,Lx=36e5;class Ix{constructor({shouldSetOnWindow:e,connectionStream:t,shouldSendMetadata:n=!1,shouldShimWeb3:r,debug:i=!1}){this.debug=!1,this.debug=i;const o=new QM({connectionStream:t,shouldSendMetadata:n,shouldSetOnWindow:e,shouldShimWeb3:r,autoRequestAccounts:!1,debug:i});this.debug=i;const a=new Proxy(o,{deleteProperty:()=>!0});this.provider=a,e&&"undefined"!=typeof window&&mA.setGlobalProvider(this.provider),r&&"undefined"!=typeof window&&mA.shimWeb3(this.provider),this.provider.on("_initialized",(()=>{const e={chainId:this.provider.chainId,isConnected:this.provider.isConnected(),isMetaNask:this.provider.isMetaMask,selectedAddress:this.provider.selectedAddress,networkVersion:this.provider.networkVersion};this.debug&&console.info("Ethereum provider initialized",e)}))}static init(e){var t;return e.debug&&console.debug("Ethereum::init()"),this.instance=new Ix(e),null===(t=this.instance)||void 0===t?void 0:t.provider}static destroy(){Ix.instance=void 0}static getInstance(){var e;if(!(null===(e=this.instance)||void 0===e?void 0:e.provider))throw new Error("Ethereum instance not intiialized - call Ethereum.factory first.");return this.instance}static getProvider(){var e;if(!(null===(e=this.instance)||void 0===e?void 0:e.provider))throw new Error("Ethereum instance not intiialized - call Ethereum.factory first.");return this.instance.provider}}function Nx(e,t,n,r){var i,o,a,s,u,l,c,d,f,h,p,m,g,v;return fA(this,void 0,void 0,(function*(){const n=null===(i=e.state.remote)||void 0===i?void 0:i.isReady(),y=null===(o=e.state.remote)||void 0===o?void 0:o.isConnected(),b=null===(a=e.state.remote)||void 0===a?void 0:a.isPaused(),w=Ix.getProvider(),A=null===(s=e.state.remote)||void 0===s?void 0:s.getChannelId(),_=null===(u=e.state.remote)||void 0===u?void 0:u.isAuthorized(),{method:E,data:S}=(e=>{var t;let n;return Ke.isBuffer(e)?(n=e.toJSON(),n._isBuffer=!0):n=e,{method:null===(t=null==n?void 0:n.data)||void 0===t?void 0:t.method,data:n}})(t);if(e.state.debug&&console.debug(`RPCMS::_write method='${E}' isRemoteReady=${n} channelId=${A} isSocketConnected=${y} isRemotePaused=${b} providerConnected=${w.isConnected()}`,t),!A)return e.state.debug&&E!==yx.METAMASK_GETPROVIDERSTATE&&console.warn("RPCMS::_write Invalid channel id -- undefined"),r();e.state.debug&&console.debug(`RPCMS::_write remote.isPaused()=${null===(l=e.state.remote)||void 0===l?void 0:l.isPaused()} authorized=${_} ready=${n} socketConnected=${y}`,t);try{if(null===(c=e.state.remote)||void 0===c||c.sendMessage(null==S?void 0:S.data).then((()=>{e.state.debug&&console.debug(`RCPMS::_write ${E} sent successfully`)})).catch((e=>{console.error("RCPMS::_write error sending message",e)})),!(null===(d=e.state.platformManager)||void 0===d?void 0:d.isSecure()))return e.state.debug&&console.log(`RCPMS::_write unsecure platform for method ${E} -- return callback`),r();if(!y&&!n)return e.state.debug&&console.debug(`RCPMS::_write invalid connection status targetMethod=${E} socketConnected=${y} ready=${n} providerConnected=${w.isConnected()}\n\n`),r();if(!y&&n)return console.warn("RCPMS::_write invalid socket status -- shouln't happen"),r();const t=null!==(p=null===(h=null===(f=e.state.remote)||void 0===f?void 0:f.getKeyInfo())||void 0===h?void 0:h.ecies.public)&&void 0!==p?p:"",i=encodeURI(`channelId=${A}&pubkey=${t}&comm=socket&t=d`);mx[E]?(e.state.debug&&console.debug(`RCPMS::_write redirect link for '${E}' socketConnected=${y}`,`connect?${i}`),null===(m=e.state.platformManager)||void 0===m||m.openDeeplink(`${Rx}?${i}`,`${Ox}?${i}`,"_self")):(null===(g=e.state.remote)||void 0===g?void 0:g.isPaused())?(e.state.debug&&console.debug(`RCPMS::_write MM is PAUSED! deeplink with connect! targetMethod=${E}`),null===(v=e.state.platformManager)||void 0===v||v.openDeeplink(`${Rx}?redirect=true&${i}`,`${Ox}?redirect=true&${i}`,"_self")):console.debug(`RCPMS::_write method ${E} doesn't need redirect.`)}catch(t){return e.state.debug&&console.error("RCPMS::_write error",t),r(new Error("RemoteCommunicationPostMessageStream - disconnected"))}return r()}))}class Dx extends oS{constructor({name:e,remote:n,platformManager:r,debug:i}){super({objectMode:!0}),this.state={_name:null,remote:null,platformManager:null,debug:!1},this.state._name=e,this.state.remote=n,this.state.debug=i,this.state.platformManager=r,this._onMessage=this._onMessage.bind(this),this.state.remote.on(t.EventType.MESSAGE,this._onMessage)}_write(e,t,n){return fA(this,void 0,void 0,(function*(){return Nx(this,e,0,n)}))}_read(){}_onMessage(e){return function(e,t){try{if(e.state.debug&&console.debug("[RCPMS] _onMessage ",t),!t||"object"!=typeof t)return;if("object"!=typeof(null==t?void 0:t.data))return;if(!(null==t?void 0:t.name))return;if((null==t?void 0:t.name)!==xx.PROVIDER)return;if(Ke.isBuffer(t)){const n=Ke.from(t);e.push(n)}else e.push(t)}catch(t){e.state.debug&&console.debug("RCPMS ignore message error",t)}}(this,e)}start(){}}var Bx={exports:{}};!function(e,t){var n="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==r&&r,i=function(){function e(){this.fetch=!1,this.DOMException=n.DOMException}return e.prototype=n,new e}();!function(e){!function(t){var n=void 0!==e&&e||"undefined"!=typeof self&&self||void 0!==n&&n,r="URLSearchParams"in n,i="Symbol"in n&&"iterator"in Symbol,o="FileReader"in n&&"Blob"in n&&function(){try{return new Blob,!0}catch(e){return!1}}(),a="FormData"in n,s="ArrayBuffer"in n;if(s)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],l=ArrayBuffer.isView||function(e){return e&&u.indexOf(Object.prototype.toString.call(e))>-1};function c(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||""===e)throw new TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function d(e){return"string"!=typeof e&&(e=String(e)),e}function f(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return i&&(t[Symbol.iterator]=function(){return t}),t}function h(e){this.map={},e instanceof h?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function p(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function m(e){return new Promise((function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function g(e){var t=new FileReader,n=m(t);return t.readAsArrayBuffer(e),n}function v(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function y(){return this.bodyUsed=!1,this._initBody=function(e){var t;this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:o&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:a&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:r&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():s&&o&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=v(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(e)||l(e))?this._bodyArrayBuffer=v(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},o&&(this.blob=function(){var e=p(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?p(this)||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer)):this.blob().then(g)}),this.text=function(){var e,t,n,r=p(this);if(r)return r;if(this._bodyBlob)return e=this._bodyBlob,n=m(t=new FileReader),t.readAsText(e),n;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=new Array(t.length),r=0;r<t.length;r++)n[r]=String.fromCharCode(t[r]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},a&&(this.formData=function(){return this.text().then(A)}),this.json=function(){return this.text().then(JSON.parse)},this}h.prototype.append=function(e,t){e=c(e),t=d(t);var n=this.map[e];this.map[e]=n?n+", "+t:t},h.prototype.delete=function(e){delete this.map[c(e)]},h.prototype.get=function(e){return e=c(e),this.has(e)?this.map[e]:null},h.prototype.has=function(e){return this.map.hasOwnProperty(c(e))},h.prototype.set=function(e,t){this.map[c(e)]=d(t)},h.prototype.forEach=function(e,t){for(var n in this.map)this.map.hasOwnProperty(n)&&e.call(t,this.map[n],n,this)},h.prototype.keys=function(){var e=[];return this.forEach((function(t,n){e.push(n)})),f(e)},h.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),f(e)},h.prototype.entries=function(){var e=[];return this.forEach((function(t,n){e.push([n,t])})),f(e)},i&&(h.prototype[Symbol.iterator]=h.prototype.entries);var b=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function w(e,t){if(!(this instanceof w))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');var n=(t=t||{}).body;if(e instanceof w){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new h(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,n||null==e._bodyInit||(n=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new h(t.headers)),this.method=function(e){var t=e.toUpperCase();return b.indexOf(t)>-1?t:e}(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(n),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==t.cache&&"no-cache"!==t.cache)){var r=/([?&])_=[^&]*/;r.test(this.url)?this.url=this.url.replace(r,"$1_="+(new Date).getTime()):this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}function A(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(i))}})),t}function _(e,t){if(!(this instanceof _))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText=void 0===t.statusText?"":""+t.statusText,this.headers=new h(t.headers),this.url=t.url||"",this._initBody(e)}w.prototype.clone=function(){return new w(this,{body:this._bodyInit})},y.call(w.prototype),y.call(_.prototype),_.prototype.clone=function(){return new _(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},_.error=function(){var e=new _(null,{status:0,statusText:""});return e.type="error",e};var E=[301,302,303,307,308];_.redirect=function(e,t){if(-1===E.indexOf(t))throw new RangeError("Invalid status code");return new _(null,{status:t,headers:{location:e}})},t.DOMException=n.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function S(e,r){return new Promise((function(i,a){var u=new w(e,r);if(u.signal&&u.signal.aborted)return a(new t.DOMException("Aborted","AbortError"));var l=new XMLHttpRequest;function c(){l.abort()}l.onload=function(){var e,t,n={status:l.status,statusText:l.statusText,headers:(e=l.getAllResponseHeaders()||"",t=new h,e.replace(/\r?\n[\t ]+/g," ").split("\r").map((function(e){return 0===e.indexOf("\n")?e.substr(1,e.length):e})).forEach((function(e){var n=e.split(":"),r=n.shift().trim();if(r){var i=n.join(":").trim();t.append(r,i)}})),t)};n.url="responseURL"in l?l.responseURL:n.headers.get("X-Request-URL");var r="response"in l?l.response:l.responseText;setTimeout((function(){i(new _(r,n))}),0)},l.onerror=function(){setTimeout((function(){a(new TypeError("Network request failed"))}),0)},l.ontimeout=function(){setTimeout((function(){a(new TypeError("Network request failed"))}),0)},l.onabort=function(){setTimeout((function(){a(new t.DOMException("Aborted","AbortError"))}),0)},l.open(u.method,function(e){try{return""===e&&n.location.href?n.location.href:e}catch(t){return e}}(u.url),!0),"include"===u.credentials?l.withCredentials=!0:"omit"===u.credentials&&(l.withCredentials=!1),"responseType"in l&&(o?l.responseType="blob":s&&u.headers.get("Content-Type")&&-1!==u.headers.get("Content-Type").indexOf("application/octet-stream")&&(l.responseType="arraybuffer")),!r||"object"!=typeof r.headers||r.headers instanceof h?u.headers.forEach((function(e,t){l.setRequestHeader(t,e)})):Object.getOwnPropertyNames(r.headers).forEach((function(e){l.setRequestHeader(e,d(r.headers[e]))})),u.signal&&(u.signal.addEventListener("abort",c),l.onreadystatechange=function(){4===l.readyState&&u.signal.removeEventListener("abort",c)}),l.send(void 0===u._bodyInit?null:u._bodyInit)}))}S.polyfill=!0,n.fetch||(n.fetch=S,n.Headers=h,n.Request=w,n.Response=_),t.Headers=h,t.Request=w,t.Response=_,t.fetch=S}({})}(i),i.fetch.ponyfill=!0,delete i.fetch.polyfill;var o=n.fetch?n:i;(t=o.fetch).default=o.fetch,t.fetch=o.fetch,t.Headers=o.Headers,t.Request=o.Request,t.Response=o.Response,e.exports=t}(Bx,Bx.exports);var jx=i(Bx.exports);let Ux=1;const zx=e=>new Promise((t=>{setTimeout((()=>{t(!0)}),e)})),Fx=({checkInstallationOnAllCalls:e=!1,communicationLayerPreference:n,injectProvider:r,shouldShimWeb3:i,platformManager:o,installer:a,sdk:s,remoteConnection:u,debug:l})=>{var c;const d=(({name:e,remoteConnection:t,debug:n})=>{if(!t||!(null==t?void 0:t.getConnector()))throw new Error("Missing remote connection parameter");return new Dx({name:e,remote:null==t?void 0:t.getConnector(),platformManager:null==t?void 0:t.getPlatformManager(),debug:n})})({name:xx.INPAGE,target:xx.CONTENT_SCRIPT,platformManager:o,communicationLayerPreference:n,remoteConnection:u,debug:l}),f=o.getPlatformType(),h=s.options.dappMetadata,p=`Sdk/Javascript SdkVersion/${px} Platform/${f} dApp/${null!==(c=h.url)&&void 0!==c?c:h.name}`;let m=null,g=null;const v=!(!r||f===t.PlatformType.NonBrowser||f===t.PlatformType.ReactNative),y=Ix.init({shouldSetOnWindow:v,connectionStream:d,shouldShimWeb3:i,debug:l});let b=!1;const w=e=>{b=e},A=()=>b,_=(n,r,i,c)=>fA(void 0,void 0,void 0,(function*(){var d,f,h,v,y,_,E,S,k,M,C;if(b){null==u||u.showActiveModal();let e=A();for(;e;)yield zx(1e3),e=A();return l&&console.debug("initializeProvider::sendRequest() initial method completed -- prevent installation and call provider"),i(...r)}const x=o.isMetaMaskInstalled(),R=null==u?void 0:u.isConnected();let{selectedAddress:O,chainId:T}=Ix.getProvider();if(O=null!=O?O:m,T=null!==(d=null!=T?T:g)&&void 0!==d?d:s.defaultReadOnlyChainId,O&&(m=O),T&&(g=T),c&&console.debug(`initializeProvider::sendRequest() method=${n} ongoing=${b} selectedAddress=${O} isInstalled=${x} checkInstallationOnAllCalls=${e} socketConnected=${R}`),O&&n.toLowerCase()===yx.ETH_ACCOUNTS.toLowerCase())return[O];if(T&&n.toLowerCase()===yx.ETH_CHAINID.toLowerCase())return T;const P=[yx.ETH_REQUESTACCOUNTS,yx.METAMASK_CONNECTSIGN,yx.METAMASK_CONNECTWITH],L=!mx[n],I=null===(f=s.options.readonlyRPCMap)||void 0===f?void 0:f[T];if(I&&L)try{const e=null===(h=null==r?void 0:r[0])||void 0===h?void 0:h.params,t=yield(({rpcEndpoint:e,method:t,sdkInfo:n,params:r})=>fA(void 0,void 0,void 0,(function*(){const i=JSON.stringify({jsonrpc:"2.0",method:t,params:r,id:(Ux+=1,Ux)}),o={Accept:"application/json","Content-Type":"application/json"};let a;e.includes("infura")&&(o["Metamask-Sdk-Info"]=n);try{a=yield jx(e,{method:"POST",headers:o,body:i})}catch(e){throw e instanceof Error?new Error(`Failed to fetch from RPC: ${e.message}`):new Error(`Failed to fetch from RPC: ${e}`)}if(!a.ok)throw new Error(`Server responded with a status of ${a.status}`);return(yield a.json()).result})))({rpcEndpoint:I,sdkInfo:p,method:n,params:e||[]});return c&&console.log("initializeProvider::ReadOnlyRPCResponse",t),t}catch(e){console.warn(`initializeProvider::sendRequest() method=${n} readOnlyRPCRequest failed:`,e)}if((!x||x&&!R)&&n!==yx.METAMASK_GETPROVIDERSTATE){if(-1!==P.indexOf(n)||e){w(!0);try{yield a.start({wait:!1})}catch(e){if(w(!1),t.PROVIDER_UPDATE_TYPE.EXTENSION===e){if(l&&console.debug(`initializeProvider extension provider detect: re-create ${n} on the active provider`),n.toLowerCase()===yx.METAMASK_CONNECTSIGN.toLowerCase()){const[e]=r,{params:t}=e,n=yield null===(v=s.getProvider())||void 0===v?void 0:v.request({method:yx.ETH_REQUESTACCOUNTS,params:[]});if(!n.length)throw new Error("SDK state invalid -- undefined accounts");return yield null===(y=s.getProvider())||void 0===y?void 0:y.request({method:yx.PERSONAL_SIGN,params:[t[0],n[0]]})}if(n.toLowerCase()===yx.METAMASK_CONNECTWITH.toLowerCase()){const e=yield null===(_=s.getProvider())||void 0===_?void 0:_.request({method:yx.ETH_REQUESTACCOUNTS,params:[]});if(!e.length)throw new Error("SDK state invalid -- undefined accounts");const[t]=r;console.log("connectWith:: initialMethod",t);const{params:n}=t,[i]=n;if(console.warn("FIXME:: handle CONNECT_WITH",i),(null===(E=i.method)||void 0===E?void 0:E.toLowerCase())===yx.PERSONAL_SIGN.toLowerCase()){const t={method:i.method,params:[i.params[0],e[0]]};return console.log("connectWith:: connectedRpc",t),yield null===(S=s.getProvider())||void 0===S?void 0:S.request(t)}console.warn("FIXME:: handle CONNECT_WITH",i)}return yield null===(k=s.getProvider())||void 0===k?void 0:k.request({method:n,params:r})}throw l&&console.debug(`initializeProvider failed to start installer: ${e}`),e}const e=i(...r);try{yield new Promise(((e,n)=>{null==u||u.getConnector().once(t.EventType.AUTHORIZED,(()=>{e(!0)})),s.once(t.EventType.PROVIDER_UPDATE,(e=>{l&&console.debug("initializeProvider::sendRequest() PROVIDER_UPDATE --- remote provider request interupted",e),e===t.PROVIDER_UPDATE_TYPE.EXTENSION?n(t.EventType.PROVIDER_UPDATE):n(new Error("Connection Terminated"))}))}))}catch(e){if(w(!1),e===t.EventType.PROVIDER_UPDATE)return yield null===(M=s.getProvider())||void 0===M?void 0:M.request({method:n,params:r});throw e}return w(!1),e}if(o.isSecure()&&mx[n])return i(...r);if(s.isExtensionActive())return l&&console.debug(`initializeProvider::sendRequest() EXTENSION active - redirect request '${n}' to it`),yield null===(C=s.getProvider())||void 0===C?void 0:C.request({method:n,params:r});throw l&&console.debug(`initializeProvider::sendRequest() method=${n} --- skip --- not connected/installed`),new Error("MetaMask is not connected/installed, please call eth_requestAccounts to connect first.")}const N=yield i(...r);return l&&console.debug(`initializeProvider::sendRequest() method=${n} rpcResponse:`,N),N})),{request:E}=y;y.request=(...e)=>fA(void 0,void 0,void 0,(function*(){return _(null==e?void 0:e[0].method,e,E,l)}));const{send:S}=y;return y.send=(...e)=>fA(void 0,void 0,void 0,(function*(){return _(null==e?void 0:e[0],e,S,l)})),l&&console.debug("initializeProvider metamaskStream.start()"),d.start(),y};function qx(e){var n,r,i;return fA(this,void 0,void 0,(function*(){const{options:o}=e;e.activeProvider=Fx({communicationLayerPreference:null!==(n=o.communicationLayerPreference)&&void 0!==n?n:t.CommunicationLayerPreference.SOCKET,platformManager:e.platformManager,sdk:e,checkInstallationOnAllCalls:o.checkInstallationOnAllCalls,injectProvider:null===(r=o.injectProvider)||void 0===r||r,shouldShimWeb3:null===(i=o.shouldShimWeb3)||void 0===i||i,installer:e.installer,remoteConnection:e.remoteConnection,debug:e.debug}),function(e){var n,r,i,o;null===(r=null===(n=e.remoteConnection)||void 0===n?void 0:n.getConnector())||void 0===r||r.on(t.EventType.CONNECTION_STATUS,(n=>{e.emit(t.EventType.CONNECTION_STATUS,n)})),null===(o=null===(i=e.remoteConnection)||void 0===i?void 0:i.getConnector())||void 0===o||o.on(t.EventType.SERVICE_STATUS,(n=>{e.emit(t.EventType.SERVICE_STATUS,n)}))}(e)}))}const Wx=()=>{if("undefined"==typeof document)return;let e;const t=document.getElementsByTagName("link");for(let n=0;n<t.length;n++)"icon"!==t[n].getAttribute("rel")&&"shortcut icon"!==t[n].getAttribute("rel")||(e=t[n].getAttribute("href"));return e},Vx=163400,Kx=({provider:e,debug:t})=>{if("state"in e)throw new Error("INVALID EXTENSION PROVIDER");return new Proxy(e,{get:(n,r)=>"request"===r?function(r){return fA(this,void 0,void 0,(function*(){t&&console.debug("[wrapExtensionProvider] Overwriting request method, args:",r);const{method:i,params:o}=r;if(i===yx.METAMASK_BATCH&&Array.isArray(o)){const t=[];for(const n of o){const r=yield null==e?void 0:e.request({method:n.method,params:n.params});t.push(r)}return t}return n.request(r)}))}:n[r]})};var Hx;function $x({mustBeMetaMask:e,debug:t}){return fA(this,void 0,void 0,(function*(){if("undefined"==typeof window)throw new Error("window not available");let n;try{return n=yield new Promise(((e,t)=>{const n=setTimeout((()=>{t(new Error("eip6963RequestProvider timed out"))}),500);window.addEventListener(Hx.Announce,(t=>{const r=t,{detail:{info:i,provider:o}={}}=r,{name:a,rdns:s,uuid:u}=null!=i?i:{};Px.test(u)&&a===Tx.NAME&&s===Tx.RDNS&&(clearTimeout(n),e(o))})),window.dispatchEvent(new Event(Hx.Request))})),Kx({provider:n,debug:t})}catch(n){const{ethereum:r}=window;if(!r)throw new Error("Ethereum not found in window object");if("providers"in r){if(Array.isArray(r.providers)){const n=e?r.providers.find((e=>e.isMetaMask)):r.providers[0];if(!n)throw new Error("No suitable provider found");return Kx({provider:n,debug:t})}}else if(e&&!r.isMetaMask)throw new Error("MetaMask provider not found in Ethereum");return Kx({provider:r,debug:t})}}))}!function(e){e.Announce="eip6963:announceProvider",e.Request="eip6963:requestProvider"}(Hx||(Hx={}));var Yx={exports:{}};!function(e,t){e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=90)}({17:function(e,t,n){t.__esModule=!0,t.default=void 0;var r=n(18),i=function(){function e(){}return e.getFirstMatch=function(e,t){var n=t.match(e);return n&&n.length>0&&n[1]||""},e.getSecondMatch=function(e,t){var n=t.match(e);return n&&n.length>1&&n[2]||""},e.matchAndReturnConst=function(e,t,n){if(e.test(t))return n},e.getWindowsVersionName=function(e){switch(e){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,n,r){void 0===r&&(r=!1);var i=e.getVersionPrecision(t),o=e.getVersionPrecision(n),a=Math.max(i,o),s=0,u=e.map([t,n],(function(t){var n=a-e.getVersionPrecision(t),r=t+new Array(n+1).join(".0");return e.map(r.split("."),(function(e){return new Array(20-e.length).join("0")+e})).reverse()}));for(r&&(s=a-Math.min(i,o)),a-=1;a>=s;){if(u[0][a]>u[1][a])return 1;if(u[0][a]===u[1][a]){if(a===s)return 0;a-=1}else if(u[0][a]<u[1][a])return-1}},e.map=function(e,t){var n,r=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(n=0;n<e.length;n+=1)r.push(t(e[n]));return r},e.find=function(e,t){var n,r;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(n=0,r=e.length;n<r;n+=1){var i=e[n];if(t(i,n))return i}},e.assign=function(e){for(var t,n,r=e,i=arguments.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];if(Object.assign)return Object.assign.apply(Object,[e].concat(o));var s=function(){var e=o[t];"object"==typeof e&&null!==e&&Object.keys(e).forEach((function(t){r[t]=e[t]}))};for(t=0,n=o.length;t<n;t+=1)s();return e},e.getBrowserAlias=function(e){return r.BROWSER_ALIASES_MAP[e]},e.getBrowserTypeByAlias=function(e){return r.BROWSER_MAP[e]||""},e}();t.default=i,e.exports=t.default},18:function(e,t,n){t.__esModule=!0,t.ENGINE_MAP=t.OS_MAP=t.PLATFORMS_MAP=t.BROWSER_MAP=t.BROWSER_ALIASES_MAP=void 0,t.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},t.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},t.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},t.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},t.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(91))&&r.__esModule?r:{default:r},o=n(18);function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var s=function(){function e(){}var t,n,r;return e.getParser=function(e,t){if(void 0===t&&(t=!1),"string"!=typeof e)throw new Error("UserAgent should be a string");return new i.default(e,t)},e.parse=function(e){return new i.default(e).getResult()},t=e,r=[{key:"BROWSER_MAP",get:function(){return o.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return o.ENGINE_MAP}},{key:"OS_MAP",get:function(){return o.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return o.PLATFORMS_MAP}}],(n=null)&&a(t.prototype,n),r&&a(t,r),e}();t.default=s,e.exports=t.default},91:function(e,t,n){t.__esModule=!0,t.default=void 0;var r=u(n(92)),i=u(n(93)),o=u(n(94)),a=u(n(95)),s=u(n(17));function u(e){return e&&e.__esModule?e:{default:e}}var l=function(){function e(e,t){if(void 0===t&&(t=!1),null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},!0!==t&&this.parse()}var t=e.prototype;return t.getUA=function(){return this._ua},t.test=function(e){return e.test(this._ua)},t.parseBrowser=function(){var e=this;this.parsedResult.browser={};var t=s.default.find(r.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.browser=t.describe(this.getUA())),this.parsedResult.browser},t.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},t.getBrowserName=function(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},t.getBrowserVersion=function(){return this.getBrowser().version},t.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},t.parseOS=function(){var e=this;this.parsedResult.os={};var t=s.default.find(i.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.os=t.describe(this.getUA())),this.parsedResult.os},t.getOSName=function(e){var t=this.getOS().name;return e?String(t).toLowerCase()||"":t||""},t.getOSVersion=function(){return this.getOS().version},t.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},t.getPlatformType=function(e){void 0===e&&(e=!1);var t=this.getPlatform().type;return e?String(t).toLowerCase()||"":t||""},t.parsePlatform=function(){var e=this;this.parsedResult.platform={};var t=s.default.find(o.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.platform=t.describe(this.getUA())),this.parsedResult.platform},t.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},t.getEngineName=function(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},t.parseEngine=function(){var e=this;this.parsedResult.engine={};var t=s.default.find(a.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.engine=t.describe(this.getUA())),this.parsedResult.engine},t.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},t.getResult=function(){return s.default.assign({},this.parsedResult)},t.satisfies=function(e){var t=this,n={},r=0,i={},o=0;if(Object.keys(e).forEach((function(t){var a=e[t];"string"==typeof a?(i[t]=a,o+=1):"object"==typeof a&&(n[t]=a,r+=1)})),r>0){var a=Object.keys(n),u=s.default.find(a,(function(e){return t.isOS(e)}));if(u){var l=this.satisfies(n[u]);if(void 0!==l)return l}var c=s.default.find(a,(function(e){return t.isPlatform(e)}));if(c){var d=this.satisfies(n[c]);if(void 0!==d)return d}}if(o>0){var f=Object.keys(i),h=s.default.find(f,(function(e){return t.isBrowser(e,!0)}));if(void 0!==h)return this.compareVersion(i[h])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var n=this.getBrowserName().toLowerCase(),r=e.toLowerCase(),i=s.default.getBrowserTypeByAlias(r);return t&&i&&(r=i.toLowerCase()),r===n},t.compareVersion=function(e){var t=[0],n=e,r=!1,i=this.getBrowserVersion();if("string"==typeof i)return">"===e[0]||"<"===e[0]?(n=e.substr(1),"="===e[1]?(r=!0,n=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?n=e.substr(1):"~"===e[0]&&(r=!0,n=e.substr(1)),t.indexOf(s.default.compareVersions(i,n,r))>-1},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase()},t.is=function(e,t){return void 0===t&&(t=!1),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some((function(e){return t.is(e)}))},e}();t.default=l,e.exports=t.default},92:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=/version\/(\d+(\.?_?\d+)+)/i,a=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},n=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},n=i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},n=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},n=i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},n=i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(e){var t={name:"Opera Touch"},n=i.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},n=i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},n=i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},n=i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},n=i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},n=i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},n=i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},n=i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},n=i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},n=i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return n&&(t.version=n),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},n=i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},n=i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},n=i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},n=i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},n=i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},n=i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},n=i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/electron/i],describe:function(e){var t={name:"Electron"},n=i.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},n=i.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},n=i.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},n=i.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},n=i.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t={name:"Android Browser"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:i.default.getFirstMatch(t,e),version:i.default.getSecondMatch(t,e)}}}];t.default=a,e.exports=t.default},93:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),a=[{test:[/Roku\/DVP/],describe:function(e){var t=i.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:o.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=i.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.WindowsPhone,version:t}}},{test:[/windows /i],describe:function(e){var t=i.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),n=i.default.getWindowsVersionName(t);return{name:o.OS_MAP.Windows,version:t,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:o.OS_MAP.iOS},n=i.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return n&&(t.version=n),t}},{test:[/macintosh/i],describe:function(e){var t=i.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),n=i.default.getMacOSVersionName(t),r={name:o.OS_MAP.MacOS,version:t};return n&&(r.versionName=n),r}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=i.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:o.OS_MAP.iOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t=i.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),n=i.default.getAndroidVersionName(t),r={name:o.OS_MAP.Android,version:t};return n&&(r.versionName=n),r}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=i.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),n={name:o.OS_MAP.WebOS};return t&&t.length&&(n.version=t),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=i.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||i.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||i.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:o.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=i.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:o.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:o.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.PlayStation4,version:t}}}];t.default=a,e.exports=t.default},94:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),a=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(e){var t=i.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",n={type:o.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(n.model=t),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),n=e.test(/like (ipod|iphone)/i);return t&&!n},describe:function(e){var t=i.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:o.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}}];t.default=a,e.exports=t.default},95:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),a=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:o.ENGINE_MAP.Blink};var t=i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:o.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:o.ENGINE_MAP.Trident},n=i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:o.ENGINE_MAP.Presto},n=i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=e.test(/gecko/i),n=e.test(/like gecko/i);return t&&!n},describe:function(e){var t={name:o.ENGINE_MAP.Gecko},n=i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:o.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:o.ENGINE_MAP.WebKit},n=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}}];t.default=a,e.exports=t.default}})}(Yx);var Gx,Qx=i(Yx.exports);!function(e){e.Disabled="Disabled",e.Temporary="Temporary",e.UntilResponse="UntilResponse"}(Gx||(Gx={}));const Zx=()=>"wakeLock"in navigator,Xx=()=>{if("undefined"==typeof navigator)return!1;const{userAgent:e}=navigator,t=/CPU (?:iPhone )?OS (\d+)(?:_\d+)?_?\d+ like Mac OS X/iu.exec(e);return!!t&&parseInt(t[1],10)<10&&!window.MSStream};class Jx{constructor(e){this.enabled=!1,this._eventsAdded=!1,this.debug=null!=e&&e}start(){if(this.enabled=!1,Zx()&&!this._eventsAdded){this._eventsAdded=!0,this._wakeLock=void 0;const e=()=>fA(this,void 0,void 0,(function*(){null!==this._wakeLock&&"visible"===document.visibilityState&&(yield this.enable())}));document.addEventListener("visibilitychange",e),document.addEventListener("fullscreenchange",e)}else Xx()?this.noSleepTimer=void 0:(this.noSleepVideo=document.createElement("video"),this.noSleepVideo.setAttribute("title","MetaMask SDK - Listening for responses"),this.noSleepVideo.setAttribute("playsinline",""),this._addSourceToVideo(this.noSleepVideo,"webm","data:video/webm;base64,GkXfowEAAAAAAAAfQoaBAUL3gQFC8oEEQvOBCEKChHdlYm1Ch4EEQoWBAhhTgGcBAAAAAAAVkhFNm3RALE27i1OrhBVJqWZTrIHfTbuMU6uEFlSua1OsggEwTbuMU6uEHFO7a1OsghV17AEAAAAAAACkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmAQAAAAAAAEUq17GDD0JATYCNTGF2ZjU1LjMzLjEwMFdBjUxhdmY1NS4zMy4xMDBzpJBlrrXf3DCDVB8KcgbMpcr+RImIQJBgAAAAAAAWVK5rAQAAAAAAD++uAQAAAAAAADLXgQFzxYEBnIEAIrWcg3VuZIaFVl9WUDiDgQEj44OEAmJaAOABAAAAAAAABrCBsLqBkK4BAAAAAAAPq9eBAnPFgQKcgQAitZyDdW5khohBX1ZPUkJJU4OBAuEBAAAAAAAAEZ+BArWIQOdwAAAAAABiZIEgY6JPbwIeVgF2b3JiaXMAAAAAAoC7AAAAAAAAgLUBAAAAAAC4AQN2b3JiaXMtAAAAWGlwaC5PcmcgbGliVm9yYmlzIEkgMjAxMDExMDEgKFNjaGF1ZmVudWdnZXQpAQAAABUAAABlbmNvZGVyPUxhdmM1NS41Mi4xMDIBBXZvcmJpcyVCQ1YBAEAAACRzGCpGpXMWhBAaQlAZ4xxCzmvsGUJMEYIcMkxbyyVzkCGkoEKIWyiB0JBVAABAAACHQXgUhIpBCCGEJT1YkoMnPQghhIg5eBSEaUEIIYQQQgghhBBCCCGERTlokoMnQQgdhOMwOAyD5Tj4HIRFOVgQgydB6CCED0K4moOsOQghhCQ1SFCDBjnoHITCLCiKgsQwuBaEBDUojILkMMjUgwtCiJqDSTX4GoRnQXgWhGlBCCGEJEFIkIMGQcgYhEZBWJKDBjm4FITLQagahCo5CB+EIDRkFQCQAACgoiiKoigKEBqyCgDIAAAQQFEUx3EcyZEcybEcCwgNWQUAAAEACAAAoEiKpEiO5EiSJFmSJVmSJVmS5omqLMuyLMuyLMsyEBqyCgBIAABQUQxFcRQHCA1ZBQBkAAAIoDiKpViKpWiK54iOCISGrAIAgAAABAAAEDRDUzxHlETPVFXXtm3btm3btm3btm3btm1blmUZCA1ZBQBAAAAQ0mlmqQaIMAMZBkJDVgEACAAAgBGKMMSA0JBVAABAAACAGEoOogmtOd+c46BZDppKsTkdnEi1eZKbirk555xzzsnmnDHOOeecopxZDJoJrTnnnMSgWQqaCa0555wnsXnQmiqtOeeccc7pYJwRxjnnnCateZCajbU555wFrWmOmkuxOeecSLl5UptLtTnnnHPOOeecc84555zqxekcnBPOOeecqL25lpvQxTnnnE/G6d6cEM4555xzzjnnnHPOOeecIDRkFQAABABAEIaNYdwpCNLnaCBGEWIaMulB9+gwCRqDnELq0ehopJQ6CCWVcVJKJwgNWQUAAAIAQAghhRRSSCGFFFJIIYUUYoghhhhyyimnoIJKKqmooowyyyyzzDLLLLPMOuyssw47DDHEEEMrrcRSU2011lhr7jnnmoO0VlprrbVSSimllFIKQkNWAQAgAAAEQgYZZJBRSCGFFGKIKaeccgoqqIDQkFUAACAAgAAAAABP8hzRER3RER3RER3RER3R8RzPESVREiVREi3TMjXTU0VVdWXXlnVZt31b2IVd933d933d+HVhWJZlWZZlWZZlWZZlWZZlWZYgNGQVAAACAAAghBBCSCGFFFJIKcYYc8w56CSUEAgNWQUAAAIACAAAAHAUR3EcyZEcSbIkS9IkzdIsT/M0TxM9URRF0zRV0RVdUTdtUTZl0zVdUzZdVVZtV5ZtW7Z125dl2/d93/d93/d93/d93/d9XQdCQ1YBABIAADqSIymSIimS4ziOJElAaMgqAEAGAEAAAIriKI7jOJIkSZIlaZJneZaomZrpmZ4qqkBoyCoAABAAQAAAAAAAAIqmeIqpeIqoeI7oiJJomZaoqZoryqbsuq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq4LhIasAgAkAAB0JEdyJEdSJEVSJEdygNCQVQCADACAAAAcwzEkRXIsy9I0T/M0TxM90RM901NFV3SB0JBVAAAgAIAAAAAAAAAMybAUy9EcTRIl1VItVVMt1VJF1VNVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVN0zRNEwgNWQkAkAEAkBBTLS3GmgmLJGLSaqugYwxS7KWxSCpntbfKMYUYtV4ah5RREHupJGOKQcwtpNApJq3WVEKFFKSYYyoVUg5SIDRkhQAQmgHgcBxAsixAsiwAAAAAAAAAkDQN0DwPsDQPAAAAAAAAACRNAyxPAzTPAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABA0jRA8zxA8zwAAAAAAAAA0DwP8DwR8EQRAAAAAAAAACzPAzTRAzxRBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABA0jRA8zxA8zwAAAAAAAAAsDwP8EQR0DwRAAAAAAAAACzPAzxRBDzRAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAEOAAABBgIRQasiIAiBMAcEgSJAmSBM0DSJYFTYOmwTQBkmVB06BpME0AAAAAAAAAAAAAJE2DpkHTIIoASdOgadA0iCIAAAAAAAAAAAAAkqZB06BpEEWApGnQNGgaRBEAAAAAAAAAAAAAzzQhihBFmCbAM02IIkQRpgkAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAGHAAAAgwoQwUGrIiAIgTAHA4imUBAIDjOJYFAACO41gWAABYliWKAABgWZooAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAYcAAACDChDBQashIAiAIAcCiKZQHHsSzgOJYFJMmyAJYF0DyApgFEEQAIAAAocAAACLBBU2JxgEJDVgIAUQAABsWxLE0TRZKkaZoniiRJ0zxPFGma53meacLzPM80IYqiaJoQRVE0TZimaaoqME1VFQAAUOAAABBgg6bE4gCFhqwEAEICAByKYlma5nmeJ4qmqZokSdM8TxRF0TRNU1VJkqZ5niiKommapqqyLE3zPFEURdNUVVWFpnmeKIqiaaqq6sLzPE8URdE0VdV14XmeJ4qiaJqq6roQRVE0TdNUTVV1XSCKpmmaqqqqrgtETxRNU1Vd13WB54miaaqqq7ouEE3TVFVVdV1ZBpimaaqq68oyQFVV1XVdV5YBqqqqruu6sgxQVdd1XVmWZQCu67qyLMsCAAAOHAAAAoygk4wqi7DRhAsPQKEhKwKAKAAAwBimFFPKMCYhpBAaxiSEFEImJaXSUqogpFJSKRWEVEoqJaOUUmopVRBSKamUCkIqJZVSAADYgQMA2IGFUGjISgAgDwCAMEYpxhhzTiKkFGPOOScRUoox55yTSjHmnHPOSSkZc8w556SUzjnnnHNSSuacc845KaVzzjnnnJRSSuecc05KKSWEzkEnpZTSOeecEwAAVOAAABBgo8jmBCNBhYasBABSAQAMjmNZmuZ5omialiRpmud5niiapiZJmuZ5nieKqsnzPE8URdE0VZXneZ4oiqJpqirXFUXTNE1VVV2yLIqmaZqq6rowTdNUVdd1XZimaaqq67oubFtVVdV1ZRm2raqq6rqyDFzXdWXZloEsu67s2rIAAPAEBwCgAhtWRzgpGgssNGQlAJABAEAYg5BCCCFlEEIKIYSUUggJAAAYcAAACDChDBQashIASAUAAIyx1lprrbXWQGettdZaa62AzFprrbXWWmuttdZaa6211lJrrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmstpZRSSimllFJKKaWUUkoppZRSSgUA+lU4APg/2LA6wknRWGChISsBgHAAAMAYpRhzDEIppVQIMeacdFRai7FCiDHnJKTUWmzFc85BKCGV1mIsnnMOQikpxVZjUSmEUlJKLbZYi0qho5JSSq3VWIwxqaTWWoutxmKMSSm01FqLMRYjbE2ptdhqq7EYY2sqLbQYY4zFCF9kbC2m2moNxggjWywt1VprMMYY3VuLpbaaizE++NpSLDHWXAAAd4MDAESCjTOsJJ0VjgYXGrISAAgJACAQUooxxhhzzjnnpFKMOeaccw5CCKFUijHGnHMOQgghlIwx5pxzEEIIIYRSSsaccxBCCCGEkFLqnHMQQgghhBBKKZ1zDkIIIYQQQimlgxBCCCGEEEoopaQUQgghhBBCCKmklEIIIYRSQighlZRSCCGEEEIpJaSUUgohhFJCCKGElFJKKYUQQgillJJSSimlEkoJJYQSUikppRRKCCGUUkpKKaVUSgmhhBJKKSWllFJKIYQQSikFAAAcOAAABBhBJxlVFmGjCRcegEJDVgIAZAAAkKKUUiktRYIipRikGEtGFXNQWoqocgxSzalSziDmJJaIMYSUk1Qy5hRCDELqHHVMKQYtlRhCxhik2HJLoXMOAAAAQQCAgJAAAAMEBTMAwOAA4XMQdAIERxsAgCBEZohEw0JweFAJEBFTAUBigkIuAFRYXKRdXECXAS7o4q4DIQQhCEEsDqCABByccMMTb3jCDU7QKSp1IAAAAAAADADwAACQXAAREdHMYWRobHB0eHyAhIiMkAgAAAAAABcAfAAAJCVAREQ0cxgZGhscHR4fICEiIyQBAIAAAgAAAAAggAAEBAQAAAAAAAIAAAAEBB9DtnUBAAAAAAAEPueBAKOFggAAgACjzoEAA4BwBwCdASqwAJAAAEcIhYWIhYSIAgIABhwJ7kPfbJyHvtk5D32ych77ZOQ99snIe+2TkPfbJyHvtk5D32ych77ZOQ99YAD+/6tQgKOFggADgAqjhYIAD4AOo4WCACSADqOZgQArADECAAEQEAAYABhYL/QACIBDmAYAAKOFggA6gA6jhYIAT4AOo5mBAFMAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAGSADqOFggB6gA6jmYEAewAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIAj4AOo5mBAKMAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAKSADqOFggC6gA6jmYEAywAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIAz4AOo4WCAOSADqOZgQDzADECAAEQEAAYABhYL/QACIBDmAYAAKOFggD6gA6jhYIBD4AOo5iBARsAEQIAARAQFGAAYWC/0AAiAQ5gGACjhYIBJIAOo4WCATqADqOZgQFDADECAAEQEAAYABhYL/QACIBDmAYAAKOFggFPgA6jhYIBZIAOo5mBAWsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAXqADqOFggGPgA6jmYEBkwAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIBpIAOo4WCAbqADqOZgQG7ADECAAEQEAAYABhYL/QACIBDmAYAAKOFggHPgA6jmYEB4wAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIB5IAOo4WCAfqADqOZgQILADECAAEQEAAYABhYL/QACIBDmAYAAKOFggIPgA6jhYICJIAOo5mBAjMAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAjqADqOFggJPgA6jmYECWwAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYICZIAOo4WCAnqADqOZgQKDADECAAEQEAAYABhYL/QACIBDmAYAAKOFggKPgA6jhYICpIAOo5mBAqsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCArqADqOFggLPgA6jmIEC0wARAgABEBAUYABhYL/QACIBDmAYAKOFggLkgA6jhYIC+oAOo5mBAvsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAw+ADqOZgQMjADECAAEQEAAYABhYL/QACIBDmAYAAKOFggMkgA6jhYIDOoAOo5mBA0sAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCA0+ADqOFggNkgA6jmYEDcwAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIDeoAOo4WCA4+ADqOZgQObADECAAEQEAAYABhYL/QACIBDmAYAAKOFggOkgA6jhYIDuoAOo5mBA8MAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCA8+ADqOFggPkgA6jhYID+oAOo4WCBA+ADhxTu2sBAAAAAAAAEbuPs4EDt4r3gQHxghEr8IEK"),this._addSourceToVideo(this.noSleepVideo,"mp4","data:video/mp4;base64,AAAAHGZ0eXBNNFYgAAACAGlzb21pc28yYXZjMQAAAAhmcmVlAAAGF21kYXTeBAAAbGliZmFhYyAxLjI4AABCAJMgBDIARwAAArEGBf//rdxF6b3m2Ui3lizYINkj7u94MjY0IC0gY29yZSAxNDIgcjIgOTU2YzhkOCAtIEguMjY0L01QRUctNCBBVkMgY29kZWMgLSBDb3B5bGVmdCAyMDAzLTIwMTQgLSBodHRwOi8vd3d3LnZpZGVvbGFuLm9yZy94MjY0Lmh0bWwgLSBvcHRpb25zOiBjYWJhYz0wIHJlZj0zIGRlYmxvY2s9MTowOjAgYW5hbHlzZT0weDE6MHgxMTEgbWU9aGV4IHN1Ym1lPTcgcHN5PTEgcHN5X3JkPTEuMDA6MC4wMCBtaXhlZF9yZWY9MSBtZV9yYW5nZT0xNiBjaHJvbWFfbWU9MSB0cmVsbGlzPTEgOHg4ZGN0PTAgY3FtPTAgZGVhZHpvbmU9MjEsMTEgZmFzdF9wc2tpcD0xIGNocm9tYV9xcF9vZmZzZXQ9LTIgdGhyZWFkcz02IGxvb2thaGVhZF90aHJlYWRzPTEgc2xpY2VkX3RocmVhZHM9MCBucj0wIGRlY2ltYXRlPTEgaW50ZXJsYWNlZD0wIGJsdXJheV9jb21wYXQ9MCBjb25zdHJhaW5lZF9pbnRyYT0wIGJmcmFtZXM9MCB3ZWlnaHRwPTAga2V5aW50PTI1MCBrZXlpbnRfbWluPTI1IHNjZW5lY3V0PTQwIGludHJhX3JlZnJlc2g9MCByY19sb29rYWhlYWQ9NDAgcmM9Y3JmIG1idHJlZT0xIGNyZj0yMy4wIHFjb21wPTAuNjAgcXBtaW49MCBxcG1heD02OSBxcHN0ZXA9NCB2YnZfbWF4cmF0ZT03NjggdmJ2X2J1ZnNpemU9MzAwMCBjcmZfbWF4PTAuMCBuYWxfaHJkPW5vbmUgZmlsbGVyPTAgaXBfcmF0aW89MS40MCBhcT0xOjEuMDAAgAAAAFZliIQL8mKAAKvMnJycnJycnJycnXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXiEASZACGQAjgCEASZACGQAjgAAAAAdBmjgX4GSAIQBJkAIZACOAAAAAB0GaVAX4GSAhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZpgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGagC/AySEASZACGQAjgAAAAAZBmqAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZrAL8DJIQBJkAIZACOAAAAABkGa4C/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmwAvwMkhAEmQAhkAI4AAAAAGQZsgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGbQC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBm2AvwMkhAEmQAhkAI4AAAAAGQZuAL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGboC/AySEASZACGQAjgAAAAAZBm8AvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZvgL8DJIQBJkAIZACOAAAAABkGaAC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmiAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZpAL8DJIQBJkAIZACOAAAAABkGaYC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmoAvwMkhAEmQAhkAI4AAAAAGQZqgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGawC/AySEASZACGQAjgAAAAAZBmuAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZsAL8DJIQBJkAIZACOAAAAABkGbIC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBm0AvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZtgL8DJIQBJkAIZACOAAAAABkGbgCvAySEASZACGQAjgCEASZACGQAjgAAAAAZBm6AnwMkhAEmQAhkAI4AhAEmQAhkAI4AhAEmQAhkAI4AhAEmQAhkAI4AAAAhubW9vdgAAAGxtdmhkAAAAAAAAAAAAAAAAAAAD6AAABDcAAQAAAQAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAzB0cmFrAAAAXHRraGQAAAADAAAAAAAAAAAAAAABAAAAAAAAA+kAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAALAAAACQAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAAAPpAAAAAAABAAAAAAKobWRpYQAAACBtZGhkAAAAAAAAAAAAAAAAAAB1MAAAdU5VxAAAAAAALWhkbHIAAAAAAAAAAHZpZGUAAAAAAAAAAAAAAABWaWRlb0hhbmRsZXIAAAACU21pbmYAAAAUdm1oZAAAAAEAAAAAAAAAAAAAACRkaW5mAAAAHGRyZWYAAAAAAAAAAQAAAAx1cmwgAAAAAQAAAhNzdGJsAAAAr3N0c2QAAAAAAAAAAQAAAJ9hdmMxAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAALAAkABIAAAASAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGP//AAAALWF2Y0MBQsAN/+EAFWdCwA3ZAsTsBEAAAPpAADqYA8UKkgEABWjLg8sgAAAAHHV1aWRraEDyXyRPxbo5pRvPAyPzAAAAAAAAABhzdHRzAAAAAAAAAAEAAAAeAAAD6QAAABRzdHNzAAAAAAAAAAEAAAABAAAAHHN0c2MAAAAAAAAAAQAAAAEAAAABAAAAAQAAAIxzdHN6AAAAAAAAAAAAAAAeAAADDwAAAAsAAAALAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAAiHN0Y28AAAAAAAAAHgAAAEYAAANnAAADewAAA5gAAAO0AAADxwAAA+MAAAP2AAAEEgAABCUAAARBAAAEXQAABHAAAASMAAAEnwAABLsAAATOAAAE6gAABQYAAAUZAAAFNQAABUgAAAVkAAAFdwAABZMAAAWmAAAFwgAABd4AAAXxAAAGDQAABGh0cmFrAAAAXHRraGQAAAADAAAAAAAAAAAAAAACAAAAAAAABDcAAAAAAAAAAAAAAAEBAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAAAQkAAADcAABAAAAAAPgbWRpYQAAACBtZGhkAAAAAAAAAAAAAAAAAAC7gAAAykBVxAAAAAAALWhkbHIAAAAAAAAAAHNvdW4AAAAAAAAAAAAAAABTb3VuZEhhbmRsZXIAAAADi21pbmYAAAAQc21oZAAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAADT3N0YmwAAABnc3RzZAAAAAAAAAABAAAAV21wNGEAAAAAAAAAAQAAAAAAAAAAAAIAEAAAAAC7gAAAAAAAM2VzZHMAAAAAA4CAgCIAAgAEgICAFEAVBbjYAAu4AAAADcoFgICAAhGQBoCAgAECAAAAIHN0dHMAAAAAAAAAAgAAADIAAAQAAAAAAQAAAkAAAAFUc3RzYwAAAAAAAAAbAAAAAQAAAAEAAAABAAAAAgAAAAIAAAABAAAAAwAAAAEAAAABAAAABAAAAAIAAAABAAAABgAAAAEAAAABAAAABwAAAAIAAAABAAAACAAAAAEAAAABAAAACQAAAAIAAAABAAAACgAAAAEAAAABAAAACwAAAAIAAAABAAAADQAAAAEAAAABAAAADgAAAAIAAAABAAAADwAAAAEAAAABAAAAEAAAAAIAAAABAAAAEQAAAAEAAAABAAAAEgAAAAIAAAABAAAAFAAAAAEAAAABAAAAFQAAAAIAAAABAAAAFgAAAAEAAAABAAAAFwAAAAIAAAABAAAAGAAAAAEAAAABAAAAGQAAAAIAAAABAAAAGgAAAAEAAAABAAAAGwAAAAIAAAABAAAAHQAAAAEAAAABAAAAHgAAAAIAAAABAAAAHwAAAAQAAAABAAAA4HN0c3oAAAAAAAAAAAAAADMAAAAaAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAACMc3RjbwAAAAAAAAAfAAAALAAAA1UAAANyAAADhgAAA6IAAAO+AAAD0QAAA+0AAAQAAAAEHAAABC8AAARLAAAEZwAABHoAAASWAAAEqQAABMUAAATYAAAE9AAABRAAAAUjAAAFPwAABVIAAAVuAAAFgQAABZ0AAAWwAAAFzAAABegAAAX7AAAGFwAAAGJ1ZHRhAAAAWm1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAALWlsc3QAAAAlqXRvbwAAAB1kYXRhAAAAAQAAAABMYXZmNTUuMzMuMTAw"),this.noSleepVideo.addEventListener("loadedmetadata",(()=>{this.debug&&console.debug("WakeLockManager::start() video loadedmetadata",this.noSleepVideo),this.noSleepVideo&&(this.noSleepVideo.duration<=1?this.noSleepVideo.setAttribute("loop",""):this.noSleepVideo.addEventListener("timeupdate",(()=>{this.noSleepVideo&&this.noSleepVideo.currentTime>.5&&(this.noSleepVideo.currentTime=Math.random())})))})))}_addSourceToVideo(e,t,n){const r=document.createElement("source");r.src=n,r.type=`video/${t}`,e.appendChild(r)}isEnabled(){return this.enabled}setDebug(e){e&&!this.debug&&console.debug("WakeLockManager::setDebug() activate debug mode"),this.debug=e}enable(){return fA(this,void 0,void 0,(function*(){this.enabled&&this.disable("from_enable");const e=Zx(),t=Xx();if(this.debug&&console.debug(`WakeLockManager::enable() hasWakelock=${e} isOldIos=${t}`,this.noSleepVideo),this.start(),Zx())try{const e=yield navigator.wakeLock.request("screen");this._wakeLock=e,this.enabled=!0}catch(e){return this.debug&&console.error("WakeLockManager::enable() failed to enable wake lock",e),this.enabled=!1,!1}else if(Xx())return this.disable("from_enable_old_ios"),this.noSleepTimer=window.setInterval((()=>{document.hidden||(window.location.href=window.location.href.split("#")[0],window.setTimeout(window.stop,0))}),15e3),this.enabled=!0,!0;return!!this.noSleepVideo&&(this.noSleepVideo.play().then((()=>{this.debug&&console.debug("WakeLockManager::enable() video started playing successfully")})).catch((e=>{console.warn("WakeLockManager::enable() video failed to play",e)})),this.enabled=!0,!0)}))}disable(e){if(this.enabled){if(this.debug&&console.debug(`WakeLockManager::disable() context=${e}`),Zx())this._wakeLock&&(this.debug&&console.debug("WakeLockManager::disable() release wake lock"),this._wakeLock.release()),this._wakeLock=void 0;else if(Xx())this.noSleepTimer&&(console.warn("\n NoSleep now disabled for older iOS devices.\n "),window.clearInterval(this.noSleepTimer),this.noSleepTimer=void 0);else try{if(!this.noSleepVideo)return void(this.debug&&console.debug("WakeLockManager::disable() noSleepVideo is undefined"));this.debug&&console.debug("WakeLockManager::disable() pause noSleepVideo"),this.noSleepVideo.firstChild&&(this.noSleepVideo.removeChild(this.noSleepVideo.firstChild),this.noSleepVideo.load()),this.noSleepVideo.pause(),this.noSleepVideo.src="",this.noSleepVideo.remove()}catch(e){console.log(e)}this.enabled=!1}}}const eR=2e3,tR=4e4,nR=500;class rR{constructor({useDeepLink:e,preferredOpenLink:t,wakeLockStatus:n=Gx.UntilResponse,debug:r=!1}){this.state={wakeLock:new Jx,wakeLockStatus:Gx.UntilResponse,wakeLockTimer:void 0,wakeLockFeatureActive:!1,platformType:void 0,useDeeplink:!1,preferredOpenLink:void 0,debug:!1},this.state.platformType=this.getPlatformType(),this.state.useDeeplink=e,this.state.preferredOpenLink=t,this.state.wakeLockStatus=n,this.state.debug=r,this.state.wakeLock.setDebug(r)}enableWakeLock(){return function(e){const{state:t}=e;if(t.wakeLockStatus===Gx.Disabled)return void(t.debug&&console.debug("WakeLock is disabled"));t.wakeLock.enable().catch((e=>{console.error("WakeLock is not supported",e)}));const n=t.wakeLockStatus===Gx.Temporary?eR:tR;t.wakeLockTimer=setTimeout((()=>{e.disableWakeLock()}),n),t.wakeLockFeatureActive||t.wakeLockStatus!==Gx.UntilResponse||(t.wakeLockFeatureActive=!0,window.addEventListener("focus",(()=>{e.disableWakeLock()})))}(this)}disableWakeLock(){return function(e){const{state:t}=e;t.wakeLockStatus!==Gx.Disabled&&(t.wakeLockTimer&&clearTimeout(t.wakeLockTimer),t.wakeLock.disable("disableWakeLock"))}(this)}openDeeplink(e,t,n){return function(e,t,n,r){const{state:i}=e;i.debug&&(console.debug(`Platform::openDeepLink universalLink --\x3e ${t}`),console.debug(`Platform::openDeepLink deepLink --\x3e ${n}`)),e.isBrowser()&&e.enableWakeLock();try{if(i.preferredOpenLink)return void i.preferredOpenLink(i.useDeeplink?n:t,r);if(i.debug&&console.warn(`Platform::openDeepLink() open link now useDeepLink=${i.useDeeplink}`,i.useDeeplink?n:t),"undefined"!=typeof window){let e;e=i.useDeeplink?window.open(n,"_blank"):window.open(t,"_blank"),setTimeout((()=>{var t;return null===(t=null==e?void 0:e.close)||void 0===t?void 0:t.call(e)}),nR)}}catch(e){console.log("Platform::openDeepLink() can't open link",e)}}(this,e,t,n)}isReactNative(){var e;return this.isNotBrowser()&&"undefined"!=typeof window&&(null===window||void 0===window?void 0:window.navigator)&&"ReactNative"===(null===(e=window.navigator)||void 0===e?void 0:e.product)}isMetaMaskInstalled(){return function(e){const{state:t}=e,n=Ix.getProvider()||(null===window||void 0===window?void 0:window.ethereum);return t.debug&&console.debug(`Platform::isMetaMaskInstalled isMetaMask=${null==n?void 0:n.isMetaMask} isConnected=${null==n?void 0:n.isConnected()}`),(null==n?void 0:n.isMetaMask)&&(null==n?void 0:n.isConnected())}(this)}isDesktopWeb(){return this.isBrowser()&&!this.isMobileWeb()}isMobile(){var e,t;const n=Qx.parse(window.navigator.userAgent);return"mobile"===(null===(e=null==n?void 0:n.platform)||void 0===e?void 0:e.type)||"tablet"===(null===(t=null==n?void 0:n.platform)||void 0===t?void 0:t.type)}isSecure(){return this.isReactNative()||this.isMobileWeb()}isMetaMaskMobileWebView(){return"undefined"!=typeof window&&Boolean(window.ReactNativeWebView)&&Boolean(navigator.userAgent.endsWith("MetaMaskMobile"))}isMobileWeb(){return this.state.platformType===t.PlatformType.MobileWeb}isNotBrowser(){var t;return"undefined"==typeof window||!(null===window||void 0===window?void 0:window.navigator)||void 0!==e.commonjsGlobal&&"ReactNative"===(null===(t=null===e.commonjsGlobal||void 0===e.commonjsGlobal?void 0:e.commonjsGlobal.navigator)||void 0===t?void 0:t.product)||"ReactNative"===(null===navigator||void 0===navigator?void 0:navigator.product)}isNodeJS(){return this.isNotBrowser()&&!this.isReactNative()}isBrowser(){return!this.isNotBrowser()}isUseDeepLink(){return this.state.useDeeplink}getPlatformType(){return function(e){const{state:n}=e;return n.platformType?n.platformType:e.isReactNative()?t.PlatformType.ReactNative:e.isNotBrowser()?t.PlatformType.NonBrowser:e.isMetaMaskMobileWebView()?t.PlatformType.MetaMaskMobileWebview:e.isMobile()?t.PlatformType.MobileWeb:t.PlatformType.DesktopWeb}(this)}}
|
|
2
2
|
/*! *****************************************************************************
|
|
3
3
|
Copyright (c) Microsoft Corporation.
|
|
4
4
|
|