diff --git a/CNAME b/CNAME deleted file mode 100644 index b8111b0..0000000 --- a/CNAME +++ /dev/null @@ -1 +0,0 @@ -app.silentium.dev \ No newline at end of file diff --git a/asset-manifest.json b/asset-manifest.json index e41f2fa..95f1316 100644 --- a/asset-manifest.json +++ b/asset-manifest.json @@ -1,14 +1,14 @@ { "files": { "main.css": "./static/css/main.2de7be6f.css", - "main.js": "./static/js/main.6fee7145.js", + "main.js": "./static/js/main.6e322620.js", "service-worker.js": "./service-worker.js", "index.html": "./index.html", "main.2de7be6f.css.map": "./static/css/main.2de7be6f.css.map", - "main.6fee7145.js.map": "./static/js/main.6fee7145.js.map" + "main.6e322620.js.map": "./static/js/main.6e322620.js.map" }, "entrypoints": [ "static/css/main.2de7be6f.css", - "static/js/main.6fee7145.js" + "static/js/main.6e322620.js" ] } \ No newline at end of file diff --git a/index.html b/index.html index 738e664..55b6305 100644 --- a/index.html +++ b/index.html @@ -1 +1 @@ -Silentium Wallet
\ No newline at end of file +Silentium Wallet
\ No newline at end of file diff --git a/service-worker.js b/service-worker.js index 7b48eba..188440f 100644 --- a/service-worker.js +++ b/service-worker.js @@ -1,2 +1,2 @@ -(()=>{"use strict";var e={295:()=>{try{self["workbox:core:6.6.0"]&&_()}catch(e){}},229:()=>{try{self["workbox:expiration:6.6.0"]&&_()}catch(e){}},740:()=>{try{self["workbox:precaching:6.6.0"]&&_()}catch(e){}},130:()=>{try{self["workbox:routing:6.6.0"]&&_()}catch(e){}},205:()=>{try{self["workbox:strategies:6.6.0"]&&_()}catch(e){}}},t={};function s(n){var a=t[n];if(void 0!==a)return a.exports;var r=t[n]={exports:{}};return e[n](r,r.exports,s),r.exports}(()=>{s(295);const e=function(e){let t=e;for(var s=arguments.length,n=new Array(s>1?s-1:0),a=1;a0&&(t+=" :: ".concat(JSON.stringify(n))),t};class t extends Error{constructor(t,s){super(e(t,s)),this.name=t,this.details=s}}const n=new Set;const a={googleAnalytics:"googleAnalytics",precache:"precache-v2",prefix:"workbox",runtime:"runtime",suffix:"undefined"!==typeof registration?registration.scope:""},r=e=>[a.prefix,e,a.suffix].filter((e=>e&&e.length>0)).join("-"),i=e=>e||r(a.precache),o=e=>e||r(a.runtime);function c(e,t){const s=new URL(e);for(const n of t)s.searchParams.delete(n);return s.href}let h;function l(e){e.then((()=>{}))}class u{constructor(){this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}}const d=e=>new URL(String(e),location.href).href.replace(new RegExp("^".concat(location.origin)),"");function f(e){return new Promise((t=>setTimeout(t,e)))}function p(e,t){const s=t();return e.waitUntil(s),s}async function g(e,s){let n=null;if(e.url){n=new URL(e.url).origin}if(n!==self.location.origin)throw new t("cross-origin-copy-response",{origin:n});const a=e.clone(),r={headers:new Headers(a.headers),status:a.status,statusText:a.statusText},i=s?s(r):r,o=function(){if(void 0===h){const t=new Response("");if("body"in t)try{new Response(t.body),h=!0}catch(e){h=!1}h=!1}return h}()?a.body:await a.blob();return new Response(o,i)}const w=(e,t)=>t.some((t=>e instanceof t));let m,y;const _=new WeakMap,v=new WeakMap,b=new WeakMap,R=new WeakMap,x=new WeakMap;let C={get(e,t,s){if(e instanceof IDBTransaction){if("done"===t)return v.get(e);if("objectStoreNames"===t)return e.objectStoreNames||b.get(e);if("store"===t)return s.objectStoreNames[1]?void 0:s.objectStore(s.objectStoreNames[0])}return q(e[t])},set:(e,t,s)=>(e[t]=s,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function L(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(y||(y=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(){for(var t=arguments.length,s=new Array(t),n=0;n1?s-1:0),a=1;a{const n=()=>{e.removeEventListener("complete",a),e.removeEventListener("error",r),e.removeEventListener("abort",r)},a=()=>{t(),n()},r=()=>{s(e.error||new DOMException("AbortError","AbortError")),n()};e.addEventListener("complete",a),e.addEventListener("error",r),e.addEventListener("abort",r)}));v.set(e,t)}(e),w(e,m||(m=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(e,C):e)}function q(e){if(e instanceof IDBRequest)return function(e){const t=new Promise(((t,s)=>{const n=()=>{e.removeEventListener("success",a),e.removeEventListener("error",r)},a=()=>{t(q(e.result)),n()},r=()=>{s(e.error),n()};e.addEventListener("success",a),e.addEventListener("error",r)}));return t.then((t=>{t instanceof IDBCursor&&_.set(t,e)})).catch((()=>{})),x.set(t,e),t}(e);if(R.has(e))return R.get(e);const t=E(e);return t!==e&&(R.set(e,t),x.set(t,e)),t}const D=e=>x.get(e);const U=["get","getKey","getAll","getAllKeys","count"],T=["put","add","delete","clear"],k=new Map;function N(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!==typeof t)return;if(k.get(t))return k.get(t);const s=t.replace(/FromIndex$/,""),n=t!==s,a=T.includes(s);if(!(s in(n?IDBIndex:IDBObjectStore).prototype)||!a&&!U.includes(s))return;const r=async function(e){const t=this.transaction(e,a?"readwrite":"readonly");let r=t.store;for(var i=arguments.length,o=new Array(i>1?i-1:0),c=1;c({...e,get:(t,s,n)=>N(t,s)||e.get(t,s,n),has:(t,s)=>!!N(t,s)||e.has(t,s)}))(C);s(229);const I="cache-entries",K=e=>{const t=new URL(e,location.href);return t.hash="",t.href};class M{constructor(e){this._db=null,this._cacheName=e}_upgradeDb(e){const t=e.createObjectStore(I,{keyPath:"id"});t.createIndex("cacheName","cacheName",{unique:!1}),t.createIndex("timestamp","timestamp",{unique:!1})}_upgradeDbAndDeleteOldDbs(e){this._upgradeDb(e),this._cacheName&&function(e){let{blocked:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=indexedDB.deleteDatabase(e);t&&s.addEventListener("blocked",(e=>t(e.oldVersion,e))),q(s).then((()=>{}))}(this._cacheName)}async setTimestamp(e,t){const s={url:e=K(e),timestamp:t,cacheName:this._cacheName,id:this._getId(e)},n=(await this.getDb()).transaction(I,"readwrite",{durability:"relaxed"});await n.store.put(s),await n.done}async getTimestamp(e){const t=await this.getDb(),s=await t.get(I,this._getId(e));return null===s||void 0===s?void 0:s.timestamp}async expireEntries(e,t){const s=await this.getDb();let n=await s.transaction(I).store.index("timestamp").openCursor(null,"prev");const a=[];let r=0;for(;n;){const s=n.value;s.cacheName===this._cacheName&&(e&&s.timestamp=t?a.push(n.value):r++),n=await n.continue()}const i=[];for(const o of a)await s.delete(I,o.id),i.push(o.url);return i}_getId(e){return this._cacheName+"|"+K(e)}async getDb(){return this._db||(this._db=await function(e,t){let{blocked:s,upgrade:n,blocking:a,terminated:r}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=indexedDB.open(e,t),o=q(i);return n&&i.addEventListener("upgradeneeded",(e=>{n(q(i.result),e.oldVersion,e.newVersion,q(i.transaction),e)})),s&&i.addEventListener("blocked",(e=>s(e.oldVersion,e.newVersion,e))),o.then((e=>{r&&e.addEventListener("close",(()=>r())),a&&e.addEventListener("versionchange",(e=>a(e.oldVersion,e.newVersion,e)))})).catch((()=>{})),o}("workbox-expiration",1,{upgrade:this._upgradeDbAndDeleteOldDbs.bind(this)})),this._db}}class A{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this._isRunning=!1,this._rerunRequested=!1,this._maxEntries=t.maxEntries,this._maxAgeSeconds=t.maxAgeSeconds,this._matchOptions=t.matchOptions,this._cacheName=e,this._timestampModel=new M(e)}async expireEntries(){if(this._isRunning)return void(this._rerunRequested=!0);this._isRunning=!0;const e=this._maxAgeSeconds?Date.now()-1e3*this._maxAgeSeconds:0,t=await this._timestampModel.expireEntries(e,this._maxEntries),s=await self.caches.open(this._cacheName);for(const n of t)await s.delete(n,this._matchOptions);this._isRunning=!1,this._rerunRequested&&(this._rerunRequested=!1,l(this.expireEntries()))}async updateTimestamp(e){await this._timestampModel.setTimestamp(e,Date.now())}async isURLExpired(e){if(this._maxAgeSeconds){const t=await this._timestampModel.getTimestamp(e),s=Date.now()-1e3*this._maxAgeSeconds;return void 0===t||t{let{request:t,state:s}=e;s&&(s.originalRequest=t)},this.cachedResponseWillBeUsed=async e=>{let{event:t,state:s,cachedResponse:n}=e;if("install"===t.type&&s&&s.originalRequest&&s.originalRequest instanceof Request){const e=s.originalRequest.url;n?this.notUpdatedURLs.push(e):this.updatedURLs.push(e)}return n}}}class O{constructor(e){let{precacheController:t}=e;this.cacheKeyWillBeUsed=async e=>{let{request:t,params:s}=e;const n=(null===s||void 0===s?void 0:s.cacheKey)||this._precacheController.getCacheKeyForURL(t.url);return n?new Request(n,{headers:t.headers}):t},this._precacheController=t}}s(205);function W(e){return"string"===typeof e?new Request(e):e}class B{constructor(e,t){this._cacheKeys={},Object.assign(this,t),this.event=t.event,this._strategy=e,this._handlerDeferred=new u,this._extendLifetimePromises=[],this._plugins=[...e.plugins],this._pluginStateMap=new Map;for(const s of this._plugins)this._pluginStateMap.set(s,{});this.event.waitUntil(this._handlerDeferred.promise)}async fetch(e){const{event:s}=this;let n=W(e);if("navigate"===n.mode&&s instanceof FetchEvent&&s.preloadResponse){const e=await s.preloadResponse;if(e)return e}const a=this.hasCallback("fetchDidFail")?n.clone():null;try{for(const e of this.iterateCallbacks("requestWillFetch"))n=await e({request:n.clone(),event:s})}catch(i){if(i instanceof Error)throw new t("plugin-error-request-will-fetch",{thrownErrorMessage:i.message})}const r=n.clone();try{let e;e=await fetch(n,"navigate"===n.mode?void 0:this._strategy.fetchOptions);for(const t of this.iterateCallbacks("fetchDidSucceed"))e=await t({event:s,request:r,response:e});return e}catch(o){throw a&&await this.runCallbacks("fetchDidFail",{error:o,event:s,originalRequest:a.clone(),request:r.clone()}),o}}async fetchAndCachePut(e){const t=await this.fetch(e),s=t.clone();return this.waitUntil(this.cachePut(e,s)),t}async cacheMatch(e){const t=W(e);let s;const{cacheName:n,matchOptions:a}=this._strategy,r=await this.getCacheKey(t,"read"),i=Object.assign(Object.assign({},a),{cacheName:n});s=await caches.match(r,i);for(const o of this.iterateCallbacks("cachedResponseWillBeUsed"))s=await o({cacheName:n,matchOptions:a,cachedResponse:s,request:r,event:this.event})||void 0;return s}async cachePut(e,s){const a=W(e);await f(0);const r=await this.getCacheKey(a,"write");if(!s)throw new t("cache-put-with-no-response",{url:d(r.url)});const i=await this._ensureResponseSafeToCache(s);if(!i)return!1;const{cacheName:o,matchOptions:h}=this._strategy,l=await self.caches.open(o),u=this.hasCallback("cacheDidUpdate"),p=u?await async function(e,t,s,n){const a=c(t.url,s);if(t.url===a)return e.match(t,n);const r=Object.assign(Object.assign({},n),{ignoreSearch:!0}),i=await e.keys(t,r);for(const o of i)if(a===c(o.url,s))return e.match(o,n)}(l,r.clone(),["__WB_REVISION__"],h):null;try{await l.put(r,u?i.clone():i)}catch(g){if(g instanceof Error)throw"QuotaExceededError"===g.name&&await async function(){for(const e of n)await e()}(),g}for(const t of this.iterateCallbacks("cacheDidUpdate"))await t({cacheName:o,oldResponse:p,newResponse:i.clone(),request:r,event:this.event});return!0}async getCacheKey(e,t){const s="".concat(e.url," | ").concat(t);if(!this._cacheKeys[s]){let n=e;for(const e of this.iterateCallbacks("cacheKeyWillBeUsed"))n=W(await e({mode:t,request:n,event:this.event,params:this.params}));this._cacheKeys[s]=n}return this._cacheKeys[s]}hasCallback(e){for(const t of this._strategy.plugins)if(e in t)return!0;return!1}async runCallbacks(e,t){for(const s of this.iterateCallbacks(e))await s(t)}*iterateCallbacks(e){for(const t of this._strategy.plugins)if("function"===typeof t[e]){const s=this._pluginStateMap.get(t),n=n=>{const a=Object.assign(Object.assign({},n),{state:s});return t[e](a)};yield n}}waitUntil(e){return this._extendLifetimePromises.push(e),e}async doneWaiting(){let e;for(;e=this._extendLifetimePromises.shift();)await e}destroy(){this._handlerDeferred.resolve(null)}async _ensureResponseSafeToCache(e){let t=e,s=!1;for(const n of this.iterateCallbacks("cacheWillUpdate"))if(t=await n({request:this.request,response:t,event:this.event})||void 0,s=!0,!t)break;return s||t&&200!==t.status&&(t=void 0),t}}class j{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.cacheName=o(e.cacheName),this.plugins=e.plugins||[],this.fetchOptions=e.fetchOptions,this.matchOptions=e.matchOptions}handle(e){const[t]=this.handleAll(e);return t}handleAll(e){e instanceof FetchEvent&&(e={event:e,request:e.request});const t=e.event,s="string"===typeof e.request?new Request(e.request):e.request,n="params"in e?e.params:void 0,a=new B(this,{event:t,request:s,params:n}),r=this._getResponse(a,s,t);return[r,this._awaitComplete(r,a,s,t)]}async _getResponse(e,s,n){let a;await e.runCallbacks("handlerWillStart",{event:n,request:s});try{if(a=await this._handle(s,e),!a||"error"===a.type)throw new t("no-response",{url:s.url})}catch(r){if(r instanceof Error)for(const t of e.iterateCallbacks("handlerDidError"))if(a=await t({error:r,event:n,request:s}),a)break;if(!a)throw r}for(const t of e.iterateCallbacks("handlerWillRespond"))a=await t({event:n,request:s,response:a});return a}async _awaitComplete(e,t,s,n){let a,r;try{a=await e}catch(r){}try{await t.runCallbacks("handlerDidRespond",{event:n,request:s,response:a}),await t.doneWaiting()}catch(i){i instanceof Error&&(r=i)}if(await t.runCallbacks("handlerDidComplete",{event:n,request:s,response:a,error:r}),t.destroy(),r)throw r}}class F extends j{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.cacheName=i(e.cacheName),super(e),this._fallbackToNetwork=!1!==e.fallbackToNetwork,this.plugins.push(F.copyRedirectedCacheableResponsesPlugin)}async _handle(e,t){const s=await t.cacheMatch(e);return s||(t.event&&"install"===t.event.type?await this._handleInstall(e,t):await this._handleFetch(e,t))}async _handleFetch(e,s){let n;const a=s.params||{};if(!this._fallbackToNetwork)throw new t("missing-precache-entry",{cacheName:this.cacheName,url:e.url});{0;const t=a.integrity,r=e.integrity,i=!r||r===t;if(n=await s.fetch(new Request(e,{integrity:"no-cors"!==e.mode?r||t:void 0})),t&&i&&"no-cors"!==e.mode){this._useDefaultCacheabilityPluginIfNeeded();await s.cachePut(e,n.clone());0}}return n}async _handleInstall(e,s){this._useDefaultCacheabilityPluginIfNeeded();const n=await s.fetch(e);if(!await s.cachePut(e,n.clone()))throw new t("bad-precaching-response",{url:e.url,status:n.status});return n}_useDefaultCacheabilityPluginIfNeeded(){let e=null,t=0;for(const[s,n]of this.plugins.entries())n!==F.copyRedirectedCacheableResponsesPlugin&&(n===F.defaultPrecacheCacheabilityPlugin&&(e=s),n.cacheWillUpdate&&t++);0===t?this.plugins.push(F.defaultPrecacheCacheabilityPlugin):t>1&&null!==e&&this.plugins.splice(e,1)}}F.defaultPrecacheCacheabilityPlugin={async cacheWillUpdate(e){let{response:t}=e;return!t||t.status>=400?null:t}},F.copyRedirectedCacheableResponsesPlugin={async cacheWillUpdate(e){let{response:t}=e;return t.redirected?await g(t):t}};class H{constructor(){let{cacheName:e,plugins:t=[],fallbackToNetwork:s=!0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this._urlsToCacheKeys=new Map,this._urlsToCacheModes=new Map,this._cacheKeysToIntegrities=new Map,this._strategy=new F({cacheName:i(e),plugins:[...t,new O({precacheController:this})],fallbackToNetwork:s}),this.install=this.install.bind(this),this.activate=this.activate.bind(this)}get strategy(){return this._strategy}precache(e){this.addToCacheList(e),this._installAndActiveListenersAdded||(self.addEventListener("install",this.install),self.addEventListener("activate",this.activate),this._installAndActiveListenersAdded=!0)}addToCacheList(e){const s=[];for(const n of e){"string"===typeof n?s.push(n):n&&void 0===n.revision&&s.push(n.url);const{cacheKey:e,url:a}=P(n),r="string"!==typeof n&&n.revision?"reload":"default";if(this._urlsToCacheKeys.has(a)&&this._urlsToCacheKeys.get(a)!==e)throw new t("add-to-cache-list-conflicting-entries",{firstEntry:this._urlsToCacheKeys.get(a),secondEntry:e});if("string"!==typeof n&&n.integrity){if(this._cacheKeysToIntegrities.has(e)&&this._cacheKeysToIntegrities.get(e)!==n.integrity)throw new t("add-to-cache-list-conflicting-integrities",{url:a});this._cacheKeysToIntegrities.set(e,n.integrity)}if(this._urlsToCacheKeys.set(a,e),this._urlsToCacheModes.set(a,r),s.length>0){const e="Workbox is precaching URLs without revision "+"info: ".concat(s.join(", "),"\nThis is generally NOT safe. ")+"Learn more at https://bit.ly/wb-precache";console.warn(e)}}}install(e){return p(e,(async()=>{const t=new S;this.strategy.plugins.push(t);for(const[a,r]of this._urlsToCacheKeys){const t=this._cacheKeysToIntegrities.get(r),s=this._urlsToCacheModes.get(a),n=new Request(a,{integrity:t,cache:s,credentials:"same-origin"});await Promise.all(this.strategy.handleAll({params:{cacheKey:r},request:n,event:e}))}const{updatedURLs:s,notUpdatedURLs:n}=t;return{updatedURLs:s,notUpdatedURLs:n}}))}activate(e){return p(e,(async()=>{const e=await self.caches.open(this.strategy.cacheName),t=await e.keys(),s=new Set(this._urlsToCacheKeys.values()),n=[];for(const a of t)s.has(a.url)||(await e.delete(a),n.push(a.url));return{deletedURLs:n}}))}getURLsToCacheKeys(){return this._urlsToCacheKeys}getCachedURLs(){return[...this._urlsToCacheKeys.keys()]}getCacheKeyForURL(e){const t=new URL(e,location.href);return this._urlsToCacheKeys.get(t.href)}getIntegrityForCacheKey(e){return this._cacheKeysToIntegrities.get(e)}async matchPrecache(e){const t=e instanceof Request?e.url:e,s=this.getCacheKeyForURL(t);if(s){return(await self.caches.open(this.strategy.cacheName)).match(s)}}createHandlerBoundToURL(e){const s=this.getCacheKeyForURL(e);if(!s)throw new t("non-precached-url",{url:e});return t=>(t.request=new Request(e),t.params=Object.assign({cacheKey:s},t.params),this.strategy.handle(t))}}let V;const G=()=>(V||(V=new H),V);s(130);const $=e=>e&&"object"===typeof e?e:{handle:e};class Q{constructor(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"GET";this.handler=$(t),this.match=e,this.method=s}setCatchHandler(e){this.catchHandler=$(e)}}class J extends Q{constructor(e,t,s){super((t=>{let{url:s}=t;const n=e.exec(s.href);if(n&&(s.origin===location.origin||0===n.index))return n.slice(1)}),t,s)}}class z{constructor(){this._routes=new Map,this._defaultHandlerMap=new Map}get routes(){return this._routes}addFetchListener(){self.addEventListener("fetch",(e=>{const{request:t}=e,s=this.handleRequest({request:t,event:e});s&&e.respondWith(s)}))}addCacheListener(){self.addEventListener("message",(e=>{if(e.data&&"CACHE_URLS"===e.data.type){const{payload:t}=e.data;0;const s=Promise.all(t.urlsToCache.map((t=>{"string"===typeof t&&(t=[t]);const s=new Request(...t);return this.handleRequest({request:s,event:e})})));e.waitUntil(s),e.ports&&e.ports[0]&&s.then((()=>e.ports[0].postMessage(!0)))}}))}handleRequest(e){let{request:t,event:s}=e;const n=new URL(t.url,location.href);if(!n.protocol.startsWith("http"))return void 0;const a=n.origin===location.origin,{params:r,route:i}=this.findMatchingRoute({event:s,request:t,sameOrigin:a,url:n});let o=i&&i.handler;const c=t.method;if(!o&&this._defaultHandlerMap.has(c)&&(o=this._defaultHandlerMap.get(c)),!o)return void 0;let h;try{h=o.handle({url:n,request:t,event:s,params:r})}catch(u){h=Promise.reject(u)}const l=i&&i.catchHandler;return h instanceof Promise&&(this._catchHandler||l)&&(h=h.catch((async e=>{if(l){0;try{return await l.handle({url:n,request:t,event:s,params:r})}catch(a){a instanceof Error&&(e=a)}}if(this._catchHandler)return this._catchHandler.handle({url:n,request:t,event:s});throw e}))),h}findMatchingRoute(e){let{url:t,sameOrigin:s,request:n,event:a}=e;const r=this._routes.get(n.method)||[];for(const i of r){let e;const r=i.match({url:t,sameOrigin:s,request:n,event:a});if(r)return e=r,(Array.isArray(e)&&0===e.length||r.constructor===Object&&0===Object.keys(r).length||"boolean"===typeof r)&&(e=void 0),{route:i,params:e}}return{}}setDefaultHandler(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"GET";this._defaultHandlerMap.set(t,$(e))}setCatchHandler(e){this._catchHandler=$(e)}registerRoute(e){this._routes.has(e.method)||this._routes.set(e.method,[]),this._routes.get(e.method).push(e)}unregisterRoute(e){if(!this._routes.has(e.method))throw new t("unregister-route-but-not-found-with-method",{method:e.method});const s=this._routes.get(e.method).indexOf(e);if(!(s>-1))throw new t("unregister-route-route-not-registered");this._routes.get(e.method).splice(s,1)}}let X;const Y=()=>(X||(X=new z,X.addFetchListener(),X.addCacheListener()),X);function Z(e,s,n){let a;if("string"===typeof e){const t=new URL(e,location.href);0;a=new Q((e=>{let{url:s}=e;return s.href===t.href}),s,n)}else if(e instanceof RegExp)a=new J(e,s,n);else if("function"===typeof e)a=new Q(e,s,n);else{if(!(e instanceof Q))throw new t("unsupported-route-type",{moduleName:"workbox-routing",funcName:"registerRoute",paramName:"capture"});a=e}return Y().registerRoute(a),a}class ee extends Q{constructor(e,t){super((s=>{let{request:n}=s;const a=e.getURLsToCacheKeys();for(const r of function(e){let{ignoreURLParametersMatching:t=[/^utm_/,/^fbclid$/],directoryIndex:s="index.html",cleanURLs:n=!0,urlManipulation:a}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){const r=new URL(e,location.href);r.hash="",yield r.href;const i=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];for(const s of[...e.searchParams.keys()])t.some((e=>e.test(s)))&&e.searchParams.delete(s);return e}(r,t);if(yield i.href,s&&i.pathname.endsWith("/")){const e=new URL(i.href);e.pathname+=s,yield e.href}if(n){const e=new URL(i.href);e.pathname+=".html",yield e.href}if(a){const e=a({url:r});for(const t of e)yield t.href}}()}(n.url,t)){const t=a.get(r);if(t){return{cacheKey:t,integrity:e.getIntegrityForCacheKey(t)}}}}),e.strategy)}}const te={cacheWillUpdate:async e=>{let{response:t}=e;return 200===t.status||0===t.status?t:null}};var se;self.addEventListener("activate",(()=>self.clients.claim())),function(e){G().precache(e)}([{'revision':'4e65a2b1c881051b56e37a120ce8b062','url':'./index.html'},{'revision':null,'url':'./static/css/main.2de7be6f.css'},{'revision':null,'url':'./static/js/main.6fee7145.js'}]),function(e){const t=G();Z(new ee(t,e))}(se);const ne=new RegExp("/[^/?]+\\.[^/]+$");var ae;Z((e=>{let{request:t,url:s}=e;return"navigate"===t.mode&&(!s.pathname.startsWith("/_")&&!s.pathname.match(ne))}),(ae="./index.html",G().createHandlerBoundToURL(ae))),Z((e=>{let{url:t}=e;return t.origin===self.location.origin&&t.pathname.endsWith(".png")}),new class extends j{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this.plugins.some((e=>"cacheWillUpdate"in e))||this.plugins.unshift(te)}async _handle(e,s){const n=s.fetchAndCachePut(e).catch((()=>{}));s.waitUntil(n);let a,r=await s.cacheMatch(e);if(r)0;else{0;try{r=await n}catch(i){i instanceof Error&&(a=i)}}if(!r)throw new t("no-response",{url:e.url,error:a});return r}}({cacheName:"images",plugins:[new class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.cachedResponseWillBeUsed=async e=>{let{event:t,request:s,cacheName:n,cachedResponse:a}=e;if(!a)return null;const r=this._isResponseDateFresh(a),i=this._getCacheExpiration(n);l(i.expireEntries());const o=i.updateTimestamp(s.url);if(t)try{t.waitUntil(o)}catch(c){0}return r?a:null},this.cacheDidUpdate=async e=>{let{cacheName:t,request:s}=e;const n=this._getCacheExpiration(t);await n.updateTimestamp(s.url),await n.expireEntries()},this._config=e,this._maxAgeSeconds=e.maxAgeSeconds,this._cacheExpirations=new Map,e.purgeOnQuotaError&&function(e){n.add(e)}((()=>this.deleteCacheAndMetadata()))}_getCacheExpiration(e){if(e===o())throw new t("expire-custom-caches-only");let s=this._cacheExpirations.get(e);return s||(s=new A(e,this._config),this._cacheExpirations.set(e,s)),s}_isResponseDateFresh(e){if(!this._maxAgeSeconds)return!0;const t=this._getDateHeaderTimestamp(e);if(null===t)return!0;return t>=Date.now()-1e3*this._maxAgeSeconds}_getDateHeaderTimestamp(e){if(!e.headers.has("date"))return null;const t=e.headers.get("date"),s=new Date(t).getTime();return isNaN(s)?null:s}async deleteCacheAndMetadata(){for(const[e,t]of this._cacheExpirations)await self.caches.delete(e),await t.delete();this._cacheExpirations=new Map}}({maxEntries:50})]})),self.addEventListener("message",(e=>{e.data&&"SKIP_WAITING"===e.data.type&&self.skipWaiting()}))})()})(); +(()=>{"use strict";var e={295:()=>{try{self["workbox:core:6.6.0"]&&_()}catch(e){}},229:()=>{try{self["workbox:expiration:6.6.0"]&&_()}catch(e){}},740:()=>{try{self["workbox:precaching:6.6.0"]&&_()}catch(e){}},130:()=>{try{self["workbox:routing:6.6.0"]&&_()}catch(e){}},205:()=>{try{self["workbox:strategies:6.6.0"]&&_()}catch(e){}}},t={};function s(n){var a=t[n];if(void 0!==a)return a.exports;var r=t[n]={exports:{}};return e[n](r,r.exports,s),r.exports}(()=>{s(295);const e=function(e){let t=e;for(var s=arguments.length,n=new Array(s>1?s-1:0),a=1;a0&&(t+=" :: ".concat(JSON.stringify(n))),t};class t extends Error{constructor(t,s){super(e(t,s)),this.name=t,this.details=s}}const n=new Set;const a={googleAnalytics:"googleAnalytics",precache:"precache-v2",prefix:"workbox",runtime:"runtime",suffix:"undefined"!==typeof registration?registration.scope:""},r=e=>[a.prefix,e,a.suffix].filter((e=>e&&e.length>0)).join("-"),i=e=>e||r(a.precache),o=e=>e||r(a.runtime);function c(e,t){const s=new URL(e);for(const n of t)s.searchParams.delete(n);return s.href}let h;function l(e){e.then((()=>{}))}class u{constructor(){this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}}const d=e=>new URL(String(e),location.href).href.replace(new RegExp("^".concat(location.origin)),"");function f(e){return new Promise((t=>setTimeout(t,e)))}function p(e,t){const s=t();return e.waitUntil(s),s}async function g(e,s){let n=null;if(e.url){n=new URL(e.url).origin}if(n!==self.location.origin)throw new t("cross-origin-copy-response",{origin:n});const a=e.clone(),r={headers:new Headers(a.headers),status:a.status,statusText:a.statusText},i=s?s(r):r,o=function(){if(void 0===h){const t=new Response("");if("body"in t)try{new Response(t.body),h=!0}catch(e){h=!1}h=!1}return h}()?a.body:await a.blob();return new Response(o,i)}const w=(e,t)=>t.some((t=>e instanceof t));let m,y;const _=new WeakMap,v=new WeakMap,b=new WeakMap,R=new WeakMap,x=new WeakMap;let C={get(e,t,s){if(e instanceof IDBTransaction){if("done"===t)return v.get(e);if("objectStoreNames"===t)return e.objectStoreNames||b.get(e);if("store"===t)return s.objectStoreNames[1]?void 0:s.objectStore(s.objectStoreNames[0])}return q(e[t])},set:(e,t,s)=>(e[t]=s,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function L(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(y||(y=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(){for(var t=arguments.length,s=new Array(t),n=0;n1?s-1:0),a=1;a{const n=()=>{e.removeEventListener("complete",a),e.removeEventListener("error",r),e.removeEventListener("abort",r)},a=()=>{t(),n()},r=()=>{s(e.error||new DOMException("AbortError","AbortError")),n()};e.addEventListener("complete",a),e.addEventListener("error",r),e.addEventListener("abort",r)}));v.set(e,t)}(e),w(e,m||(m=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(e,C):e)}function q(e){if(e instanceof IDBRequest)return function(e){const t=new Promise(((t,s)=>{const n=()=>{e.removeEventListener("success",a),e.removeEventListener("error",r)},a=()=>{t(q(e.result)),n()},r=()=>{s(e.error),n()};e.addEventListener("success",a),e.addEventListener("error",r)}));return t.then((t=>{t instanceof IDBCursor&&_.set(t,e)})).catch((()=>{})),x.set(t,e),t}(e);if(R.has(e))return R.get(e);const t=E(e);return t!==e&&(R.set(e,t),x.set(t,e)),t}const D=e=>x.get(e);const U=["get","getKey","getAll","getAllKeys","count"],T=["put","add","delete","clear"],k=new Map;function N(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!==typeof t)return;if(k.get(t))return k.get(t);const s=t.replace(/FromIndex$/,""),n=t!==s,a=T.includes(s);if(!(s in(n?IDBIndex:IDBObjectStore).prototype)||!a&&!U.includes(s))return;const r=async function(e){const t=this.transaction(e,a?"readwrite":"readonly");let r=t.store;for(var i=arguments.length,o=new Array(i>1?i-1:0),c=1;c({...e,get:(t,s,n)=>N(t,s)||e.get(t,s,n),has:(t,s)=>!!N(t,s)||e.has(t,s)}))(C);s(229);const I="cache-entries",K=e=>{const t=new URL(e,location.href);return t.hash="",t.href};class M{constructor(e){this._db=null,this._cacheName=e}_upgradeDb(e){const t=e.createObjectStore(I,{keyPath:"id"});t.createIndex("cacheName","cacheName",{unique:!1}),t.createIndex("timestamp","timestamp",{unique:!1})}_upgradeDbAndDeleteOldDbs(e){this._upgradeDb(e),this._cacheName&&function(e){let{blocked:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=indexedDB.deleteDatabase(e);t&&s.addEventListener("blocked",(e=>t(e.oldVersion,e))),q(s).then((()=>{}))}(this._cacheName)}async setTimestamp(e,t){const s={url:e=K(e),timestamp:t,cacheName:this._cacheName,id:this._getId(e)},n=(await this.getDb()).transaction(I,"readwrite",{durability:"relaxed"});await n.store.put(s),await n.done}async getTimestamp(e){const t=await this.getDb(),s=await t.get(I,this._getId(e));return null===s||void 0===s?void 0:s.timestamp}async expireEntries(e,t){const s=await this.getDb();let n=await s.transaction(I).store.index("timestamp").openCursor(null,"prev");const a=[];let r=0;for(;n;){const s=n.value;s.cacheName===this._cacheName&&(e&&s.timestamp=t?a.push(n.value):r++),n=await n.continue()}const i=[];for(const o of a)await s.delete(I,o.id),i.push(o.url);return i}_getId(e){return this._cacheName+"|"+K(e)}async getDb(){return this._db||(this._db=await function(e,t){let{blocked:s,upgrade:n,blocking:a,terminated:r}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=indexedDB.open(e,t),o=q(i);return n&&i.addEventListener("upgradeneeded",(e=>{n(q(i.result),e.oldVersion,e.newVersion,q(i.transaction),e)})),s&&i.addEventListener("blocked",(e=>s(e.oldVersion,e.newVersion,e))),o.then((e=>{r&&e.addEventListener("close",(()=>r())),a&&e.addEventListener("versionchange",(e=>a(e.oldVersion,e.newVersion,e)))})).catch((()=>{})),o}("workbox-expiration",1,{upgrade:this._upgradeDbAndDeleteOldDbs.bind(this)})),this._db}}class A{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this._isRunning=!1,this._rerunRequested=!1,this._maxEntries=t.maxEntries,this._maxAgeSeconds=t.maxAgeSeconds,this._matchOptions=t.matchOptions,this._cacheName=e,this._timestampModel=new M(e)}async expireEntries(){if(this._isRunning)return void(this._rerunRequested=!0);this._isRunning=!0;const e=this._maxAgeSeconds?Date.now()-1e3*this._maxAgeSeconds:0,t=await this._timestampModel.expireEntries(e,this._maxEntries),s=await self.caches.open(this._cacheName);for(const n of t)await s.delete(n,this._matchOptions);this._isRunning=!1,this._rerunRequested&&(this._rerunRequested=!1,l(this.expireEntries()))}async updateTimestamp(e){await this._timestampModel.setTimestamp(e,Date.now())}async isURLExpired(e){if(this._maxAgeSeconds){const t=await this._timestampModel.getTimestamp(e),s=Date.now()-1e3*this._maxAgeSeconds;return void 0===t||t{let{request:t,state:s}=e;s&&(s.originalRequest=t)},this.cachedResponseWillBeUsed=async e=>{let{event:t,state:s,cachedResponse:n}=e;if("install"===t.type&&s&&s.originalRequest&&s.originalRequest instanceof Request){const e=s.originalRequest.url;n?this.notUpdatedURLs.push(e):this.updatedURLs.push(e)}return n}}}class O{constructor(e){let{precacheController:t}=e;this.cacheKeyWillBeUsed=async e=>{let{request:t,params:s}=e;const n=(null===s||void 0===s?void 0:s.cacheKey)||this._precacheController.getCacheKeyForURL(t.url);return n?new Request(n,{headers:t.headers}):t},this._precacheController=t}}s(205);function W(e){return"string"===typeof e?new Request(e):e}class B{constructor(e,t){this._cacheKeys={},Object.assign(this,t),this.event=t.event,this._strategy=e,this._handlerDeferred=new u,this._extendLifetimePromises=[],this._plugins=[...e.plugins],this._pluginStateMap=new Map;for(const s of this._plugins)this._pluginStateMap.set(s,{});this.event.waitUntil(this._handlerDeferred.promise)}async fetch(e){const{event:s}=this;let n=W(e);if("navigate"===n.mode&&s instanceof FetchEvent&&s.preloadResponse){const e=await s.preloadResponse;if(e)return e}const a=this.hasCallback("fetchDidFail")?n.clone():null;try{for(const e of this.iterateCallbacks("requestWillFetch"))n=await e({request:n.clone(),event:s})}catch(i){if(i instanceof Error)throw new t("plugin-error-request-will-fetch",{thrownErrorMessage:i.message})}const r=n.clone();try{let e;e=await fetch(n,"navigate"===n.mode?void 0:this._strategy.fetchOptions);for(const t of this.iterateCallbacks("fetchDidSucceed"))e=await t({event:s,request:r,response:e});return e}catch(o){throw a&&await this.runCallbacks("fetchDidFail",{error:o,event:s,originalRequest:a.clone(),request:r.clone()}),o}}async fetchAndCachePut(e){const t=await this.fetch(e),s=t.clone();return this.waitUntil(this.cachePut(e,s)),t}async cacheMatch(e){const t=W(e);let s;const{cacheName:n,matchOptions:a}=this._strategy,r=await this.getCacheKey(t,"read"),i=Object.assign(Object.assign({},a),{cacheName:n});s=await caches.match(r,i);for(const o of this.iterateCallbacks("cachedResponseWillBeUsed"))s=await o({cacheName:n,matchOptions:a,cachedResponse:s,request:r,event:this.event})||void 0;return s}async cachePut(e,s){const a=W(e);await f(0);const r=await this.getCacheKey(a,"write");if(!s)throw new t("cache-put-with-no-response",{url:d(r.url)});const i=await this._ensureResponseSafeToCache(s);if(!i)return!1;const{cacheName:o,matchOptions:h}=this._strategy,l=await self.caches.open(o),u=this.hasCallback("cacheDidUpdate"),p=u?await async function(e,t,s,n){const a=c(t.url,s);if(t.url===a)return e.match(t,n);const r=Object.assign(Object.assign({},n),{ignoreSearch:!0}),i=await e.keys(t,r);for(const o of i)if(a===c(o.url,s))return e.match(o,n)}(l,r.clone(),["__WB_REVISION__"],h):null;try{await l.put(r,u?i.clone():i)}catch(g){if(g instanceof Error)throw"QuotaExceededError"===g.name&&await async function(){for(const e of n)await e()}(),g}for(const t of this.iterateCallbacks("cacheDidUpdate"))await t({cacheName:o,oldResponse:p,newResponse:i.clone(),request:r,event:this.event});return!0}async getCacheKey(e,t){const s="".concat(e.url," | ").concat(t);if(!this._cacheKeys[s]){let n=e;for(const e of this.iterateCallbacks("cacheKeyWillBeUsed"))n=W(await e({mode:t,request:n,event:this.event,params:this.params}));this._cacheKeys[s]=n}return this._cacheKeys[s]}hasCallback(e){for(const t of this._strategy.plugins)if(e in t)return!0;return!1}async runCallbacks(e,t){for(const s of this.iterateCallbacks(e))await s(t)}*iterateCallbacks(e){for(const t of this._strategy.plugins)if("function"===typeof t[e]){const s=this._pluginStateMap.get(t),n=n=>{const a=Object.assign(Object.assign({},n),{state:s});return t[e](a)};yield n}}waitUntil(e){return this._extendLifetimePromises.push(e),e}async doneWaiting(){let e;for(;e=this._extendLifetimePromises.shift();)await e}destroy(){this._handlerDeferred.resolve(null)}async _ensureResponseSafeToCache(e){let t=e,s=!1;for(const n of this.iterateCallbacks("cacheWillUpdate"))if(t=await n({request:this.request,response:t,event:this.event})||void 0,s=!0,!t)break;return s||t&&200!==t.status&&(t=void 0),t}}class j{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.cacheName=o(e.cacheName),this.plugins=e.plugins||[],this.fetchOptions=e.fetchOptions,this.matchOptions=e.matchOptions}handle(e){const[t]=this.handleAll(e);return t}handleAll(e){e instanceof FetchEvent&&(e={event:e,request:e.request});const t=e.event,s="string"===typeof e.request?new Request(e.request):e.request,n="params"in e?e.params:void 0,a=new B(this,{event:t,request:s,params:n}),r=this._getResponse(a,s,t);return[r,this._awaitComplete(r,a,s,t)]}async _getResponse(e,s,n){let a;await e.runCallbacks("handlerWillStart",{event:n,request:s});try{if(a=await this._handle(s,e),!a||"error"===a.type)throw new t("no-response",{url:s.url})}catch(r){if(r instanceof Error)for(const t of e.iterateCallbacks("handlerDidError"))if(a=await t({error:r,event:n,request:s}),a)break;if(!a)throw r}for(const t of e.iterateCallbacks("handlerWillRespond"))a=await t({event:n,request:s,response:a});return a}async _awaitComplete(e,t,s,n){let a,r;try{a=await e}catch(r){}try{await t.runCallbacks("handlerDidRespond",{event:n,request:s,response:a}),await t.doneWaiting()}catch(i){i instanceof Error&&(r=i)}if(await t.runCallbacks("handlerDidComplete",{event:n,request:s,response:a,error:r}),t.destroy(),r)throw r}}class F extends j{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.cacheName=i(e.cacheName),super(e),this._fallbackToNetwork=!1!==e.fallbackToNetwork,this.plugins.push(F.copyRedirectedCacheableResponsesPlugin)}async _handle(e,t){const s=await t.cacheMatch(e);return s||(t.event&&"install"===t.event.type?await this._handleInstall(e,t):await this._handleFetch(e,t))}async _handleFetch(e,s){let n;const a=s.params||{};if(!this._fallbackToNetwork)throw new t("missing-precache-entry",{cacheName:this.cacheName,url:e.url});{0;const t=a.integrity,r=e.integrity,i=!r||r===t;if(n=await s.fetch(new Request(e,{integrity:"no-cors"!==e.mode?r||t:void 0})),t&&i&&"no-cors"!==e.mode){this._useDefaultCacheabilityPluginIfNeeded();await s.cachePut(e,n.clone());0}}return n}async _handleInstall(e,s){this._useDefaultCacheabilityPluginIfNeeded();const n=await s.fetch(e);if(!await s.cachePut(e,n.clone()))throw new t("bad-precaching-response",{url:e.url,status:n.status});return n}_useDefaultCacheabilityPluginIfNeeded(){let e=null,t=0;for(const[s,n]of this.plugins.entries())n!==F.copyRedirectedCacheableResponsesPlugin&&(n===F.defaultPrecacheCacheabilityPlugin&&(e=s),n.cacheWillUpdate&&t++);0===t?this.plugins.push(F.defaultPrecacheCacheabilityPlugin):t>1&&null!==e&&this.plugins.splice(e,1)}}F.defaultPrecacheCacheabilityPlugin={async cacheWillUpdate(e){let{response:t}=e;return!t||t.status>=400?null:t}},F.copyRedirectedCacheableResponsesPlugin={async cacheWillUpdate(e){let{response:t}=e;return t.redirected?await g(t):t}};class H{constructor(){let{cacheName:e,plugins:t=[],fallbackToNetwork:s=!0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this._urlsToCacheKeys=new Map,this._urlsToCacheModes=new Map,this._cacheKeysToIntegrities=new Map,this._strategy=new F({cacheName:i(e),plugins:[...t,new O({precacheController:this})],fallbackToNetwork:s}),this.install=this.install.bind(this),this.activate=this.activate.bind(this)}get strategy(){return this._strategy}precache(e){this.addToCacheList(e),this._installAndActiveListenersAdded||(self.addEventListener("install",this.install),self.addEventListener("activate",this.activate),this._installAndActiveListenersAdded=!0)}addToCacheList(e){const s=[];for(const n of e){"string"===typeof n?s.push(n):n&&void 0===n.revision&&s.push(n.url);const{cacheKey:e,url:a}=P(n),r="string"!==typeof n&&n.revision?"reload":"default";if(this._urlsToCacheKeys.has(a)&&this._urlsToCacheKeys.get(a)!==e)throw new t("add-to-cache-list-conflicting-entries",{firstEntry:this._urlsToCacheKeys.get(a),secondEntry:e});if("string"!==typeof n&&n.integrity){if(this._cacheKeysToIntegrities.has(e)&&this._cacheKeysToIntegrities.get(e)!==n.integrity)throw new t("add-to-cache-list-conflicting-integrities",{url:a});this._cacheKeysToIntegrities.set(e,n.integrity)}if(this._urlsToCacheKeys.set(a,e),this._urlsToCacheModes.set(a,r),s.length>0){const e="Workbox is precaching URLs without revision "+"info: ".concat(s.join(", "),"\nThis is generally NOT safe. ")+"Learn more at https://bit.ly/wb-precache";console.warn(e)}}}install(e){return p(e,(async()=>{const t=new S;this.strategy.plugins.push(t);for(const[a,r]of this._urlsToCacheKeys){const t=this._cacheKeysToIntegrities.get(r),s=this._urlsToCacheModes.get(a),n=new Request(a,{integrity:t,cache:s,credentials:"same-origin"});await Promise.all(this.strategy.handleAll({params:{cacheKey:r},request:n,event:e}))}const{updatedURLs:s,notUpdatedURLs:n}=t;return{updatedURLs:s,notUpdatedURLs:n}}))}activate(e){return p(e,(async()=>{const e=await self.caches.open(this.strategy.cacheName),t=await e.keys(),s=new Set(this._urlsToCacheKeys.values()),n=[];for(const a of t)s.has(a.url)||(await e.delete(a),n.push(a.url));return{deletedURLs:n}}))}getURLsToCacheKeys(){return this._urlsToCacheKeys}getCachedURLs(){return[...this._urlsToCacheKeys.keys()]}getCacheKeyForURL(e){const t=new URL(e,location.href);return this._urlsToCacheKeys.get(t.href)}getIntegrityForCacheKey(e){return this._cacheKeysToIntegrities.get(e)}async matchPrecache(e){const t=e instanceof Request?e.url:e,s=this.getCacheKeyForURL(t);if(s){return(await self.caches.open(this.strategy.cacheName)).match(s)}}createHandlerBoundToURL(e){const s=this.getCacheKeyForURL(e);if(!s)throw new t("non-precached-url",{url:e});return t=>(t.request=new Request(e),t.params=Object.assign({cacheKey:s},t.params),this.strategy.handle(t))}}let V;const G=()=>(V||(V=new H),V);s(130);const $=e=>e&&"object"===typeof e?e:{handle:e};class Q{constructor(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"GET";this.handler=$(t),this.match=e,this.method=s}setCatchHandler(e){this.catchHandler=$(e)}}class J extends Q{constructor(e,t,s){super((t=>{let{url:s}=t;const n=e.exec(s.href);if(n&&(s.origin===location.origin||0===n.index))return n.slice(1)}),t,s)}}class z{constructor(){this._routes=new Map,this._defaultHandlerMap=new Map}get routes(){return this._routes}addFetchListener(){self.addEventListener("fetch",(e=>{const{request:t}=e,s=this.handleRequest({request:t,event:e});s&&e.respondWith(s)}))}addCacheListener(){self.addEventListener("message",(e=>{if(e.data&&"CACHE_URLS"===e.data.type){const{payload:t}=e.data;0;const s=Promise.all(t.urlsToCache.map((t=>{"string"===typeof t&&(t=[t]);const s=new Request(...t);return this.handleRequest({request:s,event:e})})));e.waitUntil(s),e.ports&&e.ports[0]&&s.then((()=>e.ports[0].postMessage(!0)))}}))}handleRequest(e){let{request:t,event:s}=e;const n=new URL(t.url,location.href);if(!n.protocol.startsWith("http"))return void 0;const a=n.origin===location.origin,{params:r,route:i}=this.findMatchingRoute({event:s,request:t,sameOrigin:a,url:n});let o=i&&i.handler;const c=t.method;if(!o&&this._defaultHandlerMap.has(c)&&(o=this._defaultHandlerMap.get(c)),!o)return void 0;let h;try{h=o.handle({url:n,request:t,event:s,params:r})}catch(u){h=Promise.reject(u)}const l=i&&i.catchHandler;return h instanceof Promise&&(this._catchHandler||l)&&(h=h.catch((async e=>{if(l){0;try{return await l.handle({url:n,request:t,event:s,params:r})}catch(a){a instanceof Error&&(e=a)}}if(this._catchHandler)return this._catchHandler.handle({url:n,request:t,event:s});throw e}))),h}findMatchingRoute(e){let{url:t,sameOrigin:s,request:n,event:a}=e;const r=this._routes.get(n.method)||[];for(const i of r){let e;const r=i.match({url:t,sameOrigin:s,request:n,event:a});if(r)return e=r,(Array.isArray(e)&&0===e.length||r.constructor===Object&&0===Object.keys(r).length||"boolean"===typeof r)&&(e=void 0),{route:i,params:e}}return{}}setDefaultHandler(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"GET";this._defaultHandlerMap.set(t,$(e))}setCatchHandler(e){this._catchHandler=$(e)}registerRoute(e){this._routes.has(e.method)||this._routes.set(e.method,[]),this._routes.get(e.method).push(e)}unregisterRoute(e){if(!this._routes.has(e.method))throw new t("unregister-route-but-not-found-with-method",{method:e.method});const s=this._routes.get(e.method).indexOf(e);if(!(s>-1))throw new t("unregister-route-route-not-registered");this._routes.get(e.method).splice(s,1)}}let X;const Y=()=>(X||(X=new z,X.addFetchListener(),X.addCacheListener()),X);function Z(e,s,n){let a;if("string"===typeof e){const t=new URL(e,location.href);0;a=new Q((e=>{let{url:s}=e;return s.href===t.href}),s,n)}else if(e instanceof RegExp)a=new J(e,s,n);else if("function"===typeof e)a=new Q(e,s,n);else{if(!(e instanceof Q))throw new t("unsupported-route-type",{moduleName:"workbox-routing",funcName:"registerRoute",paramName:"capture"});a=e}return Y().registerRoute(a),a}class ee extends Q{constructor(e,t){super((s=>{let{request:n}=s;const a=e.getURLsToCacheKeys();for(const r of function(e){let{ignoreURLParametersMatching:t=[/^utm_/,/^fbclid$/],directoryIndex:s="index.html",cleanURLs:n=!0,urlManipulation:a}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){const r=new URL(e,location.href);r.hash="",yield r.href;const i=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];for(const s of[...e.searchParams.keys()])t.some((e=>e.test(s)))&&e.searchParams.delete(s);return e}(r,t);if(yield i.href,s&&i.pathname.endsWith("/")){const e=new URL(i.href);e.pathname+=s,yield e.href}if(n){const e=new URL(i.href);e.pathname+=".html",yield e.href}if(a){const e=a({url:r});for(const t of e)yield t.href}}()}(n.url,t)){const t=a.get(r);if(t){return{cacheKey:t,integrity:e.getIntegrityForCacheKey(t)}}}}),e.strategy)}}const te={cacheWillUpdate:async e=>{let{response:t}=e;return 200===t.status||0===t.status?t:null}};var se;self.addEventListener("activate",(()=>self.clients.claim())),function(e){G().precache(e)}([{'revision':'ee6bfe446612415b16c2cb66baf57a44','url':'./index.html'},{'revision':null,'url':'./static/css/main.2de7be6f.css'},{'revision':null,'url':'./static/js/main.6e322620.js'}]),function(e){const t=G();Z(new ee(t,e))}(se);const ne=new RegExp("/[^/?]+\\.[^/]+$");var ae;Z((e=>{let{request:t,url:s}=e;return"navigate"===t.mode&&(!s.pathname.startsWith("/_")&&!s.pathname.match(ne))}),(ae="./index.html",G().createHandlerBoundToURL(ae))),Z((e=>{let{url:t}=e;return t.origin===self.location.origin&&t.pathname.endsWith(".png")}),new class extends j{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this.plugins.some((e=>"cacheWillUpdate"in e))||this.plugins.unshift(te)}async _handle(e,s){const n=s.fetchAndCachePut(e).catch((()=>{}));s.waitUntil(n);let a,r=await s.cacheMatch(e);if(r)0;else{0;try{r=await n}catch(i){i instanceof Error&&(a=i)}}if(!r)throw new t("no-response",{url:e.url,error:a});return r}}({cacheName:"images",plugins:[new class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.cachedResponseWillBeUsed=async e=>{let{event:t,request:s,cacheName:n,cachedResponse:a}=e;if(!a)return null;const r=this._isResponseDateFresh(a),i=this._getCacheExpiration(n);l(i.expireEntries());const o=i.updateTimestamp(s.url);if(t)try{t.waitUntil(o)}catch(c){0}return r?a:null},this.cacheDidUpdate=async e=>{let{cacheName:t,request:s}=e;const n=this._getCacheExpiration(t);await n.updateTimestamp(s.url),await n.expireEntries()},this._config=e,this._maxAgeSeconds=e.maxAgeSeconds,this._cacheExpirations=new Map,e.purgeOnQuotaError&&function(e){n.add(e)}((()=>this.deleteCacheAndMetadata()))}_getCacheExpiration(e){if(e===o())throw new t("expire-custom-caches-only");let s=this._cacheExpirations.get(e);return s||(s=new A(e,this._config),this._cacheExpirations.set(e,s)),s}_isResponseDateFresh(e){if(!this._maxAgeSeconds)return!0;const t=this._getDateHeaderTimestamp(e);if(null===t)return!0;return t>=Date.now()-1e3*this._maxAgeSeconds}_getDateHeaderTimestamp(e){if(!e.headers.has("date"))return null;const t=e.headers.get("date"),s=new Date(t).getTime();return isNaN(s)?null:s}async deleteCacheAndMetadata(){for(const[e,t]of this._cacheExpirations)await self.caches.delete(e),await t.delete();this._cacheExpirations=new Map}}({maxEntries:50})]})),self.addEventListener("message",(e=>{e.data&&"SKIP_WAITING"===e.data.type&&self.skipWaiting()}))})()})(); //# sourceMappingURL=service-worker.js.map \ No newline at end of file diff --git a/static/js/main.6e322620.js b/static/js/main.6e322620.js new file mode 100644 index 0000000..0e696c8 --- /dev/null +++ b/static/js/main.6e322620.js @@ -0,0 +1,3 @@ +/*! For license information please see main.6e322620.js.LICENSE.txt */ +(()=>{var __webpack_modules__={1344:(t,e,r)=>{"use strict";var n=r(6382).Buffer,i=r(5140),o=r(505),s=r(6905);function a(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}})),e.default=t,Object.freeze(e)}var u=a(i);const h="Expected Private",c="Expected Point",l="Expected Tweak",f="Expected Signature",d="Expected Extra Data (32 bytes)",p="Expected Scalar";u.utils.hmacSha256Sync=function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n=0)}function A(t){return t instanceof Uint8Array&&64===t.length&&E(t.subarray(0,32),w)<0&&E(t.subarray(32,64),w)<0}function I(t){return t instanceof Uint8Array&&64===t.length&&E(t.subarray(0,32),_)<0}function C(t){return t instanceof Uint8Array&&t.length===m}function k(t){return void 0===t||t instanceof Uint8Array&&t.length===v}function x(t){if("string"!==typeof t)throw new TypeError("hexToNumber: expected string, got "+typeof t);return BigInt("0x".concat(t))}function T(t){let e;if("bigint"===typeof t)e=t;else if("number"===typeof t&&Number.isSafeInteger(t)&&t>=0)e=BigInt(t);else if("string"===typeof t){if(64!==t.length)throw new Error("Expected 32 bytes of private scalar");e=x(t)}else{if(!(t instanceof Uint8Array))throw new TypeError("Expected valid private scalar");if(32!==t.length)throw new Error("Expected 32 bytes of private scalar");r=t,e=x(u.utils.bytesToHex(r))}var r;if(e<0)throw new Error("Expected private scalar >= 0");return e}const O=(t,e,r)=>{const n=u.Point.fromHex(t),i=T(e),o=u.Point.BASE.multiplyAndAddUnsafe(n,i,BigInt(1));if(!o)throw new Error("Tweaked point at infinity");return o.toRawBytes(r)};function N(t,e){return void 0===t?void 0===e||L(e):!!t}function B(t){try{return t()}catch(e){return null}}function R(t,e){if(32===t.length!==e)return!1;try{return!!u.Point.fromHex(t)}catch(r){return!1}}function P(t){return R(t,!1)}function L(t){return R(t,!1)&&33===t.length}function D(t){return u.utils.isValidPrivateKey(t)}function U(t){return R(t,!0)}function j(t){if(!P(t))throw new Error(c);return t.slice(1,33)}function F(t,e){if(!D(t))throw new Error(h);return B((()=>u.getPublicKey(t,N(e))))}e.cN=function(t,e,r){if(!P(t))throw new Error(c);if(!M(e))throw new Error(l);return B((()=>O(t,e,N(r,t))))},e.HV=function(t,e,r){if(!P(t))throw new Error(c);if(!M(e))throw new Error(l);return B((()=>((t,e,r)=>{const n=u.Point.fromHex(t),i="string"===typeof e?e:u.utils.bytesToHex(e),o=BigInt("0x".concat(i));return n.multiply(o).toRawBytes(r)})(t,e,N(r,t))))},e.jA=function(t,e){if(!1===D(t))throw new Error(h);if(!1===M(e))throw new Error(l);return B((()=>((t,e)=>{const r=g(t),n=T(e),i=u.utils._bigintTo32Bytes(u.utils.mod(r+n,u.CURVE.n));return u.utils.isValidPrivateKey(i)?i:null})(t,e)))},e.Gp=function(t){if(!1===D(t))throw new Error(h);return(t=>{const e=g(t),r=u.utils._bigintTo32Bytes(u.CURVE.n-e);return u.utils.isValidPrivateKey(r)?r:null})(t)},e.V0=function(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:n.alloc(32,0);if(!D(e))throw new Error(h);if(!C(t))throw new Error(p);if(!k(r))throw new Error(d);return u.schnorr.signSync(t,e,r)}},7319:(t,e)=>{"use strict";function r(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, not ".concat(t))}function n(t){if("boolean"!==typeof t)throw new Error("boolean expected, not ".concat(t))}function i(t){return t instanceof Uint8Array||null!=t&&"object"===typeof t&&"Uint8Array"===t.constructor.name}function o(t){if(!i(t))throw new Error("Uint8Array expected");for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n0&&!r.includes(t.length))throw new Error("Uint8Array expected of length ".concat(r,", not of length=").concat(t.length))}function s(t){if("function"!==typeof t||"function"!==typeof t.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");r(t.outputLen),r(t.blockLen)}function a(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function u(t,e){o(t);const r=e.outputLen;if(t.length{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.HashMD=e.Maj=e.Chi=void 0;const n=r(7319),i=r(5605);e.Chi=(t,e,r)=>t&e^~t&r;e.Maj=(t,e,r)=>t&e^t&r^e&r;class o extends i.Hash{constructor(t,e,r,n){super(),this.blockLen=t,this.outputLen=e,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=(0,i.createView)(this.buffer)}update(t){(0,n.exists)(this);const{view:e,buffer:r,blockLen:o}=this,s=(t=(0,i.toBytes)(t)).length;for(let n=0;no-a&&(this.process(r,0),a=0);for(let n=a;n>i&o),a=Number(r&o),u=n?4:0,h=n?0:4;t.setUint32(e+u,s,n),t.setUint32(e+h,a,n)}(r,o-8,BigInt(8*this.length),s),this.process(r,0);const u=(0,i.createView)(t),h=this.outputLen;if(h%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=h/4,l=this.get();if(c>l.length)throw new Error("_sha2: outputLen bigger than state");for(let n=0;n{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.crypto=void 0,e.crypto="object"===typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0},505:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hmac=e.HMAC=void 0;const n=r(7319),i=r(5605);class o extends i.Hash{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,(0,n.hash)(t);const r=(0,i.toBytes)(e);if(this.iHash=t.create(),"function"!==typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const o=this.blockLen,s=new Uint8Array(o);s.set(r.length>o?t.create().update(r).digest():r);for(let n=0;nnew o(t,e).update(r).digest(),e.hmac.create=(t,e)=>new o(t,e)},6905:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sha224=e.sha256=void 0;const n=r(5936),i=r(5605),o=new Uint32Array([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]),s=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),a=new Uint32Array(64);class u extends n.HashMD{constructor(){super(64,32,8,!1),this.A=0|s[0],this.B=0|s[1],this.C=0|s[2],this.D=0|s[3],this.E=0|s[4],this.F=0|s[5],this.G=0|s[6],this.H=0|s[7]}get(){const{A:t,B:e,C:r,D:n,E:i,F:o,G:s,H:a}=this;return[t,e,r,n,i,o,s,a]}set(t,e,r,n,i,o,s,a){this.A=0|t,this.B=0|e,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(t,e){for(let n=0;n<16;n++,e+=4)a[n]=t.getUint32(e,!1);for(let n=16;n<64;n++){const t=a[n-15],e=a[n-2],r=(0,i.rotr)(t,7)^(0,i.rotr)(t,18)^t>>>3,o=(0,i.rotr)(e,17)^(0,i.rotr)(e,19)^e>>>10;a[n]=o+a[n-7]+r+a[n-16]|0}let{A:r,B:s,C:u,D:h,E:c,F:l,G:f,H:d}=this;for(let p=0;p<64;p++){const t=d+((0,i.rotr)(c,6)^(0,i.rotr)(c,11)^(0,i.rotr)(c,25))+(0,n.Chi)(c,l,f)+o[p]+a[p]|0,e=((0,i.rotr)(r,2)^(0,i.rotr)(r,13)^(0,i.rotr)(r,22))+(0,n.Maj)(r,s,u)|0;d=f,f=l,l=c,c=h+t|0,h=u,u=s,s=r,r=t+e|0}r=r+this.A|0,s=s+this.B|0,u=u+this.C|0,h=h+this.D|0,c=c+this.E|0,l=l+this.F|0,f=f+this.G|0,d=d+this.H|0,this.set(r,s,u,h,c,l,f,d)}roundClean(){a.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class h extends u{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}e.sha256=(0,i.wrapConstructor)((()=>new u)),e.sha224=(0,i.wrapConstructor)((()=>new h))},5605:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.randomBytes=e.wrapXOFConstructorWithOpts=e.wrapConstructorWithOpts=e.wrapConstructor=e.checkOpts=e.Hash=e.concatBytes=e.toBytes=e.utf8ToBytes=e.asyncLoop=e.nextTick=e.hexToBytes=e.bytesToHex=e.byteSwap32=e.byteSwapIfBE=e.byteSwap=e.isLE=e.rotl=e.rotr=e.createView=e.u32=e.u8=e.isBytes=void 0;const n=r(1851),i=r(7319);e.isBytes=function(t){return t instanceof Uint8Array||null!=t&&"object"===typeof t&&"Uint8Array"===t.constructor.name};e.u8=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength);e.u32=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4));e.createView=t=>new DataView(t.buffer,t.byteOffset,t.byteLength);e.rotr=(t,e)=>t<<32-e|t>>>e;e.rotl=(t,e)=>t<>>32-e>>>0,e.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0];e.byteSwap=t=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255,e.byteSwapIfBE=e.isLE?t=>t:t=>(0,e.byteSwap)(t),e.byteSwap32=function(t){for(let r=0;re.toString(16).padStart(2,"0")));e.bytesToHex=function(t){(0,i.bytes)(t);let e="";for(let r=0;r=s._0&&t<=s._9?t-s._0:t>=s._A&&t<=s._F?t-(s._A-10):t>=s._a&&t<=s._f?t-(s._a-10):void 0}e.hexToBytes=function(t){if("string"!==typeof t)throw new Error("hex string expected, got "+typeof t);const e=t.length,r=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(r);for(let i=0,o=0;i{},e.asyncLoop=async function(t,r,n){let i=Date.now();for(let o=0;o=0&&tt().update(h(e)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e},e.wrapConstructorWithOpts=function(t){const e=(e,r)=>t(r).update(h(e)).digest(),r=t({});return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=e=>t(e),e},e.wrapXOFConstructorWithOpts=function(t){const e=(e,r)=>t(r).update(h(e)).digest(),r=t({});return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=e=>t(e),e},e.randomBytes=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:32;if(n.crypto&&"function"===typeof n.crypto.getRandomValues)return n.crypto.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}},5140:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.utils=e.schnorr=e.verify=e.signSync=e.sign=e.getSharedSecret=e.recoverPublicKey=e.getPublicKey=e.Signature=e.Point=e.CURVE=void 0;const n=r(3898),i=BigInt(0),o=BigInt(1),s=BigInt(2),a=BigInt(3),u=BigInt(8),h=Object.freeze({a:i,b:BigInt(7),P:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:o,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee")});e.CURVE=h;const c=(t,e)=>(t+e/s)/e,l={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar(t){const{n:e}=h,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-o*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=r,a=BigInt("0x100000000000000000000000000000000"),u=c(s*t,e),l=c(-n*t,e);let f=j(t-u*r-l*i,e),d=j(-u*n-l*s,e);const p=f>a,g=d>a;if(p&&(f=e-f),g&&(d=e-d),f>a||d>a)throw new Error("splitScalarEndo: Endomorphism failed, k="+t);return{k1neg:p,k1:f,k2neg:g,k2:d}}},f=32,d=32,p=f+1,g=2*f+1;function m(t){const{a:e,b:r}=h,n=j(t*t),i=j(n*t);return j(i+e*t+r)}const y=h.a===i;class w extends Error{constructor(t){super(t)}}function v(t){if(!(t instanceof b))throw new TypeError("JacobianPoint expected")}class b{constructor(t,e,r){this.x=t,this.y=e,this.z=r}static fromAffine(t){if(!(t instanceof S))throw new TypeError("JacobianPoint#fromAffine: expected Point");return t.equals(S.ZERO)?b.ZERO:new b(t.x,t.y,o)}static toAffineBatch(t){const e=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:h.P;const r=new Array(t.length),n=H(t.reduce(((t,n,o)=>n===i?t:(r[o]=t,j(t*n,e))),o),e);return t.reduceRight(((t,n,o)=>n===i?t:(r[o]=j(t*r[o],e),j(t*n,e))),n),r}(t.map((t=>t.z)));return t.map(((t,r)=>t.toAffine(e[r])))}static normalizeZ(t){return b.toAffineBatch(t).map(b.fromAffine)}equals(t){v(t);const{x:e,y:r,z:n}=this,{x:i,y:o,z:s}=t,a=j(n*n),u=j(s*s),h=j(e*u),c=j(i*a),l=j(j(r*s)*u),f=j(j(o*n)*a);return h===c&&l===f}negate(){return new b(this.x,j(-this.y),this.z)}double(){const{x:t,y:e,z:r}=this,n=j(t*t),i=j(e*e),o=j(i*i),h=t+i,c=j(s*(j(h*h)-n-o)),l=j(a*n),f=j(l*l),d=j(f-s*c),p=j(l*(c-d)-u*o),g=j(s*e*r);return new b(d,p,g)}add(t){v(t);const{x:e,y:r,z:n}=this,{x:o,y:a,z:u}=t;if(o===i||a===i)return this;if(e===i||r===i)return t;const h=j(n*n),c=j(u*u),l=j(e*c),f=j(o*h),d=j(j(r*u)*c),p=j(j(a*n)*h),g=j(f-l),m=j(p-d);if(g===i)return m===i?this.double():b.ZERO;const y=j(g*g),w=j(g*y),_=j(l*y),E=j(m*m-w-s*_),S=j(m*(_-E)-d*w),M=j(n*u*g);return new b(E,S,M)}subtract(t){return this.add(t.negate())}multiplyUnsafe(t){const e=b.ZERO;if("bigint"===typeof t&&t===i)return e;let r=U(t);if(r===o)return this;if(!y){let t=e,n=this;for(;r>i;)r&o&&(t=t.add(n)),n=n.double(),r>>=o;return t}let{k1neg:n,k1:s,k2neg:a,k2:u}=l.splitScalar(r),h=e,c=e,f=this;for(;s>i||u>i;)s&o&&(h=h.add(f)),u&o&&(c=c.add(f)),f=f.double(),s>>=o,u>>=o;return n&&(h=h.negate()),a&&(c=c.negate()),c=new b(j(c.x*l.beta),c.y,c.z),h.add(c)}precomputeWindow(t){const e=y?128/t+1:256/t+1,r=[];let n=this,i=n;for(let o=0;o>=l,r>u&&(r-=c,t+=o);const a=e,d=e+Math.abs(r)-1,p=f%2!==0,g=r<0;0===r?s=s.add(_(p,n[a])):i=i.add(_(g,n[d]))}return{p:i,f:s}}multiply(t,e){let r,n,i=U(t);if(y){const{k1neg:t,k1:o,k2neg:s,k2:a}=l.splitScalar(i);let{p:u,f:h}=this.wNAF(o,e),{p:c,f:f}=this.wNAF(a,e);u=_(t,u),c=_(s,c),c=new b(j(c.x*l.beta),c.y,c.z),r=u.add(c),n=h.add(f)}else{const{p:t,f:o}=this.wNAF(i,e);r=t,n=o}return b.normalizeZ([r,n])[0]}toAffine(t){const{x:e,y:r,z:n}=this,i=this.equals(b.ZERO);null==t&&(t=i?u:H(n));const s=t,a=j(s*s),h=j(a*s),c=j(e*a),l=j(r*h),f=j(n*s);if(i)return S.ZERO;if(f!==o)throw new Error("invZ was invalid");return new S(c,l)}}function _(t,e){const r=e.negate();return t?r:e}b.BASE=new b(h.Gx,h.Gy,o),b.ZERO=new b(i,o,i);const E=new WeakMap;class S{constructor(t,e){this.x=t,this.y=e}_setWindowSize(t){this._WINDOW_SIZE=t,E.delete(this)}hasEvenY(){return this.y%s===i}static fromCompressedHex(t){const e=32===t.length,r=L(e?t:t.subarray(1));if(!G(r))throw new Error("Point is not on curve");let n=function(t){const{P:e}=h,r=BigInt(6),n=BigInt(11),i=BigInt(22),o=BigInt(23),u=BigInt(44),c=BigInt(88),l=t*t*t%e,f=l*l*t%e,d=F(f,a)*f%e,p=F(d,a)*f%e,g=F(p,s)*l%e,m=F(g,n)*g%e,y=F(m,i)*m%e,w=F(y,u)*y%e,v=F(w,c)*w%e,b=F(v,u)*y%e,_=F(b,a)*f%e,E=F(_,o)*m%e,S=F(E,r)*l%e,M=F(S,s);if(M*M%e!==t)throw new Error("Cannot find square root");return M}(m(r));const i=(n&o)===o;if(e)i&&(n=j(-n));else{1===(1&t[0])!==i&&(n=j(-n))}const u=new S(r,n);return u.assertValidity(),u}static fromUncompressedHex(t){const e=L(t.subarray(1,f+1)),r=L(t.subarray(f+1,2*f+1)),n=new S(e,r);return n.assertValidity(),n}static fromHex(t){const e=D(t),r=e.length,n=e[0];if(r===f)return this.fromCompressedHex(e);if(r===p&&(2===n||3===n))return this.fromCompressedHex(e);if(r===g&&4===n)return this.fromUncompressedHex(e);throw new Error("Point.fromHex: received invalid point. Expected 32-".concat(p," compressed bytes or ").concat(g," uncompressed bytes, not ").concat(r))}static fromPrivateKey(t){return S.BASE.multiply(Z(t))}static fromSignature(t,e,r){const{r:n,s:i}=Q(e);if(![0,1,2,3].includes(r))throw new Error("Cannot recover: invalid recovery bit");const o=z(D(t)),{n:s}=h,a=2===r||3===r?n+s:n,u=H(a,s),c=j(-o*u,s),l=j(i*u,s),f=1&r?"03":"02",d=S.fromHex(f+O(a)),p=S.BASE.multiplyAndAddUnsafe(d,c,l);if(!p)throw new Error("Cannot recover signature: point at infinify");return p.assertValidity(),p}toRawBytes(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return P(this.toHex(t))}toHex(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const e=O(this.x);if(t){const t=this.hasEvenY()?"02":"03";return"".concat(t).concat(e)}return"04".concat(e).concat(O(this.y))}toHexX(){return this.toHex(!0).slice(2)}toRawX(){return this.toRawBytes(!0).slice(1)}assertValidity(){const t="Point is not on elliptic curve",{x:e,y:r}=this;if(!G(e)||!G(r))throw new Error(t);const n=j(r*r);if(j(n-m(e))!==i)throw new Error(t)}equals(t){return this.x===t.x&&this.y===t.y}negate(){return new S(this.x,j(-this.y))}double(){return b.fromAffine(this).double().toAffine()}add(t){return b.fromAffine(this).add(b.fromAffine(t)).toAffine()}subtract(t){return this.add(t.negate())}multiply(t){return b.fromAffine(this).multiply(t,this).toAffine()}multiplyAndAddUnsafe(t,e,r){const n=b.fromAffine(this),s=e===i||e===o||this!==S.BASE?n.multiplyUnsafe(e):n.multiply(e),a=b.fromAffine(t).multiplyUnsafe(r),u=s.add(a);return u.equals(b.ZERO)?void 0:u.toAffine()}}function M(t){return Number.parseInt(t[0],16)>=8?"00"+t:t}function A(t){if(t.length<2||2!==t[0])throw new Error("Invalid signature integer tag: ".concat(x(t)));const e=t[1],r=t.subarray(2,e+2);if(!e||r.length!==e)throw new Error("Invalid signature integer: wrong length");if(0===r[0]&&r[1]<=127)throw new Error("Invalid signature integer: trailing length");return{data:L(r),left:t.subarray(e+2)}}e.Point=S,S.BASE=new S(h.Gx,h.Gy),S.ZERO=new S(i,i);class I{constructor(t,e){this.r=t,this.s=e,this.assertValidity()}static fromCompact(t){const e=t instanceof Uint8Array,r="Signature.fromCompact";if("string"!==typeof t&&!e)throw new TypeError("".concat(r,": Expected string or Uint8Array"));const n=e?x(t):t;if(128!==n.length)throw new Error("".concat(r,": Expected 64-byte hex"));return new I(R(n.slice(0,64)),R(n.slice(64,128)))}static fromDER(t){const e=t instanceof Uint8Array;if("string"!==typeof t&&!e)throw new TypeError("Signature.fromDER: Expected string or Uint8Array");const{r:r,s:n}=function(t){if(t.length<2||48!=t[0])throw new Error("Invalid signature tag: ".concat(x(t)));if(t[1]!==t.length-2)throw new Error("Invalid signature: incorrect length");const{data:e,left:r}=A(t.subarray(2)),{data:n,left:i}=A(r);if(i.length)throw new Error("Invalid signature: left bytes after parsing: ".concat(x(i)));return{r:e,s:n}}(e?t:P(t));return new I(r,n)}static fromHex(t){return this.fromDER(t)}assertValidity(){const{r:t,s:e}=this;if(!K(t))throw new Error("Invalid Signature: r must be 0 < r < n");if(!K(e))throw new Error("Invalid Signature: s must be 0 < s < n")}hasHighS(){const t=h.n>>o;return this.s>t}normalizeS(){return this.hasHighS()?new I(this.r,j(-this.s,h.n)):this}toDERRawBytes(){return P(this.toDERHex())}toDERHex(){const t=M(B(this.s)),e=M(B(this.r)),r=t.length/2,n=e.length/2,i=B(r),o=B(n),s=B(n+r+4);return"30".concat(s,"02").concat(o).concat(e,"02").concat(i).concat(t)}toRawBytes(){return this.toDERRawBytes()}toHex(){return this.toDERHex()}toCompactRawBytes(){return P(this.toCompactHex())}toCompactHex(){return O(this.r)+O(this.s)}}function C(){for(var t=arguments.length,e=new Array(t),r=0;rt instanceof Uint8Array)))throw new Error("Uint8Array list expected");if(1===e.length)return e[0];const n=e.reduce(((t,e)=>t+e.length),0),i=new Uint8Array(n);for(let o=0,s=0;oe.toString(16).padStart(2,"0")));function x(t){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");let e="";for(let r=0;r0)return BigInt(t);if("bigint"===typeof t&&K(t))return t;throw new TypeError("Expected valid private scalar: 0 < scalar < curve.n")}function j(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:h.P;const r=t%e;return r>=i?r:e+r}function F(t,e){const{P:r}=h;let n=t;for(;e-- >i;)n*=n,n%=r;return n}function H(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:h.P;if(t===i||e<=i)throw new Error("invert: expected positive integers, got n=".concat(t," mod=").concat(e));let r=j(t,e),n=e,s=i,a=o,u=o,c=i;for(;r!==i;){const t=n/r,e=n%r,i=s-u*t,o=a-c*t;n=r,r=e,s=u,a=c,u=i,c=o}if(n!==o)throw new Error("invert: does not exist");return j(s,e)}function z(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const r=function(t){const e=8*t.length-8*d,r=L(t);return e>0?r>>BigInt(e):r}(t);if(e)return r;const{n:n}=h;return r>=n?r-n:r}let V,q;class W{constructor(t,e){if(this.hashLen=t,this.qByteLen=e,"number"!==typeof t||t<2)throw new Error("hashLen must be a number");if("number"!==typeof e||e<2)throw new Error("qByteLen must be a number");this.v=new Uint8Array(t).fill(1),this.k=new Uint8Array(t).fill(0),this.counter=0}hmac(){for(var t=arguments.length,r=new Array(t),n=0;n=1e3)throw new Error("Tried 1,000 k values for sign(), all were invalid");this.counter+=1}async reseed(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Uint8Array;this.k=await this.hmac(this.v,Uint8Array.from([0]),t),this.v=await this.hmac(this.v),0!==t.length&&(this.k=await this.hmac(this.v,Uint8Array.from([1]),t),this.v=await this.hmac(this.v))}reseedSync(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Uint8Array;this.checkSync(),this.k=this.hmacSync(this.v,Uint8Array.from([0]),t),this.v=this.hmacSync(this.v),0!==t.length&&(this.k=this.hmacSync(this.v,Uint8Array.from([1]),t),this.v=this.hmacSync(this.v))}async generate(){this.incr();let t=0;const e=[];for(;t3&&void 0!==arguments[3])||arguments[3];const{n:s}=h,a=z(t,!0);if(!K(a))return;const u=H(a,s),c=S.BASE.multiply(a),l=j(c.x,s);if(l===i)return;const f=j(u*j(e+r*l,s),s);if(f===i)return;let d=new I(l,f),p=(c.x===d.r?0:2)|Number(c.y&o);return n&&d.hasHighS()&&(d=d.normalizeS(),p^=1),{sig:d,recovery:p}}function Z(t){let e;if("bigint"===typeof t)e=t;else if("number"===typeof t&&Number.isSafeInteger(t)&&t>0)e=BigInt(t);else if("string"===typeof t){if(t.length!==2*d)throw new Error("Expected 32 bytes of private key");e=R(t)}else{if(!(t instanceof Uint8Array))throw new TypeError("Expected valid private key");if(t.length!==d)throw new Error("Expected 32 bytes of private key");e=L(t)}if(!K(e))throw new Error("Expected private key: 0 < key < n");return e}function Y(t){return t instanceof S?(t.assertValidity(),t):S.fromHex(t)}function Q(t){if(t instanceof I)return t.assertValidity(),t;try{return I.fromDER(t)}catch(e){return I.fromCompact(t)}}function J(t){const e=t instanceof Uint8Array,r="string"===typeof t,n=(e||r)&&t.length;return e?n===p||n===g:r?n===2*p||n===2*g:t instanceof S}function $(t){return L(t.length>f?t.slice(0,f):t)}function tt(t){const e=$(t),r=j(e,h.n);return et(r1&&void 0!==arguments[1]&&arguments[1];return S.fromPrivateKey(t).toRawBytes(e)},e.recoverPublicKey=function(t,e,r){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return S.fromSignature(t,e,r).toRawBytes(n)},e.getSharedSecret=function(t,e){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(J(t))throw new TypeError("getSharedSecret: first arg must be private key");if(!J(e))throw new TypeError("getSharedSecret: second arg must be public key");const n=Y(e);return n.assertValidity(),n.multiply(Z(t)).toRawBytes(r)},e.sign=async function(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{seed:n,m:i,d:o}=rt(t,e,r.extraEntropy),s=new W(32,d);let a;for(await s.reseed(n);!(a=X(await s.generate(),i,o,r.canonical));)await s.reseed();return nt(a,r)},e.signSync=function(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{seed:n,m:i,d:o}=rt(t,e,r.extraEntropy),s=new W(32,d);let a;for(s.reseedSync(n);!(a=X(s.generateSync(),i,o,r.canonical));)s.reseedSync();return nt(a,r)};const it={strict:!0};function ot(t){return j(L(t),h.n)}e.verify=function(t,e,r){let n,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:it;try{n=Q(t),e=D(e)}catch(g){return!1}const{r:o,s:s}=n;if(i.strict&&n.hasHighS())return!1;const a=z(e);let u;try{u=Y(r)}catch(g){return!1}const{n:c}=h,l=H(s,c),f=j(a*l,c),d=j(o*l,c),p=S.BASE.multiplyAndAddUnsafe(u,f,d);return!!p&&j(p.x,c)===o};class st{constructor(t,e){this.r=t,this.s=e,this.assertValidity()}static fromHex(t){const e=D(t);if(64!==e.length)throw new TypeError("SchnorrSignature.fromHex: expected 64 bytes, not ".concat(e.length));const r=L(e.subarray(0,32)),n=L(e.subarray(32,64));return new st(r,n)}assertValidity(){const{r:t,s:e}=this;if(!G(t)||!K(e))throw new Error("Invalid signature")}toHex(){return O(this.r)+O(this.s)}toRawBytes(){return P(this.toHex())}}class at{constructor(t,r){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.utils.randomBytes();if(null==t)throw new TypeError('sign: Expected valid message, not "'.concat(t,'"'));this.m=D(t);const{x:i,scalar:o}=this.getScalar(Z(r));if(this.px=i,this.d=o,this.rand=D(n),32!==this.rand.length)throw new TypeError("sign: Expected 32 bytes of aux randomness")}getScalar(t){const e=S.fromPrivateKey(t),r=e.hasEvenY()?t:h.n-t;return{point:e,scalar:r,x:e.toRawX()}}initNonce(t,e){return N(t^L(e))}finalizeNonce(t){const e=j(L(t),h.n);if(e===i)throw new Error("sign: Creation of signature failed. k is zero");const{point:r,x:n,scalar:o}=this.getScalar(e);return{R:r,rx:n,k:o}}finalizeSig(t,e,r,n){return new st(t.x,j(e+r*n,h.n)).toRawBytes()}error(){throw new Error("sign: Invalid signature produced")}async calc(){const{m:t,d:r,px:n,rand:i}=this,o=e.utils.taggedHash,s=this.initNonce(r,await o(dt.aux,i)),{R:a,rx:u,k:h}=this.finalizeNonce(await o(dt.nonce,s,n,t)),c=ot(await o(dt.challenge,u,n,t)),l=this.finalizeSig(a,h,c,r);return await ct(l,t,n)||this.error(),l}calcSync(){const{m:t,d:r,px:n,rand:i}=this,o=e.utils.taggedHashSync,s=this.initNonce(r,o(dt.aux,i)),{R:a,rx:u,k:h}=this.finalizeNonce(o(dt.nonce,s,n,t)),c=ot(o(dt.challenge,u,n,t)),l=this.finalizeSig(a,h,c,r);return lt(l,t,n)||this.error(),l}}function ut(t,e,r){const n=t instanceof st,i=n?t:st.fromHex(t);return n&&i.assertValidity(),{...i,m:D(e),P:Y(r)}}function ht(t,e,r,n){const i=S.BASE.multiplyAndAddUnsafe(e,Z(r),j(-n,h.n));return!(!i||!i.hasEvenY()||i.x!==t)}async function ct(t,r,n){try{const{r:i,s:o,m:s,P:a}=ut(t,r,n),u=ot(await e.utils.taggedHash(dt.challenge,N(i),a.toRawX(),s));return ht(i,a,o,u)}catch(i){return!1}}function lt(t,r,n){try{const{r:i,s:o,m:s,P:a}=ut(t,r,n),u=ot(e.utils.taggedHashSync(dt.challenge,N(i),a.toRawX(),s));return ht(i,a,o,u)}catch(i){if(i instanceof w)throw i;return!1}}e.schnorr={Signature:st,getPublicKey:function(t){return S.fromPrivateKey(t).toRawX()},sign:async function(t,e,r){return new at(t,e,r).calc()},verify:ct,signSync:function(t,e,r){return new at(t,e,r).calcSync()},verifySync:lt},S.BASE._setWindowSize(8);const ft={node:n,web:"object"===typeof self&&"crypto"in self?self.crypto:void 0},dt={challenge:"BIP0340/challenge",aux:"BIP0340/aux",nonce:"BIP0340/nonce"},pt={};e.utils={bytesToHex:x,hexToBytes:P,concatBytes:C,mod:j,invert:H,isValidPrivateKey(t){try{return Z(t),!0}catch(e){return!1}},_bigintTo32Bytes:N,_normalizePrivateKey:Z,hashToPrivateKey:t=>{t=D(t);const e=d+8;if(t.length1024)throw new Error("Expected valid bytes of private key as per FIPS 186");return N(j(L(t),h.n-o)+o)},randomBytes:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:32;if(ft.web)return ft.web.getRandomValues(new Uint8Array(t));if(ft.node){const{randomBytes:e}=ft.node;return Uint8Array.from(e(t))}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>e.utils.hashToPrivateKey(e.utils.randomBytes(d+8)),precompute(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:8,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:S.BASE;const r=e===S.BASE?e:new S(e.x,e.y);return r._setWindowSize(t),r.multiply(a),r},sha256:async function(){for(var t=arguments.length,e=new Array(t),r=0;rr.update(t))),Uint8Array.from(r.digest())}throw new Error("The environment doesn't have sha256 function")},hmacSha256:async function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;nn.update(t))),Uint8Array.from(n.digest())}throw new Error("The environment doesn't have hmac-sha256 function")},sha256Sync:void 0,hmacSha256Sync:void 0,taggedHash:async function(t){let r=pt[t];if(void 0===r){const n=await e.utils.sha256(Uint8Array.from(t,(t=>t.charCodeAt(0))));r=C(n,n),pt[t]=r}for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;ot.charCodeAt(0))));e=C(r,r),pt[t]=e}for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;iV,set(t){V||(V=t)}},hmacSha256Sync:{configurable:!1,get:()=>q,set(t){q||(q=t)}}})},7250:(t,e)=>{"use strict";function r(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, not ".concat(t))}function n(t){if("boolean"!==typeof t)throw new Error("boolean expected, not ".concat(t))}function i(t){return t instanceof Uint8Array||null!=t&&"object"===typeof t&&"Uint8Array"===t.constructor.name}function o(t){if(!i(t))throw new Error("Uint8Array expected");for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n0&&!r.includes(t.length))throw new Error("Uint8Array expected of length ".concat(r,", not of length=").concat(t.length))}function s(t){if("function"!==typeof t||"function"!==typeof t.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");r(t.outputLen),r(t.blockLen)}function a(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function u(t,e){o(t);const r=e.outputLen;if(t.length{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.HashMD=e.Maj=e.Chi=void 0;const n=r(7250),i=r(684);e.Chi=(t,e,r)=>t&e^~t&r;e.Maj=(t,e,r)=>t&e^t&r^e&r;class o extends i.Hash{constructor(t,e,r,n){super(),this.blockLen=t,this.outputLen=e,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=(0,i.createView)(this.buffer)}update(t){(0,n.exists)(this);const{view:e,buffer:r,blockLen:o}=this,s=(t=(0,i.toBytes)(t)).length;for(let n=0;no-a&&(this.process(r,0),a=0);for(let n=a;n>i&o),a=Number(r&o),u=n?4:0,h=n?0:4;t.setUint32(e+u,s,n),t.setUint32(e+h,a,n)}(r,o-8,BigInt(8*this.length),s),this.process(r,0);const u=(0,i.createView)(t),h=this.outputLen;if(h%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=h/4,l=this.get();if(c>l.length)throw new Error("_sha2: outputLen bigger than state");for(let n=0;n{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.crypto=void 0,e.crypto="object"===typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0},5829:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ripemd160=e.RIPEMD160=void 0;const n=r(1193),i=r(684),o=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),s=new Uint8Array(new Array(16).fill(0).map(((t,e)=>e)));let a=[s],u=[s.map((t=>(9*t+5)%16))];for(let y=0;y<4;y++)for(let t of[a,u])t.push(t[y].map((t=>o[t])));const h=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map((t=>new Uint8Array(t))),c=a.map(((t,e)=>t.map((t=>h[e][t])))),l=u.map(((t,e)=>t.map((t=>h[e][t])))),f=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),d=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]);function p(t,e,r,n){return 0===t?e^r^n:1===t?e&r|~e&n:2===t?(e|~r)^n:3===t?e&n|r&~n:e^(r|~n)}const g=new Uint32Array(16);class m extends n.HashMD{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:t,h1:e,h2:r,h3:n,h4:i}=this;return[t,e,r,n,i]}set(t,e,r,n,i){this.h0=0|t,this.h1=0|e,this.h2=0|r,this.h3=0|n,this.h4=0|i}process(t,e){for(let i=0;i<16;i++,e+=4)g[i]=t.getUint32(e,!0);let r=0|this.h0,n=r,o=0|this.h1,s=o,h=0|this.h2,m=h,y=0|this.h3,w=y,v=0|this.h4,b=v;for(let _=0;_<5;_++){const t=4-_,e=f[_],E=d[_],S=a[_],M=u[_],A=c[_],I=l[_];for(let n=0;n<16;n++){const t=(0,i.rotl)(r+p(_,o,h,y)+g[S[n]]+e,A[n])+v|0;r=v,v=y,y=0|(0,i.rotl)(h,10),h=o,o=t}for(let r=0;r<16;r++){const e=(0,i.rotl)(n+p(t,s,m,w)+g[M[r]]+E,I[r])+b|0;n=b,b=w,w=0|(0,i.rotl)(m,10),m=s,s=e}}this.set(this.h1+h+w|0,this.h2+y+b|0,this.h3+v+n|0,this.h4+r+s|0,this.h0+o+m|0)}roundClean(){g.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}}e.RIPEMD160=m,e.ripemd160=(0,i.wrapConstructor)((()=>new m))},1736:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sha1=void 0;const n=r(1193),i=r(684),o=new Uint32Array([1732584193,4023233417,2562383102,271733878,3285377520]),s=new Uint32Array(80);class a extends n.HashMD{constructor(){super(64,20,8,!1),this.A=0|o[0],this.B=0|o[1],this.C=0|o[2],this.D=0|o[3],this.E=0|o[4]}get(){const{A:t,B:e,C:r,D:n,E:i}=this;return[t,e,r,n,i]}set(t,e,r,n,i){this.A=0|t,this.B=0|e,this.C=0|r,this.D=0|n,this.E=0|i}process(t,e){for(let n=0;n<16;n++,e+=4)s[n]=t.getUint32(e,!1);for(let n=16;n<80;n++)s[n]=(0,i.rotl)(s[n-3]^s[n-8]^s[n-14]^s[n-16],1);let{A:r,B:o,C:a,D:u,E:h}=this;for(let c=0;c<80;c++){let t,e;c<20?(t=(0,n.Chi)(o,a,u),e=1518500249):c<40?(t=o^a^u,e=1859775393):c<60?(t=(0,n.Maj)(o,a,u),e=2400959708):(t=o^a^u,e=3395469782);const l=(0,i.rotl)(r,5)+t+h+e+s[c]|0;h=u,u=a,a=(0,i.rotl)(o,30),o=r,r=l}r=r+this.A|0,o=o+this.B|0,a=a+this.C|0,u=u+this.D|0,h=h+this.E|0,this.set(r,o,a,u,h)}roundClean(){s.fill(0)}destroy(){this.set(0,0,0,0,0),this.buffer.fill(0)}}e.sha1=(0,i.wrapConstructor)((()=>new a))},1678:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sha224=e.sha256=void 0;const n=r(1193),i=r(684),o=new Uint32Array([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]),s=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),a=new Uint32Array(64);class u extends n.HashMD{constructor(){super(64,32,8,!1),this.A=0|s[0],this.B=0|s[1],this.C=0|s[2],this.D=0|s[3],this.E=0|s[4],this.F=0|s[5],this.G=0|s[6],this.H=0|s[7]}get(){const{A:t,B:e,C:r,D:n,E:i,F:o,G:s,H:a}=this;return[t,e,r,n,i,o,s,a]}set(t,e,r,n,i,o,s,a){this.A=0|t,this.B=0|e,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(t,e){for(let n=0;n<16;n++,e+=4)a[n]=t.getUint32(e,!1);for(let n=16;n<64;n++){const t=a[n-15],e=a[n-2],r=(0,i.rotr)(t,7)^(0,i.rotr)(t,18)^t>>>3,o=(0,i.rotr)(e,17)^(0,i.rotr)(e,19)^e>>>10;a[n]=o+a[n-7]+r+a[n-16]|0}let{A:r,B:s,C:u,D:h,E:c,F:l,G:f,H:d}=this;for(let p=0;p<64;p++){const t=d+((0,i.rotr)(c,6)^(0,i.rotr)(c,11)^(0,i.rotr)(c,25))+(0,n.Chi)(c,l,f)+o[p]+a[p]|0,e=((0,i.rotr)(r,2)^(0,i.rotr)(r,13)^(0,i.rotr)(r,22))+(0,n.Maj)(r,s,u)|0;d=f,f=l,l=c,c=h+t|0,h=u,u=s,s=r,r=t+e|0}r=r+this.A|0,s=s+this.B|0,u=u+this.C|0,h=h+this.D|0,c=c+this.E|0,l=l+this.F|0,f=f+this.G|0,d=d+this.H|0,this.set(r,s,u,h,c,l,f,d)}roundClean(){a.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class h extends u{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}e.sha256=(0,i.wrapConstructor)((()=>new u)),e.sha224=(0,i.wrapConstructor)((()=>new h))},684:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.randomBytes=e.wrapXOFConstructorWithOpts=e.wrapConstructorWithOpts=e.wrapConstructor=e.checkOpts=e.Hash=e.concatBytes=e.toBytes=e.utf8ToBytes=e.asyncLoop=e.nextTick=e.hexToBytes=e.bytesToHex=e.byteSwap32=e.byteSwapIfBE=e.byteSwap=e.isLE=e.rotl=e.rotr=e.createView=e.u32=e.u8=e.isBytes=void 0;const n=r(7932),i=r(7250);e.isBytes=function(t){return t instanceof Uint8Array||null!=t&&"object"===typeof t&&"Uint8Array"===t.constructor.name};e.u8=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength);e.u32=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4));e.createView=t=>new DataView(t.buffer,t.byteOffset,t.byteLength);e.rotr=(t,e)=>t<<32-e|t>>>e;e.rotl=(t,e)=>t<>>32-e>>>0,e.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0];e.byteSwap=t=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255,e.byteSwapIfBE=e.isLE?t=>t:t=>(0,e.byteSwap)(t),e.byteSwap32=function(t){for(let r=0;re.toString(16).padStart(2,"0")));e.bytesToHex=function(t){(0,i.bytes)(t);let e="";for(let r=0;r=s._0&&t<=s._9?t-s._0:t>=s._A&&t<=s._F?t-(s._A-10):t>=s._a&&t<=s._f?t-(s._a-10):void 0}e.hexToBytes=function(t){if("string"!==typeof t)throw new Error("hex string expected, got "+typeof t);const e=t.length,r=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(r);for(let i=0,o=0;i{},e.asyncLoop=async function(t,r,n){let i=Date.now();for(let o=0;o=0&&tt().update(h(e)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e},e.wrapConstructorWithOpts=function(t){const e=(e,r)=>t(r).update(h(e)).digest(),r=t({});return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=e=>t(e),e},e.wrapXOFConstructorWithOpts=function(t){const e=(e,r)=>t(r).update(h(e)).digest(),r=t({});return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=e=>t(e),e},e.randomBytes=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:32;if(n.crypto&&"function"===typeof n.crypto.getRandomValues)return n.crypto.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}},9753:(t,e,r)=>{var n=e;n.bignum=r(147),n.define=r(4130).define,n.base=r(1354),n.constants=r(828),n.decoders=r(3206),n.encoders=r(6618)},4130:(t,e,r)=>{var n=r(9753),i=r(6329);function o(t,e){this.name=t,this.body=e,this.decoders={},this.encoders={}}e.define=function(t,e){return new o(t,e)},o.prototype._createNamed=function(t){var e;try{e=r(1190).runInThisContext("(function "+this.name+"(entity) {\n this._initNamed(entity);\n})")}catch(n){e=function(t){this._initNamed(t)}}return i(e,t),e.prototype._initNamed=function(e){t.call(this,e)},new e(this)},o.prototype._getDecoder=function(t){return t=t||"der",this.decoders.hasOwnProperty(t)||(this.decoders[t]=this._createNamed(n.decoders[t])),this.decoders[t]},o.prototype.decode=function(t,e,r){return this._getDecoder(e).decode(t,r)},o.prototype._getEncoder=function(t){return t=t||"der",this.encoders.hasOwnProperty(t)||(this.encoders[t]=this._createNamed(n.encoders[t])),this.encoders[t]},o.prototype.encode=function(t,e,r){return this._getEncoder(e).encode(t,r)}},2538:(t,e,r)=>{var n=r(6329),i=r(1354).Reporter,o=r(6382).Buffer;function s(t,e){i.call(this,e),o.isBuffer(t)?(this.base=t,this.offset=0,this.length=t.length):this.error("Input not Buffer")}function a(t,e){if(Array.isArray(t))this.length=0,this.value=t.map((function(t){return t instanceof a||(t=new a(t,e)),this.length+=t.length,t}),this);else if("number"===typeof t){if(!(0<=t&&t<=255))return e.error("non-byte EncoderBuffer value");this.value=t,this.length=1}else if("string"===typeof t)this.value=t,this.length=o.byteLength(t);else{if(!o.isBuffer(t))return e.error("Unsupported type: "+typeof t);this.value=t,this.length=t.length}}n(s,i),e.t=s,s.prototype.save=function(){return{offset:this.offset,reporter:i.prototype.save.call(this)}},s.prototype.restore=function(t){var e=new s(this.base);return e.offset=t.offset,e.length=this.offset,this.offset=t.offset,i.prototype.restore.call(this,t.reporter),e},s.prototype.isEmpty=function(){return this.offset===this.length},s.prototype.readUInt8=function(t){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(t||"DecoderBuffer overrun")},s.prototype.skip=function(t,e){if(!(this.offset+t<=this.length))return this.error(e||"DecoderBuffer overrun");var r=new s(this.base);return r._reporterState=this._reporterState,r.offset=this.offset,r.length=this.offset+t,this.offset+=t,r},s.prototype.raw=function(t){return this.base.slice(t?t.offset:this.offset,this.length)},e.d=a,a.prototype.join=function(t,e){return t||(t=new o(this.length)),e||(e=0),0===this.length||(Array.isArray(this.value)?this.value.forEach((function(r){r.join(t,e),e+=r.length})):("number"===typeof this.value?t[e]=this.value:"string"===typeof this.value?t.write(this.value,e):o.isBuffer(this.value)&&this.value.copy(t,e),e+=this.length)),t}},1354:(t,e,r)=>{var n=e;n.Reporter=r(4913).a,n.DecoderBuffer=r(2538).t,n.EncoderBuffer=r(2538).d,n.Node=r(64)},64:(t,e,r)=>{var n=r(1354).Reporter,i=r(1354).EncoderBuffer,o=r(1354).DecoderBuffer,s=r(5482),a=["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"],u=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(a);function h(t,e){var r={};this._baseState=r,r.enc=t,r.parent=e||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())}t.exports=h;var c=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];h.prototype.clone=function(){var t=this._baseState,e={};c.forEach((function(r){e[r]=t[r]}));var r=new this.constructor(e.parent);return r._baseState=e,r},h.prototype._wrap=function(){var t=this._baseState;u.forEach((function(e){this[e]=function(){var r=new this.constructor(this);return t.children.push(r),r[e].apply(r,arguments)}}),this)},h.prototype._init=function(t){var e=this._baseState;s(null===e.parent),t.call(this),e.children=e.children.filter((function(t){return t._baseState.parent===this}),this),s.equal(e.children.length,1,"Root node can have only one child")},h.prototype._useArgs=function(t){var e=this._baseState,r=t.filter((function(t){return t instanceof this.constructor}),this);t=t.filter((function(t){return!(t instanceof this.constructor)}),this),0!==r.length&&(s(null===e.children),e.children=r,r.forEach((function(t){t._baseState.parent=this}),this)),0!==t.length&&(s(null===e.args),e.args=t,e.reverseArgs=t.map((function(t){if("object"!==typeof t||t.constructor!==Object)return t;var e={};return Object.keys(t).forEach((function(r){r==(0|r)&&(r|=0);var n=t[r];e[n]=r})),e})))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach((function(t){h.prototype[t]=function(){var e=this._baseState;throw new Error(t+" not implemented for encoding: "+e.enc)}})),a.forEach((function(t){h.prototype[t]=function(){var e=this._baseState,r=Array.prototype.slice.call(arguments);return s(null===e.tag),e.tag=t,this._useArgs(r),this}})),h.prototype.use=function(t){s(t);var e=this._baseState;return s(null===e.use),e.use=t,this},h.prototype.optional=function(){return this._baseState.optional=!0,this},h.prototype.def=function(t){var e=this._baseState;return s(null===e.default),e.default=t,e.optional=!0,this},h.prototype.explicit=function(t){var e=this._baseState;return s(null===e.explicit&&null===e.implicit),e.explicit=t,this},h.prototype.implicit=function(t){var e=this._baseState;return s(null===e.explicit&&null===e.implicit),e.implicit=t,this},h.prototype.obj=function(){var t=this._baseState,e=Array.prototype.slice.call(arguments);return t.obj=!0,0!==e.length&&this._useArgs(e),this},h.prototype.key=function(t){var e=this._baseState;return s(null===e.key),e.key=t,this},h.prototype.any=function(){return this._baseState.any=!0,this},h.prototype.choice=function(t){var e=this._baseState;return s(null===e.choice),e.choice=t,this._useArgs(Object.keys(t).map((function(e){return t[e]}))),this},h.prototype.contains=function(t){var e=this._baseState;return s(null===e.use),e.contains=t,this},h.prototype._decode=function(t,e){var r=this._baseState;if(null===r.parent)return t.wrapResult(r.children[0]._decode(t,e));var n,i=r.default,s=!0,a=null;if(null!==r.key&&(a=t.enterKey(r.key)),r.optional){var u=null;if(null!==r.explicit?u=r.explicit:null!==r.implicit?u=r.implicit:null!==r.tag&&(u=r.tag),null!==u||r.any){if(s=this._peekTag(t,u,r.any),t.isError(s))return s}else{var h=t.save();try{null===r.choice?this._decodeGeneric(r.tag,t,e):this._decodeChoice(t,e),s=!0}catch(p){s=!1}t.restore(h)}}if(r.obj&&s&&(n=t.enterObject()),s){if(null!==r.explicit){var c=this._decodeTag(t,r.explicit);if(t.isError(c))return c;t=c}var l=t.offset;if(null===r.use&&null===r.choice){if(r.any)h=t.save();var f=this._decodeTag(t,null!==r.implicit?r.implicit:r.tag,r.any);if(t.isError(f))return f;r.any?i=t.raw(h):t=f}if(e&&e.track&&null!==r.tag&&e.track(t.path(),l,t.length,"tagged"),e&&e.track&&null!==r.tag&&e.track(t.path(),t.offset,t.length,"content"),r.any||(i=null===r.choice?this._decodeGeneric(r.tag,t,e):this._decodeChoice(t,e)),t.isError(i))return i;if(r.any||null!==r.choice||null===r.children||r.children.forEach((function(r){r._decode(t,e)})),r.contains&&("octstr"===r.tag||"bitstr"===r.tag)){var d=new o(i);i=this._getUse(r.contains,t._reporterState.obj)._decode(d,e)}}return r.obj&&s&&(i=t.leaveObject(n)),null===r.key||null===i&&!0!==s?null!==a&&t.exitKey(a):t.leaveKey(a,r.key,i),i},h.prototype._decodeGeneric=function(t,e,r){var n=this._baseState;return"seq"===t||"set"===t?null:"seqof"===t||"setof"===t?this._decodeList(e,t,n.args[0],r):/str$/.test(t)?this._decodeStr(e,t,r):"objid"===t&&n.args?this._decodeObjid(e,n.args[0],n.args[1],r):"objid"===t?this._decodeObjid(e,null,null,r):"gentime"===t||"utctime"===t?this._decodeTime(e,t,r):"null_"===t?this._decodeNull(e,r):"bool"===t?this._decodeBool(e,r):"objDesc"===t?this._decodeStr(e,t,r):"int"===t||"enum"===t?this._decodeInt(e,n.args&&n.args[0],r):null!==n.use?this._getUse(n.use,e._reporterState.obj)._decode(e,r):e.error("unknown tag: "+t)},h.prototype._getUse=function(t,e){var r=this._baseState;return r.useDecoder=this._use(t,e),s(null===r.useDecoder._baseState.parent),r.useDecoder=r.useDecoder._baseState.children[0],r.implicit!==r.useDecoder._baseState.implicit&&(r.useDecoder=r.useDecoder.clone(),r.useDecoder._baseState.implicit=r.implicit),r.useDecoder},h.prototype._decodeChoice=function(t,e){var r=this._baseState,n=null,i=!1;return Object.keys(r.choice).some((function(o){var s=t.save(),a=r.choice[o];try{var u=a._decode(t,e);if(t.isError(u))return!1;n={type:o,value:u},i=!0}catch(h){return t.restore(s),!1}return!0}),this),i?n:t.error("Choice not matched")},h.prototype._createEncoderBuffer=function(t){return new i(t,this.reporter)},h.prototype._encode=function(t,e,r){var n=this._baseState;if(null===n.default||n.default!==t){var i=this._encodeValue(t,e,r);if(void 0!==i&&!this._skipDefault(i,e,r))return i}},h.prototype._encodeValue=function(t,e,r){var i=this._baseState;if(null===i.parent)return i.children[0]._encode(t,e||new n);var o=null;if(this.reporter=e,i.optional&&void 0===t){if(null===i.default)return;t=i.default}var s=null,a=!1;if(i.any)o=this._createEncoderBuffer(t);else if(i.choice)o=this._encodeChoice(t,e);else if(i.contains)s=this._getUse(i.contains,r)._encode(t,e),a=!0;else if(i.children)s=i.children.map((function(r){if("null_"===r._baseState.tag)return r._encode(null,e,t);if(null===r._baseState.key)return e.error("Child should have a key");var n=e.enterKey(r._baseState.key);if("object"!==typeof t)return e.error("Child expected, but input is not object");var i=r._encode(t[r._baseState.key],e,t);return e.leaveKey(n),i}),this).filter((function(t){return t})),s=this._createEncoderBuffer(s);else if("seqof"===i.tag||"setof"===i.tag){if(!i.args||1!==i.args.length)return e.error("Too many args for : "+i.tag);if(!Array.isArray(t))return e.error("seqof/setof, but data is not Array");var u=this.clone();u._baseState.implicit=null,s=this._createEncoderBuffer(t.map((function(r){var n=this._baseState;return this._getUse(n.args[0],t)._encode(r,e)}),u))}else null!==i.use?o=this._getUse(i.use,r)._encode(t,e):(s=this._encodePrimitive(i.tag,t),a=!0);if(!i.any&&null===i.choice){var h=null!==i.implicit?i.implicit:i.tag,c=null===i.implicit?"universal":"context";null===h?null===i.use&&e.error("Tag could be omitted only for .use()"):null===i.use&&(o=this._encodeComposite(h,a,c,s))}return null!==i.explicit&&(o=this._encodeComposite(i.explicit,!1,"context",o)),o},h.prototype._encodeChoice=function(t,e){var r=this._baseState,n=r.choice[t.type];return n||s(!1,t.type+" not found in "+JSON.stringify(Object.keys(r.choice))),n._encode(t.value,e)},h.prototype._encodePrimitive=function(t,e){var r=this._baseState;if(/str$/.test(t))return this._encodeStr(e,t);if("objid"===t&&r.args)return this._encodeObjid(e,r.reverseArgs[0],r.args[1]);if("objid"===t)return this._encodeObjid(e,null,null);if("gentime"===t||"utctime"===t)return this._encodeTime(e,t);if("null_"===t)return this._encodeNull();if("int"===t||"enum"===t)return this._encodeInt(e,r.args&&r.reverseArgs[0]);if("bool"===t)return this._encodeBool(e);if("objDesc"===t)return this._encodeStr(e,t);throw new Error("Unsupported tag: "+t)},h.prototype._isNumstr=function(t){return/^[0-9 ]*$/.test(t)},h.prototype._isPrintstr=function(t){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(t)}},4913:(t,e,r)=>{var n=r(6329);function i(t){this._reporterState={obj:null,path:[],options:t||{},errors:[]}}function o(t,e){this.path=t,this.rethrow(e)}e.a=i,i.prototype.isError=function(t){return t instanceof o},i.prototype.save=function(){var t=this._reporterState;return{obj:t.obj,pathLen:t.path.length}},i.prototype.restore=function(t){var e=this._reporterState;e.obj=t.obj,e.path=e.path.slice(0,t.pathLen)},i.prototype.enterKey=function(t){return this._reporterState.path.push(t)},i.prototype.exitKey=function(t){var e=this._reporterState;e.path=e.path.slice(0,t-1)},i.prototype.leaveKey=function(t,e,r){var n=this._reporterState;this.exitKey(t),null!==n.obj&&(n.obj[e]=r)},i.prototype.path=function(){return this._reporterState.path.join("/")},i.prototype.enterObject=function(){var t=this._reporterState,e=t.obj;return t.obj={},e},i.prototype.leaveObject=function(t){var e=this._reporterState,r=e.obj;return e.obj=t,r},i.prototype.error=function(t){var e,r=this._reporterState,n=t instanceof o;if(e=n?t:new o(r.path.map((function(t){return"["+JSON.stringify(t)+"]"})).join(""),t.message||t,t.stack),!r.options.partial)throw e;return n||r.errors.push(e),e},i.prototype.wrapResult=function(t){var e=this._reporterState;return e.options.partial?{result:this.isError(t)?null:t,errors:e.errors}:t},n(o,Error),o.prototype.rethrow=function(t){if(this.message=t+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,o),!this.stack)try{throw new Error(this.message)}catch(e){this.stack=e.stack}return this}},395:(t,e,r)=>{var n=r(828);e.tagClass={0:"universal",1:"application",2:"context",3:"private"},e.tagClassByName=n._reverse(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=n._reverse(e.tag)},828:(t,e,r)=>{var n=e;n._reverse=function(t){var e={};return Object.keys(t).forEach((function(r){(0|r)==r&&(r|=0);var n=t[r];e[n]=r})),e},n.der=r(395)},5749:(t,e,r)=>{var n=r(6329),i=r(9753),o=i.base,s=i.bignum,a=i.constants.der;function u(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new h,this.tree._init(t.body)}function h(t){o.Node.call(this,"der",t)}function c(t,e){var r=t.readUInt8(e);if(t.isError(r))return r;var n=a.tagClass[r>>6],i=0===(32&r);if(31===(31&r)){var o=r;for(r=0;128===(128&o);){if(o=t.readUInt8(e),t.isError(o))return o;r<<=7,r|=127&o}}else r&=31;return{cls:n,primitive:i,tag:r,tagStr:a.tag[r]}}function l(t,e,r){var n=t.readUInt8(r);if(t.isError(n))return n;if(!e&&128===n)return null;if(0===(128&n))return n;var i=127&n;if(i>4)return t.error("length octect is too long");n=0;for(var o=0;o{var n=e;n.der=r(5749),n.pem=r(5524)},5524:(t,e,r)=>{var n=r(6329),i=r(6382).Buffer,o=r(5749);function s(t){o.call(this,t),this.enc="pem"}n(s,o),t.exports=s,s.prototype.decode=function(t,e){for(var r=t.toString().split(/[\r\n]+/g),n=e.label.toUpperCase(),s=/^-----(BEGIN|END) ([^-]+)-----$/,a=-1,u=-1,h=0;h{var n=r(6329),i=r(6382).Buffer,o=r(9753),s=o.base,a=o.constants.der;function u(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new h,this.tree._init(t.body)}function h(t){s.Node.call(this,"der",t)}function c(t){return t<10?"0"+t:t}t.exports=u,u.prototype.encode=function(t,e){return this.tree._encode(t,e).join()},n(h,s.Node),h.prototype._encodeComposite=function(t,e,r,n){var o,s=function(t,e,r,n){var i;"seqof"===t?t="seq":"setof"===t&&(t="set");if(a.tagByName.hasOwnProperty(t))i=a.tagByName[t];else{if("number"!==typeof t||(0|t)!==t)return n.error("Unknown tag: "+t);i=t}if(i>=31)return n.error("Multi-octet tag encoding unsupported");e||(i|=32);return i|=a.tagClassByName[r||"universal"]<<6,i}(t,e,r,this.reporter);if(n.length<128)return(o=new i(2))[0]=s,o[1]=n.length,this._createEncoderBuffer([o,n]);for(var u=1,h=n.length;h>=256;h>>=8)u++;(o=new i(2+u))[0]=s,o[1]=128|u;h=1+u;for(var c=n.length;c>0;h--,c>>=8)o[h]=255&c;return this._createEncoderBuffer([o,n])},h.prototype._encodeStr=function(t,e){if("bitstr"===e)return this._createEncoderBuffer([0|t.unused,t.data]);if("bmpstr"===e){for(var r=new i(2*t.length),n=0;n=40)return this.reporter.error("Second objid identifier OOB");t.splice(0,2,40*t[0]+t[1])}var o=0;for(n=0;n=128;s>>=7)o++}var a=new i(o),u=a.length-1;for(n=t.length-1;n>=0;n--){s=t[n];for(a[u--]=127&s;(s>>=7)>0;)a[u--]=128|127&s}return this._createEncoderBuffer(a)},h.prototype._encodeTime=function(t,e){var r,n=new Date(t);return"gentime"===e?r=[c(n.getFullYear()),c(n.getUTCMonth()+1),c(n.getUTCDate()),c(n.getUTCHours()),c(n.getUTCMinutes()),c(n.getUTCSeconds()),"Z"].join(""):"utctime"===e?r=[c(n.getFullYear()%100),c(n.getUTCMonth()+1),c(n.getUTCDate()),c(n.getUTCHours()),c(n.getUTCMinutes()),c(n.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+e+" time is not supported yet"),this._encodeStr(r,"octstr")},h.prototype._encodeNull=function(){return this._createEncoderBuffer("")},h.prototype._encodeInt=function(t,e){if("string"===typeof t){if(!e)return this.reporter.error("String int or enum given, but no values map");if(!e.hasOwnProperty(t))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(t));t=e[t]}if("number"!==typeof t&&!i.isBuffer(t)){var r=t.toArray();!t.sign&&128&r[0]&&r.unshift(0),t=new i(r)}if(i.isBuffer(t)){var n=t.length;0===t.length&&n++;var o=new i(n);return t.copy(o),0===t.length&&(o[0]=0),this._createEncoderBuffer(o)}if(t<128)return this._createEncoderBuffer(t);if(t<256)return this._createEncoderBuffer([0,t]);n=1;for(var s=t;s>=256;s>>=8)n++;for(s=(o=new Array(n)).length-1;s>=0;s--)o[s]=255&t,t>>=8;return 128&o[0]&&o.unshift(0),this._createEncoderBuffer(new i(o))},h.prototype._encodeBool=function(t){return this._createEncoderBuffer(t?255:0)},h.prototype._use=function(t,e){return"function"===typeof t&&(t=t(e)),t._getEncoder("der").tree},h.prototype._skipDefault=function(t,e,r){var n,i=this._baseState;if(null===i.default)return!1;var o=t.join();if(void 0===i.defaultBuffer&&(i.defaultBuffer=this._encodeValue(i.default,e,r).join()),o.length!==i.defaultBuffer.length)return!1;for(n=0;n{var n=e;n.der=r(3889),n.pem=r(7232)},7232:(t,e,r)=>{var n=r(6329),i=r(3889);function o(t){i.call(this,t),this.enc="pem"}n(o,i),t.exports=o,o.prototype.encode=function(t,e){for(var r=i.prototype.encode.call(this,t).toString("base64"),n=["-----BEGIN "+e.label+"-----"],o=0;o=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function u(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function h(t,e,r,n){for(var i=0,o=Math.min(t.length,r),s=e;s=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"===typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"===typeof t)return this._initNumber(t,e,r);if("object"===typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n=e;n-=2)i=u(t,e,n)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2===0?e+1:e;n=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,c=r;c1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var c=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var h=1;h>>26,l=67108863&u,f=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=f;d++){var p=h-d|0;c+=(s=(i=0|t.words[p])*(o=0|e.words[d])+l)/67108864|0,l=67108863&s}r.words[h]=0|l,u=0|c}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,s=0;s>>24-i&16777215)||s!==this.length-1?c[6-u.length]+u+r:u+r,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!==0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var h=l[t],d=f[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var g=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?g+r:c[h-g.length]+g+r}for(this.isZero()&&(r="0"+r);r.length%e!==0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return n("undefined"!==typeof s),this.toArrayLike(s,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,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 s,a,u="le"===e,h=new t(o),c=this.clone();if(u){for(a=0;!c.isZero();a++)s=c.andln(255),c.iushrn(8),h[a]=s;for(;a=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0===(8191&e)&&(r+=13,e>>>=13),0===(127&e)&&(r+=7,e>>>=7),0===(15&e)&&(r+=4,e>>>=4),0===(3&e)&&(r+=2,e>>>=2),0===(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"===typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"===typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,d=0|s[1],p=8191&d,g=d>>>13,m=0|s[2],y=8191&m,w=m>>>13,v=0|s[3],b=8191&v,_=v>>>13,E=0|s[4],S=8191&E,M=E>>>13,A=0|s[5],I=8191&A,C=A>>>13,k=0|s[6],x=8191&k,T=k>>>13,O=0|s[7],N=8191&O,B=O>>>13,R=0|s[8],P=8191&R,L=R>>>13,D=0|s[9],U=8191&D,j=D>>>13,F=0|a[0],H=8191&F,z=F>>>13,V=0|a[1],q=8191&V,W=V>>>13,K=0|a[2],G=8191&K,X=K>>>13,Z=0|a[3],Y=8191&Z,Q=Z>>>13,J=0|a[4],$=8191&J,tt=J>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,ht=at>>>13,ct=0|a[8],lt=8191&ct,ft=ct>>>13,dt=0|a[9],pt=8191&dt,gt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(h+(n=Math.imul(l,H))|0)+((8191&(i=(i=Math.imul(l,z))+Math.imul(f,H)|0))<<13)|0;h=((o=Math.imul(f,z))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(p,H),i=(i=Math.imul(p,z))+Math.imul(g,H)|0,o=Math.imul(g,z);var yt=(h+(n=n+Math.imul(l,q)|0)|0)+((8191&(i=(i=i+Math.imul(l,W)|0)+Math.imul(f,q)|0))<<13)|0;h=((o=o+Math.imul(f,W)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(y,H),i=(i=Math.imul(y,z))+Math.imul(w,H)|0,o=Math.imul(w,z),n=n+Math.imul(p,q)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(g,q)|0,o=o+Math.imul(g,W)|0;var wt=(h+(n=n+Math.imul(l,G)|0)|0)+((8191&(i=(i=i+Math.imul(l,X)|0)+Math.imul(f,G)|0))<<13)|0;h=((o=o+Math.imul(f,X)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(b,H),i=(i=Math.imul(b,z))+Math.imul(_,H)|0,o=Math.imul(_,z),n=n+Math.imul(y,q)|0,i=(i=i+Math.imul(y,W)|0)+Math.imul(w,q)|0,o=o+Math.imul(w,W)|0,n=n+Math.imul(p,G)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(g,G)|0,o=o+Math.imul(g,X)|0;var vt=(h+(n=n+Math.imul(l,Y)|0)|0)+((8191&(i=(i=i+Math.imul(l,Q)|0)+Math.imul(f,Y)|0))<<13)|0;h=((o=o+Math.imul(f,Q)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(S,H),i=(i=Math.imul(S,z))+Math.imul(M,H)|0,o=Math.imul(M,z),n=n+Math.imul(b,q)|0,i=(i=i+Math.imul(b,W)|0)+Math.imul(_,q)|0,o=o+Math.imul(_,W)|0,n=n+Math.imul(y,G)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(w,G)|0,o=o+Math.imul(w,X)|0,n=n+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,Q)|0)+Math.imul(g,Y)|0,o=o+Math.imul(g,Q)|0;var bt=(h+(n=n+Math.imul(l,$)|0)|0)+((8191&(i=(i=i+Math.imul(l,tt)|0)+Math.imul(f,$)|0))<<13)|0;h=((o=o+Math.imul(f,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(I,H),i=(i=Math.imul(I,z))+Math.imul(C,H)|0,o=Math.imul(C,z),n=n+Math.imul(S,q)|0,i=(i=i+Math.imul(S,W)|0)+Math.imul(M,q)|0,o=o+Math.imul(M,W)|0,n=n+Math.imul(b,G)|0,i=(i=i+Math.imul(b,X)|0)+Math.imul(_,G)|0,o=o+Math.imul(_,X)|0,n=n+Math.imul(y,Y)|0,i=(i=i+Math.imul(y,Q)|0)+Math.imul(w,Y)|0,o=o+Math.imul(w,Q)|0,n=n+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(g,$)|0,o=o+Math.imul(g,tt)|0;var _t=(h+(n=n+Math.imul(l,rt)|0)|0)+((8191&(i=(i=i+Math.imul(l,nt)|0)+Math.imul(f,rt)|0))<<13)|0;h=((o=o+Math.imul(f,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(x,H),i=(i=Math.imul(x,z))+Math.imul(T,H)|0,o=Math.imul(T,z),n=n+Math.imul(I,q)|0,i=(i=i+Math.imul(I,W)|0)+Math.imul(C,q)|0,o=o+Math.imul(C,W)|0,n=n+Math.imul(S,G)|0,i=(i=i+Math.imul(S,X)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,X)|0,n=n+Math.imul(b,Y)|0,i=(i=i+Math.imul(b,Q)|0)+Math.imul(_,Y)|0,o=o+Math.imul(_,Q)|0,n=n+Math.imul(y,$)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(w,$)|0,o=o+Math.imul(w,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(g,rt)|0,o=o+Math.imul(g,nt)|0;var Et=(h+(n=n+Math.imul(l,ot)|0)|0)+((8191&(i=(i=i+Math.imul(l,st)|0)+Math.imul(f,ot)|0))<<13)|0;h=((o=o+Math.imul(f,st)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(N,H),i=(i=Math.imul(N,z))+Math.imul(B,H)|0,o=Math.imul(B,z),n=n+Math.imul(x,q)|0,i=(i=i+Math.imul(x,W)|0)+Math.imul(T,q)|0,o=o+Math.imul(T,W)|0,n=n+Math.imul(I,G)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(C,G)|0,o=o+Math.imul(C,X)|0,n=n+Math.imul(S,Y)|0,i=(i=i+Math.imul(S,Q)|0)+Math.imul(M,Y)|0,o=o+Math.imul(M,Q)|0,n=n+Math.imul(b,$)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(_,$)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(y,rt)|0,i=(i=i+Math.imul(y,nt)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(g,ot)|0,o=o+Math.imul(g,st)|0;var St=(h+(n=n+Math.imul(l,ut)|0)|0)+((8191&(i=(i=i+Math.imul(l,ht)|0)+Math.imul(f,ut)|0))<<13)|0;h=((o=o+Math.imul(f,ht)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(P,H),i=(i=Math.imul(P,z))+Math.imul(L,H)|0,o=Math.imul(L,z),n=n+Math.imul(N,q)|0,i=(i=i+Math.imul(N,W)|0)+Math.imul(B,q)|0,o=o+Math.imul(B,W)|0,n=n+Math.imul(x,G)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,X)|0,n=n+Math.imul(I,Y)|0,i=(i=i+Math.imul(I,Q)|0)+Math.imul(C,Y)|0,o=o+Math.imul(C,Q)|0,n=n+Math.imul(S,$)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,tt)|0,n=n+Math.imul(b,rt)|0,i=(i=i+Math.imul(b,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,st)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ht)|0)+Math.imul(g,ut)|0,o=o+Math.imul(g,ht)|0;var Mt=(h+(n=n+Math.imul(l,lt)|0)|0)+((8191&(i=(i=i+Math.imul(l,ft)|0)+Math.imul(f,lt)|0))<<13)|0;h=((o=o+Math.imul(f,ft)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(U,H),i=(i=Math.imul(U,z))+Math.imul(j,H)|0,o=Math.imul(j,z),n=n+Math.imul(P,q)|0,i=(i=i+Math.imul(P,W)|0)+Math.imul(L,q)|0,o=o+Math.imul(L,W)|0,n=n+Math.imul(N,G)|0,i=(i=i+Math.imul(N,X)|0)+Math.imul(B,G)|0,o=o+Math.imul(B,X)|0,n=n+Math.imul(x,Y)|0,i=(i=i+Math.imul(x,Q)|0)+Math.imul(T,Y)|0,o=o+Math.imul(T,Q)|0,n=n+Math.imul(I,$)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(C,$)|0,o=o+Math.imul(C,tt)|0,n=n+Math.imul(S,rt)|0,i=(i=i+Math.imul(S,nt)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,nt)|0,n=n+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ht)|0)+Math.imul(w,ut)|0,o=o+Math.imul(w,ht)|0,n=n+Math.imul(p,lt)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(g,lt)|0,o=o+Math.imul(g,ft)|0;var At=(h+(n=n+Math.imul(l,pt)|0)|0)+((8191&(i=(i=i+Math.imul(l,gt)|0)+Math.imul(f,pt)|0))<<13)|0;h=((o=o+Math.imul(f,gt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(U,q),i=(i=Math.imul(U,W))+Math.imul(j,q)|0,o=Math.imul(j,W),n=n+Math.imul(P,G)|0,i=(i=i+Math.imul(P,X)|0)+Math.imul(L,G)|0,o=o+Math.imul(L,X)|0,n=n+Math.imul(N,Y)|0,i=(i=i+Math.imul(N,Q)|0)+Math.imul(B,Y)|0,o=o+Math.imul(B,Q)|0,n=n+Math.imul(x,$)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(T,$)|0,o=o+Math.imul(T,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,nt)|0,n=n+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,n=n+Math.imul(b,ut)|0,i=(i=i+Math.imul(b,ht)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,ht)|0,n=n+Math.imul(y,lt)|0,i=(i=i+Math.imul(y,ft)|0)+Math.imul(w,lt)|0,o=o+Math.imul(w,ft)|0;var It=(h+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,gt)|0)+Math.imul(g,pt)|0))<<13)|0;h=((o=o+Math.imul(g,gt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(U,G),i=(i=Math.imul(U,X))+Math.imul(j,G)|0,o=Math.imul(j,X),n=n+Math.imul(P,Y)|0,i=(i=i+Math.imul(P,Q)|0)+Math.imul(L,Y)|0,o=o+Math.imul(L,Q)|0,n=n+Math.imul(N,$)|0,i=(i=i+Math.imul(N,tt)|0)+Math.imul(B,$)|0,o=o+Math.imul(B,tt)|0,n=n+Math.imul(x,rt)|0,i=(i=i+Math.imul(x,nt)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,st)|0,n=n+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,ht)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ht)|0,n=n+Math.imul(b,lt)|0,i=(i=i+Math.imul(b,ft)|0)+Math.imul(_,lt)|0,o=o+Math.imul(_,ft)|0;var Ct=(h+(n=n+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,gt)|0)+Math.imul(w,pt)|0))<<13)|0;h=((o=o+Math.imul(w,gt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(U,Y),i=(i=Math.imul(U,Q))+Math.imul(j,Y)|0,o=Math.imul(j,Q),n=n+Math.imul(P,$)|0,i=(i=i+Math.imul(P,tt)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,tt)|0,n=n+Math.imul(N,rt)|0,i=(i=i+Math.imul(N,nt)|0)+Math.imul(B,rt)|0,o=o+Math.imul(B,nt)|0,n=n+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,n=n+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,ht)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,ht)|0,n=n+Math.imul(S,lt)|0,i=(i=i+Math.imul(S,ft)|0)+Math.imul(M,lt)|0,o=o+Math.imul(M,ft)|0;var kt=(h+(n=n+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,gt)|0)+Math.imul(_,pt)|0))<<13)|0;h=((o=o+Math.imul(_,gt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(U,$),i=(i=Math.imul(U,tt))+Math.imul(j,$)|0,o=Math.imul(j,tt),n=n+Math.imul(P,rt)|0,i=(i=i+Math.imul(P,nt)|0)+Math.imul(L,rt)|0,o=o+Math.imul(L,nt)|0,n=n+Math.imul(N,ot)|0,i=(i=i+Math.imul(N,st)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,st)|0,n=n+Math.imul(x,ut)|0,i=(i=i+Math.imul(x,ht)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ht)|0,n=n+Math.imul(I,lt)|0,i=(i=i+Math.imul(I,ft)|0)+Math.imul(C,lt)|0,o=o+Math.imul(C,ft)|0;var xt=(h+(n=n+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,gt)|0)+Math.imul(M,pt)|0))<<13)|0;h=((o=o+Math.imul(M,gt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(U,rt),i=(i=Math.imul(U,nt))+Math.imul(j,rt)|0,o=Math.imul(j,nt),n=n+Math.imul(P,ot)|0,i=(i=i+Math.imul(P,st)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,st)|0,n=n+Math.imul(N,ut)|0,i=(i=i+Math.imul(N,ht)|0)+Math.imul(B,ut)|0,o=o+Math.imul(B,ht)|0,n=n+Math.imul(x,lt)|0,i=(i=i+Math.imul(x,ft)|0)+Math.imul(T,lt)|0,o=o+Math.imul(T,ft)|0;var Tt=(h+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,gt)|0)+Math.imul(C,pt)|0))<<13)|0;h=((o=o+Math.imul(C,gt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(U,ot),i=(i=Math.imul(U,st))+Math.imul(j,ot)|0,o=Math.imul(j,st),n=n+Math.imul(P,ut)|0,i=(i=i+Math.imul(P,ht)|0)+Math.imul(L,ut)|0,o=o+Math.imul(L,ht)|0,n=n+Math.imul(N,lt)|0,i=(i=i+Math.imul(N,ft)|0)+Math.imul(B,lt)|0,o=o+Math.imul(B,ft)|0;var Ot=(h+(n=n+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,gt)|0)+Math.imul(T,pt)|0))<<13)|0;h=((o=o+Math.imul(T,gt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(U,ut),i=(i=Math.imul(U,ht))+Math.imul(j,ut)|0,o=Math.imul(j,ht),n=n+Math.imul(P,lt)|0,i=(i=i+Math.imul(P,ft)|0)+Math.imul(L,lt)|0,o=o+Math.imul(L,ft)|0;var Nt=(h+(n=n+Math.imul(N,pt)|0)|0)+((8191&(i=(i=i+Math.imul(N,gt)|0)+Math.imul(B,pt)|0))<<13)|0;h=((o=o+Math.imul(B,gt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(U,lt),i=(i=Math.imul(U,ft))+Math.imul(j,lt)|0,o=Math.imul(j,ft);var Bt=(h+(n=n+Math.imul(P,pt)|0)|0)+((8191&(i=(i=i+Math.imul(P,gt)|0)+Math.imul(L,pt)|0))<<13)|0;h=((o=o+Math.imul(L,gt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863;var Rt=(h+(n=Math.imul(U,pt))|0)+((8191&(i=(i=Math.imul(U,gt))+Math.imul(j,pt)|0))<<13)|0;return h=((o=Math.imul(j,gt))+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,u[0]=mt,u[1]=yt,u[2]=wt,u[3]=vt,u[4]=bt,u[5]=_t,u[6]=Et,u[7]=St,u[8]=Mt,u[9]=At,u[10]=It,u[11]=Ct,u[12]=kt,u[13]=xt,u[14]=Tt,u[15]=Ot,u[16]=Nt,u[17]=Bt,u[18]=Rt,0!==h&&(u[19]=h,r.length++),r};function g(t,e,r){return(new m).mulp(t,e,r)}function m(t,e){this.x=t,this.y=e}Math.imul||(p=d),o.prototype.mulTo=function(t,e){var r,n=this.length+t.length;return r=10===this.length&&10===t.length?p(this,t,e):n<63?d(this,t,e):n<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,t,e):g(this,t,e),r},m.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n>=1;return n},m.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,e+=i/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,h=0;h=0&&(0!==c||h>=i);h--){var l=0|this.words[h];this.words[h]=c<<26-o|l>>>o,c=l&a}return u&&0!==c&&(u.words[u.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"===typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"===typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===a)return this.strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,s=0|i.words[i.length-1];0!==(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var h=0;h=0;l--){var f=67108864*(0|n.words[i.length+l])+(0|n.words[i.length+l-1]);for(f=Math.min(f/s|0,67108863),n._ishlnsubmul(i,f,l);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(i,1,l),n.isZero()||(n.negative^=1);a&&(a.words[l]=f)}return a&&a.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!==(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},o.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),h=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++h;for(var c=r.clone(),l=e.clone();!e.isZero();){for(var f=0,d=1;0===(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(c),s.isub(l)),i.iushrn(1),s.iushrn(1);for(var p=0,g=1;0===(r.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(c),u.isub(l)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),s.isub(u)):(r.isub(e),a.isub(i),u.isub(s))}return{a:a,b:u,gcd:r.iushln(h)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var h=0,c=1;0===(e.words[0]&c)&&h<26;++h,c<<=1);if(h>0)for(e.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var l=0,f=1;0===(r.words[0]&f)&&l<26;++l,f<<=1);if(l>0)for(r.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0===(1&this.words[0])},o.prototype.isOdd=function(){return 1===(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"===typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new S(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var y={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(t){if("string"===typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function M(t){S.call(this,t),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},i(v,w),v.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},v.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(y[t])return y[t];var e;if("k256"===t)e=new v;else if("p224"===t)e=new b;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new E}return y[t]=e,e},S.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},S.prototype._verify2=function(t,e){n(0===(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2===1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),h=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new o(2*c*c).toRed(this);0!==this.pow(c,h).cmp(u);)c.redIAdd(u);for(var l=this.pow(c,i),f=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(a);){for(var g=d,m=0;0!==g.cmp(a);m++)g=g.redSqr();n(m=0;n--){for(var h=e.words[n],c=u-1;c>=0;c--){var l=h>>c&1;i!==r[0]&&(i=this.sqr(i)),0!==l||0!==s?(s<<=1,s|=l,(4===++a||0===n&&0===c)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}u=26}return i},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new M(t)},i(M,S),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},6281:t=>{"use strict";t.exports=function(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r>>0,h=new Uint8Array(o);t[r];){var c=e[t.charCodeAt(r)];if(255===c)return;for(var l=0,f=o-1;(0!==c||l>>0,h[f]=c%256>>>0,c=c/256>>>0;if(0!==c)throw new Error("Non-zero carry");i=l,r++}for(var d=o-i;d!==o&&0===h[d];)d++;for(var p=new Uint8Array(n+(o-d)),g=n;d!==o;)p[g++]=h[d++];return p}return{encode:function(e){if(e instanceof Uint8Array||(ArrayBuffer.isView(e)?e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength):Array.isArray(e)&&(e=Uint8Array.from(e))),!(e instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===e.length)return"";for(var r=0,n=0,i=0,o=e.length;i!==o&&0===e[i];)i++,r++;for(var u=(o-i)*h+1>>>0,c=new Uint8Array(u);i!==o;){for(var l=e[i],f=0,d=u-1;(0!==l||f>>0,c[d]=l%s>>>0,l=l/s>>>0;if(0!==l)throw new Error("Non-zero carry");n=f,i++}for(var p=u-n;p!==u&&0===c[p];)p++;for(var g=a.repeat(r);p{"use strict";e.byteLength=function(t){var e=a(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,o=a(t),s=o[0],u=o[1],h=new i(function(t,e,r){return 3*(e+r)/4-r}(0,s,u)),c=0,l=u>0?s-4:s;for(r=0;r>16&255,h[c++]=e>>8&255,h[c++]=255&e;2===u&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,h[c++]=255&e);1===u&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,h[c++]=e>>8&255,h[c++]=255&e);return h},e.fromByteArray=function(t){for(var e,n=t.length,i=n%3,o=[],s=16383,a=0,h=n-i;ah?h:a+s));1===i?(e=t[n-1],o.push(r[e>>2]+r[e<<4&63]+"==")):2===i&&(e=(t[n-2]<<8)+t[n-1],o.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"="));return o.join("")};for(var r=[],n=[],i="undefined"!==typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)r[s]=o[s],n[o.charCodeAt(s)]=s;function a(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function u(t,e,n){for(var i,o,s=[],a=e;a>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return s.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},1219:(t,e,r)=>{"use strict";t.exports=r(1570)},715:t=>{"use strict";t.exports=function t(e,r){if(!e){const e=new Error(r||"Assertion failed");throw Error.captureStackTrace&&Error.captureStackTrace(e,t),e}}},3166:(t,e,r)=>{"use strict";var n=r(6382).Buffer;const i=r(715);t.exports=class{constructor(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];i("function"===typeof t),i(e>>>0===e),i(Array.isArray(r)),i(Array.isArray(n)),this.hash=t,this.size=e,this.x=r,this.y=n,this.inner=new t,this.outer=new t}init(t){if(i(n.isBuffer(t)),t.length>this.size){const e=new(0,this.hash);e.init(...this.x),e.update(t),t=e.final(...this.y),i(t.length<=this.size)}const e=n.alloc(this.size);for(let r=0;r{"use strict";var n=r(6382).Buffer;const i=r(715),o=r(4152),s=r(3166);class a{constructor(){this.ctx=new o}init(){return this.ctx.init(),this}update(t){return this.ctx.update(t),this}final(){const t=n.alloc(32);return this.ctx._final(t),this.ctx.init(),this.ctx.update(t),this.ctx._final(t),t}static hash(){return new a}static hmac(){return new s(a,64)}static digest(t){return a.ctx.init().update(t).final()}static root(t,e){return i(n.isBuffer(t)&&32===t.length),i(n.isBuffer(e)&&32===e.length),a.ctx.init().update(t).update(e).final()}static multi(t,e,r){const{ctx:n}=a;return n.init(),n.update(t),n.update(e),r&&n.update(r),n.final()}static mac(t,e){return a.hmac().init(e).update(t).final()}}a.native=0,a.id="HASH256",a.size=32,a.bits=256,a.blockSize=64,a.zero=n.alloc(32,0),a.ctx=new a,t.exports=a},4152:(t,e,r)=>{"use strict";var n=r(6382).Buffer;const i=r(715),o=r(3166),s=n.alloc(8,0),a=n.alloc(64,0);a[0]=128;const u=new Uint32Array([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]);class h{constructor(){this.state=new Uint32Array(8),this.msg=new Uint32Array(64),this.block=n.alloc(64),this.size=-1}init(){return this.state[0]=1779033703,this.state[1]=3144134277,this.state[2]=1013904242,this.state[3]=2773480762,this.state[4]=1359893119,this.state[5]=2600822924,this.state[6]=528734635,this.state[7]=1541459225,this.size=0,this}update(t){return i(n.isBuffer(t)),this._update(t,t.length),this}final(){return this._final(n.alloc(32))}_update(t,e){i(-1!==this.size,"Context is not initialized.");let r=63&this.size,n=0;if(this.size+=e,r>0){let i=64-r;if(i>e&&(i=e),t.copy(this.block,r,n,n+i),r+=i,e-=i,n+=i,r<64)return;this._transform(this.block,0)}for(;e>=64;)this._transform(t,n),n+=64,e-=64;e>0&&t.copy(this.block,0,n,n+e)}_final(t){i(-1!==this.size,"Context is not initialized.");const e=63&this.size,r=8*this.size;g(s,r*(1/4294967296)>>>0,0),g(s,r>>>0,4),this._update(a,1+(119-e&63)),this._update(s,8);for(let n=0;n<8;n++)g(t,this.state[n],4*n),this.state[n]=0;for(let n=0;n<64;n++)this.msg[n]=0;for(let n=0;n<64;n++)this.block[n]=0;return this.size=-1,t}_transform(t,e){const r=this.msg;let n=this.state[0],i=this.state[1],o=this.state[2],s=this.state[3],a=this.state[4],h=this.state[5],g=this.state[6],m=this.state[7],y=0;for(;y<16;y++)r[y]=(v=e+4*y,16777216*(w=t)[v++]+65536*w[v++]+256*w[v++]+w[v]);for(var w,v,b;y<64;y++)r[y]=(((b=r[y-2])>>>17|b<<15)^(b>>>19|b<<13)^b>>>10)+r[y-7]+f(r[y-15])+r[y-16];for(y=0;y<64;y++){const t=m+l(a)+d(a,h,g)+u[y]+r[y],e=c(n)+p(n,i,o);m=g,g=h,h=a,a=s+t>>>0,s=o,o=i,i=n,n=t+e>>>0}this.state[0]+=n,this.state[1]+=i,this.state[2]+=o,this.state[3]+=s,this.state[4]+=a,this.state[5]+=h,this.state[6]+=g,this.state[7]+=m}static hash(){return new h}static hmac(){return new o(h,64)}static digest(t){return h.ctx.init().update(t).final()}static root(t,e){return i(n.isBuffer(t)&&32===t.length),i(n.isBuffer(e)&&32===e.length),h.ctx.init().update(t).update(e).final()}static multi(t,e,r){const{ctx:n}=h;return n.init(),n.update(t),n.update(e),r&&n.update(r),n.final()}static mac(t,e){return h.hmac().init(e).update(t).final()}}function c(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function l(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function f(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}function d(t,e,r){return r^t&(e^r)}function p(t,e,r){return t&e|r&(t|e)}function g(t,e,r){return t[r++]=e>>>24,t[r++]=e>>>16,t[r++]=e>>>8,t[r++]=e,r}h.native=0,h.id="SHA256",h.size=32,h.bits=256,h.blockSize=64,h.zero=n.alloc(32,0),h.ctx=new h,t.exports=h},6147:(t,e,r)=>{"use strict";var n=r(6382).Buffer;const i=r(715),o=1/4294967296;function s(t,e){i(n.isBuffer(t)),i(n.isBuffer(e)&&e.length>=16);const r=t.length>>>3,o=new h(1936682341,1886610805),s=new h(1685025377,1852075885),a=new h(1819895653,1852142177),u=new h(1952801890,2037671283),l=new h(t.length<<24,0),f=new h(0,255),d=h.decode(e,0),p=h.decode(e,8),g=o.ixor(d),m=s.ixor(p),y=a.ixor(d),w=u.ixor(p);let v=0;for(let n=0;n=16);const o=new h(1936682341,1886610805),s=new h(1685025377,1852075885),a=new h(1819895653,1852142177),u=new h(1952801890,2037671283),l=new h(t,e),f=new h(0,255),d=h.decode(r,0),p=h.decode(r,8),g=o.ixor(d),m=s.ixor(p),y=a.ixor(d),w=u.ixor(p);return w.ixor(l),c(g,m,y,w),c(g,m,y,w),g.ixor(l),y.ixor(f),c(g,m,y,w),c(g,m,y,w),c(g,m,y,w),c(g,m,y,w),g.ixor(m),g.ixor(y),g.ixor(w),[g.hi,g.lo]}function u(t,e,r){i("number"===typeof t),i("number"===typeof e),i(n.isBuffer(r)&&r.length>=32);const o=new h(t,e),s=new h(0,255),a=h.decode(r,0),u=h.decode(r,8),l=h.decode(r,16),f=h.decode(r,24);return f.ixor(o),c(a,u,l,f),c(a,u,l,f),a.ixor(o),l.ixor(s),c(a,u,l,f),c(a,u,l,f),c(a,u,l,f),c(a,u,l,f),a.ixor(u),a.ixor(l),a.ixor(f),[a.hi,a.lo]}class h{constructor(t,e){this.hi=0|t,this.lo=0|e}isum(t,e){const r=this,n=r.lo+e|0,i=n>>31,o=r.lo>>31,s=e>>31,a=1&(o&s|~i&(o^s)),u=(r.hi+t|0)+a;return r.hi=0|u,r.lo=n,r}iadd(t){return this.isum(t.hi,t.lo)}ixor(t){return this.hi^=t.hi,this.lo^=t.lo,this}irotl(t){let e=this.hi,r=this.lo,n=this.hi,i=this.lo;return t<32?(e<<=t,e|=r>>>32-t,r<<=t):(e=r<>>=t,i|=n<<32-t,n>>>=t):(i=n>>>t-32,n=0),this.hi=e|n,this.lo=r|i,this}static mul(t,e){const r=t>>>16,n=65535&t,i=e>>>16,o=65535&e;let s=0,a=0,u=0,c=0;c+=n*o,u+=c>>>16,c&=65535,u+=r*o,a+=u>>>16,u&=65535,u+=n*i,a+=u>>>16,u&=65535,s+=a>>>16,a&=65535,a+=r*i,s+=a>>>16,a&=65535,s+=a>>>16,s&=65535;return new h(s<<16|a,u<<16|c)}static decode(t,e){const r=l(t,e),n=l(t,e+4);return new h(n,r)}}function c(t,e,r,n){t.iadd(e),e.irotl(13),e.ixor(t),t.irotl(32),r.iadd(n),n.irotl(16),n.ixor(r),t.iadd(n),n.irotl(21),n.ixor(t),r.iadd(e),e.irotl(17),e.ixor(r),r.irotl(32)}function l(t,e){return t[e++]+256*t[e++]+65536*t[e++]+16777216*t[e]}e.native=0,e.siphash=function(t,e){return s(t,e)},e.siphash32=function(t,e){return a(0,t,e)[1]},e.siphash64=function(t,e,r){return a(t,e,r)},e.siphash32k256=function(t,e){return u(0,t,e)[1]},e.siphash64k256=function(t,e,r){return u(t,e,r)},e.sipmod=function(t,e,r,n){const[i,a]=s(t,e);return function(t,e,r,n){const i=h.mul(t,r),s=h.mul(t,n),a=h.mul(r,e),u=h.mul(e,n),c=(s.lo>>>0)+(a.lo>>>0)+(u.hi>>>0),l=(s.hi>>>0)+(a.hi>>>0)+(c*o>>>0),{hi:f,lo:d}=i.isum(l*o|0,0|l);return[f,d]}(i,a,r,n)}},618:(t,e,r)=>{"use strict";t.exports=r(6147)},6740:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.bech32m=e.bech32=void 0;const r="qpzry9x8gf2tvdw0s3jn54khce6mua7l",n={};for(let l=0;l<32;l++){const t=r.charAt(l);n[t]=l}function i(t){const e=t>>25;return(33554431&t)<<5^996825010&-(1&e)^642813549&-(e>>1&1)^513874426&-(e>>2&1)^1027748829&-(e>>3&1)^705979059&-(e>>4&1)}function o(t){let e=1;for(let r=0;r126)return"Invalid prefix ("+t+")";e=i(e)^n>>5}e=i(e);for(let r=0;r=r;)o-=r,a.push(i>>o&s);if(n)o>0&&a.push(i<=e)return"Excess padding";if(i<r)return"Exceeds length limit";const s=t.toLowerCase(),a=t.toUpperCase();if(t!==s&&t!==a)return"Mixed-case string "+t;const u=(t=s).lastIndexOf("1");if(-1===u)return"No separator character for "+t;if(0===u)return"Missing prefix for "+t;const h=t.slice(0,u),c=t.slice(u+1);if(c.length<6)return"Data too short";let l=o(h);if("string"===typeof l)return l;const f=[];for(let e=0;e=c.length||f.push(r)}return l!==e?"Invalid checksum for "+t:{prefix:h,words:f}}return e="bech32"===t?1:734539939,{decodeUnsafe:function(t,e){const r=s(t,e);if("object"===typeof r)return r},decode:function(t,e){const r=s(t,e);if("object"===typeof r)return r;throw new Error(r)},encode:function(t,n,s){if(s=s||90,t.length+7+n.length>s)throw new TypeError("Exceeds length limit");let a=o(t=t.toLowerCase());if("string"===typeof a)throw new Error(a);let u=t+"1";for(let e=0;e>5!==0)throw new Error("Non 5-bit word");a=i(a)^t,u+=r.charAt(t)}for(let e=0;e<6;++e)a=i(a);a^=e;for(let e=0;e<6;++e){u+=r.charAt(a>>5*(5-e)&31)}return u},toWords:a,fromWordsUnsafe:u,fromWords:h}}e.bech32=c("bech32"),e.bech32m=c("bech32m")},5468:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(1330);function i(t,e,r){return n=>{if(t.has(n))return;const i=r.filter((t=>t.key.toString("hex")===n))[0];e.push(i),t.add(n)}}function o(t){return t.globalMap.unsignedTx}function s(t){const e=new Set;return t.forEach((t=>{const r=t.key.toString("hex");if(e.has(r))throw new Error("Combine: KeyValue Map keys should be unique");e.add(r)})),e}e.combine=function(t){const e=t[0],r=n.psbtToKeyVals(e),a=t.slice(1);if(0===a.length)throw new Error("Combine: Nothing to combine");const u=o(e);if(void 0===u)throw new Error("Combine: Self missing transaction");const h=s(r.globalKeyVals),c=r.inputKeyVals.map(s),l=r.outputKeyVals.map(s);for(const f of a){const t=o(f);if(void 0===t||!t.toBuffer().equals(u.toBuffer()))throw new Error("Combine: One of the Psbts does not have the same transaction.");const e=n.psbtToKeyVals(f);s(e.globalKeyVals).forEach(i(h,r.globalKeyVals,e.globalKeyVals));e.inputKeyVals.map(s).forEach(((t,n)=>t.forEach(i(c[n],r.inputKeyVals[n],e.inputKeyVals[n]))));e.outputKeyVals.map(s).forEach(((t,n)=>t.forEach(i(l[n],r.outputKeyVals[n],e.outputKeyVals[n]))))}return n.psbtFromKeyVals(u,{globalMapKeyVals:r.globalKeyVals,inputKeyVals:r.inputKeyVals,outputKeyVals:r.outputKeyVals})}},6871:(t,e,r)=>{"use strict";var n=r(6382).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(8087);e.decode=function(t){if(t.key[0]!==i.GlobalTypes.GLOBAL_XPUB)throw new Error("Decode Error: could not decode globalXpub with key 0x"+t.key.toString("hex"));if(79!==t.key.length||![2,3].includes(t.key[46]))throw new Error("Decode Error: globalXpub has invalid extended pubkey in key 0x"+t.key.toString("hex"));if(t.value.length/4%1!==0)throw new Error("Decode Error: Global GLOBAL_XPUB value length should be multiple of 4");const e=t.key.slice(1),r={masterFingerprint:t.value.slice(0,4),extendedPubkey:e,path:"m"};for(const i of(n=t.value.length/4-1,[...Array(n).keys()])){const e=t.value.readUInt32LE(4*i+4),n=!!(2147483648&e),o=2147483647&e;r.path+="/"+o.toString(10)+(n?"'":"")}var n;return r},e.encode=function(t){const e=n.from([i.GlobalTypes.GLOBAL_XPUB]),r=n.concat([e,t.extendedPubkey]),o=t.path.split("/"),s=n.allocUnsafe(4*o.length);t.masterFingerprint.copy(s,0);let a=4;return o.slice(1).forEach((t=>{const e="'"===t.slice(-1);let r=2147483647&parseInt(e?t.slice(0,-1):t,10);e&&(r+=2147483648),s.writeUInt32LE(r,a),a+=4})),{key:r,value:s}},e.expected="{ masterFingerprint: Buffer; extendedPubkey: Buffer; path: string; }",e.check=function(t){const e=t.extendedPubkey,r=t.masterFingerprint,i=t.path;return n.isBuffer(e)&&78===e.length&&[2,3].indexOf(e[45])>-1&&n.isBuffer(r)&&4===r.length&&"string"===typeof i&&!!i.match(/^m(\/\d+'?)*$/)},e.canAddToArray=function(t,e,r){const n=e.extendedPubkey.toString("hex");return!r.has(n)&&(r.add(n),0===t.filter((t=>t.extendedPubkey.equals(e.extendedPubkey))).length)}},2084:(t,e,r)=>{"use strict";var n=r(6382).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(8087);e.encode=function(t){return{key:n.from([i.GlobalTypes.UNSIGNED_TX]),value:t.toBuffer()}}},9391:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(8087),i=r(6871),o=r(2084),s=r(6606),a=r(9072),u=r(7140),h=r(9376),c=r(5012),l=r(9217),f=r(8113),d=r(2262),p=r(9795),g=r(905),m=r(799),y=r(4676),w=r(3218),v=r(6943),b=r(6986),_=r(8877),E=r(6346),S=r(2777),M={unsignedTx:o,globalXpub:i,checkPubkey:v.makeChecker([])};e.globals=M;const A={nonWitnessUtxo:u,partialSig:h,sighashType:l,finalScriptSig:s,finalScriptWitness:a,porCommitment:c,witnessUtxo:m,bip32Derivation:w.makeConverter(n.InputTypes.BIP32_DERIVATION),redeemScript:b.makeConverter(n.InputTypes.REDEEM_SCRIPT),witnessScript:S.makeConverter(n.InputTypes.WITNESS_SCRIPT),checkPubkey:v.makeChecker([n.InputTypes.PARTIAL_SIG,n.InputTypes.BIP32_DERIVATION]),tapKeySig:f,tapScriptSig:g,tapLeafScript:d,tapBip32Derivation:_.makeConverter(n.InputTypes.TAP_BIP32_DERIVATION),tapInternalKey:E.makeConverter(n.InputTypes.TAP_INTERNAL_KEY),tapMerkleRoot:p};e.inputs=A;const I={bip32Derivation:w.makeConverter(n.OutputTypes.BIP32_DERIVATION),redeemScript:b.makeConverter(n.OutputTypes.REDEEM_SCRIPT),witnessScript:S.makeConverter(n.OutputTypes.WITNESS_SCRIPT),checkPubkey:v.makeChecker([n.OutputTypes.BIP32_DERIVATION]),tapBip32Derivation:_.makeConverter(n.OutputTypes.TAP_BIP32_DERIVATION),tapTree:y,tapInternalKey:E.makeConverter(n.OutputTypes.TAP_INTERNAL_KEY)};e.outputs=I},6606:(t,e,r)=>{"use strict";var n=r(6382).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(8087);e.decode=function(t){if(t.key[0]!==i.InputTypes.FINAL_SCRIPTSIG)throw new Error("Decode Error: could not decode finalScriptSig with key 0x"+t.key.toString("hex"));return t.value},e.encode=function(t){return{key:n.from([i.InputTypes.FINAL_SCRIPTSIG]),value:t}},e.expected="Buffer",e.check=function(t){return n.isBuffer(t)},e.canAdd=function(t,e){return!!t&&!!e&&void 0===t.finalScriptSig}},9072:(t,e,r)=>{"use strict";var n=r(6382).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(8087);e.decode=function(t){if(t.key[0]!==i.InputTypes.FINAL_SCRIPTWITNESS)throw new Error("Decode Error: could not decode finalScriptWitness with key 0x"+t.key.toString("hex"));return t.value},e.encode=function(t){return{key:n.from([i.InputTypes.FINAL_SCRIPTWITNESS]),value:t}},e.expected="Buffer",e.check=function(t){return n.isBuffer(t)},e.canAdd=function(t,e){return!!t&&!!e&&void 0===t.finalScriptWitness}},7140:(t,e,r)=>{"use strict";var n=r(6382).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(8087);e.decode=function(t){if(t.key[0]!==i.InputTypes.NON_WITNESS_UTXO)throw new Error("Decode Error: could not decode nonWitnessUtxo with key 0x"+t.key.toString("hex"));return t.value},e.encode=function(t){return{key:n.from([i.InputTypes.NON_WITNESS_UTXO]),value:t}},e.expected="Buffer",e.check=function(t){return n.isBuffer(t)},e.canAdd=function(t,e){return!!t&&!!e&&void 0===t.nonWitnessUtxo}},9376:(t,e,r)=>{"use strict";var n=r(6382).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(8087);e.decode=function(t){if(t.key[0]!==i.InputTypes.PARTIAL_SIG)throw new Error("Decode Error: could not decode partialSig with key 0x"+t.key.toString("hex"));if(34!==t.key.length&&66!==t.key.length||![2,3,4].includes(t.key[1]))throw new Error("Decode Error: partialSig has invalid pubkey in key 0x"+t.key.toString("hex"));return{pubkey:t.key.slice(1),signature:t.value}},e.encode=function(t){const e=n.from([i.InputTypes.PARTIAL_SIG]);return{key:n.concat([e,t.pubkey]),value:t.signature}},e.expected="{ pubkey: Buffer; signature: Buffer; }",e.check=function(t){return n.isBuffer(t.pubkey)&&n.isBuffer(t.signature)&&[33,65].includes(t.pubkey.length)&&[2,3,4].includes(t.pubkey[0])&&function(t){if(!n.isBuffer(t)||t.length<9)return!1;if(48!==t[0])return!1;if(t.length!==t[1]+3)return!1;if(2!==t[2])return!1;const e=t[3];if(e>33||e<1)return!1;if(2!==t[3+e+1])return!1;const r=t[3+e+2];return!(r>33||r<1)&&t.length===3+e+2+r+2}(t.signature)},e.canAddToArray=function(t,e,r){const n=e.pubkey.toString("hex");return!r.has(n)&&(r.add(n),0===t.filter((t=>t.pubkey.equals(e.pubkey))).length)}},5012:(t,e,r)=>{"use strict";var n=r(6382).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(8087);e.decode=function(t){if(t.key[0]!==i.InputTypes.POR_COMMITMENT)throw new Error("Decode Error: could not decode porCommitment with key 0x"+t.key.toString("hex"));return t.value.toString("utf8")},e.encode=function(t){return{key:n.from([i.InputTypes.POR_COMMITMENT]),value:n.from(t,"utf8")}},e.expected="string",e.check=function(t){return"string"===typeof t},e.canAdd=function(t,e){return!!t&&!!e&&void 0===t.porCommitment}},9217:(t,e,r)=>{"use strict";var n=r(6382).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(8087);e.decode=function(t){if(t.key[0]!==i.InputTypes.SIGHASH_TYPE)throw new Error("Decode Error: could not decode sighashType with key 0x"+t.key.toString("hex"));return t.value.readUInt32LE(0)},e.encode=function(t){const e=n.from([i.InputTypes.SIGHASH_TYPE]),r=n.allocUnsafe(4);return r.writeUInt32LE(t,0),{key:e,value:r}},e.expected="number",e.check=function(t){return"number"===typeof t},e.canAdd=function(t,e){return!!t&&!!e&&void 0===t.sighashType}},8113:(t,e,r)=>{"use strict";var n=r(6382).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(8087);function o(t){return n.isBuffer(t)&&(64===t.length||65===t.length)}e.decode=function(t){if(t.key[0]!==i.InputTypes.TAP_KEY_SIG||1!==t.key.length)throw new Error("Decode Error: could not decode tapKeySig with key 0x"+t.key.toString("hex"));if(!o(t.value))throw new Error("Decode Error: tapKeySig not a valid 64-65-byte BIP340 signature");return t.value},e.encode=function(t){return{key:n.from([i.InputTypes.TAP_KEY_SIG]),value:t}},e.expected="Buffer",e.check=o,e.canAdd=function(t,e){return!!t&&!!e&&void 0===t.tapKeySig}},2262:(t,e,r)=>{"use strict";var n=r(6382).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(8087);e.decode=function(t){if(t.key[0]!==i.InputTypes.TAP_LEAF_SCRIPT)throw new Error("Decode Error: could not decode tapLeafScript with key 0x"+t.key.toString("hex"));if((t.key.length-2)%32!==0)throw new Error("Decode Error: tapLeafScript has invalid control block in key 0x"+t.key.toString("hex"));const e=t.value[t.value.length-1];if((254&t.key[1])!==e)throw new Error("Decode Error: tapLeafScript bad leaf version in key 0x"+t.key.toString("hex"));const r=t.value.slice(0,-1);return{controlBlock:t.key.slice(1),script:r,leafVersion:e}},e.encode=function(t){const e=n.from([i.InputTypes.TAP_LEAF_SCRIPT]),r=n.from([t.leafVersion]);return{key:n.concat([e,t.controlBlock]),value:n.concat([t.script,r])}},e.expected="{ controlBlock: Buffer; leafVersion: number, script: Buffer; }",e.check=function(t){return n.isBuffer(t.controlBlock)&&(t.controlBlock.length-1)%32===0&&(254&t.controlBlock[0])===t.leafVersion&&n.isBuffer(t.script)},e.canAddToArray=function(t,e,r){const n=e.controlBlock.toString("hex");return!r.has(n)&&(r.add(n),0===t.filter((t=>t.controlBlock.equals(e.controlBlock))).length)}},9795:(t,e,r)=>{"use strict";var n=r(6382).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(8087);function o(t){return n.isBuffer(t)&&32===t.length}e.decode=function(t){if(t.key[0]!==i.InputTypes.TAP_MERKLE_ROOT||1!==t.key.length)throw new Error("Decode Error: could not decode tapMerkleRoot with key 0x"+t.key.toString("hex"));if(!o(t.value))throw new Error("Decode Error: tapMerkleRoot not a 32-byte hash");return t.value},e.encode=function(t){return{key:n.from([i.InputTypes.TAP_MERKLE_ROOT]),value:t}},e.expected="Buffer",e.check=o,e.canAdd=function(t,e){return!!t&&!!e&&void 0===t.tapMerkleRoot}},905:(t,e,r)=>{"use strict";var n=r(6382).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(8087);e.decode=function(t){if(t.key[0]!==i.InputTypes.TAP_SCRIPT_SIG)throw new Error("Decode Error: could not decode tapScriptSig with key 0x"+t.key.toString("hex"));if(65!==t.key.length)throw new Error("Decode Error: tapScriptSig has invalid key 0x"+t.key.toString("hex"));if(64!==t.value.length&&65!==t.value.length)throw new Error("Decode Error: tapScriptSig has invalid signature in key 0x"+t.key.toString("hex"));return{pubkey:t.key.slice(1,33),leafHash:t.key.slice(33),signature:t.value}},e.encode=function(t){const e=n.from([i.InputTypes.TAP_SCRIPT_SIG]);return{key:n.concat([e,t.pubkey,t.leafHash]),value:t.signature}},e.expected="{ pubkey: Buffer; leafHash: Buffer; signature: Buffer; }",e.check=function(t){return n.isBuffer(t.pubkey)&&n.isBuffer(t.leafHash)&&n.isBuffer(t.signature)&&32===t.pubkey.length&&32===t.leafHash.length&&(64===t.signature.length||65===t.signature.length)},e.canAddToArray=function(t,e,r){const n=e.pubkey.toString("hex")+e.leafHash.toString("hex");return!r.has(n)&&(r.add(n),0===t.filter((t=>t.pubkey.equals(e.pubkey)&&t.leafHash.equals(e.leafHash))).length)}},799:(t,e,r)=>{"use strict";var n=r(6382).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(8087),o=r(2172),s=r(5409);e.decode=function(t){if(t.key[0]!==i.InputTypes.WITNESS_UTXO)throw new Error("Decode Error: could not decode witnessUtxo with key 0x"+t.key.toString("hex"));const e=o.readUInt64LE(t.value,0);let r=8;const n=s.decode(t.value,r);r+=s.encodingLength(n);const a=t.value.slice(r);if(a.length!==n)throw new Error("Decode Error: WITNESS_UTXO script is not proper length");return{script:a,value:e}},e.encode=function(t){const{script:e,value:r}=t,a=s.encodingLength(e.length),u=n.allocUnsafe(8+a+e.length);return o.writeUInt64LE(u,r,0),s.encode(e.length,u,8),e.copy(u,8+a),{key:n.from([i.InputTypes.WITNESS_UTXO]),value:u}},e.expected="{ script: Buffer; value: number; }",e.check=function(t){return n.isBuffer(t.script)&&"number"===typeof t.value},e.canAdd=function(t,e){return!!t&&!!e&&void 0===t.witnessUtxo}},4676:(t,e,r)=>{"use strict";var n=r(6382).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(8087),o=r(5409);e.decode=function(t){if(t.key[0]!==i.OutputTypes.TAP_TREE||1!==t.key.length)throw new Error("Decode Error: could not decode tapTree with key 0x"+t.key.toString("hex"));let e=0;const r=[];for(;e[n.of(t.depth,t.leafVersion),o.encode(t.script.length),t.script])));return{key:e,value:n.concat(r)}},e.expected="{ leaves: [{ depth: number; leafVersion: number, script: Buffer; }] }",e.check=function(t){return Array.isArray(t.leaves)&&t.leaves.every((t=>t.depth>=0&&t.depth<=128&&(254&t.leafVersion)===t.leafVersion&&n.isBuffer(t.script)))},e.canAdd=function(t,e){return!!t&&!!e&&void 0===t.tapTree}},3218:(t,e,r)=>{"use strict";var n=r(6382).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=t=>33===t.length&&[2,3].includes(t[0])||65===t.length&&4===t[0];e.makeConverter=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:i;return{decode:function(r){if(r.key[0]!==t)throw new Error("Decode Error: could not decode bip32Derivation with key 0x"+r.key.toString("hex"));const n=r.key.slice(1);if(!e(n))throw new Error("Decode Error: bip32Derivation has invalid pubkey in key 0x"+r.key.toString("hex"));if(r.value.length/4%1!==0)throw new Error("Decode Error: Input BIP32_DERIVATION value length should be multiple of 4");const i={masterFingerprint:r.value.slice(0,4),pubkey:n,path:"m"};for(const t of(o=r.value.length/4-1,[...Array(o).keys()])){const e=r.value.readUInt32LE(4*t+4),n=!!(2147483648&e),o=2147483647&e;i.path+="/"+o.toString(10)+(n?"'":"")}var o;return i},encode:function(e){const r=n.from([t]),i=n.concat([r,e.pubkey]),o=e.path.split("/"),s=n.allocUnsafe(4*o.length);e.masterFingerprint.copy(s,0);let a=4;return o.slice(1).forEach((t=>{const e="'"===t.slice(-1);let r=2147483647&parseInt(e?t.slice(0,-1):t,10);e&&(r+=2147483648),s.writeUInt32LE(r,a),a+=4})),{key:i,value:s}},check:function(t){return n.isBuffer(t.pubkey)&&n.isBuffer(t.masterFingerprint)&&"string"===typeof t.path&&e(t.pubkey)&&4===t.masterFingerprint.length},expected:"{ masterFingerprint: Buffer; pubkey: Buffer; path: string; }",canAddToArray:function(t,e,r){const n=e.pubkey.toString("hex");return!r.has(n)&&(r.add(n),0===t.filter((t=>t.pubkey.equals(e.pubkey))).length)}}}},6943:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.makeChecker=function(t){return function(e){let r;if(t.includes(e.key[0])&&(r=e.key.slice(1),33!==r.length&&65!==r.length||![2,3,4].includes(r[0])))throw new Error("Format Error: invalid pubkey in key 0x"+e.key.toString("hex"));return r}}},6986:(t,e,r)=>{"use strict";var n=r(6382).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.makeConverter=function(t){return{decode:function(e){if(e.key[0]!==t)throw new Error("Decode Error: could not decode redeemScript with key 0x"+e.key.toString("hex"));return e.value},encode:function(e){return{key:n.from([t]),value:e}},check:function(t){return n.isBuffer(t)},expected:"Buffer",canAdd:function(t,e){return!!t&&!!e&&void 0===t.redeemScript}}}},8877:(t,e,r)=>{"use strict";var n=r(6382).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(5409),o=r(3218),s=t=>32===t.length;e.makeConverter=function(t){const e=o.makeConverter(t,s);return{decode:function(t){const r=i.decode(t.value),n=i.encodingLength(r),o=e.decode({key:t.key,value:t.value.slice(n+32*r)}),s=new Array(r);for(let e=0,i=n;en.isBuffer(t)&&32===t.length))&&e.check(t)},expected:"{ masterFingerprint: Buffer; pubkey: Buffer; path: string; leafHashes: Buffer[]; }",canAddToArray:e.canAddToArray}}},6346:(t,e,r)=>{"use strict";var n=r(6382).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.makeConverter=function(t){return{decode:function(e){if(e.key[0]!==t||1!==e.key.length)throw new Error("Decode Error: could not decode tapInternalKey with key 0x"+e.key.toString("hex"));if(32!==e.value.length)throw new Error("Decode Error: tapInternalKey not a 32-byte x-only pubkey");return e.value},encode:function(e){return{key:n.from([t]),value:e}},check:function(t){return n.isBuffer(t)&&32===t.length},expected:"Buffer",canAdd:function(t,e){return!!t&&!!e&&void 0===t.tapInternalKey}}}},2777:(t,e,r)=>{"use strict";var n=r(6382).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.makeConverter=function(t){return{decode:function(e){if(e.key[0]!==t)throw new Error("Decode Error: could not decode witnessScript with key 0x"+e.key.toString("hex"));return e.value},encode:function(e){return{key:n.from([t]),value:e}},check:function(t){return n.isBuffer(t)},expected:"Buffer",canAdd:function(t,e){return!!t&&!!e&&void 0===t.witnessScript}}}},2172:(t,e,r)=>{"use strict";var n=r(6382).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(5409);function o(t){const e=t.key.length,r=t.value.length,o=i.encodingLength(e),s=i.encodingLength(r),a=n.allocUnsafe(o+e+s+r);return i.encode(e,a,0),t.key.copy(a,o),i.encode(r,a,o+e),t.value.copy(a,o+e+s),a}function s(t,e){if("number"!==typeof t)throw new Error("cannot write a non-number as a number");if(t<0)throw new Error("specified a negative value for writing an unsigned value");if(t>e)throw new Error("RangeError: value out of range");if(Math.floor(t)!==t)throw new Error("value has a fractional component")}e.range=t=>[...Array(t).keys()],e.reverseBuffer=function(t){if(t.length<1)return t;let e=t.length-1,r=0;for(let n=0;n{"use strict";var n=r(6382).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=9007199254740991;function o(t){if(t<0||t>i||t%1!==0)throw new RangeError("value out of range")}function s(t){return o(t),t<253?1:t<=65535?3:t<=4294967295?5:9}e.encode=function t(e,r,i){if(o(e),r||(r=n.allocUnsafe(s(e))),!n.isBuffer(r))throw new TypeError("buffer must be a Buffer instance");return i||(i=0),e<253?(r.writeUInt8(e,i),Object.assign(t,{bytes:1})):e<=65535?(r.writeUInt8(253,i),r.writeUInt16LE(e,i+1),Object.assign(t,{bytes:3})):e<=4294967295?(r.writeUInt8(254,i),r.writeUInt32LE(e,i+1),Object.assign(t,{bytes:5})):(r.writeUInt8(255,i),r.writeUInt32LE(e>>>0,i+1),r.writeUInt32LE(e/4294967296|0,i+5),Object.assign(t,{bytes:9})),r},e.decode=function t(e,r){if(!n.isBuffer(e))throw new TypeError("buffer must be a Buffer instance");r||(r=0);const i=e.readUInt8(r);if(i<253)return Object.assign(t,{bytes:1}),i;if(253===i)return Object.assign(t,{bytes:3}),e.readUInt16LE(r+1);if(254===i)return Object.assign(t,{bytes:5}),e.readUInt32LE(r+1);{Object.assign(t,{bytes:9});const n=e.readUInt32LE(r+1),i=4294967296*e.readUInt32LE(r+5)+n;return o(i),i}},e.encodingLength=s},8830:(t,e,r)=>{"use strict";var n=r(6382).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(9391),o=r(2172),s=r(5409),a=r(8087);function u(t,e,r){if(!e.equals(n.from([r])))throw new Error("Format Error: Invalid ".concat(t," key: ").concat(e.toString("hex")))}function h(t,e){let{globalMapKeyVals:r,inputKeyVals:n,outputKeyVals:s}=e;const h={unsignedTx:t};let c=0;for(const o of r)switch(o.key[0]){case a.GlobalTypes.UNSIGNED_TX:if(u("global",o.key,a.GlobalTypes.UNSIGNED_TX),c>0)throw new Error("Format Error: GlobalMap has multiple UNSIGNED_TX");c++;break;case a.GlobalTypes.GLOBAL_XPUB:void 0===h.globalXpub&&(h.globalXpub=[]),h.globalXpub.push(i.globals.globalXpub.decode(o));break;default:h.unknownKeyVals||(h.unknownKeyVals=[]),h.unknownKeyVals.push(o)}const l=n.length,f=s.length,d=[],p=[];for(const g of o.range(l)){const t={};for(const e of n[g])switch(i.inputs.checkPubkey(e),e.key[0]){case a.InputTypes.NON_WITNESS_UTXO:if(u("input",e.key,a.InputTypes.NON_WITNESS_UTXO),void 0!==t.nonWitnessUtxo)throw new Error("Format Error: Input has multiple NON_WITNESS_UTXO");t.nonWitnessUtxo=i.inputs.nonWitnessUtxo.decode(e);break;case a.InputTypes.WITNESS_UTXO:if(u("input",e.key,a.InputTypes.WITNESS_UTXO),void 0!==t.witnessUtxo)throw new Error("Format Error: Input has multiple WITNESS_UTXO");t.witnessUtxo=i.inputs.witnessUtxo.decode(e);break;case a.InputTypes.PARTIAL_SIG:void 0===t.partialSig&&(t.partialSig=[]),t.partialSig.push(i.inputs.partialSig.decode(e));break;case a.InputTypes.SIGHASH_TYPE:if(u("input",e.key,a.InputTypes.SIGHASH_TYPE),void 0!==t.sighashType)throw new Error("Format Error: Input has multiple SIGHASH_TYPE");t.sighashType=i.inputs.sighashType.decode(e);break;case a.InputTypes.REDEEM_SCRIPT:if(u("input",e.key,a.InputTypes.REDEEM_SCRIPT),void 0!==t.redeemScript)throw new Error("Format Error: Input has multiple REDEEM_SCRIPT");t.redeemScript=i.inputs.redeemScript.decode(e);break;case a.InputTypes.WITNESS_SCRIPT:if(u("input",e.key,a.InputTypes.WITNESS_SCRIPT),void 0!==t.witnessScript)throw new Error("Format Error: Input has multiple WITNESS_SCRIPT");t.witnessScript=i.inputs.witnessScript.decode(e);break;case a.InputTypes.BIP32_DERIVATION:void 0===t.bip32Derivation&&(t.bip32Derivation=[]),t.bip32Derivation.push(i.inputs.bip32Derivation.decode(e));break;case a.InputTypes.FINAL_SCRIPTSIG:u("input",e.key,a.InputTypes.FINAL_SCRIPTSIG),t.finalScriptSig=i.inputs.finalScriptSig.decode(e);break;case a.InputTypes.FINAL_SCRIPTWITNESS:u("input",e.key,a.InputTypes.FINAL_SCRIPTWITNESS),t.finalScriptWitness=i.inputs.finalScriptWitness.decode(e);break;case a.InputTypes.POR_COMMITMENT:u("input",e.key,a.InputTypes.POR_COMMITMENT),t.porCommitment=i.inputs.porCommitment.decode(e);break;case a.InputTypes.TAP_KEY_SIG:u("input",e.key,a.InputTypes.TAP_KEY_SIG),t.tapKeySig=i.inputs.tapKeySig.decode(e);break;case a.InputTypes.TAP_SCRIPT_SIG:void 0===t.tapScriptSig&&(t.tapScriptSig=[]),t.tapScriptSig.push(i.inputs.tapScriptSig.decode(e));break;case a.InputTypes.TAP_LEAF_SCRIPT:void 0===t.tapLeafScript&&(t.tapLeafScript=[]),t.tapLeafScript.push(i.inputs.tapLeafScript.decode(e));break;case a.InputTypes.TAP_BIP32_DERIVATION:void 0===t.tapBip32Derivation&&(t.tapBip32Derivation=[]),t.tapBip32Derivation.push(i.inputs.tapBip32Derivation.decode(e));break;case a.InputTypes.TAP_INTERNAL_KEY:u("input",e.key,a.InputTypes.TAP_INTERNAL_KEY),t.tapInternalKey=i.inputs.tapInternalKey.decode(e);break;case a.InputTypes.TAP_MERKLE_ROOT:u("input",e.key,a.InputTypes.TAP_MERKLE_ROOT),t.tapMerkleRoot=i.inputs.tapMerkleRoot.decode(e);break;default:t.unknownKeyVals||(t.unknownKeyVals=[]),t.unknownKeyVals.push(e)}d.push(t)}for(const g of o.range(f)){const t={};for(const e of s[g])switch(i.outputs.checkPubkey(e),e.key[0]){case a.OutputTypes.REDEEM_SCRIPT:if(u("output",e.key,a.OutputTypes.REDEEM_SCRIPT),void 0!==t.redeemScript)throw new Error("Format Error: Output has multiple REDEEM_SCRIPT");t.redeemScript=i.outputs.redeemScript.decode(e);break;case a.OutputTypes.WITNESS_SCRIPT:if(u("output",e.key,a.OutputTypes.WITNESS_SCRIPT),void 0!==t.witnessScript)throw new Error("Format Error: Output has multiple WITNESS_SCRIPT");t.witnessScript=i.outputs.witnessScript.decode(e);break;case a.OutputTypes.BIP32_DERIVATION:void 0===t.bip32Derivation&&(t.bip32Derivation=[]),t.bip32Derivation.push(i.outputs.bip32Derivation.decode(e));break;case a.OutputTypes.TAP_INTERNAL_KEY:u("output",e.key,a.OutputTypes.TAP_INTERNAL_KEY),t.tapInternalKey=i.outputs.tapInternalKey.decode(e);break;case a.OutputTypes.TAP_TREE:u("output",e.key,a.OutputTypes.TAP_TREE),t.tapTree=i.outputs.tapTree.decode(e);break;case a.OutputTypes.TAP_BIP32_DERIVATION:void 0===t.tapBip32Derivation&&(t.tapBip32Derivation=[]),t.tapBip32Derivation.push(i.outputs.tapBip32Derivation.decode(e));break;default:t.unknownKeyVals||(t.unknownKeyVals=[]),t.unknownKeyVals.push(e)}p.push(t)}return{globalMap:h,inputs:d,outputs:p}}e.psbtFromBuffer=function(t,e){let r=0;function n(){const e=s.decode(t,r);r+=s.encodingLength(e);const n=t.slice(r,r+e);return r+=e,n}function i(){return{key:n(),value:n()}}function u(){if(r>=t.length)throw new Error("Format Error: Unexpected End of PSBT");const e=0===t.readUInt8(r);return e&&r++,e}if(1886610036!==function(){const e=t.readUInt32BE(r);return r+=4,e}())throw new Error("Format Error: Invalid Magic Number");if(255!==function(){const e=t.readUInt8(r);return r+=1,e}())throw new Error("Format Error: Magic Number must be followed by 0xff separator");const c=[],l={};for(;!u();){const t=i(),e=t.key.toString("hex");if(l[e])throw new Error("Format Error: Keys must be unique for global keymap: key "+e);l[e]=1,c.push(t)}const f=c.filter((t=>t.key[0]===a.GlobalTypes.UNSIGNED_TX));if(1!==f.length)throw new Error("Format Error: Only one UNSIGNED_TX allowed");const d=e(f[0].value),{inputCount:p,outputCount:g}=d.getInputOutputCounts(),m=[],y=[];for(const s of o.range(p)){const t={},e=[];for(;!u();){const r=i(),n=r.key.toString("hex");if(t[n])throw new Error("Format Error: Keys must be unique for each input: input index "+s+" key "+n);t[n]=1,e.push(r)}m.push(e)}for(const s of o.range(g)){const t={},e=[];for(;!u();){const r=i(),n=r.key.toString("hex");if(t[n])throw new Error("Format Error: Keys must be unique for each output: output index "+s+" key "+n);t[n]=1,e.push(r)}y.push(e)}return h(d,{globalMapKeyVals:c,inputKeyVals:m,outputKeyVals:y})},e.checkKeyBuffer=u,e.psbtFromKeyVals=h},1330:(t,e,r)=>{"use strict";function n(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}Object.defineProperty(e,"__esModule",{value:!0}),n(r(8830)),n(r(1095))},1095:(t,e,r)=>{"use strict";var n=r(6382).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(9391),o=r(2172);e.psbtToBuffer=function(t){let{globalMap:e,inputs:r,outputs:i}=t;const{globalKeyVals:s,inputKeyVals:a,outputKeyVals:h}=u({globalMap:e,inputs:r,outputs:i}),c=o.keyValsToBuffer(s),l=t=>0===t.length?[n.from([0])]:t.map(o.keyValsToBuffer),f=l(a),d=l(h),p=n.allocUnsafe(5);return p.writeUIntBE(482972169471,0,5),n.concat([p,c].concat(f,d))};const s=(t,e)=>t.key.compare(e.key);function a(t,e){const r=new Set,n=Object.entries(t).reduce(((t,n)=>{let[i,o]=n;if("unknownKeyVals"===i)return t;const s=e[i];if(void 0===s)return t;const a=(Array.isArray(o)?o:[o]).map(s.encode);return a.map((t=>t.key.toString("hex"))).forEach((t=>{if(r.has(t))throw new Error("Serialize Error: Duplicate key: "+t);r.add(t)})),t.concat(a)}),[]),i=t.unknownKeyVals?t.unknownKeyVals.filter((t=>!r.has(t.key.toString("hex")))):[];return n.concat(i).sort(s)}function u(t){let{globalMap:e,inputs:r,outputs:n}=t;return{globalKeyVals:a(e,i.globals),inputKeyVals:r.map((t=>a(t,i.inputs))),outputKeyVals:n.map((t=>a(t,i.outputs)))}}e.psbtToKeyVals=u},1697:(t,e,r)=>{"use strict";var n=r(6382).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(5468),o=r(1330),s=r(8087),a=r(6613);e.Psbt=class{constructor(t){this.inputs=[],this.outputs=[],this.globalMap={unsignedTx:t}}static fromBase64(t,e){const r=n.from(t,"base64");return this.fromBuffer(r,e)}static fromHex(t,e){const r=n.from(t,"hex");return this.fromBuffer(r,e)}static fromBuffer(t,e){const r=o.psbtFromBuffer(t,e),n=new this(r.globalMap.unsignedTx);return Object.assign(n,r),n}toBase64(){return this.toBuffer().toString("base64")}toHex(){return this.toBuffer().toString("hex")}toBuffer(){return o.psbtToBuffer(this)}updateGlobal(t){return a.updateGlobal(t,this.globalMap),this}updateInput(t,e){const r=a.checkForInput(this.inputs,t);return a.updateInput(e,r),this}updateOutput(t,e){const r=a.checkForOutput(this.outputs,t);return a.updateOutput(e,r),this}addUnknownKeyValToGlobal(t){return a.checkHasKey(t,this.globalMap.unknownKeyVals,a.getEnumLength(s.GlobalTypes)),this.globalMap.unknownKeyVals||(this.globalMap.unknownKeyVals=[]),this.globalMap.unknownKeyVals.push(t),this}addUnknownKeyValToInput(t,e){const r=a.checkForInput(this.inputs,t);return a.checkHasKey(e,r.unknownKeyVals,a.getEnumLength(s.InputTypes)),r.unknownKeyVals||(r.unknownKeyVals=[]),r.unknownKeyVals.push(e),this}addUnknownKeyValToOutput(t,e){const r=a.checkForOutput(this.outputs,t);return a.checkHasKey(e,r.unknownKeyVals,a.getEnumLength(s.OutputTypes)),r.unknownKeyVals||(r.unknownKeyVals=[]),r.unknownKeyVals.push(e),this}addInput(t){this.globalMap.unsignedTx.addInput(t),this.inputs.push({unknownKeyVals:[]});const e=t.unknownKeyVals||[],r=this.inputs.length-1;if(!Array.isArray(e))throw new Error("unknownKeyVals must be an Array");return e.forEach((t=>this.addUnknownKeyValToInput(r,t))),a.addInputAttributes(this.inputs,t),this}addOutput(t){this.globalMap.unsignedTx.addOutput(t),this.outputs.push({unknownKeyVals:[]});const e=t.unknownKeyVals||[],r=this.outputs.length-1;if(!Array.isArray(e))throw new Error("unknownKeyVals must be an Array");return e.forEach((t=>this.addUnknownKeyValToOutput(r,t))),a.addOutputAttributes(this.outputs,t),this}clearFinalizedInput(t){const e=a.checkForInput(this.inputs,t);a.inputCheckUncleanFinalized(t,e);for(const r of Object.keys(e))["witnessUtxo","nonWitnessUtxo","finalScriptSig","finalScriptWitness","unknownKeyVals"].includes(r)||delete e[r];return this}combine(){for(var t=arguments.length,e=new Array(t),r=0;r{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t[t.UNSIGNED_TX=0]="UNSIGNED_TX",t[t.GLOBAL_XPUB=1]="GLOBAL_XPUB"}(e.GlobalTypes||(e.GlobalTypes={})),e.GLOBAL_TYPE_NAMES=["unsignedTx","globalXpub"],function(t){t[t.NON_WITNESS_UTXO=0]="NON_WITNESS_UTXO",t[t.WITNESS_UTXO=1]="WITNESS_UTXO",t[t.PARTIAL_SIG=2]="PARTIAL_SIG",t[t.SIGHASH_TYPE=3]="SIGHASH_TYPE",t[t.REDEEM_SCRIPT=4]="REDEEM_SCRIPT",t[t.WITNESS_SCRIPT=5]="WITNESS_SCRIPT",t[t.BIP32_DERIVATION=6]="BIP32_DERIVATION",t[t.FINAL_SCRIPTSIG=7]="FINAL_SCRIPTSIG",t[t.FINAL_SCRIPTWITNESS=8]="FINAL_SCRIPTWITNESS",t[t.POR_COMMITMENT=9]="POR_COMMITMENT",t[t.TAP_KEY_SIG=19]="TAP_KEY_SIG",t[t.TAP_SCRIPT_SIG=20]="TAP_SCRIPT_SIG",t[t.TAP_LEAF_SCRIPT=21]="TAP_LEAF_SCRIPT",t[t.TAP_BIP32_DERIVATION=22]="TAP_BIP32_DERIVATION",t[t.TAP_INTERNAL_KEY=23]="TAP_INTERNAL_KEY",t[t.TAP_MERKLE_ROOT=24]="TAP_MERKLE_ROOT"}(e.InputTypes||(e.InputTypes={})),e.INPUT_TYPE_NAMES=["nonWitnessUtxo","witnessUtxo","partialSig","sighashType","redeemScript","witnessScript","bip32Derivation","finalScriptSig","finalScriptWitness","porCommitment","tapKeySig","tapScriptSig","tapLeafScript","tapBip32Derivation","tapInternalKey","tapMerkleRoot"],function(t){t[t.REDEEM_SCRIPT=0]="REDEEM_SCRIPT",t[t.WITNESS_SCRIPT=1]="WITNESS_SCRIPT",t[t.BIP32_DERIVATION=2]="BIP32_DERIVATION",t[t.TAP_INTERNAL_KEY=5]="TAP_INTERNAL_KEY",t[t.TAP_TREE=6]="TAP_TREE",t[t.TAP_BIP32_DERIVATION=7]="TAP_BIP32_DERIVATION"}(e.OutputTypes||(e.OutputTypes={})),e.OUTPUT_TYPE_NAMES=["redeemScript","witnessScript","bip32Derivation","tapInternalKey","tapTree","tapBip32Derivation"]},6613:(t,e,r)=>{"use strict";var n=r(6382).Buffer;Object.defineProperty(e,"__esModule",{value:!0});const i=r(9391);function o(t,e){const r=t[e];if(void 0===r)throw new Error("No input #".concat(e));return r}function s(t,e){const r=t[e];if(void 0===r)throw new Error("No output #".concat(e));return r}function a(t,e,r,n){throw new Error("Data for ".concat(t," key ").concat(e," is incorrect: Expected ")+"".concat(r," and got ").concat(JSON.stringify(n)))}function u(t){return(e,r)=>{for(const n of Object.keys(e)){const o=e[n],{canAdd:s,canAddToArray:u,check:h,expected:c}=i[t+"s"][n]||{};if(h)if(!!u){if(!Array.isArray(o)||r[n]&&!Array.isArray(r[n]))throw new Error("Key type ".concat(n," must be an array"));o.every(h)||a(t,n,c,o);const e=r[n]||[],i=new Set;if(!o.every((t=>u(e,t,i))))throw new Error("Can not add duplicate data to array");r[n]=e.concat(o)}else{if(h(o)||a(t,n,c,o),!s(r,o))throw new Error("Can not add duplicate data to ".concat(t));r[n]=o}}}}e.checkForInput=o,e.checkForOutput=s,e.checkHasKey=function(t,e,r){if(t.key[0]e.key.equals(t.key))).length)throw new Error("Duplicate Key: ".concat(t.key.toString("hex")))},e.getEnumLength=function(t){let e=0;return Object.keys(t).forEach((t=>{Number(isNaN(Number(t)))&&e++})),e},e.inputCheckUncleanFinalized=function(t,e){let r=!1;if(e.nonWitnessUtxo||e.witnessUtxo){const t=!!e.redeemScript,n=!!e.witnessScript,i=!t||!!e.finalScriptSig,o=!n||!!e.finalScriptWitness,s=!!e.finalScriptSig||!!e.finalScriptWitness;r=i&&o&&s}if(!1===r)throw new Error("Input #".concat(t," has too much or too little data to clean"))},e.updateGlobal=u("global"),e.updateInput=u("input"),e.updateOutput=u("output"),e.addInputAttributes=function(t,r){const n=o(t,t.length-1);e.updateInput(r,n)},e.addOutputAttributes=function(t,r){const n=s(t,t.length-1);e.updateOutput(r,n)},e.defaultVersionSetter=function(t,e){if(!n.isBuffer(e)||e.length<4)throw new Error("Set Version: Invalid Transaction");return e.writeUInt32LE(t,0),e},e.defaultLocktimeSetter=function(t,e){if(!n.isBuffer(e)||e.length<4)throw new Error("Set Locktime: Invalid Transaction");return e.writeUInt32LE(t,e.length-4),e}},9234:(t,e,r)=>{"use strict";var n=r(6382).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.toOutputScript=e.fromOutputScript=e.toBech32=e.toBase58Check=e.fromBech32=e.fromBase58Check=void 0;const i=r(583),o=r(2148),s=r(3515),a=r(3239),u=r(6740),h=r(3630),c=40,l=2,f=16,d=2,p=80,g="WARNING: Sending to a future segwit version address can lead to loss of funds. End users MUST be warned carefully in the GUI and asked if they wish to proceed with caution. Wallets should verify the segwit version from the output of fromBech32, then decide when it is safe to use which version of segwit.";function m(t){const e=n.from(h.decode(t));if(e.length<21)throw new TypeError(t+" is too short");if(e.length>21)throw new TypeError(t+" is too long");return{version:e.readUInt8(0),hash:e.slice(1)}}function y(t){let e,r;try{e=u.bech32.decode(t)}catch(o){}if(e){if(r=e.words[0],0!==r)throw new TypeError(t+" uses wrong encoding")}else if(e=u.bech32m.decode(t),r=e.words[0],0===r)throw new TypeError(t+" uses wrong encoding");const i=u.bech32.fromWords(e.words.slice(1));return{version:r,prefix:e.prefix,data:n.from(i)}}function w(t,e,r){const n=u.bech32.toWords(t);return n.unshift(e),0===e?u.bech32.encode(r,n):u.bech32m.encode(r,n)}e.fromBase58Check=m,e.fromBech32=y,e.toBase58Check=function(t,e){(0,a.typeforce)((0,a.tuple)(a.Hash160bit,a.UInt8),arguments);const r=n.allocUnsafe(21);return r.writeUInt8(e,0),t.copy(r,1),h.encode(r)},e.toBech32=w,e.fromOutputScript=function(t,e){e=e||i.bitcoin;try{return o.p2pkh({output:t,network:e}).address}catch(r){}try{return o.p2sh({output:t,network:e}).address}catch(r){}try{return o.p2wpkh({output:t,network:e}).address}catch(r){}try{return o.p2wsh({output:t,network:e}).address}catch(r){}try{return o.p2tr({output:t,network:e}).address}catch(r){}try{return function(t,e){const r=t.slice(2);if(r.lengthc)throw new TypeError("Invalid program length for segwit address");const n=t[0]-p;if(nf)throw new TypeError("Invalid version for segwit address");if(t[1]!==r.length)throw new TypeError("Invalid script for segwit address");return console.warn(g),w(r,n,e.bech32)}(t,e)}catch(r){}throw new Error(s.toASM(t)+" has no matching Address")},e.toOutputScript=function(t,e){let r,n;e=e||i.bitcoin;try{r=m(t)}catch(a){}if(r){if(r.version===e.pubKeyHash)return o.p2pkh({hash:r.hash}).output;if(r.version===e.scriptHash)return o.p2sh({hash:r.hash}).output}else{try{n=y(t)}catch(a){}if(n){if(n.prefix!==e.bech32)throw new Error(t+" has an invalid prefix");if(0===n.version){if(20===n.data.length)return o.p2wpkh({hash:n.data}).output;if(32===n.data.length)return o.p2wsh({hash:n.data}).output}else if(1===n.version){if(32===n.data.length)return o.p2tr({pubkey:n.data}).output}else if(n.version>=d&&n.version<=f&&n.data.length>=l&&n.data.length<=c)return console.warn(g),s.compile([n.version+p,n.data])}}throw new Error(t+" has no matching Script")}},7329:(t,e,r)=>{"use strict";var n=r(6382).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.encode=e.decode=e.check=void 0,e.check=function(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 e=t[3];if(0===e)return!1;if(5+e>=t.length)return!1;if(2!==t[4+e])return!1;const r=t[5+e];return 0!==r&&(6+e+r===t.length&&(!(128&t[4])&&(!(e>1&&0===t[4]&&!(128&t[5]))&&(!(128&t[e+6])&&!(r>1&&0===t[e+6]&&!(128&t[e+7]))))))},e.decode=function(t){if(t.length<8)throw new Error("DER sequence length is too short");if(t.length>72)throw new Error("DER sequence length is too long");if(48!==t[0])throw new Error("Expected DER sequence");if(t[1]!==t.length-2)throw new Error("DER sequence length is invalid");if(2!==t[2])throw new Error("Expected DER integer");const e=t[3];if(0===e)throw new Error("R length is zero");if(5+e>=t.length)throw new Error("R length is too long");if(2!==t[4+e])throw new Error("Expected DER integer (2)");const r=t[5+e];if(0===r)throw new Error("S length is zero");if(6+e+r!==t.length)throw new Error("S length is invalid");if(128&t[4])throw new Error("R value is negative");if(e>1&&0===t[4]&&!(128&t[5]))throw new Error("R value excessively padded");if(128&t[e+6])throw new Error("S value is negative");if(r>1&&0===t[e+6]&&!(128&t[e+7]))throw new Error("S value excessively padded");return{r:t.slice(4,4+e),s:t.slice(6+e)}},e.encode=function(t,e){const r=t.length,i=e.length;if(0===r)throw new Error("R length is zero");if(0===i)throw new Error("S length is zero");if(r>33)throw new Error("R length is too long");if(i>33)throw new Error("S length is too long");if(128&t[0])throw new Error("R value is negative");if(128&e[0])throw new Error("S value is negative");if(r>1&&0===t[0]&&!(128&t[1]))throw new Error("R value excessively padded");if(i>1&&0===e[0]&&!(128&e[1]))throw new Error("S value excessively padded");const o=n.allocUnsafe(6+r+i);return o[0]=48,o[1]=o.length-2,o[2]=2,o[3]=t.length,t.copy(o,4),o[4+r]=2,o[5+r]=e.length,e.copy(o,6+r),o}},9651:(t,e,r)=>{"use strict";var n=r(6382).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.Block=void 0;const i=r(6333),o=r(3469),s=r(838),a=r(4222),u=r(3239),{typeforce:h}=u,c=new TypeError("Cannot compute merkle root for zero transactions"),l=new TypeError("Cannot compute witness commit for non-segwit block");class f{constructor(){this.version=1,this.prevHash=void 0,this.merkleRoot=void 0,this.timestamp=0,this.witnessCommit=void 0,this.bits=0,this.nonce=0,this.transactions=void 0}static fromBuffer(t){if(t.length<80)throw new Error("Buffer too small (< 80 bytes)");const e=new i.BufferReader(t),r=new f;if(r.version=e.readInt32(),r.prevHash=e.readSlice(32),r.merkleRoot=e.readSlice(32),r.timestamp=e.readUInt32(),r.bits=e.readUInt32(),r.nonce=e.readUInt32(),80===t.length)return r;const n=()=>{const t=a.Transaction.fromBuffer(e.buffer.slice(e.offset),!0);return e.offset+=t.byteLength(),t},o=e.readVarInt();r.transactions=[];for(let i=0;i>24)-3,r=8388607&t,i=n.alloc(32,0);return i.writeUIntBE(r,29-e,3),i}static calculateMerkleRoot(t,e){if(h([{getHash:u.Function}],t),0===t.length)throw c;if(e&&!d(t))throw l;const r=t.map((t=>t.getHash(e))),i=(0,s.fastMerkleRoot)(r,o.hash256);return e?o.hash256(n.concat([i,t[0].ins[0].witness[0]])):i}getWitnessCommit(){if(!d(this.transactions))return null;const t=this.transactions[0].outs.filter((t=>t.script.slice(0,6).equals(n.from("6a24aa21a9ed","hex")))).map((t=>t.script.slice(6,38)));if(0===t.length)return null;const e=t[t.length-1];return e instanceof n&&32===e.length?e:null}hasWitnessCommit(){return this.witnessCommit instanceof n&&32===this.witnessCommit.length||null!==this.getWitnessCommit()}hasWitness(){return(t=this.transactions)instanceof Array&&t.some((t=>"object"===typeof t&&t.ins instanceof Array&&t.ins.some((t=>"object"===typeof t&&t.witness instanceof Array&&t.witness.length>0))));var t}weight(){return 3*this.byteLength(!1,!1)+this.byteLength(!1,!0)}byteLength(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return t||!this.transactions?80:80+i.varuint.encodingLength(this.transactions.length)+this.transactions.reduce(((t,r)=>t+r.byteLength(e)),0)}getHash(){return o.hash256(this.toBuffer(!0))}getId(){return(0,i.reverseBuffer)(this.getHash()).toString("hex")}getUTCDate(){const t=new Date(0);return t.setUTCSeconds(this.timestamp),t}toBuffer(t){const e=n.allocUnsafe(this.byteLength(t)),r=new i.BufferWriter(e);return r.writeInt32(this.version),r.writeSlice(this.prevHash),r.writeSlice(this.merkleRoot),r.writeUInt32(this.timestamp),r.writeUInt32(this.bits),r.writeUInt32(this.nonce),t||!this.transactions||(i.varuint.encode(this.transactions.length,e,r.offset),r.offset+=i.varuint.encode.bytes,this.transactions.forEach((t=>{const n=t.byteLength();t.toBuffer(e,r.offset),r.offset+=n}))),e}toHex(t){return this.toBuffer(t).toString("hex")}checkTxRoots(){const t=this.hasWitnessCommit();return!(!t&&this.hasWitness())&&(this.__checkMerkleRoot()&&(!t||this.__checkWitnessCommit()))}checkProofOfWork(){const t=(0,i.reverseBuffer)(this.getHash()),e=f.calculateTarget(this.bits);return t.compare(e)<=0}__checkMerkleRoot(){if(!this.transactions)throw c;const t=f.calculateMerkleRoot(this.transactions);return 0===this.merkleRoot.compare(t)}__checkWitnessCommit(){if(!this.transactions)throw c;if(!this.hasWitnessCommit())throw l;const t=f.calculateMerkleRoot(this.transactions,!0);return 0===this.witnessCommit.compare(t)}}function d(t){return t instanceof Array&&t[0]&&t[0].ins&&t[0].ins instanceof Array&&t[0].ins[0]&&t[0].ins[0].witness&&t[0].ins[0].witness instanceof Array&&t[0].ins[0].witness.length>0}e.Block=f},6333:(t,e,r)=>{"use strict";var n=r(6382).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.BufferReader=e.BufferWriter=e.cloneBuffer=e.reverseBuffer=e.writeUInt64LE=e.readUInt64LE=e.varuint=void 0;const i=r(3239),{typeforce:o}=i,s=r(6954);function a(t,e){if("number"!==typeof t)throw new Error("cannot write a non-number as a number");if(t<0)throw new Error("specified a negative value for writing an unsigned value");if(t>e)throw new Error("RangeError: value out of range");if(Math.floor(t)!==t)throw new Error("value has a fractional component")}function u(t,e){const r=t.readUInt32LE(e);let n=t.readUInt32LE(e+4);return n*=4294967296,a(n+r,9007199254740991),n+r}function h(t,e,r){return a(e,9007199254740991),t.writeInt32LE(-1&e,r),t.writeUInt32LE(Math.floor(e/4294967296),r+4),r+8}e.varuint=s,e.readUInt64LE=u,e.writeUInt64LE=h,e.reverseBuffer=function(t){if(t.length<1)return t;let e=t.length-1,r=0;for(let n=0;n1&&void 0!==arguments[1]?arguments[1]:0;this.buffer=t,this.offset=e,o(i.tuple(i.Buffer,i.UInt32),[t,e])}writeUInt8(t){this.offset=this.buffer.writeUInt8(t,this.offset)}writeInt32(t){this.offset=this.buffer.writeInt32LE(t,this.offset)}writeUInt32(t){this.offset=this.buffer.writeUInt32LE(t,this.offset)}writeUInt64(t){this.offset=h(this.buffer,t,this.offset)}writeVarInt(t){s.encode(t,this.buffer,this.offset),this.offset+=s.encode.bytes}writeSlice(t){if(this.buffer.lengththis.writeVarSlice(t)))}end(){if(this.buffer.length===this.offset)return this.buffer;throw new Error("buffer size ".concat(this.buffer.length,", offset ").concat(this.offset))}}e.BufferWriter=c;e.BufferReader=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.buffer=t,this.offset=e,o(i.tuple(i.Buffer,i.UInt32),[t,e])}readUInt8(){const t=this.buffer.readUInt8(this.offset);return this.offset++,t}readInt32(){const t=this.buffer.readInt32LE(this.offset);return this.offset+=4,t}readUInt32(){const t=this.buffer.readUInt32LE(this.offset);return this.offset+=4,t}readUInt64(){const t=u(this.buffer,this.offset);return this.offset+=8,t}readVarInt(){const t=s.decode(this.buffer,this.offset);return this.offset+=s.decode.bytes,t}readSlice(t){if(this.buffer.length{"use strict";var n=r(6382).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.taggedHash=e.TAGGED_HASH_PREFIXES=e.TAGS=e.hash256=e.hash160=e.sha256=e.sha1=e.ripemd160=void 0;const i=r(5829),o=r(1736),s=r(1678);function a(t){return n.from((0,s.sha256)(Uint8Array.from(t)))}e.ripemd160=function(t){return n.from((0,i.ripemd160)(Uint8Array.from(t)))},e.sha1=function(t){return n.from((0,o.sha1)(Uint8Array.from(t)))},e.sha256=a,e.hash160=function(t){return n.from((0,i.ripemd160)((0,s.sha256)(Uint8Array.from(t))))},e.hash256=function(t){return n.from((0,s.sha256)((0,s.sha256)(Uint8Array.from(t))))},e.TAGS=["BIP0340/challenge","BIP0340/aux","BIP0340/nonce","TapLeaf","TapBranch","TapSighash","TapTweak","KeyAgg list","KeyAgg coefficient"],e.TAGGED_HASH_PREFIXES={"BIP0340/challenge":n.from([123,181,45,122,159,239,88,50,62,177,191,122,64,125,179,130,210,243,242,216,27,177,34,79,73,254,81,143,109,72,211,124,123,181,45,122,159,239,88,50,62,177,191,122,64,125,179,130,210,243,242,216,27,177,34,79,73,254,81,143,109,72,211,124]),"BIP0340/aux":n.from([241,239,78,94,192,99,202,218,109,148,202,250,157,152,126,160,105,38,88,57,236,193,31,151,45,119,165,46,216,193,204,144,241,239,78,94,192,99,202,218,109,148,202,250,157,152,126,160,105,38,88,57,236,193,31,151,45,119,165,46,216,193,204,144]),"BIP0340/nonce":n.from([7,73,119,52,167,155,203,53,91,155,140,125,3,79,18,28,244,52,215,62,247,45,218,25,135,0,97,251,82,191,235,47,7,73,119,52,167,155,203,53,91,155,140,125,3,79,18,28,244,52,215,62,247,45,218,25,135,0,97,251,82,191,235,47]),TapLeaf:n.from([174,234,143,220,66,8,152,49,5,115,75,88,8,29,30,38,56,211,95,28,181,64,8,212,211,87,202,3,190,120,233,238,174,234,143,220,66,8,152,49,5,115,75,88,8,29,30,38,56,211,95,28,181,64,8,212,211,87,202,3,190,120,233,238]),TapBranch:n.from([25,65,161,242,229,110,185,95,162,169,241,148,190,92,1,247,33,111,51,237,130,176,145,70,52,144,208,91,245,22,160,21,25,65,161,242,229,110,185,95,162,169,241,148,190,92,1,247,33,111,51,237,130,176,145,70,52,144,208,91,245,22,160,21]),TapSighash:n.from([244,10,72,223,75,42,112,200,180,146,75,242,101,70,97,237,61,149,253,102,163,19,235,135,35,117,151,198,40,228,160,49,244,10,72,223,75,42,112,200,180,146,75,242,101,70,97,237,61,149,253,102,163,19,235,135,35,117,151,198,40,228,160,49]),TapTweak:n.from([232,15,225,99,156,156,160,80,227,175,27,57,193,67,198,62,66,156,188,235,21,217,64,251,181,197,161,244,175,87,197,233,232,15,225,99,156,156,160,80,227,175,27,57,193,67,198,62,66,156,188,235,21,217,64,251,181,197,161,244,175,87,197,233]),"KeyAgg list":n.from([72,28,151,28,60,11,70,215,240,178,117,174,89,141,78,44,126,215,49,156,89,74,92,110,199,158,160,212,153,2,148,240,72,28,151,28,60,11,70,215,240,178,117,174,89,141,78,44,126,215,49,156,89,74,92,110,199,158,160,212,153,2,148,240]),"KeyAgg coefficient":n.from([191,201,4,3,77,28,136,232,200,14,34,229,61,36,86,109,100,130,78,214,66,114,129,192,145,0,249,77,205,82,201,129,191,201,4,3,77,28,136,232,200,14,34,229,61,36,86,109,100,130,78,214,66,114,129,192,145,0,249,77,205,82,201,129])},e.taggedHash=function(t,r){return a(n.concat([e.TAGGED_HASH_PREFIXES[t],r]))}},8883:(t,e,r)=>{"use strict";var n=r(6382).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.getEccLib=e.initEccLib=void 0;const i={};e.initEccLib=function(t){var e;t?t!==i.eccLib&&(s("function"===typeof(e=t).isXOnlyPoint),s(e.isXOnlyPoint(o("79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"))),s(e.isXOnlyPoint(o("fffffffffffffffffffffffffffffffffffffffffffffffffffffffeeffffc2e"))),s(e.isXOnlyPoint(o("f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9"))),s(e.isXOnlyPoint(o("0000000000000000000000000000000000000000000000000000000000000001"))),s(!e.isXOnlyPoint(o("0000000000000000000000000000000000000000000000000000000000000000"))),s(!e.isXOnlyPoint(o("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"))),s("function"===typeof e.xOnlyPointAddTweak),a.forEach((t=>{const r=e.xOnlyPointAddTweak(o(t.pubkey),o(t.tweak));null===t.result?s(null===r):(s(null!==r),s(r.parity===t.parity),s(n.from(r.xOnlyPubkey).equals(o(t.result))))})),i.eccLib=t):i.eccLib=t},e.getEccLib=function(){if(!i.eccLib)throw new Error("No ECC Library provided. You must call initEccLib() with a valid TinySecp256k1Interface instance");return i.eccLib};const o=t=>n.from(t,"hex");function s(t){if(!t)throw new Error("ecc library invalid")}const a=[{pubkey:"79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",tweak:"fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140",parity:-1,result:null},{pubkey:"1617d38ed8d8657da4d4761e8057bc396ea9e4b9d29776d4be096016dbd2509b",tweak:"a8397a935f0dfceba6ba9618f6451ef4d80637abf4e6af2669fbc9de6a8fd2ac",parity:1,result:"e478f99dab91052ab39a33ea35fd5e6e4933f4d28023cd597c9a1f6760346adf"},{pubkey:"2c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991",tweak:"823c3cd2142744b075a87eade7e1b8678ba308d566226a0056ca2b7a76f86b47",parity:0,result:"9534f8dc8c6deda2dc007655981c78b49c5d96c778fbf363462a11ec9dfd948c"}]},6682:(t,e,r)=>{"use strict";e.eB=void 0;r(9234);r(3469);r(583);r(2148);r(3515);var n=r(9651);Object.defineProperty(e,"eB",{enumerable:!0,get:function(){return n.Block}});var i=r(3183);var o=r(8662);var s=r(4222);var a=r(8883)},838:(t,e,r)=>{"use strict";var n=r(6382).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.fastMerkleRoot=void 0,e.fastMerkleRoot=function(t,e){if(!Array.isArray(t))throw TypeError("Expected values Array");if("function"!==typeof e)throw TypeError("Expected digest Function");let r=t.length;const i=t.concat();for(;r>1;){let t=0;for(let o=0;o{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.testnet=e.regtest=e.bitcoin=void 0,e.bitcoin={messagePrefix:"\x18Bitcoin Signed Message:\n",bech32:"bc",bip32:{public:76067358,private:76066276},pubKeyHash:0,scriptHash:5,wif:128},e.regtest={messagePrefix:"\x18Bitcoin Signed Message:\n",bech32:"bcrt",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239},e.testnet={messagePrefix:"\x18Bitcoin Signed Message:\n",bech32:"tb",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239}},8662:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.REVERSE_OPS=e.OPS=void 0;const r={OP_FALSE:0,OP_0:0,OP_PUSHDATA1:76,OP_PUSHDATA2:77,OP_PUSHDATA4:78,OP_1NEGATE:79,OP_RESERVED:80,OP_TRUE:81,OP_1:81,OP_2:82,OP_3:83,OP_4:84,OP_5:85,OP_6:86,OP_7:87,OP_8:88,OP_9:89,OP_10:90,OP_11:91,OP_12:92,OP_13:93,OP_14:94,OP_15:95,OP_16:96,OP_NOP:97,OP_VER:98,OP_IF:99,OP_NOTIF:100,OP_VERIF:101,OP_VERNOTIF:102,OP_ELSE:103,OP_ENDIF:104,OP_VERIFY:105,OP_RETURN:106,OP_TOALTSTACK:107,OP_FROMALTSTACK:108,OP_2DROP:109,OP_2DUP:110,OP_3DUP:111,OP_2OVER:112,OP_2ROT:113,OP_2SWAP:114,OP_IFDUP:115,OP_DEPTH:116,OP_DROP:117,OP_DUP:118,OP_NIP:119,OP_OVER:120,OP_PICK:121,OP_ROLL:122,OP_ROT:123,OP_SWAP:124,OP_TUCK:125,OP_CAT:126,OP_SUBSTR:127,OP_LEFT:128,OP_RIGHT:129,OP_SIZE:130,OP_INVERT:131,OP_AND:132,OP_OR:133,OP_XOR:134,OP_EQUAL:135,OP_EQUALVERIFY:136,OP_RESERVED1:137,OP_RESERVED2:138,OP_1ADD:139,OP_1SUB:140,OP_2MUL:141,OP_2DIV:142,OP_NEGATE:143,OP_ABS:144,OP_NOT:145,OP_0NOTEQUAL:146,OP_ADD:147,OP_SUB:148,OP_MUL:149,OP_DIV:150,OP_MOD:151,OP_LSHIFT:152,OP_RSHIFT:153,OP_BOOLAND:154,OP_BOOLOR:155,OP_NUMEQUAL:156,OP_NUMEQUALVERIFY:157,OP_NUMNOTEQUAL:158,OP_LESSTHAN:159,OP_GREATERTHAN:160,OP_LESSTHANOREQUAL:161,OP_GREATERTHANOREQUAL:162,OP_MIN:163,OP_MAX:164,OP_WITHIN:165,OP_RIPEMD160:166,OP_SHA1:167,OP_SHA256:168,OP_HASH160:169,OP_HASH256:170,OP_CODESEPARATOR:171,OP_CHECKSIG:172,OP_CHECKSIGVERIFY:173,OP_CHECKMULTISIG:174,OP_CHECKMULTISIGVERIFY:175,OP_NOP1:176,OP_NOP2:177,OP_CHECKLOCKTIMEVERIFY:177,OP_NOP3:178,OP_CHECKSEQUENCEVERIFY:178,OP_NOP4:179,OP_NOP5:180,OP_NOP6:181,OP_NOP7:182,OP_NOP8:183,OP_NOP9:184,OP_NOP10:185,OP_CHECKSIGADD:186,OP_PUBKEYHASH:253,OP_PUBKEY:254,OP_INVALIDOPCODE:255};e.OPS=r;const n={};e.REVERSE_OPS=n;for(const i of Object.keys(r)){n[r[i]]=i}},925:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.tweakKey=e.tapTweakHash=e.tapleafHash=e.findScriptPath=e.toHashTree=e.rootHashFromPath=e.MAX_TAPTREE_DEPTH=e.LEAF_VERSION_TAPSCRIPT=void 0;const n=r(6382),i=r(8883),o=r(3469),s=r(6333),a=r(3239);e.LEAF_VERSION_TAPSCRIPT=192,e.MAX_TAPTREE_DEPTH=128;function u(t){const r=t.version||e.LEAF_VERSION_TAPSCRIPT;return o.taggedHash("TapLeaf",n.Buffer.concat([n.Buffer.from([r]),l(t.output)]))}function h(t,e){return o.taggedHash("TapTweak",n.Buffer.concat(e?[t,e]:[t]))}function c(t,e){return o.taggedHash("TapBranch",n.Buffer.concat([t,e]))}function l(t){const e=s.varuint.encodingLength(t.length),r=n.Buffer.allocUnsafe(e);return s.varuint.encode(t.length,r),n.Buffer.concat([r,t])}e.rootHashFromPath=function(t,e){if(t.length<33)throw new TypeError("The control-block length is too small. Got ".concat(t.length,", expected min 33."));const r=(t.length-33)/32;let n=e;for(let i=0;it.hash.compare(e.hash)));const[n,i]=r;return{hash:c(n.hash,i.hash),left:n,right:i}},e.findScriptPath=function t(e,r){if("left"in(n=e)&&"right"in n){const n=t(e.left,r);if(void 0!==n)return[...n,e.right.hash];const i=t(e.right,r);if(void 0!==i)return[...i,e.left.hash]}else if(e.hash.equals(r))return[];var n},e.tapleafHash=u,e.tapTweakHash=h,e.tweakKey=function(t,e){if(!n.Buffer.isBuffer(t))return null;if(32!==t.length)return null;if(e&&32!==e.length)return null;const r=h(t,e),o=(0,i.getEccLib)().xOnlyPointAddTweak(t,r);return o&&null!==o.xOnlyPubkey?{parity:o.parity,x:n.Buffer.from(o.xOnlyPubkey)}:null}},5725:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.p2data=void 0;const n=r(583),i=r(3515),o=r(3239),s=r(9552),a=i.OPS;e.p2data=function(t,e){if(!t.data&&!t.output)throw new TypeError("Not enough data");e=Object.assign({validate:!0},e||{}),(0,o.typeforce)({network:o.typeforce.maybe(o.typeforce.Object),output:o.typeforce.maybe(o.typeforce.Buffer),data:o.typeforce.maybe(o.typeforce.arrayOf(o.typeforce.Buffer))},t);const r={name:"embed",network:t.network||n.bitcoin};if(s.prop(r,"output",(()=>{if(t.data)return i.compile([a.OP_RETURN].concat(t.data))})),s.prop(r,"data",(()=>{if(t.output)return i.decompile(t.output).slice(1)})),e.validate&&t.output){const e=i.decompile(t.output);if(e[0]!==a.OP_RETURN)throw new TypeError("Output is invalid");if(!e.slice(1).every(o.typeforce.Buffer))throw new TypeError("Output is invalid");if(t.data&&!function(t,e){return t.length===e.length&&t.every(((t,r)=>t.equals(e[r])))}(t.data,r.data))throw new TypeError("Data mismatch")}return Object.assign(r,t)}},2148:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.p2tr=e.p2wsh=e.p2wpkh=e.p2sh=e.p2pkh=e.p2pk=e.p2ms=e.embed=void 0;const n=r(5725);Object.defineProperty(e,"embed",{enumerable:!0,get:function(){return n.p2data}});const i=r(152);Object.defineProperty(e,"p2ms",{enumerable:!0,get:function(){return i.p2ms}});const o=r(1585);Object.defineProperty(e,"p2pk",{enumerable:!0,get:function(){return o.p2pk}});const s=r(8837);Object.defineProperty(e,"p2pkh",{enumerable:!0,get:function(){return s.p2pkh}});const a=r(375);Object.defineProperty(e,"p2sh",{enumerable:!0,get:function(){return a.p2sh}});const u=r(4436);Object.defineProperty(e,"p2wpkh",{enumerable:!0,get:function(){return u.p2wpkh}});const h=r(4956);Object.defineProperty(e,"p2wsh",{enumerable:!0,get:function(){return h.p2wsh}});const c=r(6254);Object.defineProperty(e,"p2tr",{enumerable:!0,get:function(){return c.p2tr}})},9552:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.value=e.prop=void 0,e.prop=function(t,e,r){Object.defineProperty(t,e,{configurable:!0,enumerable:!0,get(){const t=r.call(this);return this[e]=t,t},set(t){Object.defineProperty(this,e,{configurable:!0,enumerable:!0,value:t,writable:!0})}})},e.value=function(t){let e;return()=>(void 0!==e||(e=t()),e)}},152:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.p2ms=void 0;const n=r(583),i=r(3515),o=r(3239),s=r(9552),a=i.OPS,u=a.OP_RESERVED;function h(t,e){return t.length===e.length&&t.every(((t,r)=>t.equals(e[r])))}e.p2ms=function(t,e){if(!t.input&&!t.output&&(!t.pubkeys||void 0===t.m)&&!t.signatures)throw new TypeError("Not enough data");function r(t){return i.isCanonicalScriptSignature(t)||void 0!==(e.allowIncomplete&&t===a.OP_0)}e=Object.assign({validate:!0},e||{}),(0,o.typeforce)({network:o.typeforce.maybe(o.typeforce.Object),m:o.typeforce.maybe(o.typeforce.Number),n:o.typeforce.maybe(o.typeforce.Number),output:o.typeforce.maybe(o.typeforce.Buffer),pubkeys:o.typeforce.maybe(o.typeforce.arrayOf(o.isPoint)),signatures:o.typeforce.maybe(o.typeforce.arrayOf(r)),input:o.typeforce.maybe(o.typeforce.Buffer)},t);const c={network:t.network||n.bitcoin};let l=[],f=!1;function d(t){f||(f=!0,l=i.decompile(t),c.m=l[0]-u,c.n=l[l.length-2]-u,c.pubkeys=l.slice(1,-2))}if(s.prop(c,"output",(()=>{if(t.m&&c.n&&t.pubkeys)return i.compile([].concat(u+t.m,t.pubkeys,u+c.n,a.OP_CHECKMULTISIG))})),s.prop(c,"m",(()=>{if(c.output)return d(c.output),c.m})),s.prop(c,"n",(()=>{if(c.pubkeys)return c.pubkeys.length})),s.prop(c,"pubkeys",(()=>{if(t.output)return d(t.output),c.pubkeys})),s.prop(c,"signatures",(()=>{if(t.input)return i.decompile(t.input).slice(1)})),s.prop(c,"input",(()=>{if(t.signatures)return i.compile([a.OP_0].concat(t.signatures))})),s.prop(c,"witness",(()=>{if(c.input)return[]})),s.prop(c,"name",(()=>{if(c.m&&c.n)return"p2ms(".concat(c.m," of ").concat(c.n,")")})),e.validate){if(t.output){if(d(t.output),!o.typeforce.Number(l[0]))throw new TypeError("Output is invalid");if(!o.typeforce.Number(l[l.length-2]))throw new TypeError("Output is invalid");if(l[l.length-1]!==a.OP_CHECKMULTISIG)throw new TypeError("Output is invalid");if(c.m<=0||c.n>16||c.m>c.n||c.n!==l.length-3)throw new TypeError("Output is invalid");if(!c.pubkeys.every((t=>(0,o.isPoint)(t))))throw new TypeError("Output is invalid");if(void 0!==t.m&&t.m!==c.m)throw new TypeError("m mismatch");if(void 0!==t.n&&t.n!==c.n)throw new TypeError("n mismatch");if(t.pubkeys&&!h(t.pubkeys,c.pubkeys))throw new TypeError("Pubkeys mismatch")}if(t.pubkeys){if(void 0!==t.n&&t.n!==t.pubkeys.length)throw new TypeError("Pubkey count mismatch");if(c.n=t.pubkeys.length,c.nc.m)throw new TypeError("Too many signatures provided")}if(t.input){if(t.input[0]!==a.OP_0)throw new TypeError("Input is invalid");if(0===c.signatures.length||!c.signatures.every(r))throw new TypeError("Input has invalid signature(s)");if(t.signatures&&!h(t.signatures,c.signatures))throw new TypeError("Signature mismatch");if(void 0!==t.m&&t.m!==t.signatures.length)throw new TypeError("Signature count mismatch")}}return Object.assign(c,t)}},1585:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.p2pk=void 0;const n=r(583),i=r(3515),o=r(3239),s=r(9552),a=i.OPS;e.p2pk=function(t,e){if(!t.input&&!t.output&&!t.pubkey&&!t.input&&!t.signature)throw new TypeError("Not enough data");e=Object.assign({validate:!0},e||{}),(0,o.typeforce)({network:o.typeforce.maybe(o.typeforce.Object),output:o.typeforce.maybe(o.typeforce.Buffer),pubkey:o.typeforce.maybe(o.isPoint),signature:o.typeforce.maybe(i.isCanonicalScriptSignature),input:o.typeforce.maybe(o.typeforce.Buffer)},t);const r=s.value((()=>i.decompile(t.input))),u={name:"p2pk",network:t.network||n.bitcoin};if(s.prop(u,"output",(()=>{if(t.pubkey)return i.compile([t.pubkey,a.OP_CHECKSIG])})),s.prop(u,"pubkey",(()=>{if(t.output)return t.output.slice(1,-1)})),s.prop(u,"signature",(()=>{if(t.input)return r()[0]})),s.prop(u,"input",(()=>{if(t.signature)return i.compile([t.signature])})),s.prop(u,"witness",(()=>{if(u.input)return[]})),e.validate){if(t.output){if(t.output[t.output.length-1]!==a.OP_CHECKSIG)throw new TypeError("Output is invalid");if(!(0,o.isPoint)(u.pubkey))throw new TypeError("Output pubkey is invalid");if(t.pubkey&&!t.pubkey.equals(u.pubkey))throw new TypeError("Pubkey mismatch")}if(t.signature&&t.input&&!t.input.equals(u.input))throw new TypeError("Signature mismatch");if(t.input){if(1!==r().length)throw new TypeError("Input is invalid");if(!i.isCanonicalScriptSignature(u.signature))throw new TypeError("Input has invalid signature")}}return Object.assign(u,t)}},8837:(t,e,r)=>{"use strict";var n=r(6382).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.p2pkh=void 0;const i=r(3469),o=r(583),s=r(3515),a=r(3239),u=r(9552),h=r(3630),c=s.OPS;e.p2pkh=function(t,e){if(!t.address&&!t.hash&&!t.output&&!t.pubkey&&!t.input)throw new TypeError("Not enough data");e=Object.assign({validate:!0},e||{}),(0,a.typeforce)({network:a.typeforce.maybe(a.typeforce.Object),address:a.typeforce.maybe(a.typeforce.String),hash:a.typeforce.maybe(a.typeforce.BufferN(20)),output:a.typeforce.maybe(a.typeforce.BufferN(25)),pubkey:a.typeforce.maybe(a.isPoint),signature:a.typeforce.maybe(s.isCanonicalScriptSignature),input:a.typeforce.maybe(a.typeforce.Buffer)},t);const r=u.value((()=>{const e=n.from(h.decode(t.address));return{version:e.readUInt8(0),hash:e.slice(1)}})),l=u.value((()=>s.decompile(t.input))),f=t.network||o.bitcoin,d={name:"p2pkh",network:f};if(u.prop(d,"address",(()=>{if(!d.hash)return;const t=n.allocUnsafe(21);return t.writeUInt8(f.pubKeyHash,0),d.hash.copy(t,1),h.encode(t)})),u.prop(d,"hash",(()=>t.output?t.output.slice(3,23):t.address?r().hash:t.pubkey||d.pubkey?i.hash160(t.pubkey||d.pubkey):void 0)),u.prop(d,"output",(()=>{if(d.hash)return s.compile([c.OP_DUP,c.OP_HASH160,d.hash,c.OP_EQUALVERIFY,c.OP_CHECKSIG])})),u.prop(d,"pubkey",(()=>{if(t.input)return l()[1]})),u.prop(d,"signature",(()=>{if(t.input)return l()[0]})),u.prop(d,"input",(()=>{if(t.pubkey&&t.signature)return s.compile([t.signature,t.pubkey])})),u.prop(d,"witness",(()=>{if(d.input)return[]})),e.validate){let e=n.from([]);if(t.address){if(r().version!==f.pubKeyHash)throw new TypeError("Invalid version or Network mismatch");if(20!==r().hash.length)throw new TypeError("Invalid address");e=r().hash}if(t.hash){if(e.length>0&&!e.equals(t.hash))throw new TypeError("Hash mismatch");e=t.hash}if(t.output){if(25!==t.output.length||t.output[0]!==c.OP_DUP||t.output[1]!==c.OP_HASH160||20!==t.output[2]||t.output[23]!==c.OP_EQUALVERIFY||t.output[24]!==c.OP_CHECKSIG)throw new TypeError("Output is invalid");const r=t.output.slice(3,23);if(e.length>0&&!e.equals(r))throw new TypeError("Hash mismatch");e=r}if(t.pubkey){const r=i.hash160(t.pubkey);if(e.length>0&&!e.equals(r))throw new TypeError("Hash mismatch");e=r}if(t.input){const r=l();if(2!==r.length)throw new TypeError("Input is invalid");if(!s.isCanonicalScriptSignature(r[0]))throw new TypeError("Input has invalid signature");if(!(0,a.isPoint)(r[1]))throw new TypeError("Input has invalid pubkey");if(t.signature&&!t.signature.equals(r[0]))throw new TypeError("Signature mismatch");if(t.pubkey&&!t.pubkey.equals(r[1]))throw new TypeError("Pubkey mismatch");const n=i.hash160(r[1]);if(e.length>0&&!e.equals(n))throw new TypeError("Hash mismatch")}}return Object.assign(d,t)}},375:(t,e,r)=>{"use strict";var n=r(6382).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.p2sh=void 0;const i=r(3469),o=r(583),s=r(3515),a=r(3239),u=r(9552),h=r(3630),c=s.OPS;e.p2sh=function(t,e){if(!t.address&&!t.hash&&!t.output&&!t.redeem&&!t.input)throw new TypeError("Not enough data");e=Object.assign({validate:!0},e||{}),(0,a.typeforce)({network:a.typeforce.maybe(a.typeforce.Object),address:a.typeforce.maybe(a.typeforce.String),hash:a.typeforce.maybe(a.typeforce.BufferN(20)),output:a.typeforce.maybe(a.typeforce.BufferN(23)),redeem:a.typeforce.maybe({network:a.typeforce.maybe(a.typeforce.Object),output:a.typeforce.maybe(a.typeforce.Buffer),input:a.typeforce.maybe(a.typeforce.Buffer),witness:a.typeforce.maybe(a.typeforce.arrayOf(a.typeforce.Buffer))}),input:a.typeforce.maybe(a.typeforce.Buffer),witness:a.typeforce.maybe(a.typeforce.arrayOf(a.typeforce.Buffer))},t);let r=t.network;r||(r=t.redeem&&t.redeem.network||o.bitcoin);const l={network:r},f=u.value((()=>{const e=n.from(h.decode(t.address));return{version:e.readUInt8(0),hash:e.slice(1)}})),d=u.value((()=>s.decompile(t.input))),p=u.value((()=>{const e=d(),i=e[e.length-1];return{network:r,output:i===c.OP_FALSE?n.from([]):i,input:s.compile(e.slice(0,-1)),witness:t.witness||[]}}));if(u.prop(l,"address",(()=>{if(!l.hash)return;const t=n.allocUnsafe(21);return t.writeUInt8(l.network.scriptHash,0),l.hash.copy(t,1),h.encode(t)})),u.prop(l,"hash",(()=>t.output?t.output.slice(2,22):t.address?f().hash:l.redeem&&l.redeem.output?i.hash160(l.redeem.output):void 0)),u.prop(l,"output",(()=>{if(l.hash)return s.compile([c.OP_HASH160,l.hash,c.OP_EQUAL])})),u.prop(l,"redeem",(()=>{if(t.input)return p()})),u.prop(l,"input",(()=>{if(t.redeem&&t.redeem.input&&t.redeem.output)return s.compile([].concat(s.decompile(t.redeem.input),t.redeem.output))})),u.prop(l,"witness",(()=>l.redeem&&l.redeem.witness?l.redeem.witness:l.input?[]:void 0)),u.prop(l,"name",(()=>{const t=["p2sh"];return void 0!==l.redeem&&void 0!==l.redeem.name&&t.push(l.redeem.name),t.join("-")})),e.validate){let e=n.from([]);if(t.address){if(f().version!==r.scriptHash)throw new TypeError("Invalid version or Network mismatch");if(20!==f().hash.length)throw new TypeError("Invalid address");e=f().hash}if(t.hash){if(e.length>0&&!e.equals(t.hash))throw new TypeError("Hash mismatch");e=t.hash}if(t.output){if(23!==t.output.length||t.output[0]!==c.OP_HASH160||20!==t.output[1]||t.output[22]!==c.OP_EQUAL)throw new TypeError("Output is invalid");const r=t.output.slice(2,22);if(e.length>0&&!e.equals(r))throw new TypeError("Hash mismatch");e=r}const o=t=>{if(t.output){const r=s.decompile(t.output);if(!r||r.length<1)throw new TypeError("Redeem.output too short");if(t.output.byteLength>520)throw new TypeError("Redeem.output unspendable if larger than 520 bytes");if(s.countNonPushOnlyOPs(r)>201)throw new TypeError("Redeem.output unspendable with more than 201 non-push ops");const n=i.hash160(t.output);if(e.length>0&&!e.equals(n))throw new TypeError("Hash mismatch");e=n}if(t.input){const e=t.input.length>0,r=t.witness&&t.witness.length>0;if(!e&&!r)throw new TypeError("Empty input");if(e&&r)throw new TypeError("Input and witness provided");if(e){const e=s.decompile(t.input);if(!s.isPushOnly(e))throw new TypeError("Non push-only scriptSig")}}};if(t.input){const t=d();if(!t||t.length<1)throw new TypeError("Input too short");if(!n.isBuffer(p().output))throw new TypeError("Input is invalid");o(p())}if(t.redeem){if(t.redeem.network&&t.redeem.network!==r)throw new TypeError("Network mismatch");if(t.input){const e=p();if(t.redeem.output&&!t.redeem.output.equals(e.output))throw new TypeError("Redeem.output mismatch");if(t.redeem.input&&!t.redeem.input.equals(e.input))throw new TypeError("Redeem.input mismatch")}o(t.redeem)}if(t.witness&&t.redeem&&t.redeem.witness&&!function(t,e){return t.length===e.length&&t.every(((t,r)=>t.equals(e[r])))}(t.redeem.witness,t.witness))throw new TypeError("Witness and redeem.witness mismatch")}return Object.assign(l,t)}},6254:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.p2tr=void 0;const n=r(6382),i=r(583),o=r(3515),s=r(3239),a=r(8883),u=r(925),h=r(9552),c=r(6740),l=o.OPS;e.p2tr=function(t,e){if(!t.address&&!t.output&&!t.pubkey&&!t.internalPubkey&&!(t.witness&&t.witness.length>1))throw new TypeError("Not enough data");e=Object.assign({validate:!0},e||{}),(0,s.typeforce)({address:s.typeforce.maybe(s.typeforce.String),input:s.typeforce.maybe(s.typeforce.BufferN(0)),network:s.typeforce.maybe(s.typeforce.Object),output:s.typeforce.maybe(s.typeforce.BufferN(34)),internalPubkey:s.typeforce.maybe(s.typeforce.BufferN(32)),hash:s.typeforce.maybe(s.typeforce.BufferN(32)),pubkey:s.typeforce.maybe(s.typeforce.BufferN(32)),signature:s.typeforce.maybe(s.typeforce.anyOf(s.typeforce.BufferN(64),s.typeforce.BufferN(65))),witness:s.typeforce.maybe(s.typeforce.arrayOf(s.typeforce.Buffer)),scriptTree:s.typeforce.maybe(s.isTaptree),redeem:s.typeforce.maybe({output:s.typeforce.maybe(s.typeforce.Buffer),redeemVersion:s.typeforce.maybe(s.typeforce.Number),witness:s.typeforce.maybe(s.typeforce.arrayOf(s.typeforce.Buffer))}),redeemVersion:s.typeforce.maybe(s.typeforce.Number)},t);const r=h.value((()=>{const e=c.bech32m.decode(t.address),r=e.words.shift(),i=c.bech32m.fromWords(e.words);return{version:r,prefix:e.prefix,data:n.Buffer.from(i)}})),f=h.value((()=>{if(t.witness&&t.witness.length)return t.witness.length>=2&&80===t.witness[t.witness.length-1][0]?t.witness.slice(0,-1):t.witness.slice()})),d=h.value((()=>t.scriptTree?(0,u.toHashTree)(t.scriptTree):t.hash?{hash:t.hash}:void 0)),p=t.network||i.bitcoin,g={name:"p2tr",network:p};if(h.prop(g,"address",(()=>{if(!g.pubkey)return;const t=c.bech32m.toWords(g.pubkey);return t.unshift(1),c.bech32m.encode(p.bech32,t)})),h.prop(g,"hash",(()=>{const t=d();if(t)return t.hash;const e=f();if(e&&e.length>1){const t=e[e.length-1],r=t[0]&s.TAPLEAF_VERSION_MASK,n=e[e.length-2],i=(0,u.tapleafHash)({output:n,version:r});return(0,u.rootHashFromPath)(t,i)}return null})),h.prop(g,"output",(()=>{if(g.pubkey)return o.compile([l.OP_1,g.pubkey])})),h.prop(g,"redeemVersion",(()=>t.redeemVersion?t.redeemVersion:t.redeem&&void 0!==t.redeem.redeemVersion&&null!==t.redeem.redeemVersion?t.redeem.redeemVersion:u.LEAF_VERSION_TAPSCRIPT)),h.prop(g,"redeem",(()=>{const t=f();if(t&&!(t.length<2))return{output:t[t.length-2],witness:t.slice(0,-2),redeemVersion:t[t.length-1][0]&s.TAPLEAF_VERSION_MASK}})),h.prop(g,"pubkey",(()=>{if(t.pubkey)return t.pubkey;if(t.output)return t.output.slice(2);if(t.address)return r().data;if(g.internalPubkey){const t=(0,u.tweakKey)(g.internalPubkey,g.hash);if(t)return t.x}})),h.prop(g,"internalPubkey",(()=>{if(t.internalPubkey)return t.internalPubkey;const e=f();return e&&e.length>1?e[e.length-1].slice(1,33):void 0})),h.prop(g,"signature",(()=>{if(t.signature)return t.signature;const e=f();return e&&1===e.length?e[0]:void 0})),h.prop(g,"witness",(()=>{if(t.witness)return t.witness;const e=d();if(e&&t.redeem&&t.redeem.output&&t.internalPubkey){const r=(0,u.tapleafHash)({output:t.redeem.output,version:g.redeemVersion}),i=(0,u.findScriptPath)(e,r);if(!i)return;const o=(0,u.tweakKey)(t.internalPubkey,e.hash);if(!o)return;const s=n.Buffer.concat([n.Buffer.from([g.redeemVersion|o.parity]),t.internalPubkey].concat(i));return[t.redeem.output,s]}return t.signature?[t.signature]:void 0})),e.validate){let e=n.Buffer.from([]);if(t.address){if(p&&p.bech32!==r().prefix)throw new TypeError("Invalid prefix or Network mismatch");if(1!==r().version)throw new TypeError("Invalid address version");if(32!==r().data.length)throw new TypeError("Invalid address data");e=r().data}if(t.pubkey){if(e.length>0&&!e.equals(t.pubkey))throw new TypeError("Pubkey mismatch");e=t.pubkey}if(t.output){if(34!==t.output.length||t.output[0]!==l.OP_1||32!==t.output[1])throw new TypeError("Output is invalid");if(e.length>0&&!e.equals(t.output.slice(2)))throw new TypeError("Pubkey mismatch");e=t.output.slice(2)}if(t.internalPubkey){const r=(0,u.tweakKey)(t.internalPubkey,g.hash);if(e.length>0&&!e.equals(r.x))throw new TypeError("Pubkey mismatch");e=r.x}if(e&&e.length&&!(0,a.getEccLib)().isXOnlyPoint(e))throw new TypeError("Invalid pubkey for p2tr");const i=d();if(t.hash&&i&&!t.hash.equals(i.hash))throw new TypeError("Hash mismatch");if(t.redeem&&t.redeem.output&&i){const e=(0,u.tapleafHash)({output:t.redeem.output,version:g.redeemVersion});if(!(0,u.findScriptPath)(i,e))throw new TypeError("Redeem script not in tree")}const h=f();if(t.redeem&&g.redeem){if(t.redeem.redeemVersion&&t.redeem.redeemVersion!==g.redeem.redeemVersion)throw new TypeError("Redeem.redeemVersion and witness mismatch");if(t.redeem.output){if(0===o.decompile(t.redeem.output).length)throw new TypeError("Redeem.output is invalid");if(g.redeem.output&&!t.redeem.output.equals(g.redeem.output))throw new TypeError("Redeem.output and witness mismatch")}if(t.redeem.witness&&g.redeem.witness&&!function(t,e){return t.length===e.length&&t.every(((t,r)=>t.equals(e[r])))}(t.redeem.witness,g.redeem.witness))throw new TypeError("Redeem.witness and witness mismatch")}if(h&&h.length)if(1===h.length){if(t.signature&&!t.signature.equals(h[0]))throw new TypeError("Signature mismatch")}else{const r=h[h.length-1];if(r.length<33)throw new TypeError("The control-block length is too small. Got ".concat(r.length,", expected min 33."));if((r.length-33)%32!==0)throw new TypeError("The control-block length of ".concat(r.length," is incorrect!"));const n=(r.length-33)/32;if(n>128)throw new TypeError("The script path is too long. Got ".concat(n,", expected max 128."));const i=r.slice(1,33);if(t.internalPubkey&&!t.internalPubkey.equals(i))throw new TypeError("Internal pubkey mismatch");if(!(0,a.getEccLib)().isXOnlyPoint(i))throw new TypeError("Invalid internalPubkey for p2tr witness");const o=r[0]&s.TAPLEAF_VERSION_MASK,c=h[h.length-2],l=(0,u.tapleafHash)({output:c,version:o}),f=(0,u.rootHashFromPath)(r,l),d=(0,u.tweakKey)(i,f);if(!d)throw new TypeError("Invalid outputKey for p2tr witness");if(e.length&&!e.equals(d.x))throw new TypeError("Pubkey mismatch for p2tr witness");if(d.parity!==(1&r[0]))throw new Error("Incorrect parity")}}return Object.assign(g,t)}},4436:(t,e,r)=>{"use strict";var n=r(6382).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.p2wpkh=void 0;const i=r(3469),o=r(583),s=r(3515),a=r(3239),u=r(9552),h=r(6740),c=s.OPS,l=n.alloc(0);e.p2wpkh=function(t,e){if(!t.address&&!t.hash&&!t.output&&!t.pubkey&&!t.witness)throw new TypeError("Not enough data");e=Object.assign({validate:!0},e||{}),(0,a.typeforce)({address:a.typeforce.maybe(a.typeforce.String),hash:a.typeforce.maybe(a.typeforce.BufferN(20)),input:a.typeforce.maybe(a.typeforce.BufferN(0)),network:a.typeforce.maybe(a.typeforce.Object),output:a.typeforce.maybe(a.typeforce.BufferN(22)),pubkey:a.typeforce.maybe(a.isPoint),signature:a.typeforce.maybe(s.isCanonicalScriptSignature),witness:a.typeforce.maybe(a.typeforce.arrayOf(a.typeforce.Buffer))},t);const r=u.value((()=>{const e=h.bech32.decode(t.address),r=e.words.shift(),i=h.bech32.fromWords(e.words);return{version:r,prefix:e.prefix,data:n.from(i)}})),f=t.network||o.bitcoin,d={name:"p2wpkh",network:f};if(u.prop(d,"address",(()=>{if(!d.hash)return;const t=h.bech32.toWords(d.hash);return t.unshift(0),h.bech32.encode(f.bech32,t)})),u.prop(d,"hash",(()=>t.output?t.output.slice(2,22):t.address?r().data:t.pubkey||d.pubkey?i.hash160(t.pubkey||d.pubkey):void 0)),u.prop(d,"output",(()=>{if(d.hash)return s.compile([c.OP_0,d.hash])})),u.prop(d,"pubkey",(()=>t.pubkey?t.pubkey:t.witness?t.witness[1]:void 0)),u.prop(d,"signature",(()=>{if(t.witness)return t.witness[0]})),u.prop(d,"input",(()=>{if(d.witness)return l})),u.prop(d,"witness",(()=>{if(t.pubkey&&t.signature)return[t.signature,t.pubkey]})),e.validate){let e=n.from([]);if(t.address){if(f&&f.bech32!==r().prefix)throw new TypeError("Invalid prefix or Network mismatch");if(0!==r().version)throw new TypeError("Invalid address version");if(20!==r().data.length)throw new TypeError("Invalid address data");e=r().data}if(t.hash){if(e.length>0&&!e.equals(t.hash))throw new TypeError("Hash mismatch");e=t.hash}if(t.output){if(22!==t.output.length||t.output[0]!==c.OP_0||20!==t.output[1])throw new TypeError("Output is invalid");if(e.length>0&&!e.equals(t.output.slice(2)))throw new TypeError("Hash mismatch");e=t.output.slice(2)}if(t.pubkey){const r=i.hash160(t.pubkey);if(e.length>0&&!e.equals(r))throw new TypeError("Hash mismatch");if(e=r,!(0,a.isPoint)(t.pubkey)||33!==t.pubkey.length)throw new TypeError("Invalid pubkey for p2wpkh")}if(t.witness){if(2!==t.witness.length)throw new TypeError("Witness is invalid");if(!s.isCanonicalScriptSignature(t.witness[0]))throw new TypeError("Witness has invalid signature");if(!(0,a.isPoint)(t.witness[1])||33!==t.witness[1].length)throw new TypeError("Witness has invalid pubkey");if(t.signature&&!t.signature.equals(t.witness[0]))throw new TypeError("Signature mismatch");if(t.pubkey&&!t.pubkey.equals(t.witness[1]))throw new TypeError("Pubkey mismatch");const r=i.hash160(t.witness[1]);if(e.length>0&&!e.equals(r))throw new TypeError("Hash mismatch")}}return Object.assign(d,t)}},4956:(t,e,r)=>{"use strict";var n=r(6382).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.p2wsh=void 0;const i=r(3469),o=r(583),s=r(3515),a=r(3239),u=r(9552),h=r(6740),c=s.OPS,l=n.alloc(0);function f(t){return!(!n.isBuffer(t)||65!==t.length||4!==t[0]||!(0,a.isPoint)(t))}e.p2wsh=function(t,e){if(!t.address&&!t.hash&&!t.output&&!t.redeem&&!t.witness)throw new TypeError("Not enough data");e=Object.assign({validate:!0},e||{}),(0,a.typeforce)({network:a.typeforce.maybe(a.typeforce.Object),address:a.typeforce.maybe(a.typeforce.String),hash:a.typeforce.maybe(a.typeforce.BufferN(32)),output:a.typeforce.maybe(a.typeforce.BufferN(34)),redeem:a.typeforce.maybe({input:a.typeforce.maybe(a.typeforce.Buffer),network:a.typeforce.maybe(a.typeforce.Object),output:a.typeforce.maybe(a.typeforce.Buffer),witness:a.typeforce.maybe(a.typeforce.arrayOf(a.typeforce.Buffer))}),input:a.typeforce.maybe(a.typeforce.BufferN(0)),witness:a.typeforce.maybe(a.typeforce.arrayOf(a.typeforce.Buffer))},t);const r=u.value((()=>{const e=h.bech32.decode(t.address),r=e.words.shift(),i=h.bech32.fromWords(e.words);return{version:r,prefix:e.prefix,data:n.from(i)}})),d=u.value((()=>s.decompile(t.redeem.input)));let p=t.network;p||(p=t.redeem&&t.redeem.network||o.bitcoin);const g={network:p};if(u.prop(g,"address",(()=>{if(!g.hash)return;const t=h.bech32.toWords(g.hash);return t.unshift(0),h.bech32.encode(p.bech32,t)})),u.prop(g,"hash",(()=>t.output?t.output.slice(2):t.address?r().data:g.redeem&&g.redeem.output?i.sha256(g.redeem.output):void 0)),u.prop(g,"output",(()=>{if(g.hash)return s.compile([c.OP_0,g.hash])})),u.prop(g,"redeem",(()=>{if(t.witness)return{output:t.witness[t.witness.length-1],input:l,witness:t.witness.slice(0,-1)}})),u.prop(g,"input",(()=>{if(g.witness)return l})),u.prop(g,"witness",(()=>{if(t.redeem&&t.redeem.input&&t.redeem.input.length>0&&t.redeem.output&&t.redeem.output.length>0){const e=s.toStack(d());return g.redeem=Object.assign({witness:e},t.redeem),g.redeem.input=l,[].concat(e,t.redeem.output)}if(t.redeem&&t.redeem.output&&t.redeem.witness)return[].concat(t.redeem.witness,t.redeem.output)})),u.prop(g,"name",(()=>{const t=["p2wsh"];return void 0!==g.redeem&&void 0!==g.redeem.name&&t.push(g.redeem.name),t.join("-")})),e.validate){let e=n.from([]);if(t.address){if(r().prefix!==p.bech32)throw new TypeError("Invalid prefix or Network mismatch");if(0!==r().version)throw new TypeError("Invalid address version");if(32!==r().data.length)throw new TypeError("Invalid address data");e=r().data}if(t.hash){if(e.length>0&&!e.equals(t.hash))throw new TypeError("Hash mismatch");e=t.hash}if(t.output){if(34!==t.output.length||t.output[0]!==c.OP_0||32!==t.output[1])throw new TypeError("Output is invalid");const r=t.output.slice(2);if(e.length>0&&!e.equals(r))throw new TypeError("Hash mismatch");e=r}if(t.redeem){if(t.redeem.network&&t.redeem.network!==p)throw new TypeError("Network mismatch");if(t.redeem.input&&t.redeem.input.length>0&&t.redeem.witness&&t.redeem.witness.length>0)throw new TypeError("Ambiguous witness source");if(t.redeem.output){const r=s.decompile(t.redeem.output);if(!r||r.length<1)throw new TypeError("Redeem.output is invalid");if(t.redeem.output.byteLength>3600)throw new TypeError("Redeem.output unspendable if larger than 3600 bytes");if(s.countNonPushOnlyOPs(r)>201)throw new TypeError("Redeem.output unspendable with more than 201 non-push ops");const n=i.sha256(t.redeem.output);if(e.length>0&&!e.equals(n))throw new TypeError("Hash mismatch");e=n}if(t.redeem.input&&!s.isPushOnly(d()))throw new TypeError("Non push-only scriptSig");if(t.witness&&t.redeem.witness&&!function(t,e){return t.length===e.length&&t.every(((t,r)=>t.equals(e[r])))}(t.witness,t.redeem.witness))throw new TypeError("Witness and redeem.witness mismatch");if(t.redeem.input&&d().some(f)||t.redeem.output&&(s.decompile(t.redeem.output)||[]).some(f))throw new TypeError("redeem.input or redeem.output contains uncompressed pubkey")}if(t.witness&&t.witness.length>0){const e=t.witness[t.witness.length-1];if(t.redeem&&t.redeem.output&&!t.redeem.output.equals(e))throw new TypeError("Witness and redeem.output mismatch");if(t.witness.some(f)||(s.decompile(e)||[]).some(f))throw new TypeError("Witness contains uncompressed pubkey")}}return Object.assign(g,t)}},3183:(t,e,r)=>{"use strict";var n=r(6382).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.Psbt=void 0;const i=r(1697),o=r(5409),s=r(6613),a=r(9234),u=r(6333),h=r(583),c=r(2148),l=r(925),f=r(3515),d=r(4222),p=r(8558),g=r(636),m={network:h.bitcoin,maximumFeeRate:5e3};class y{static fromBase64(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=n.from(t,"base64");return this.fromBuffer(r,e)}static fromHex(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=n.from(t,"hex");return this.fromBuffer(r,e)}static fromBuffer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=i.Psbt.fromBuffer(t,w),n=new y(e,r);var o,s;return o=n.__CACHE.__TX,s=n.__CACHE,o.ins.forEach((t=>{C(s,t)})),n}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new i.Psbt(new v);this.data=e,this.opts=Object.assign({},m,t),this.__CACHE={__NON_WITNESS_UTXO_TX_CACHE:[],__NON_WITNESS_UTXO_BUF_CACHE:[],__TX_IN_CACHE:{},__TX:this.data.globalMap.unsignedTx.tx,__UNSAFE_SIGN_NONSEGWIT:!1},0===this.data.inputs.length&&this.setVersion(2);const r=(t,e,r,n)=>Object.defineProperty(t,e,{enumerable:r,writable:n});r(this,"__CACHE",!1,!0),r(this,"opts",!1,!0)}get inputCount(){return this.data.inputs.length}get version(){return this.__CACHE.__TX.version}set version(t){this.setVersion(t)}get locktime(){return this.__CACHE.__TX.locktime}set locktime(t){this.setLocktime(t)}get txInputs(){return this.__CACHE.__TX.ins.map((t=>({hash:(0,u.cloneBuffer)(t.hash),index:t.index,sequence:t.sequence})))}get txOutputs(){return this.__CACHE.__TX.outs.map((t=>{let e;try{e=(0,a.fromOutputScript)(t.script,this.opts.network)}catch(r){}return{script:(0,u.cloneBuffer)(t.script),value:t.value,address:e}}))}combine(){for(var t=arguments.length,e=new Array(t),r=0;rt.data))),this}clone(){const t=y.fromBuffer(this.data.toBuffer());return t.opts=JSON.parse(JSON.stringify(this.opts)),t}setMaximumFeeRate(t){M(t),this.opts.maximumFeeRate=t}setVersion(t){M(t),A(this.data.inputs,"setVersion");const e=this.__CACHE;return e.__TX.version=t,e.__EXTRACTED_TX=void 0,this}setLocktime(t){M(t),A(this.data.inputs,"setLocktime");const e=this.__CACHE;return e.__TX.locktime=t,e.__EXTRACTED_TX=void 0,this}setInputSequence(t,e){M(e),A(this.data.inputs,"setInputSequence");const r=this.__CACHE;if(r.__TX.ins.length<=t)throw new Error("Input index too high");return r.__TX.ins[t].sequence=e,r.__EXTRACTED_TX=void 0,this}addInputs(t){return t.forEach((t=>this.addInput(t))),this}addInput(t){if(arguments.length>1||!t||void 0===t.hash||void 0===t.index)throw new Error("Invalid arguments for Psbt.addInput. Requires single object with at least [hash] and [index]");(0,p.checkTaprootInputFields)(t,t,"addInput"),A(this.data.inputs,"addInput"),t.witnessScript&&X(t.witnessScript);const e=this.__CACHE;this.data.addInput(t);C(e,e.__TX.ins[e.__TX.ins.length-1]);const r=this.data.inputs.length-1,n=this.data.inputs[r];return n.nonWitnessUtxo&&H(this.__CACHE,n,r),e.__FEE=void 0,e.__FEE_RATE=void 0,e.__EXTRACTED_TX=void 0,this}addOutputs(t){return t.forEach((t=>this.addOutput(t))),this}addOutput(t){if(arguments.length>1||!t||void 0===t.value||void 0===t.address&&void 0===t.script)throw new Error("Invalid arguments for Psbt.addOutput. Requires single object with at least [script or address] and [value]");A(this.data.inputs,"addOutput");const{address:e}=t;if("string"===typeof e){const{network:r}=this.opts,n=(0,a.toOutputScript)(e,r);t=Object.assign(t,{script:n})}(0,p.checkTaprootOutputFields)(t,t,"addOutput");const r=this.__CACHE;return this.data.addOutput(t),r.__FEE=void 0,r.__FEE_RATE=void 0,r.__EXTRACTED_TX=void 0,this}extractTransaction(t){if(!this.data.inputs.every(E))throw new Error("Not finalized");const e=this.__CACHE;if(t||function(t,e,r){const n=e.__FEE_RATE||t.getFeeRate(),i=e.__EXTRACTED_TX.virtualSize(),o=n*i;if(n>=r.maximumFeeRate)throw new Error("Warning: You are paying around ".concat((o/1e8).toFixed(8)," in ")+"fees, which is ".concat(n," satoshi per byte for a transaction ")+"with a VSize of ".concat(i," bytes (segwit counted as 0.25 byte per ")+"byte). Use setMaximumFeeRate method to raise your threshold, or pass true to the first arg of extractTransaction.")}(this,e,this.opts),e.__EXTRACTED_TX)return e.__EXTRACTED_TX;const r=e.__TX.clone();return z(this.data.inputs,r,e,!0),r}getFeeRate(){return O("__FEE_RATE","fee rate",this.data.inputs,this.__CACHE)}getFee(){return O("__FEE","fee",this.data.inputs,this.__CACHE)}finalizeAllInputs(){return(0,s.checkForInput)(this.data.inputs,0),Y(this.data.inputs.length).forEach((t=>this.finalizeInput(t))),this}finalizeInput(t,e){const r=(0,s.checkForInput)(this.data.inputs,t);return(0,p.isTaprootInput)(r)?this._finalizeTaprootInput(t,r,void 0,e):this._finalizeInput(t,r,e)}finalizeTaprootInput(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:p.tapScriptFinalizer;const n=(0,s.checkForInput)(this.data.inputs,t);if((0,p.isTaprootInput)(n))return this._finalizeTaprootInput(t,n,e,r);throw new Error("Cannot finalize input #".concat(t,". Not Taproot."))}_finalizeInput(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:N;const{script:n,isP2SH:i,isP2WSH:o,isSegwit:s}=function(t,e,r){const n=r.__TX,i={script:null,isSegwit:!1,isP2SH:!1,isP2WSH:!1};if(i.isP2SH=!!e.redeemScript,i.isP2WSH=!!e.witnessScript,e.witnessScript)i.script=e.witnessScript;else if(e.redeemScript)i.script=e.redeemScript;else if(e.nonWitnessUtxo){const o=V(r,e,t),s=n.ins[t].index;i.script=o.outs[s].script}else e.witnessUtxo&&(i.script=e.witnessUtxo.script);(e.witnessScript||(0,g.isP2WPKH)(i.script))&&(i.isSegwit=!0);return i}(t,e,this.__CACHE);if(!n)throw new Error("No script found for input #".concat(t));!function(t){if(!t.sighashType||!t.partialSig)return;const{partialSig:e,sighashType:r}=t;e.forEach((t=>{const{hashType:e}=f.signature.decode(t.signature);if(r!==e)throw new Error("Signature sighash does not match input sighash type")}))}(e);const{finalScriptSig:a,finalScriptWitness:u}=r(t,e,n,s,i,o);if(a&&this.data.updateInput(t,{finalScriptSig:a}),u&&this.data.updateInput(t,{finalScriptWitness:u}),!a&&!u)throw new Error("Unknown error finalizing input #".concat(t));return this.data.clearFinalizedInput(t),this}_finalizeTaprootInput(t,e,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:p.tapScriptFinalizer;if(!e.witnessUtxo)throw new Error("Cannot finalize input #".concat(t,". Missing withness utxo."));if(e.tapKeySig){const r=c.p2tr({output:e.witnessUtxo.script,signature:e.tapKeySig}),n=(0,g.witnessStackToScriptWitness)(r.witness);this.data.updateInput(t,{finalScriptWitness:n})}else{const{finalScriptWitness:i}=n(t,e,r);this.data.updateInput(t,{finalScriptWitness:i})}return this.data.clearFinalizedInput(t),this}getInputType(t){const e=(0,s.checkForInput)(this.data.inputs,t),r=G(q(t,e,this.__CACHE),t,"input",e.redeemScript||function(t){if(!t)return;const e=f.decompile(t);if(!e)return;const r=e[e.length-1];if(!n.isBuffer(r)||K(r)||(i=r,f.isCanonicalScriptSignature(i)))return;var i;if(!f.decompile(r))return;return r}(e.finalScriptSig),e.witnessScript||function(t){if(!t)return;const e=F(t),r=e[e.length-1];if(K(r))return;if(!f.decompile(r))return;return r}(e.finalScriptWitness));return("raw"===r.type?"":r.type+"-")+Z(r.meaningfulScript)}inputHasPubkey(t,e){return function(t,e,r,n){const i=q(r,e,n),{meaningfulScript:o}=G(i,r,"input",e.redeemScript,e.witnessScript);return(0,g.pubkeyInScript)(t,o)}(e,(0,s.checkForInput)(this.data.inputs,t),t,this.__CACHE)}inputHasHDKey(t,e){const r=(0,s.checkForInput)(this.data.inputs,t),n=S(e);return!!r.bip32Derivation&&r.bip32Derivation.some(n)}outputHasPubkey(t,e){return function(t,e,r,n){const i=n.__TX.outs[r].script,{meaningfulScript:o}=G(i,r,"output",e.redeemScript,e.witnessScript);return(0,g.pubkeyInScript)(t,o)}(e,(0,s.checkForOutput)(this.data.outputs,t),t,this.__CACHE)}outputHasHDKey(t,e){const r=(0,s.checkForOutput)(this.data.outputs,t),n=S(e);return!!r.bip32Derivation&&r.bip32Derivation.some(n)}validateSignaturesOfAllInputs(t){(0,s.checkForInput)(this.data.inputs,0);return Y(this.data.inputs.length).map((e=>this.validateSignaturesOfInput(e,t))).reduce(((t,e)=>!0===e&&t),!0)}validateSignaturesOfInput(t,e,r){const n=this.data.inputs[t];return(0,p.isTaprootInput)(n)?this.validateSignaturesOfTaprootInput(t,e,r):this._validateSignaturesOfInput(t,e,r)}_validateSignaturesOfInput(t,e,r){const n=this.data.inputs[t],i=(n||{}).partialSig;if(!n||!i||i.length<1)throw new Error("No signatures to validate");if("function"!==typeof e)throw new Error("Need validator function to validate signatures");const o=r?i.filter((t=>t.pubkey.equals(r))):i;if(o.length<1)throw new Error("No signatures for this pubkey");const s=[];let a,u,h;for(const c of o){const r=f.signature.decode(c.signature),{hash:i,script:o}=h!==r.hashType?R(t,Object.assign({},n,{sighashType:r.hashType}),this.__CACHE,!0):{hash:a,script:u};h=r.hashType,a=i,u=o,I(c.pubkey,o,"verify"),s.push(e(c.pubkey,i,r.signature))}return s.every((t=>!0===t))}validateSignaturesOfTaprootInput(t,e,r){const n=this.data.inputs[t],i=(n||{}).tapKeySig,o=(n||{}).tapScriptSig;if(!n&&!i&&(!o||o.length))throw new Error("No signatures to validate");if("function"!==typeof e)throw new Error("Need validator function to validate signatures");const s=(r=r&&(0,p.toXOnly)(r))?D(t,n,this.data.inputs,r,this.__CACHE):function(t,e,r,n){const i=[];if(e.tapInternalKey){const r=P(t,e,n);r&&i.push(r)}if(e.tapScriptSig){const t=e.tapScriptSig.map((t=>t.pubkey));i.push(...t)}const o=i.map((i=>D(t,e,r,i,n)));return o.flat()}(t,n,this.data.inputs,this.__CACHE);if(!s.length)throw new Error("No signatures for this pubkey");const a=s.find((t=>!t.leafHash));let u=0;if(i&&a){if(!e(a.pubkey,a.hash,L(i)))return!1;u++}if(o)for(const h of o){const t=s.find((t=>h.pubkey.equals(t.pubkey)));if(t){if(!e(h.pubkey,t.hash,L(h.signature)))return!1;u++}}return u>0}signAllInputsHD(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[d.Transaction.SIGHASH_ALL];if(!t||!t.publicKey||!t.fingerprint)throw new Error("Need HDSigner to sign input");const r=[];for(const i of Y(this.data.inputs.length))try{this.signInputHD(i,t,e),r.push(!0)}catch(n){r.push(!1)}if(r.every((t=>!1===t)))throw new Error("No inputs were signed");return this}signAllInputsHDAsync(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[d.Transaction.SIGHASH_ALL];return new Promise(((r,n)=>{if(!t||!t.publicKey||!t.fingerprint)return n(new Error("Need HDSigner to sign input"));const i=[],o=[];for(const s of Y(this.data.inputs.length))o.push(this.signInputHDAsync(s,t,e).then((()=>{i.push(!0)}),(()=>{i.push(!1)})));return Promise.all(o).then((()=>{if(i.every((t=>!1===t)))return n(new Error("No inputs were signed"));r()}))}))}signInputHD(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[d.Transaction.SIGHASH_ALL];if(!e||!e.publicKey||!e.fingerprint)throw new Error("Need HDSigner to sign input");return j(t,this.data.inputs,e).forEach((e=>this.signInput(t,e,r))),this}signInputHDAsync(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[d.Transaction.SIGHASH_ALL];return new Promise(((n,i)=>{if(!e||!e.publicKey||!e.fingerprint)return i(new Error("Need HDSigner to sign input"));const o=j(t,this.data.inputs,e).map((e=>this.signInputAsync(t,e,r)));return Promise.all(o).then((()=>{n()})).catch(i)}))}signAllInputs(t,e){if(!t||!t.publicKey)throw new Error("Need Signer to sign input");const r=[];for(const i of Y(this.data.inputs.length))try{this.signInput(i,t,e),r.push(!0)}catch(n){r.push(!1)}if(r.every((t=>!1===t)))throw new Error("No inputs were signed");return this}signAllInputsAsync(t,e){return new Promise(((r,n)=>{if(!t||!t.publicKey)return n(new Error("Need Signer to sign input"));const i=[],o=[];for(const[s]of this.data.inputs.entries())o.push(this.signInputAsync(s,t,e).then((()=>{i.push(!0)}),(()=>{i.push(!1)})));return Promise.all(o).then((()=>{if(i.every((t=>!1===t)))return n(new Error("No inputs were signed"));r()}))}))}signInput(t,e,r){if(!e||!e.publicKey)throw new Error("Need Signer to sign input");const n=(0,s.checkForInput)(this.data.inputs,t);return(0,p.isTaprootInput)(n)?this._signTaprootInput(t,n,e,void 0,r):this._signInput(t,e,r)}signTaprootInput(t,e,r,n){if(!e||!e.publicKey)throw new Error("Need Signer to sign input");const i=(0,s.checkForInput)(this.data.inputs,t);if((0,p.isTaprootInput)(i))return this._signTaprootInput(t,i,e,r,n);throw new Error("Input #".concat(t," is not of type Taproot."))}_signInput(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[d.Transaction.SIGHASH_ALL];const{hash:n,sighashType:i}=B(this.data.inputs,t,e.publicKey,this.__CACHE,r),o=[{pubkey:e.publicKey,signature:f.signature.encode(e.sign(n),i)}];return this.data.updateInput(t,{partialSig:o}),this}_signTaprootInput(t,e,r,n){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[d.Transaction.SIGHASH_DEFAULT];const o=this.checkTaprootHashesForSig(t,e,r,n,i),s=o.filter((t=>!t.leafHash)).map((t=>(0,p.serializeTaprootSignature)(r.signSchnorr(t.hash),e.sighashType)))[0],a=o.filter((t=>!!t.leafHash)).map((t=>({pubkey:(0,p.toXOnly)(r.publicKey),signature:(0,p.serializeTaprootSignature)(r.signSchnorr(t.hash),e.sighashType),leafHash:t.leafHash})));return s&&this.data.updateInput(t,{tapKeySig:s}),a.length&&this.data.updateInput(t,{tapScriptSig:a}),this}signInputAsync(t,e,r){return Promise.resolve().then((()=>{if(!e||!e.publicKey)throw new Error("Need Signer to sign input");const n=(0,s.checkForInput)(this.data.inputs,t);return(0,p.isTaprootInput)(n)?this._signTaprootInputAsync(t,n,e,void 0,r):this._signInputAsync(t,e,r)}))}signTaprootInputAsync(t,e,r,n){return Promise.resolve().then((()=>{if(!e||!e.publicKey)throw new Error("Need Signer to sign input");const i=(0,s.checkForInput)(this.data.inputs,t);if((0,p.isTaprootInput)(i))return this._signTaprootInputAsync(t,i,e,r,n);throw new Error("Input #".concat(t," is not of type Taproot."))}))}_signInputAsync(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[d.Transaction.SIGHASH_ALL];const{hash:n,sighashType:i}=B(this.data.inputs,t,e.publicKey,this.__CACHE,r);return Promise.resolve(e.sign(n)).then((r=>{const n=[{pubkey:e.publicKey,signature:f.signature.encode(r,i)}];this.data.updateInput(t,{partialSig:n})}))}async _signTaprootInputAsync(t,e,r,n){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[d.Transaction.SIGHASH_DEFAULT];const o=this.checkTaprootHashesForSig(t,e,r,n,i),s=[],a=o.filter((t=>!t.leafHash))[0];if(a){const t=Promise.resolve(r.signSchnorr(a.hash)).then((t=>({tapKeySig:(0,p.serializeTaprootSignature)(t,e.sighashType)})));s.push(t)}const u=o.filter((t=>!!t.leafHash));if(u.length){const t=u.map((t=>Promise.resolve(r.signSchnorr(t.hash)).then((n=>({tapScriptSig:[{pubkey:(0,p.toXOnly)(r.publicKey),signature:(0,p.serializeTaprootSignature)(n,e.sighashType),leafHash:t.leafHash}]})))));s.push(...t)}return Promise.all(s).then((e=>{e.forEach((e=>this.data.updateInput(t,e)))}))}checkTaprootHashesForSig(t,e,r,n,i){if("function"!==typeof r.signSchnorr)throw new Error("Need Schnorr Signer to sign taproot input #".concat(t,"."));const o=D(t,e,this.data.inputs,r.publicKey,this.__CACHE,n,i);if(!o||!o.length)throw new Error("Can not sign for input #".concat(t," with the key ").concat(r.publicKey.toString("hex")));return o}toBuffer(){return b(this.__CACHE),this.data.toBuffer()}toHex(){return b(this.__CACHE),this.data.toHex()}toBase64(){return b(this.__CACHE),this.data.toBase64()}updateGlobal(t){return this.data.updateGlobal(t),this}updateInput(t,e){return e.witnessScript&&X(e.witnessScript),(0,p.checkTaprootInputFields)(this.data.inputs[t],e,"updateInput"),this.data.updateInput(t,e),e.nonWitnessUtxo&&H(this.__CACHE,this.data.inputs[t],t),this}updateOutput(t,e){const r=this.data.outputs[t];return(0,p.checkTaprootOutputFields)(r,e,"updateOutput"),this.data.updateOutput(t,e),this}addUnknownKeyValToGlobal(t){return this.data.addUnknownKeyValToGlobal(t),this}addUnknownKeyValToInput(t,e){return this.data.addUnknownKeyValToInput(t,e),this}addUnknownKeyValToOutput(t,e){return this.data.addUnknownKeyValToOutput(t,e),this}clearFinalizedInput(t){return this.data.clearFinalizedInput(t),this}}e.Psbt=y;const w=t=>new v(t);class v{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:n.from([2,0,0,0,0,0,0,0,0,0]);this.tx=d.Transaction.fromBuffer(t),function(t){if(!t.ins.every((t=>t.script&&0===t.script.length&&t.witness&&0===t.witness.length)))throw new Error("Format Error: Transaction ScriptSigs are not empty")}(this.tx),Object.defineProperty(this,"tx",{enumerable:!1,writable:!0})}getInputOutputCounts(){return{inputCount:this.tx.ins.length,outputCount:this.tx.outs.length}}addInput(t){if(void 0===t.hash||void 0===t.index||!n.isBuffer(t.hash)&&"string"!==typeof t.hash||"number"!==typeof t.index)throw new Error("Error adding input.");const e="string"===typeof t.hash?(0,u.reverseBuffer)(n.from(t.hash,"hex")):t.hash;this.tx.addInput(e,t.index,t.sequence)}addOutput(t){if(void 0===t.script||void 0===t.value||!n.isBuffer(t.script)||"number"!==typeof t.value)throw new Error("Error adding output.");this.tx.addOutput(t.script,t.value)}toBuffer(){return this.tx.toBuffer()}}function b(t){if(!1!==t.__UNSAFE_SIGN_NONSEGWIT)throw new Error("Not BIP174 compliant, can not export")}function _(t,e,r){if(!e)return!1;let n;if(n=r?r.map((t=>{const r=function(t){if(65===t.length){const e=1&t[64],r=t.slice(0,33);return r[0]=2|e,r}return t.slice()}(t);return e.find((t=>t.pubkey.equals(r)))})).filter((t=>!!t)):e,n.length>t)throw new Error("Too many signatures");return n.length===t}function E(t){return!!t.finalScriptSig||!!t.finalScriptWitness}function S(t){return e=>!!e.masterFingerprint.equals(t.fingerprint)&&!!t.derivePath(e.path).publicKey.equals(e.pubkey)}function M(t){if("number"!==typeof t||t!==Math.floor(t)||t>4294967295||t<0)throw new Error("Invalid 32 bit integer")}function A(t,e){t.forEach((t=>{if((0,p.isTaprootInput)(t)?(0,p.checkTaprootInputForSigs)(t,e):(0,g.checkInputForSig)(t,e))throw new Error("Can not modify transaction, signatures exist.")}))}function I(t,e,r){if(!(0,g.pubkeyInScript)(t,e))throw new Error("Can not ".concat(r," for this input with the key ").concat(t.toString("hex")))}function C(t,e){const r=(0,u.reverseBuffer)(n.from(e.hash)).toString("hex")+":"+e.index;if(t.__TX_IN_CACHE[r])throw new Error("Duplicate input detected.");t.__TX_IN_CACHE[r]=1}function k(t,e){return(r,n,i,o)=>{const s=t({redeem:{output:i}}).output;if(!n.equals(s))throw new Error("".concat(e," for ").concat(o," #").concat(r," doesn't match the scriptPubKey in the prevout"))}}const x=k(c.p2sh,"Redeem script"),T=k(c.p2wsh,"Witness script");function O(t,e,r,n){if(!r.every(E))throw new Error("PSBT must be finalized to calculate ".concat(e));if("__FEE_RATE"===t&&n.__FEE_RATE)return n.__FEE_RATE;if("__FEE"===t&&n.__FEE)return n.__FEE;let i,o=!0;return n.__EXTRACTED_TX?(i=n.__EXTRACTED_TX,o=!1):i=n.__TX.clone(),z(r,i,n,o),"__FEE_RATE"===t?n.__FEE_RATE:"__FEE"===t?n.__FEE:void 0}function N(t,e,r,n,i,o){const s=Z(r);if(!function(t,e,r){switch(r){case"pubkey":case"pubkeyhash":case"witnesspubkeyhash":return _(1,t.partialSig);case"multisig":const r=c.p2ms({output:e});return _(r.m,t.partialSig,r.pubkeys);default:return!1}}(e,r,s))throw new Error("Can not finalize input #".concat(t));return function(t,e,r,n,i,o){let s,a;const u=function(t,e,r){let n;switch(e){case"multisig":const e=function(t,e){const r=c.p2ms({output:t});return r.pubkeys.map((t=>(e.filter((e=>e.pubkey.equals(t)))[0]||{}).signature)).filter((t=>!!t))}(t,r);n=c.p2ms({output:t,signatures:e});break;case"pubkey":n=c.p2pk({output:t,signature:r[0].signature});break;case"pubkeyhash":n=c.p2pkh({output:t,pubkey:r[0].pubkey,signature:r[0].signature});break;case"witnesspubkeyhash":n=c.p2wpkh({output:t,pubkey:r[0].pubkey,signature:r[0].signature})}return n}(t,e,r),h=o?c.p2wsh({redeem:u}):null,l=i?c.p2sh({redeem:h||u}):null;n?(a=h?(0,g.witnessStackToScriptWitness)(h.witness):(0,g.witnessStackToScriptWitness)(u.witness),l&&(s=l.input)):s=l?l.input:u.input;return{finalScriptSig:s,finalScriptWitness:a}}(r,s,e.partialSig,n,i,o)}function B(t,e,r,n,i){const o=(0,s.checkForInput)(t,e),{hash:a,sighashType:u,script:h}=R(e,o,n,!1,i);return I(r,h,"sign"),{hash:a,sighashType:u}}function R(t,e,r,n,i){const o=r.__TX,s=e.sighashType||d.Transaction.SIGHASH_ALL;let a,u;if(U(s,i),e.nonWitnessUtxo){const n=V(r,e,t),i=o.ins[t].hash,s=n.getHash();if(!i.equals(s))throw new Error("Non-witness UTXO hash for input #".concat(t," doesn't match the hash specified in the prevout"));const a=o.ins[t].index;u=n.outs[a]}else{if(!e.witnessUtxo)throw new Error("Need a Utxo input item for signing");u=e.witnessUtxo}const{meaningfulScript:h,type:l}=G(u.script,t,"input",e.redeemScript,e.witnessScript);if(["p2sh-p2wsh","p2wsh"].indexOf(l)>=0)a=o.hashForWitnessV0(t,h,u.value,s);else if((0,g.isP2WPKH)(h)){const e=c.p2pkh({hash:h.slice(2)}).output;a=o.hashForWitnessV0(t,e,u.value,s)}else{if(void 0===e.nonWitnessUtxo&&!1===r.__UNSAFE_SIGN_NONSEGWIT)throw new Error("Input #".concat(t," has witnessUtxo but non-segwit script: ")+"".concat(h.toString("hex")));n||!1===r.__UNSAFE_SIGN_NONSEGWIT||console.warn("Warning: Signing non-segwit inputs without the full parent transaction means there is a chance that a miner could feed you incorrect information to trick you into paying large fees. This behavior is the same as Psbt's predecesor (TransactionBuilder - now removed) when signing non-segwit scripts. You are not able to export this Psbt with toBuffer|toBase64|toHex since it is not BIP174 compliant.\n*********************\nPROCEED WITH CAUTION!\n*********************"),a=o.hashForSignature(t,h,s)}return{script:h,sighashType:s,hash:a}}function P(t,e,r){const{script:n}=W(t,e,r);return(0,g.isP2TR)(n)?n.subarray(2,34):null}function L(t){return 64===t.length?t:t.subarray(0,64)}function D(t,e,r,i,o,s,a){const u=o.__TX,h=e.sighashType||d.Transaction.SIGHASH_DEFAULT;U(h,a);const c=r.map(((t,e)=>W(e,t,o))),f=c.map((t=>t.script)),m=c.map((t=>t.value)),y=[];if(e.tapInternalKey&&!s){const r=P(t,e,o)||n.from([]);if((0,p.toXOnly)(i).equals(r)){const e=u.hashForWitnessV1(t,f,m,h);y.push({pubkey:i,hash:e})}}const w=(e.tapLeafScript||[]).filter((t=>(0,g.pubkeyInScript)(i,t.script))).map((t=>{const e=(0,l.tapleafHash)({output:t.script,version:t.leafVersion});return Object.assign({hash:e},t)})).filter((t=>!s||s.equals(t.hash))).map((e=>{const r=u.hashForWitnessV1(t,f,m,d.Transaction.SIGHASH_DEFAULT,e.hash);return{pubkey:i,hash:r,leafHash:e.hash}}));return y.concat(w)}function U(t,e){if(e&&e.indexOf(t)<0){const e=function(t){let e=t&d.Transaction.SIGHASH_ANYONECANPAY?"SIGHASH_ANYONECANPAY | ":"";switch(31&t){case d.Transaction.SIGHASH_ALL:e+="SIGHASH_ALL";break;case d.Transaction.SIGHASH_SINGLE:e+="SIGHASH_SINGLE";break;case d.Transaction.SIGHASH_NONE:e+="SIGHASH_NONE"}return e}(t);throw new Error("Sighash type is not allowed. Retry the sign method passing the "+"sighashTypes array of whitelisted types. Sighash type: ".concat(e))}}function j(t,e,r){const n=(0,s.checkForInput)(e,t);if(!n.bip32Derivation||0===n.bip32Derivation.length)throw new Error("Need bip32Derivation to sign with HD");const i=n.bip32Derivation.map((t=>t.masterFingerprint.equals(r.fingerprint)?t:void 0)).filter((t=>!!t));if(0===i.length)throw new Error("Need one bip32Derivation masterFingerprint to match the HDSigner fingerprint");return i.map((t=>{const e=r.derivePath(t.path);if(!t.pubkey.equals(e.publicKey))throw new Error("pubkey did not match bip32Derivation");return e}))}function F(t){let e=0;function r(){const r=o.decode(t,e);return e+=o.decode.bytes,r}function n(){return n=r(),e+=n,t.slice(e-n,e);var n}return function(){const t=r(),e=[];for(let r=0;r{if(n&&t.finalScriptSig&&(e.ins[o].script=t.finalScriptSig),n&&t.finalScriptWitness&&(e.ins[o].witness=F(t.finalScriptWitness)),t.witnessUtxo)i+=t.witnessUtxo.value;else if(t.nonWitnessUtxo){const n=V(r,t,o),s=e.ins[o].index,a=n.outs[s];i+=a.value}}));const o=e.outs.reduce(((t,e)=>t+e.value),0),s=i-o;if(s<0)throw new Error("Outputs are spending more than Inputs");const a=e.virtualSize();r.__FEE=s,r.__EXTRACTED_TX=e,r.__FEE_RATE=Math.floor(s/a)}function V(t,e,r){const n=t.__NON_WITNESS_UTXO_TX_CACHE;return n[r]||H(t,e,r),n[r]}function q(t,e,r){const{script:n}=W(t,e,r);return n}function W(t,e,r){if(void 0!==e.witnessUtxo)return{script:e.witnessUtxo.script,value:e.witnessUtxo.value};if(void 0!==e.nonWitnessUtxo){const n=V(r,e,t).outs[r.__TX.ins[t].index];return{script:n.script,value:n.value}}throw new Error("Can't find pubkey in input without Utxo data")}function K(t){return 33===t.length&&f.isCanonicalPubKey(t)}function G(t,e,r,n,i){const o=(0,g.isP2SHScript)(t),s=o&&n&&(0,g.isP2WSHScript)(n),a=(0,g.isP2WSHScript)(t);if(o&&void 0===n)throw new Error("scriptPubkey is P2SH but redeemScript missing");if((a||s)&&void 0===i)throw new Error("scriptPubkey or redeemScript is P2WSH but witnessScript missing");let u;return s?(u=i,x(e,t,n,r),T(e,n,i,r),X(u)):a?(u=i,T(e,t,i,r),X(u)):o?(u=n,x(e,t,n,r)):u=t,{meaningfulScript:u,type:s?"p2sh-p2wsh":o?"p2sh":a?"p2wsh":"raw"}}function X(t){if((0,g.isP2WPKH)(t)||(0,g.isP2SHScript)(t))throw new Error("P2WPKH or P2SH can not be contained within P2WSH")}function Z(t){return(0,g.isP2WPKH)(t)?"witnesspubkeyhash":(0,g.isP2PKH)(t)?"pubkeyhash":(0,g.isP2MS)(t)?"multisig":(0,g.isP2PK)(t)?"pubkey":"nonstandard"}function Y(t){return[...Array(t).keys()]}},8558:(t,e,r)=>{"use strict";var n=r(6382).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.checkTaprootInputForSigs=e.tapTreeFromList=e.tapTreeToList=e.tweakInternalPubKey=e.checkTaprootOutputFields=e.checkTaprootInputFields=e.isTaprootOutput=e.isTaprootInput=e.serializeTaprootSignature=e.tapScriptFinalizer=e.toXOnly=void 0;const i=r(3239),o=r(4222),s=r(636),a=r(925),u=r(2148),h=r(636);function c(t){return t&&!!(t.tapInternalKey||t.tapMerkleRoot||t.tapLeafScript&&t.tapLeafScript.length||t.tapBip32Derivation&&t.tapBip32Derivation.length||t.witnessUtxo&&(0,s.isP2TR)(t.witnessUtxo.script))}function l(t,e){return t&&!!(t.tapInternalKey||t.tapTree||t.tapBip32Derivation&&t.tapBip32Derivation.length||e&&(0,s.isP2TR)(e))}function f(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return 1===t.length&&0===t[0].depth?{output:t[0].script,version:t[0].leafVersion}:function(t){let e;for(const r of t)if(e=g(r,e),!e)throw new Error("No room left to insert tapleaf in tree");return e}(t)}function d(t){return{signature:t.slice(0,64),hashType:t.slice(64)[0]||o.Transaction.SIGHASH_DEFAULT}}function p(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(r>a.MAX_TAPTREE_DEPTH)throw new Error("Max taptree depth exceeded.");return t?(0,i.isTapleaf)(t)?(e.push({depth:r,leafVersion:t.version||a.LEAF_VERSION_TAPSCRIPT,script:t.output}),e):(t[0]&&p(t[0],e,r+1),t[1]&&p(t[1],e,r+1),e):[]}function g(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(r>a.MAX_TAPTREE_DEPTH)throw new Error("Max taptree depth exceeded.");if(t.depth===r)return e?void 0:{output:t.script,version:t.leafVersion};if((0,i.isTapleaf)(e))return;const n=g(t,e&&e[0],r+1);if(n)return[n,e&&e[1]];const o=g(t,e&&e[1],r+1);return o?[e&&e[0],o]:void 0}function m(t,e){if(!e)return!0;const r=(0,a.tapleafHash)({output:t.script,version:t.leafVersion});return(0,a.rootHashFromPath)(t.controlBlock,r).equals(e)}function y(t){return t&&!!(t.redeemScript||t.witnessScript||t.bip32Derivation&&t.bip32Derivation.length)}e.toXOnly=t=>32===t.length?t:t.slice(1,33),e.tapScriptFinalizer=function(t,e,r){const n=function(t,e,r){if(!t.tapScriptSig||!t.tapScriptSig.length)throw new Error("Can not finalize taproot input #".concat(e,". No tapleaf script signature provided."));const n=(t.tapLeafScript||[]).sort(((t,e)=>t.controlBlock.length-e.controlBlock.length)).find((e=>function(t,e,r){const n=(0,a.tapleafHash)({output:t.script,version:t.leafVersion});return(!r||r.equals(n))&&void 0!==e.find((t=>t.leafHash.equals(n)))}(e,t.tapScriptSig,r)));if(!n)throw new Error("Can not finalize taproot input #".concat(e,". Signature for tapleaf script not found."));return n}(e,t,r);try{const t=function(t,e){const r=(0,a.tapleafHash)({output:e.script,version:e.leafVersion});return(t.tapScriptSig||[]).filter((t=>t.leafHash.equals(r))).map((t=>function(t,e){return Object.assign({positionInScript:(0,s.pubkeyPositionInScript)(e.pubkey,t)},e)}(e.script,t))).sort(((t,e)=>e.positionInScript-t.positionInScript)).map((t=>t.signature))}(e,n),r=t.concat(n.script).concat(n.controlBlock);return{finalScriptWitness:(0,s.witnessStackToScriptWitness)(r)}}catch(i){throw new Error("Can not finalize taproot input #".concat(t,": ").concat(i))}},e.serializeTaprootSignature=function(t,e){const r=e?n.from([e]):n.from([]);return n.concat([t,r])},e.isTaprootInput=c,e.isTaprootOutput=l,e.checkTaprootInputFields=function(t,e,r){!function(t,e,r){const n=c(t)&&y(e),i=y(t)&&c(e),o=t===e&&c(e)&&y(e);if(n||i||o)throw new Error("Invalid arguments for Psbt.".concat(r,". ")+"Cannot use both taproot and non-taproot fields.")}(t,e,r),function(t,e,r){if(e.tapMerkleRoot){const n=(e.tapLeafScript||[]).every((t=>m(t,e.tapMerkleRoot))),i=(t.tapLeafScript||[]).every((t=>m(t,e.tapMerkleRoot)));if(!n||!i)throw new Error("Invalid arguments for Psbt.".concat(r,". Tapleaf not part of taptree."))}else if(t.tapMerkleRoot){if(!(e.tapLeafScript||[]).every((e=>m(e,t.tapMerkleRoot))))throw new Error("Invalid arguments for Psbt.".concat(r,". Tapleaf not part of taptree."))}}(t,e,r)},e.checkTaprootOutputFields=function(t,e,r){!function(t,e,r){const n=l(t)&&y(e),i=y(t)&&l(e),o=t===e&&l(e)&&y(e);if(n||i||o)throw new Error("Invalid arguments for Psbt.".concat(r,". ")+"Cannot use both taproot and non-taproot fields.")}(t,e,r),function(t,e){if(!e.tapTree&&!e.tapInternalKey)return;const r=e.tapInternalKey||t.tapInternalKey,n=e.tapTree||t.tapTree;if(r){const{script:e}=t,i=function(t,e){const r=e&&f(e.leaves),{output:n}=(0,u.p2tr)({internalPubkey:t,scriptTree:r});return n}(r,n);if(e&&!e.equals(i))throw new Error("Error adding output. Script or address missmatch.")}}(t,e)},e.tweakInternalPubKey=function(t,e){const r=e.tapInternalKey,n=r&&(0,a.tweakKey)(r,e.tapMerkleRoot);if(!n)throw new Error("Cannot tweak tap internal key for input #".concat(t,". Public key: ").concat(r&&r.toString("hex")));return n.x},e.tapTreeToList=function(t){if(!(0,i.isTaptree)(t))throw new Error("Cannot convert taptree to tapleaf list. Expecting a tapree structure.");return p(t)},e.tapTreeFromList=f,e.checkTaprootInputForSigs=function(t,e){return function(t){const e=[];t.tapKeySig&&e.push(t.tapKeySig);t.tapScriptSig&&e.push(...t.tapScriptSig.map((t=>t.signature)));if(!e.length){const r=function(t){if(!t)return;const e=t.slice(2);if(64===e.length||65===e.length)return e}(t.finalScriptWitness);r&&e.push(r)}return e}(t).some((t=>(0,h.signatureBlocksAction)(t,d,e)))}},636:(t,e,r)=>{"use strict";var n=r(6382).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.signatureBlocksAction=e.checkInputForSig=e.pubkeyInScript=e.pubkeyPositionInScript=e.witnessStackToScriptWitness=e.isP2TR=e.isP2SHScript=e.isP2WSHScript=e.isP2WPKH=e.isP2PKH=e.isP2PK=e.isP2MS=void 0;const i=r(5409),o=r(3515),s=r(4222),a=r(3469),u=r(2148);function h(t){return e=>{try{return t({output:e}),!0}catch(r){return!1}}}function c(t,e){const r=(0,a.hash160)(t),n=t.slice(1,33),i=o.decompile(e);if(null===i)throw new Error("Unknown script error");return i.findIndex((e=>"number"!==typeof e&&(e.equals(t)||e.equals(r)||e.equals(n))))}function l(t,e,r){const{hashType:n}=e(t),i=[];n&s.Transaction.SIGHASH_ANYONECANPAY&&i.push("addInput");switch(31&n){case s.Transaction.SIGHASH_ALL:break;case s.Transaction.SIGHASH_SINGLE:case s.Transaction.SIGHASH_NONE:i.push("addOutput"),i.push("setInputSequence")}return-1===i.indexOf(r)}e.isP2MS=h(u.p2ms),e.isP2PK=h(u.p2pk),e.isP2PKH=h(u.p2pkh),e.isP2WPKH=h(u.p2wpkh),e.isP2WSHScript=h(u.p2wsh),e.isP2SHScript=h(u.p2sh),e.isP2TR=h(u.p2tr),e.witnessStackToScriptWitness=function(t){let e=n.allocUnsafe(0);function r(t){const r=e.length,o=i.encodingLength(t);e=n.concat([e,n.allocUnsafe(o)]),i.encode(t,e,r)}function o(t){r(t.length),function(t){e=n.concat([e,n.from(t)])}(t)}var s;return r((s=t).length),s.forEach(o),e},e.pubkeyPositionInScript=c,e.pubkeyInScript=function(t,e){return-1!==c(t,e)},e.checkInputForSig=function(t,e){return function(t){let e=[];if(0===(t.partialSig||[]).length){if(!t.finalScriptSig&&!t.finalScriptWitness)return[];e=function(t){const e=t.finalScriptSig&&o.decompile(t.finalScriptSig)||[],r=t.finalScriptWitness&&o.decompile(t.finalScriptWitness)||[];return e.concat(r).filter((t=>n.isBuffer(t)&&o.isCanonicalScriptSignature(t))).map((t=>({signature:t})))}(t)}else e=t.partialSig;return e.map((t=>t.signature))}(t).some((t=>l(t,o.signature.decode,e)))},e.signatureBlocksAction=l},7647:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.decode=e.encode=e.encodingLength=void 0;const n=r(8662);function i(t){return tt.length)return null;i=t.readUInt8(e+1),o=2}else if(r===n.OPS.OP_PUSHDATA2){if(e+3>t.length)return null;i=t.readUInt16LE(e+1),o=3}else{if(e+5>t.length)return null;if(r!==n.OPS.OP_PUSHDATA4)throw new Error("Unexpected opcode");i=t.readUInt32LE(e+1),o=5}return{opcode:r,number:i,size:o}}},3515:(t,e,r)=>{"use strict";var n=r(6382).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.signature=e.number=e.isCanonicalScriptSignature=e.isDefinedHashType=e.isCanonicalPubKey=e.toStack=e.fromASM=e.toASM=e.decompile=e.compile=e.countNonPushOnlyOPs=e.isPushOnly=e.OPS=void 0;const i=r(7329),o=r(8662);Object.defineProperty(e,"OPS",{enumerable:!0,get:function(){return o.OPS}});const s=r(7647),a=r(5251),u=r(5570),h=r(3239),{typeforce:c}=h,l=o.OPS.OP_RESERVED;function f(t){return h.Buffer(t)||function(t){return h.Number(t)&&(t===o.OPS.OP_0||t>=o.OPS.OP_1&&t<=o.OPS.OP_16||t===o.OPS.OP_1NEGATE)}(t)}function d(t){return h.Array(t)&&t.every(f)}function p(t){return 0===t.length?o.OPS.OP_0:1===t.length?t[0]>=1&&t[0]<=16?l+t[0]:129===t[0]?o.OPS.OP_1NEGATE:void 0:void 0}function g(t){return n.isBuffer(t)}function m(t){return n.isBuffer(t)}function y(t){if(g(t))return t;c(h.Array,t);const e=t.reduce(((t,e)=>m(e)?1===e.length&&void 0!==p(e)?t+1:t+s.encodingLength(e.length)+e.length:t+1),0),r=n.allocUnsafe(e);let i=0;if(t.forEach((t=>{if(m(t)){const e=p(t);if(void 0!==e)return r.writeUInt8(e,i),void(i+=1);i+=s.encode(r,t.length,i),t.copy(r,i),i+=t.length}else r.writeUInt8(t,i),i+=1})),i!==r.length)throw new Error("Could not decode chunks");return r}function w(t){if(e=t,h.Array(e))return t;var e;c(h.Buffer,t);const r=[];let n=0;for(;no.OPS.OP_0&&e<=o.OPS.OP_PUSHDATA4){const e=s.decode(t,n);if(null===e)return null;if(n+=e.size,n+e.number>t.length)return null;const i=t.slice(n,n+e.number);n+=e.number;const o=p(i);void 0!==o?r.push(o):r.push(i)}else r.push(e),n+=1}return r}function v(t){const e=-129&t;return e>0&&e<4}e.isPushOnly=d,e.countNonPushOnlyOPs=function(t){return t.length-t.filter(f).length},e.compile=y,e.decompile=w,e.toASM=function(t){return g(t)&&(t=w(t)),t.map((t=>{if(m(t)){const e=p(t);if(void 0===e)return t.toString("hex");t=e}return o.REVERSE_OPS[t]})).join(" ")},e.fromASM=function(t){return c(h.String,t),y(t.split(" ").map((t=>void 0!==o.OPS[t]?o.OPS[t]:(c(h.Hex,t),n.from(t,"hex")))))},e.toStack=function(t){return t=w(t),c(d,t),t.map((t=>m(t)?t:t===o.OPS.OP_0?n.allocUnsafe(0):a.encode(t-l)))},e.isCanonicalPubKey=function(t){return h.isPoint(t)},e.isDefinedHashType=v,e.isCanonicalScriptSignature=function(t){return!!n.isBuffer(t)&&(!!v(t[t.length-1])&&i.check(t.slice(0,-1)))},e.number=a,e.signature=u},5251:(t,e,r)=>{"use strict";var n=r(6382).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.encode=e.decode=void 0,e.decode=function(t,e,r){e=e||4,r=void 0===r||r;const n=t.length;if(0===n)return 0;if(n>e)throw new TypeError("Script number overflow");if(r&&0===(127&t[n-1])&&(n<=1||0===(128&t[n-2])))throw new Error("Non-minimally encoded script number");if(5===n){const e=t.readUInt32LE(0),r=t.readUInt8(4);return 128&r?-(4294967296*(-129&r)+e):4294967296*r+e}let i=0;for(let o=0;o2147483647?5:i>8388607?4:i>32767?3:i>127?2:i>0?1:0;var i;const o=n.allocUnsafe(r),s=t<0;for(let n=0;n>=8;return 128&o[r-1]?o.writeUInt8(s?128:0,r-1):s&&(o[r-1]|=128),o}},5570:(t,e,r)=>{"use strict";var n=r(6382).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.encode=e.decode=void 0;const i=r(7329),o=r(3239),{typeforce:s}=o,a=n.alloc(1,0);function u(t){let e=0;for(;0===t[e];)++e;return e===t.length?a:128&(t=t.slice(e))[0]?n.concat([a,t],1+t.length):t}function h(t){0===t[0]&&(t=t.slice(1));const e=n.alloc(32,0),r=Math.max(0,32-t.length);return t.copy(e,r),e}e.decode=function(t){const e=t.readUInt8(t.length-1),r=-129&e;if(r<=0||r>=4)throw new Error("Invalid hashType "+e);const o=i.decode(t.slice(0,-1)),s=h(o.r),a=h(o.s);return{signature:n.concat([s,a],64),hashType:e}},e.encode=function(t,e){s({signature:o.BufferN(64),hashType:o.UInt8},{signature:t,hashType:e});const r=-129&e;if(r<=0||r>=4)throw new Error("Invalid hashType "+e);const a=n.allocUnsafe(1);a.writeUInt8(e,0);const h=u(t.slice(0,32)),c=u(t.slice(32,64));return n.concat([i.encode(h,c),a])}},4222:(t,e,r)=>{"use strict";var n=r(6382).Buffer;Object.defineProperty(e,"__esModule",{value:!0}),e.Transaction=void 0;const i=r(6333),o=r(3469),s=r(3515),a=r(3515),u=r(3239),{typeforce:h}=u;function c(t){const e=t.length;return i.varuint.encodingLength(e)+e}const l=n.allocUnsafe(0),f=[],d=n.from("0000000000000000000000000000000000000000000000000000000000000000","hex"),p=n.from("0000000000000000000000000000000000000000000000000000000000000001","hex"),g=n.from("ffffffffffffffff","hex"),m={script:l,valueBuffer:g};class y{constructor(){this.version=1,this.locktime=0,this.ins=[],this.outs=[]}static fromBuffer(t,e){const r=new i.BufferReader(t),n=new y;n.version=r.readInt32();const o=r.readUInt8(),s=r.readUInt8();let a=!1;o===y.ADVANCED_TRANSACTION_MARKER&&s===y.ADVANCED_TRANSACTION_FLAG?a=!0:r.offset-=2;const u=r.readVarInt();for(let i=0;i0!==t.witness.length))}weight(){return 3*this.byteLength(!1)+this.byteLength(!0)}virtualSize(){return Math.ceil(this.weight()/4)}byteLength(){const t=(!(arguments.length>0&&void 0!==arguments[0])||arguments[0])&&this.hasWitnesses();return(t?10:8)+i.varuint.encodingLength(this.ins.length)+i.varuint.encodingLength(this.outs.length)+this.ins.reduce(((t,e)=>t+40+c(e.script)),0)+this.outs.reduce(((t,e)=>t+8+c(e.script)),0)+(t?this.ins.reduce(((t,e)=>t+function(t){const e=t.length;return i.varuint.encodingLength(e)+t.reduce(((t,e)=>t+c(e)),0)}(e.witness)),0):0)}clone(){const t=new y;return t.version=this.version,t.locktime=this.locktime,t.ins=this.ins.map((t=>({hash:t.hash,index:t.index,script:t.script,sequence:t.sequence,witness:t.witness}))),t.outs=this.outs.map((t=>({script:t.script,value:t.value}))),t}hashForSignature(t,e,r){if(h(u.tuple(u.UInt32,u.Buffer,u.Number),arguments),t>=this.ins.length)return p;const i=s.compile(s.decompile(e).filter((t=>t!==a.OPS.OP_CODESEPARATOR))),c=this.clone();if((31&r)===y.SIGHASH_NONE)c.outs=[],c.ins.forEach(((e,r)=>{r!==t&&(e.sequence=0)}));else if((31&r)===y.SIGHASH_SINGLE){if(t>=this.outs.length)return p;c.outs.length=t+1;for(let e=0;e{r!==t&&(e.sequence=0)}))}r&y.SIGHASH_ANYONECANPAY?(c.ins=[c.ins[t]],c.ins[0].script=i):(c.ins.forEach((t=>{t.script=l})),c.ins[t].script=i);const f=n.allocUnsafe(c.byteLength(!1)+4);return f.writeInt32LE(r,f.length-4),c.__toBuffer(f,0,!1),o.hash256(f)}hashForWitnessV1(t,e,r,s,a,f){if(h(u.tuple(u.UInt32,h.arrayOf(u.Buffer),h.arrayOf(u.Satoshi),u.UInt32),arguments),r.length!==this.ins.length||e.length!==this.ins.length)throw new Error("Must supply prevout script and value for all inputs");const d=s===y.SIGHASH_DEFAULT?y.SIGHASH_ALL:s&y.SIGHASH_OUTPUT_MASK,p=(s&y.SIGHASH_INPUT_MASK)===y.SIGHASH_ANYONECANPAY,g=d===y.SIGHASH_NONE,m=d===y.SIGHASH_SINGLE;let w=l,v=l,b=l,_=l,E=l;if(!p){let t=i.BufferWriter.withCapacity(36*this.ins.length);this.ins.forEach((e=>{t.writeSlice(e.hash),t.writeUInt32(e.index)})),w=o.sha256(t.end()),t=i.BufferWriter.withCapacity(8*this.ins.length),r.forEach((e=>t.writeUInt64(e))),v=o.sha256(t.end()),t=i.BufferWriter.withCapacity(e.map(c).reduce(((t,e)=>t+e))),e.forEach((e=>t.writeVarSlice(e))),b=o.sha256(t.end()),t=i.BufferWriter.withCapacity(4*this.ins.length),this.ins.forEach((e=>t.writeUInt32(e.sequence))),_=o.sha256(t.end())}if(g||m){if(m&&t8+c(t.script))).reduce(((t,e)=>t+e)),e=i.BufferWriter.withCapacity(t);this.outs.forEach((t=>{e.writeUInt64(t.value),e.writeVarSlice(t.script)})),E=o.sha256(e.end())}const S=(a?2:0)+(f?1:0),M=174-(p?49:0)-(g?32:0)+(f?32:0)+(a?37:0),A=i.BufferWriter.withCapacity(M);if(A.writeUInt8(s),A.writeInt32(this.version),A.writeUInt32(this.locktime),A.writeSlice(w),A.writeSlice(v),A.writeSlice(b),A.writeSlice(_),g||m||A.writeSlice(E),A.writeUInt8(S),p){const n=this.ins[t];A.writeSlice(n.hash),A.writeUInt32(n.index),A.writeUInt64(r[t]),A.writeVarSlice(e[t]),A.writeUInt32(n.sequence)}else A.writeUInt32(t);if(f){const t=i.BufferWriter.withCapacity(c(f));t.writeVarSlice(f),A.writeSlice(o.sha256(t.end()))}return m&&A.writeSlice(E),a&&(A.writeSlice(a),A.writeUInt8(0),A.writeUInt32(4294967295)),o.taggedHash("TapSighash",n.concat([n.from([0]),A.end()]))}hashForWitnessV0(t,e,r,s){h(u.tuple(u.UInt32,u.Buffer,u.Satoshi,u.UInt32),arguments);let a,l=n.from([]),f=d,p=d,g=d;if(s&y.SIGHASH_ANYONECANPAY||(l=n.allocUnsafe(36*this.ins.length),a=new i.BufferWriter(l,0),this.ins.forEach((t=>{a.writeSlice(t.hash),a.writeUInt32(t.index)})),p=o.hash256(l)),s&y.SIGHASH_ANYONECANPAY||(31&s)===y.SIGHASH_SINGLE||(31&s)===y.SIGHASH_NONE||(l=n.allocUnsafe(4*this.ins.length),a=new i.BufferWriter(l,0),this.ins.forEach((t=>{a.writeUInt32(t.sequence)})),g=o.hash256(l)),(31&s)!==y.SIGHASH_SINGLE&&(31&s)!==y.SIGHASH_NONE){const t=this.outs.reduce(((t,e)=>t+8+c(e.script)),0);l=n.allocUnsafe(t),a=new i.BufferWriter(l,0),this.outs.forEach((t=>{a.writeUInt64(t.value),a.writeVarSlice(t.script)})),f=o.hash256(l)}else if((31&s)===y.SIGHASH_SINGLE&&t2&&void 0!==arguments[2]&&arguments[2];t||(t=n.allocUnsafe(this.byteLength(r)));const o=new i.BufferWriter(t,e||0);o.writeInt32(this.version);const s=r&&this.hasWitnesses();return s&&(o.writeUInt8(y.ADVANCED_TRANSACTION_MARKER),o.writeUInt8(y.ADVANCED_TRANSACTION_FLAG)),o.writeVarInt(this.ins.length),this.ins.forEach((t=>{o.writeSlice(t.hash),o.writeUInt32(t.index),o.writeVarSlice(t.script),o.writeUInt32(t.sequence)})),o.writeVarInt(this.outs.length),this.outs.forEach((t=>{void 0!==t.value?o.writeUInt64(t.value):o.writeSlice(t.valueBuffer),o.writeVarSlice(t.script)})),s&&this.ins.forEach((t=>{o.writeVector(t.witness)})),o.writeUInt32(this.locktime),void 0!==e?t.slice(e,o.offset):t}}e.Transaction=y,y.DEFAULT_SEQUENCE=4294967295,y.SIGHASH_DEFAULT=0,y.SIGHASH_ALL=1,y.SIGHASH_NONE=2,y.SIGHASH_SINGLE=3,y.SIGHASH_ANYONECANPAY=128,y.SIGHASH_OUTPUT_MASK=3,y.SIGHASH_INPUT_MASK=128,y.ADVANCED_TRANSACTION_MARKER=0,y.ADVANCED_TRANSACTION_FLAG=1},3239:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.oneOf=e.Null=e.BufferN=e.Function=e.UInt32=e.UInt8=e.tuple=e.maybe=e.Hex=e.Buffer=e.String=e.Boolean=e.Array=e.Number=e.Hash256bit=e.Hash160bit=e.Buffer256bit=e.isTaptree=e.isTapleaf=e.TAPLEAF_VERSION_MASK=e.Network=e.ECPoint=e.Satoshi=e.Signer=e.BIP32Path=e.UInt31=e.isPoint=e.typeforce=void 0;const n=r(6382);e.typeforce=r(2879);const i=n.Buffer.alloc(32,0),o=n.Buffer.from("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f","hex");e.isPoint=function(t){if(!n.Buffer.isBuffer(t))return!1;if(t.length<33)return!1;const e=t[0],r=t.slice(1,33);if(0===r.compare(i))return!1;if(r.compare(o)>=0)return!1;if((2===e||3===e)&&33===t.length)return!0;const s=t.slice(33);return 0!==s.compare(i)&&(!(s.compare(o)>=0)&&(4===e&&65===t.length))};const s=Math.pow(2,31)-1;function a(t){return e.typeforce.String(t)&&!!t.match(/^(m\/)?(\d+'?\/)*\d+'?$/)}e.UInt31=function(t){return e.typeforce.UInt32(t)&&t<=s},e.BIP32Path=a,a.toJSON=()=>"BIP32 derivation path",e.Signer=function(t){return(e.typeforce.Buffer(t.publicKey)||"function"===typeof t.getPublicKey)&&"function"===typeof t.sign};function u(t){return!(!t||!("output"in t))&&(!!n.Buffer.isBuffer(t.output)&&(void 0===t.version||(t.version&e.TAPLEAF_VERSION_MASK)===t.version))}e.Satoshi=function(t){return e.typeforce.UInt53(t)&&t<=21e14},e.ECPoint=e.typeforce.quacksLike("Point"),e.Network=e.typeforce.compile({messagePrefix:e.typeforce.oneOf(e.typeforce.Buffer,e.typeforce.String),bip32:{public:e.typeforce.UInt32,private:e.typeforce.UInt32},pubKeyHash:e.typeforce.UInt8,scriptHash:e.typeforce.UInt8,wif:e.typeforce.UInt8}),e.TAPLEAF_VERSION_MASK=254,e.isTapleaf=u,e.isTaptree=function t(r){return(0,e.Array)(r)?2===r.length&&r.every((e=>t(e))):u(r)},e.Buffer256bit=e.typeforce.BufferN(32),e.Hash160bit=e.typeforce.BufferN(20),e.Hash256bit=e.typeforce.BufferN(32),e.Number=e.typeforce.Number,e.Array=e.typeforce.Array,e.Boolean=e.typeforce.Boolean,e.String=e.typeforce.String,e.Buffer=e.typeforce.Buffer,e.Hex=e.typeforce.Hex,e.maybe=e.typeforce.maybe,e.tuple=e.typeforce.tuple,e.UInt8=e.typeforce.UInt8,e.UInt32=e.typeforce.UInt32,e.Function=e.typeforce.Function,e.BufferN=e.typeforce.BufferN,e.Null=e.typeforce.Null,e.oneOf=e.typeforce.oneOf},6373:function(t,e,r){!function(t,e){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var s;"object"===typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!==typeof window&&"undefined"!==typeof window.Buffer?window.Buffer:r(7790).Buffer}catch(k){}function a(t,e){var r=t.charCodeAt(e);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 "+t)}function u(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function h(t,e,r,i){for(var o=0,s=0,a=Math.min(t.length,r),u=e;u=49?h-49+10:h>=17?h-17+10:h,n(h>=0&&s0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"===typeof t)return this._initNumber(t,e,r);if("object"===typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n=e;n-=2)i=u(t,e,n)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2===0?e+1:e;n=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,c=r;c1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!==typeof Symbol&&"function"===typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(k){o.prototype.inspect=l}else o.prototype.inspect=l;function l(){return(this.red?""}var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[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];o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,s=0;s>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),r=0!==o||s!==this.length-1?f[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%e!==0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var h=d[t],c=p[t];r="";var l=this.clone();for(l.negative=0;!l.isZero();){var g=l.modrn(c).toString(t);r=(l=l.idivn(c)).isZero()?g+r:f[h-g.length]+g+r}for(this.isZero()&&(r="0"+r);r.length%e!==0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(t,e){return this.toArrayLike(s,t,e)}),o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function g(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var h=1;h>>26,l=67108863&u,f=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=f;d++){var p=h-d|0;c+=(s=(i=0|t.words[p])*(o=0|e.words[d])+l)/67108864|0,l=67108863&s}r.words[h]=0|l,u=0|c}return 0!==u?r.words[h]=0|u:r.length--,r._strip()}o.prototype.toArrayLike=function(t,e,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 s=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](s,i),s},o.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i>8&255),r>16&255),6===o?(r>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r=0&&(t[r--]=s>>8&255),r>=0&&(t[r--]=s>>16&255),6===o?(r>=0&&(t[r--]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0===(8191&e)&&(r+=13,e>>>=13),0===(127&e)&&(r+=7,e>>>=7),0===(15&e)&&(r+=4,e>>>=4),0===(3&e)&&(r+=2,e>>>=2),0===(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"===typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"===typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,d=0|s[1],p=8191&d,g=d>>>13,m=0|s[2],y=8191&m,w=m>>>13,v=0|s[3],b=8191&v,_=v>>>13,E=0|s[4],S=8191&E,M=E>>>13,A=0|s[5],I=8191&A,C=A>>>13,k=0|s[6],x=8191&k,T=k>>>13,O=0|s[7],N=8191&O,B=O>>>13,R=0|s[8],P=8191&R,L=R>>>13,D=0|s[9],U=8191&D,j=D>>>13,F=0|a[0],H=8191&F,z=F>>>13,V=0|a[1],q=8191&V,W=V>>>13,K=0|a[2],G=8191&K,X=K>>>13,Z=0|a[3],Y=8191&Z,Q=Z>>>13,J=0|a[4],$=8191&J,tt=J>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,ht=at>>>13,ct=0|a[8],lt=8191&ct,ft=ct>>>13,dt=0|a[9],pt=8191&dt,gt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(h+(n=Math.imul(l,H))|0)+((8191&(i=(i=Math.imul(l,z))+Math.imul(f,H)|0))<<13)|0;h=((o=Math.imul(f,z))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(p,H),i=(i=Math.imul(p,z))+Math.imul(g,H)|0,o=Math.imul(g,z);var yt=(h+(n=n+Math.imul(l,q)|0)|0)+((8191&(i=(i=i+Math.imul(l,W)|0)+Math.imul(f,q)|0))<<13)|0;h=((o=o+Math.imul(f,W)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(y,H),i=(i=Math.imul(y,z))+Math.imul(w,H)|0,o=Math.imul(w,z),n=n+Math.imul(p,q)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(g,q)|0,o=o+Math.imul(g,W)|0;var wt=(h+(n=n+Math.imul(l,G)|0)|0)+((8191&(i=(i=i+Math.imul(l,X)|0)+Math.imul(f,G)|0))<<13)|0;h=((o=o+Math.imul(f,X)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(b,H),i=(i=Math.imul(b,z))+Math.imul(_,H)|0,o=Math.imul(_,z),n=n+Math.imul(y,q)|0,i=(i=i+Math.imul(y,W)|0)+Math.imul(w,q)|0,o=o+Math.imul(w,W)|0,n=n+Math.imul(p,G)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(g,G)|0,o=o+Math.imul(g,X)|0;var vt=(h+(n=n+Math.imul(l,Y)|0)|0)+((8191&(i=(i=i+Math.imul(l,Q)|0)+Math.imul(f,Y)|0))<<13)|0;h=((o=o+Math.imul(f,Q)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(S,H),i=(i=Math.imul(S,z))+Math.imul(M,H)|0,o=Math.imul(M,z),n=n+Math.imul(b,q)|0,i=(i=i+Math.imul(b,W)|0)+Math.imul(_,q)|0,o=o+Math.imul(_,W)|0,n=n+Math.imul(y,G)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(w,G)|0,o=o+Math.imul(w,X)|0,n=n+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,Q)|0)+Math.imul(g,Y)|0,o=o+Math.imul(g,Q)|0;var bt=(h+(n=n+Math.imul(l,$)|0)|0)+((8191&(i=(i=i+Math.imul(l,tt)|0)+Math.imul(f,$)|0))<<13)|0;h=((o=o+Math.imul(f,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(I,H),i=(i=Math.imul(I,z))+Math.imul(C,H)|0,o=Math.imul(C,z),n=n+Math.imul(S,q)|0,i=(i=i+Math.imul(S,W)|0)+Math.imul(M,q)|0,o=o+Math.imul(M,W)|0,n=n+Math.imul(b,G)|0,i=(i=i+Math.imul(b,X)|0)+Math.imul(_,G)|0,o=o+Math.imul(_,X)|0,n=n+Math.imul(y,Y)|0,i=(i=i+Math.imul(y,Q)|0)+Math.imul(w,Y)|0,o=o+Math.imul(w,Q)|0,n=n+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(g,$)|0,o=o+Math.imul(g,tt)|0;var _t=(h+(n=n+Math.imul(l,rt)|0)|0)+((8191&(i=(i=i+Math.imul(l,nt)|0)+Math.imul(f,rt)|0))<<13)|0;h=((o=o+Math.imul(f,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(x,H),i=(i=Math.imul(x,z))+Math.imul(T,H)|0,o=Math.imul(T,z),n=n+Math.imul(I,q)|0,i=(i=i+Math.imul(I,W)|0)+Math.imul(C,q)|0,o=o+Math.imul(C,W)|0,n=n+Math.imul(S,G)|0,i=(i=i+Math.imul(S,X)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,X)|0,n=n+Math.imul(b,Y)|0,i=(i=i+Math.imul(b,Q)|0)+Math.imul(_,Y)|0,o=o+Math.imul(_,Q)|0,n=n+Math.imul(y,$)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(w,$)|0,o=o+Math.imul(w,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(g,rt)|0,o=o+Math.imul(g,nt)|0;var Et=(h+(n=n+Math.imul(l,ot)|0)|0)+((8191&(i=(i=i+Math.imul(l,st)|0)+Math.imul(f,ot)|0))<<13)|0;h=((o=o+Math.imul(f,st)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(N,H),i=(i=Math.imul(N,z))+Math.imul(B,H)|0,o=Math.imul(B,z),n=n+Math.imul(x,q)|0,i=(i=i+Math.imul(x,W)|0)+Math.imul(T,q)|0,o=o+Math.imul(T,W)|0,n=n+Math.imul(I,G)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(C,G)|0,o=o+Math.imul(C,X)|0,n=n+Math.imul(S,Y)|0,i=(i=i+Math.imul(S,Q)|0)+Math.imul(M,Y)|0,o=o+Math.imul(M,Q)|0,n=n+Math.imul(b,$)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(_,$)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(y,rt)|0,i=(i=i+Math.imul(y,nt)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(g,ot)|0,o=o+Math.imul(g,st)|0;var St=(h+(n=n+Math.imul(l,ut)|0)|0)+((8191&(i=(i=i+Math.imul(l,ht)|0)+Math.imul(f,ut)|0))<<13)|0;h=((o=o+Math.imul(f,ht)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(P,H),i=(i=Math.imul(P,z))+Math.imul(L,H)|0,o=Math.imul(L,z),n=n+Math.imul(N,q)|0,i=(i=i+Math.imul(N,W)|0)+Math.imul(B,q)|0,o=o+Math.imul(B,W)|0,n=n+Math.imul(x,G)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,X)|0,n=n+Math.imul(I,Y)|0,i=(i=i+Math.imul(I,Q)|0)+Math.imul(C,Y)|0,o=o+Math.imul(C,Q)|0,n=n+Math.imul(S,$)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,tt)|0,n=n+Math.imul(b,rt)|0,i=(i=i+Math.imul(b,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,st)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ht)|0)+Math.imul(g,ut)|0,o=o+Math.imul(g,ht)|0;var Mt=(h+(n=n+Math.imul(l,lt)|0)|0)+((8191&(i=(i=i+Math.imul(l,ft)|0)+Math.imul(f,lt)|0))<<13)|0;h=((o=o+Math.imul(f,ft)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(U,H),i=(i=Math.imul(U,z))+Math.imul(j,H)|0,o=Math.imul(j,z),n=n+Math.imul(P,q)|0,i=(i=i+Math.imul(P,W)|0)+Math.imul(L,q)|0,o=o+Math.imul(L,W)|0,n=n+Math.imul(N,G)|0,i=(i=i+Math.imul(N,X)|0)+Math.imul(B,G)|0,o=o+Math.imul(B,X)|0,n=n+Math.imul(x,Y)|0,i=(i=i+Math.imul(x,Q)|0)+Math.imul(T,Y)|0,o=o+Math.imul(T,Q)|0,n=n+Math.imul(I,$)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(C,$)|0,o=o+Math.imul(C,tt)|0,n=n+Math.imul(S,rt)|0,i=(i=i+Math.imul(S,nt)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,nt)|0,n=n+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ht)|0)+Math.imul(w,ut)|0,o=o+Math.imul(w,ht)|0,n=n+Math.imul(p,lt)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(g,lt)|0,o=o+Math.imul(g,ft)|0;var At=(h+(n=n+Math.imul(l,pt)|0)|0)+((8191&(i=(i=i+Math.imul(l,gt)|0)+Math.imul(f,pt)|0))<<13)|0;h=((o=o+Math.imul(f,gt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(U,q),i=(i=Math.imul(U,W))+Math.imul(j,q)|0,o=Math.imul(j,W),n=n+Math.imul(P,G)|0,i=(i=i+Math.imul(P,X)|0)+Math.imul(L,G)|0,o=o+Math.imul(L,X)|0,n=n+Math.imul(N,Y)|0,i=(i=i+Math.imul(N,Q)|0)+Math.imul(B,Y)|0,o=o+Math.imul(B,Q)|0,n=n+Math.imul(x,$)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(T,$)|0,o=o+Math.imul(T,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,nt)|0,n=n+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,n=n+Math.imul(b,ut)|0,i=(i=i+Math.imul(b,ht)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,ht)|0,n=n+Math.imul(y,lt)|0,i=(i=i+Math.imul(y,ft)|0)+Math.imul(w,lt)|0,o=o+Math.imul(w,ft)|0;var It=(h+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,gt)|0)+Math.imul(g,pt)|0))<<13)|0;h=((o=o+Math.imul(g,gt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(U,G),i=(i=Math.imul(U,X))+Math.imul(j,G)|0,o=Math.imul(j,X),n=n+Math.imul(P,Y)|0,i=(i=i+Math.imul(P,Q)|0)+Math.imul(L,Y)|0,o=o+Math.imul(L,Q)|0,n=n+Math.imul(N,$)|0,i=(i=i+Math.imul(N,tt)|0)+Math.imul(B,$)|0,o=o+Math.imul(B,tt)|0,n=n+Math.imul(x,rt)|0,i=(i=i+Math.imul(x,nt)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,st)|0,n=n+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,ht)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ht)|0,n=n+Math.imul(b,lt)|0,i=(i=i+Math.imul(b,ft)|0)+Math.imul(_,lt)|0,o=o+Math.imul(_,ft)|0;var Ct=(h+(n=n+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,gt)|0)+Math.imul(w,pt)|0))<<13)|0;h=((o=o+Math.imul(w,gt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(U,Y),i=(i=Math.imul(U,Q))+Math.imul(j,Y)|0,o=Math.imul(j,Q),n=n+Math.imul(P,$)|0,i=(i=i+Math.imul(P,tt)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,tt)|0,n=n+Math.imul(N,rt)|0,i=(i=i+Math.imul(N,nt)|0)+Math.imul(B,rt)|0,o=o+Math.imul(B,nt)|0,n=n+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,n=n+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,ht)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,ht)|0,n=n+Math.imul(S,lt)|0,i=(i=i+Math.imul(S,ft)|0)+Math.imul(M,lt)|0,o=o+Math.imul(M,ft)|0;var kt=(h+(n=n+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,gt)|0)+Math.imul(_,pt)|0))<<13)|0;h=((o=o+Math.imul(_,gt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(U,$),i=(i=Math.imul(U,tt))+Math.imul(j,$)|0,o=Math.imul(j,tt),n=n+Math.imul(P,rt)|0,i=(i=i+Math.imul(P,nt)|0)+Math.imul(L,rt)|0,o=o+Math.imul(L,nt)|0,n=n+Math.imul(N,ot)|0,i=(i=i+Math.imul(N,st)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,st)|0,n=n+Math.imul(x,ut)|0,i=(i=i+Math.imul(x,ht)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ht)|0,n=n+Math.imul(I,lt)|0,i=(i=i+Math.imul(I,ft)|0)+Math.imul(C,lt)|0,o=o+Math.imul(C,ft)|0;var xt=(h+(n=n+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,gt)|0)+Math.imul(M,pt)|0))<<13)|0;h=((o=o+Math.imul(M,gt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(U,rt),i=(i=Math.imul(U,nt))+Math.imul(j,rt)|0,o=Math.imul(j,nt),n=n+Math.imul(P,ot)|0,i=(i=i+Math.imul(P,st)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,st)|0,n=n+Math.imul(N,ut)|0,i=(i=i+Math.imul(N,ht)|0)+Math.imul(B,ut)|0,o=o+Math.imul(B,ht)|0,n=n+Math.imul(x,lt)|0,i=(i=i+Math.imul(x,ft)|0)+Math.imul(T,lt)|0,o=o+Math.imul(T,ft)|0;var Tt=(h+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,gt)|0)+Math.imul(C,pt)|0))<<13)|0;h=((o=o+Math.imul(C,gt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(U,ot),i=(i=Math.imul(U,st))+Math.imul(j,ot)|0,o=Math.imul(j,st),n=n+Math.imul(P,ut)|0,i=(i=i+Math.imul(P,ht)|0)+Math.imul(L,ut)|0,o=o+Math.imul(L,ht)|0,n=n+Math.imul(N,lt)|0,i=(i=i+Math.imul(N,ft)|0)+Math.imul(B,lt)|0,o=o+Math.imul(B,ft)|0;var Ot=(h+(n=n+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,gt)|0)+Math.imul(T,pt)|0))<<13)|0;h=((o=o+Math.imul(T,gt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(U,ut),i=(i=Math.imul(U,ht))+Math.imul(j,ut)|0,o=Math.imul(j,ht),n=n+Math.imul(P,lt)|0,i=(i=i+Math.imul(P,ft)|0)+Math.imul(L,lt)|0,o=o+Math.imul(L,ft)|0;var Nt=(h+(n=n+Math.imul(N,pt)|0)|0)+((8191&(i=(i=i+Math.imul(N,gt)|0)+Math.imul(B,pt)|0))<<13)|0;h=((o=o+Math.imul(B,gt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(U,lt),i=(i=Math.imul(U,ft))+Math.imul(j,lt)|0,o=Math.imul(j,ft);var Bt=(h+(n=n+Math.imul(P,pt)|0)|0)+((8191&(i=(i=i+Math.imul(P,gt)|0)+Math.imul(L,pt)|0))<<13)|0;h=((o=o+Math.imul(L,gt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863;var Rt=(h+(n=Math.imul(U,pt))|0)+((8191&(i=(i=Math.imul(U,gt))+Math.imul(j,pt)|0))<<13)|0;return h=((o=Math.imul(j,gt))+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,u[0]=mt,u[1]=yt,u[2]=wt,u[3]=vt,u[4]=bt,u[5]=_t,u[6]=Et,u[7]=St,u[8]=Mt,u[9]=At,u[10]=It,u[11]=Ct,u[12]=kt,u[13]=xt,u[14]=Tt,u[15]=Ot,u[16]=Nt,u[17]=Bt,u[18]=Rt,0!==h&&(u[19]=h,r.length++),r};function y(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function w(t,e,r){return y(t,e,r)}function v(t,e){this.x=t,this.y=e}Math.imul||(m=g),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?m(this,t,e):r<63?g(this,t,e):r<1024?y(this,t,e):w(this,t,e)},v.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n>=1;return n},v.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,r+=o/67108864|0,r+=s>>>26,this.words[i]=67108863&s}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i&1}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,h=0;h=0&&(0!==c||h>=i);h--){var l=0|this.words[h];this.words[h]=c<<26-o|l>>>o,c=l&a}return u&&0!==c&&(u.words[u.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"===typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"===typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===a)return this._strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,s=0|i.words[i.length-1];0!==(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var h=0;h=0;l--){var f=67108864*(0|n.words[i.length+l])+(0|n.words[i.length+l-1]);for(f=Math.min(f/s|0,67108863),n._ishlnsubmul(i,f,l);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(i,1,l),n.isZero()||(n.negative^=1);a&&(a.words[l]=f)}return a&&a._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!==(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modrn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},o.prototype.modn=function(t){return this.modrn(t)},o.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),h=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++h;for(var c=r.clone(),l=e.clone();!e.isZero();){for(var f=0,d=1;0===(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(c),s.isub(l)),i.iushrn(1),s.iushrn(1);for(var p=0,g=1;0===(r.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(c),u.isub(l)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),s.isub(u)):(r.isub(e),a.isub(i),u.isub(s))}return{a:a,b:u,gcd:r.iushln(h)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var h=0,c=1;0===(e.words[0]&c)&&h<26;++h,c<<=1);if(h>0)for(e.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var l=0,f=1;0===(r.words[0]&f)&&l<26;++l,f<<=1);if(l>0)for(r.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0===(1&this.words[0])},o.prototype.isOdd=function(){return 1===(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"===typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new I(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var b={k256:null,p224:null,p192:null,p25519:null};function _(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function E(){_.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function S(){_.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){_.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function A(){_.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function I(t){if("string"===typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function C(t){I.call(this,t),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}_.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},_.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},_.prototype.split=function(t,e){t.iushrn(this.n,0,e)},_.prototype.imulK=function(t){return t.imul(this.k)},i(E,_),E.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},E.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(b[t])return b[t];var e;if("k256"===t)e=new E;else if("p224"===t)e=new S;else if("p192"===t)e=new M;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new A}return b[t]=e,e},I.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},I.prototype._verify2=function(t,e){n(0===(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},I.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(c(t,t.umod(this.m)._forceRed(this)),t)},I.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},I.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},I.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},I.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},I.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},I.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},I.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},I.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},I.prototype.isqr=function(t){return this.imul(t,t.clone())},I.prototype.sqr=function(t){return this.mul(t,t)},I.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2===1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),h=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new o(2*c*c).toRed(this);0!==this.pow(c,h).cmp(u);)c.redIAdd(u);for(var l=this.pow(c,i),f=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(a);){for(var g=d,m=0;0!==g.cmp(a);m++)g=g.redSqr();n(m=0;n--){for(var h=e.words[n],c=u-1;c>=0;c--){var l=h>>c&1;i!==r[0]&&(i=this.sqr(i)),0!==l||0!==s?(s<<=1,s|=l,(4===++a||0===n&&0===c)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}u=26}return i},I.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},I.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new C(t)},i(C,I),C.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},C.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},C.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},C.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},C.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},8462:(t,e,r)=>{var n;function i(t){this.rand=t}if(t.exports=function(t){return n||(n=new i(null)),n.generate(t)},t.exports.Rand=i,i.prototype.generate=function(t){return this._rand(t)},i.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var e=new Uint8Array(t),r=0;r{var n=r(9966).Buffer;function i(t){n.isBuffer(t)||(t=n.from(t));for(var e=t.length/4|0,r=new Array(e),i=0;i>>24]^c[p>>>16&255]^l[g>>>8&255]^f[255&m]^e[y++],s=h[p>>>24]^c[g>>>16&255]^l[m>>>8&255]^f[255&d]^e[y++],a=h[g>>>24]^c[m>>>16&255]^l[d>>>8&255]^f[255&p]^e[y++],u=h[m>>>24]^c[d>>>16&255]^l[p>>>8&255]^f[255&g]^e[y++],d=o,p=s,g=a,m=u;return o=(n[d>>>24]<<24|n[p>>>16&255]<<16|n[g>>>8&255]<<8|n[255&m])^e[y++],s=(n[p>>>24]<<24|n[g>>>16&255]<<16|n[m>>>8&255]<<8|n[255&d])^e[y++],a=(n[g>>>24]<<24|n[m>>>16&255]<<16|n[d>>>8&255]<<8|n[255&p])^e[y++],u=(n[m>>>24]<<24|n[d>>>16&255]<<16|n[p>>>8&255]<<8|n[255&g])^e[y++],[o>>>=0,s>>>=0,a>>>=0,u>>>=0]}var a=[0,1,2,4,8,16,32,64,128,27,54],u=function(){for(var t=new Array(256),e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;for(var r=[],n=[],i=[[],[],[],[]],o=[[],[],[],[]],s=0,a=0,u=0;u<256;++u){var h=a^a<<1^a<<2^a<<3^a<<4;h=h>>>8^255&h^99,r[s]=h,n[h]=s;var c=t[s],l=t[c],f=t[l],d=257*t[h]^16843008*h;i[0][s]=d<<24|d>>>8,i[1][s]=d<<16|d>>>16,i[2][s]=d<<8|d>>>24,i[3][s]=d,d=16843009*f^65537*l^257*c^16843008*s,o[0][h]=d<<24|d>>>8,o[1][h]=d<<16|d>>>16,o[2][h]=d<<8|d>>>24,o[3][h]=d,0===s?s=a=1:(s=c^t[t[t[f^c]]],a^=t[t[a]])}return{SBOX:r,INV_SBOX:n,SUB_MIX:i,INV_SUB_MIX:o}}();function h(t){this._key=i(t),this._reset()}h.blockSize=16,h.keySize=32,h.prototype.blockSize=h.blockSize,h.prototype.keySize=h.keySize,h.prototype._reset=function(){for(var t=this._key,e=t.length,r=e+6,n=4*(r+1),i=[],o=0;o>>24,s=u.SBOX[s>>>24]<<24|u.SBOX[s>>>16&255]<<16|u.SBOX[s>>>8&255]<<8|u.SBOX[255&s],s^=a[o/e|0]<<24):e>6&&o%e===4&&(s=u.SBOX[s>>>24]<<24|u.SBOX[s>>>16&255]<<16|u.SBOX[s>>>8&255]<<8|u.SBOX[255&s]),i[o]=i[o-e]^s}for(var h=[],c=0;c>>24]]^u.INV_SUB_MIX[1][u.SBOX[f>>>16&255]]^u.INV_SUB_MIX[2][u.SBOX[f>>>8&255]]^u.INV_SUB_MIX[3][u.SBOX[255&f]]}this._nRounds=r,this._keySchedule=i,this._invKeySchedule=h},h.prototype.encryptBlockRaw=function(t){return s(t=i(t),this._keySchedule,u.SUB_MIX,u.SBOX,this._nRounds)},h.prototype.encryptBlock=function(t){var e=this.encryptBlockRaw(t),r=n.allocUnsafe(16);return r.writeUInt32BE(e[0],0),r.writeUInt32BE(e[1],4),r.writeUInt32BE(e[2],8),r.writeUInt32BE(e[3],12),r},h.prototype.decryptBlock=function(t){var e=(t=i(t))[1];t[1]=t[3],t[3]=e;var r=s(t,this._invKeySchedule,u.INV_SUB_MIX,u.INV_SBOX,this._nRounds),o=n.allocUnsafe(16);return o.writeUInt32BE(r[0],0),o.writeUInt32BE(r[3],4),o.writeUInt32BE(r[2],8),o.writeUInt32BE(r[1],12),o},h.prototype.scrub=function(){o(this._keySchedule),o(this._invKeySchedule),o(this._key)},t.exports.AES=h},5787:(t,e,r)=>{var n=r(4279),i=r(9966).Buffer,o=r(6239),s=r(6329),a=r(8525),u=r(8586),h=r(3277);function c(t,e,r,s){o.call(this);var u=i.alloc(4,0);this._cipher=new n.AES(e);var c=this._cipher.encryptBlock(u);this._ghash=new a(c),r=function(t,e,r){if(12===e.length)return t._finID=i.concat([e,i.from([0,0,0,1])]),i.concat([e,i.from([0,0,0,2])]);var n=new a(r),o=e.length,s=o%16;n.update(e),s&&(s=16-s,n.update(i.alloc(s,0))),n.update(i.alloc(8,0));var u=8*o,c=i.alloc(8);c.writeUIntBE(u,0,8),n.update(c),t._finID=n.state;var l=i.from(t._finID);return h(l),l}(this,r,c),this._prev=i.from(r),this._cache=i.allocUnsafe(0),this._secCache=i.allocUnsafe(0),this._decrypt=s,this._alen=0,this._len=0,this._mode=t,this._authTag=null,this._called=!1}s(c,o),c.prototype._update=function(t){if(!this._called&&this._alen){var e=16-this._alen%16;e<16&&(e=i.alloc(e,0),this._ghash.update(e))}this._called=!0;var r=this._mode.encrypt(this,t);return this._decrypt?this._ghash.update(t):this._ghash.update(r),this._len+=t.length,r},c.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var t=u(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(t,e){var r=0;t.length!==e.length&&r++;for(var n=Math.min(t.length,e.length),i=0;i{var n=r(9454),i=r(5190),o=r(3219);e.createCipher=e.Cipher=n.createCipher,e.createCipheriv=e.Cipheriv=n.createCipheriv,e.createDecipher=e.Decipher=i.createDecipher,e.createDecipheriv=e.Decipheriv=i.createDecipheriv,e.listCiphers=e.getCiphers=function(){return Object.keys(o)}},5190:(t,e,r)=>{var n=r(5787),i=r(9966).Buffer,o=r(1735),s=r(2301),a=r(6239),u=r(4279),h=r(8451);function c(t,e,r){a.call(this),this._cache=new l,this._last=void 0,this._cipher=new u.AES(e),this._prev=i.from(r),this._mode=t,this._autopadding=!0}function l(){this.cache=i.allocUnsafe(0)}function f(t,e,r){var a=o[t.toLowerCase()];if(!a)throw new TypeError("invalid suite type");if("string"===typeof r&&(r=i.from(r)),"GCM"!==a.mode&&r.length!==a.iv)throw new TypeError("invalid iv length "+r.length);if("string"===typeof e&&(e=i.from(e)),e.length!==a.key/8)throw new TypeError("invalid key length "+e.length);return"stream"===a.type?new s(a.module,e,r,!0):"auth"===a.type?new n(a.module,e,r,!0):new c(a.module,e,r)}r(6329)(c,a),c.prototype._update=function(t){var e,r;this._cache.add(t);for(var n=[];e=this._cache.get(this._autopadding);)r=this._mode.decrypt(this,e),n.push(r);return i.concat(n)},c.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return function(t){var e=t[15];if(e<1||e>16)throw new Error("unable to decrypt data");var r=-1;for(;++r16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e}else if(this.cache.length>=16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e;return null},l.prototype.flush=function(){if(this.cache.length)return this.cache},e.createDecipher=function(t,e){var r=o[t.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var n=h(e,!1,r.key,r.iv);return f(t,n.key,n.iv)},e.createDecipheriv=f},9454:(t,e,r)=>{var n=r(1735),i=r(5787),o=r(9966).Buffer,s=r(2301),a=r(6239),u=r(4279),h=r(8451);function c(t,e,r){a.call(this),this._cache=new f,this._cipher=new u.AES(e),this._prev=o.from(r),this._mode=t,this._autopadding=!0}r(6329)(c,a),c.prototype._update=function(t){var e,r;this._cache.add(t);for(var n=[];e=this._cache.get();)r=this._mode.encrypt(this,e),n.push(r);return o.concat(n)};var l=o.alloc(16,16);function f(){this.cache=o.allocUnsafe(0)}function d(t,e,r){var a=n[t.toLowerCase()];if(!a)throw new TypeError("invalid suite type");if("string"===typeof e&&(e=o.from(e)),e.length!==a.key/8)throw new TypeError("invalid key length "+e.length);if("string"===typeof r&&(r=o.from(r)),"GCM"!==a.mode&&r.length!==a.iv)throw new TypeError("invalid iv length "+r.length);return"stream"===a.type?new s(a.module,e,r):"auth"===a.type?new i(a.module,e,r):new c(a.module,e,r)}c.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return t=this._mode.encrypt(this,t),this._cipher.scrub(),t;if(!t.equals(l))throw this._cipher.scrub(),new Error("data not multiple of block length")},c.prototype.setAutoPadding=function(t){return this._autopadding=!!t,this},f.prototype.add=function(t){this.cache=o.concat([this.cache,t])},f.prototype.get=function(){if(this.cache.length>15){var t=this.cache.slice(0,16);return this.cache=this.cache.slice(16),t}return null},f.prototype.flush=function(){for(var t=16-this.cache.length,e=o.allocUnsafe(t),r=-1;++r{var n=r(9966).Buffer,i=n.alloc(16,0);function o(t){var e=n.allocUnsafe(16);return e.writeUInt32BE(t[0]>>>0,0),e.writeUInt32BE(t[1]>>>0,4),e.writeUInt32BE(t[2]>>>0,8),e.writeUInt32BE(t[3]>>>0,12),e}function s(t){this.h=t,this.state=n.alloc(16,0),this.cache=n.allocUnsafe(0)}s.prototype.ghash=function(t){for(var e=-1;++e0;e--)n[e]=n[e]>>>1|(1&n[e-1])<<31;n[0]=n[0]>>>1,r&&(n[0]=n[0]^225<<24)}this.state=o(i)},s.prototype.update=function(t){var e;for(this.cache=n.concat([this.cache,t]);this.cache.length>=16;)e=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(e)},s.prototype.final=function(t,e){return this.cache.length&&this.ghash(n.concat([this.cache,i],16)),this.ghash(o([0,t,0,e])),this.state},t.exports=s},3277:t=>{t.exports=function(t){for(var e,r=t.length;r--;){if(255!==(e=t.readUInt8(r))){e++,t.writeUInt8(e,r);break}t.writeUInt8(0,r)}}},4645:(t,e,r)=>{var n=r(8586);e.encrypt=function(t,e){var r=n(e,t._prev);return t._prev=t._cipher.encryptBlock(r),t._prev},e.decrypt=function(t,e){var r=t._prev;t._prev=e;var i=t._cipher.decryptBlock(e);return n(i,r)}},6210:(t,e,r)=>{var n=r(9966).Buffer,i=r(8586);function o(t,e,r){var o=e.length,s=i(e,t._cache);return t._cache=t._cache.slice(o),t._prev=n.concat([t._prev,r?e:s]),s}e.encrypt=function(t,e,r){for(var i,s=n.allocUnsafe(0);e.length;){if(0===t._cache.length&&(t._cache=t._cipher.encryptBlock(t._prev),t._prev=n.allocUnsafe(0)),!(t._cache.length<=e.length)){s=n.concat([s,o(t,e,r)]);break}i=t._cache.length,s=n.concat([s,o(t,e.slice(0,i),r)]),e=e.slice(i)}return s}},7071:(t,e,r)=>{var n=r(9966).Buffer;function i(t,e,r){for(var n,i,s=-1,a=0;++s<8;)n=e&1<<7-s?128:0,a+=(128&(i=t._cipher.encryptBlock(t._prev)[0]^n))>>s%8,t._prev=o(t._prev,r?n:i);return a}function o(t,e){var r=t.length,i=-1,o=n.allocUnsafe(t.length);for(t=n.concat([t,n.from([e])]);++i>7;return o}e.encrypt=function(t,e,r){for(var o=e.length,s=n.allocUnsafe(o),a=-1;++a{var n=r(9966).Buffer;function i(t,e,r){var i=t._cipher.encryptBlock(t._prev)[0]^e;return t._prev=n.concat([t._prev.slice(1),n.from([r?e:i])]),i}e.encrypt=function(t,e,r){for(var o=e.length,s=n.allocUnsafe(o),a=-1;++a{var n=r(8586),i=r(9966).Buffer,o=r(3277);function s(t){var e=t._cipher.encryptBlockRaw(t._prev);return o(t._prev),e}e.encrypt=function(t,e){var r=Math.ceil(e.length/16),o=t._cache.length;t._cache=i.concat([t._cache,i.allocUnsafe(16*r)]);for(var a=0;a{e.encrypt=function(t,e){return t._cipher.encryptBlock(e)},e.decrypt=function(t,e){return t._cipher.decryptBlock(e)}},1735:(t,e,r)=>{var n={ECB:r(7257),CBC:r(4645),CFB:r(6210),CFB8:r(8528),CFB1:r(7071),OFB:r(3542),CTR:r(5536),GCM:r(5536)},i=r(3219);for(var o in i)i[o].module=n[i[o].mode];t.exports=i},3542:(t,e,r)=>{var n=r(6382).Buffer,i=r(8586);function o(t){return t._prev=t._cipher.encryptBlock(t._prev),t._prev}e.encrypt=function(t,e){for(;t._cache.length{var n=r(4279),i=r(9966).Buffer,o=r(6239);function s(t,e,r,s){o.call(this),this._cipher=new n.AES(e),this._prev=i.from(r),this._cache=i.allocUnsafe(0),this._secCache=i.allocUnsafe(0),this._decrypt=s,this._mode=t}r(6329)(s,o),s.prototype._update=function(t){return this._mode.encrypt(this,t,this._decrypt)},s.prototype._final=function(){this._cipher.scrub()},t.exports=s},4014:(t,e,r)=>{var n=r(6951),i=r(2428),o=r(1735),s=r(5491),a=r(8451);function u(t,e,r){if(t=t.toLowerCase(),o[t])return i.createCipheriv(t,e,r);if(s[t])return new n({key:e,iv:r,mode:t});throw new TypeError("invalid suite type")}function h(t,e,r){if(t=t.toLowerCase(),o[t])return i.createDecipheriv(t,e,r);if(s[t])return new n({key:e,iv:r,mode:t,decrypt:!0});throw new TypeError("invalid suite type")}e.createCipher=e.Cipher=function(t,e){var r,n;if(t=t.toLowerCase(),o[t])r=o[t].key,n=o[t].iv;else{if(!s[t])throw new TypeError("invalid suite type");r=8*s[t].key,n=s[t].iv}var i=a(e,!1,r,n);return u(t,i.key,i.iv)},e.createCipheriv=e.Cipheriv=u,e.createDecipher=e.Decipher=function(t,e){var r,n;if(t=t.toLowerCase(),o[t])r=o[t].key,n=o[t].iv;else{if(!s[t])throw new TypeError("invalid suite type");r=8*s[t].key,n=s[t].iv}var i=a(e,!1,r,n);return h(t,i.key,i.iv)},e.createDecipheriv=e.Decipheriv=h,e.listCiphers=e.getCiphers=function(){return Object.keys(s).concat(i.getCiphers())}},6951:(t,e,r)=>{var n=r(6239),i=r(3325),o=r(6329),s=r(9966).Buffer,a={"des-ede3-cbc":i.CBC.instantiate(i.EDE),"des-ede3":i.EDE,"des-ede-cbc":i.CBC.instantiate(i.EDE),"des-ede":i.EDE,"des-cbc":i.CBC.instantiate(i.DES),"des-ecb":i.DES};function u(t){n.call(this);var e,r=t.mode.toLowerCase(),i=a[r];e=t.decrypt?"decrypt":"encrypt";var o=t.key;s.isBuffer(o)||(o=s.from(o)),"des-ede"!==r&&"des-ede-cbc"!==r||(o=s.concat([o,o.slice(0,8)]));var u=t.iv;s.isBuffer(u)||(u=s.from(u)),this._des=i.create({key:o,iv:u,type:e})}a.des=a["des-cbc"],a.des3=a["des-ede3-cbc"],t.exports=u,o(u,n),u.prototype._update=function(t){return s.from(this._des.update(t))},u.prototype._final=function(){return s.from(this._des.final())}},5491:(t,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}},5721:(t,e,r)=>{var n=r(6382).Buffer,i=r(6373),o=r(5838);function s(t){var e,r=t.modulus.byteLength();do{e=new i(o(r))}while(e.cmp(t.modulus)>=0||!e.umod(t.prime1)||!e.umod(t.prime2));return e}function a(t,e){var r=function(t){var e=s(t);return{blinder:e.toRed(i.mont(t.modulus)).redPow(new i(t.publicExponent)).fromRed(),unblinder:e.invm(t.modulus)}}(e),o=e.modulus.byteLength(),a=new i(t).mul(r.blinder).umod(e.modulus),u=a.toRed(i.mont(e.prime1)),h=a.toRed(i.mont(e.prime2)),c=e.coefficient,l=e.prime1,f=e.prime2,d=u.redPow(e.exponent1).fromRed(),p=h.redPow(e.exponent2).fromRed(),g=d.isub(p).imul(c).umod(l).imul(f);return p.iadd(g).imul(r.unblinder).umod(e.modulus).toArrayLike(n,"be",o)}a.getr=s,t.exports=a},9096:(t,e,r)=>{"use strict";t.exports=r(2951)},7207:(t,e,r)=>{"use strict";var n=r(9966).Buffer,i=r(6059),o=r(3486),s=r(6329),a=r(2478),u=r(8818),h=r(2951);function c(t){o.Writable.call(this);var e=h[t];if(!e)throw new Error("Unknown message digest");this._hashType=e.hash,this._hash=i(e.hash),this._tag=e.id,this._signType=e.sign}function l(t){o.Writable.call(this);var e=h[t];if(!e)throw new Error("Unknown message digest");this._hash=i(e.hash),this._tag=e.id,this._signType=e.sign}function f(t){return new c(t)}function d(t){return new l(t)}Object.keys(h).forEach((function(t){h[t].id=n.from(h[t].id,"hex"),h[t.toLowerCase()]=h[t]})),s(c,o.Writable),c.prototype._write=function(t,e,r){this._hash.update(t),r()},c.prototype.update=function(t,e){return this._hash.update("string"===typeof t?n.from(t,e):t),this},c.prototype.sign=function(t,e){this.end();var r=this._hash.digest(),n=a(r,t,this._hashType,this._signType,this._tag);return e?n.toString(e):n},s(l,o.Writable),l.prototype._write=function(t,e,r){this._hash.update(t),r()},l.prototype.update=function(t,e){return this._hash.update("string"===typeof t?n.from(t,e):t),this},l.prototype.verify=function(t,e,r){var i="string"===typeof e?n.from(e,r):e;this.end();var o=this._hash.digest();return u(i,o,t,this._signType,this._tag)},t.exports={Sign:f,Verify:d,createSign:f,createVerify:d}},2478:(t,e,r)=>{"use strict";var n=r(9966).Buffer,i=r(2080),o=r(5721),s=r(8086).ec,a=r(6373),u=r(4496),h=r(4589);function c(t,e,r,o){if((t=n.from(t.toArray())).length0&&r.ishrn(n),r}function f(t,e,r){var o,s;do{for(o=n.alloc(0);8*o.length{"use strict";var n=r(9966).Buffer,i=r(6373),o=r(8086).ec,s=r(4496),a=r(4589);function u(t,e){if(t.cmpn(0)<=0)throw new Error("invalid sig");if(t.cmp(e)>=0)throw new Error("invalid sig")}t.exports=function(t,e,r,h,c){var l=s(r);if("ec"===l.type){if("ecdsa"!==h&&"ecdsa/rsa"!==h)throw new Error("wrong public key type");return function(t,e,r){var n=a[r.data.algorithm.curve.join(".")];if(!n)throw new Error("unknown curve "+r.data.algorithm.curve.join("."));var i=new o(n),s=r.data.subjectPrivateKey.data;return i.verify(e,t,s)}(t,e,l)}if("dsa"===l.type){if("dsa"!==h)throw new Error("wrong public key type");return function(t,e,r){var n=r.data.p,o=r.data.q,a=r.data.g,h=r.data.pub_key,c=s.signature.decode(t,"der"),l=c.s,f=c.r;u(l,o),u(f,o);var d=i.mont(n),p=l.invm(o),g=a.toRed(d).redPow(new i(e).mul(p).mod(o)).fromRed().mul(h.toRed(d).redPow(f.mul(p).mod(o)).fromRed()).mod(n).mod(o);return 0===g.cmp(f)}(t,e,l)}if("rsa"!==h&&"ecdsa/rsa"!==h)throw new Error("wrong public key type");e=n.concat([c,e]);for(var f=l.modulus.byteLength(),d=[1],p=0;e.length+d.length+2{var e={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==e.call(t)}},6211:(t,e,r)=>{"use strict";var n=r(6600),i=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=l;var o=Object.create(r(3525));o.inherits=r(6329);var s=r(1137),a=r(9873);o.inherits(l,s);for(var u=i(a.prototype),h=0;h{"use strict";t.exports=o;var n=r(981),i=Object.create(r(3525));function o(t){if(!(this instanceof o))return new o(t);n.call(this,t)}i.inherits=r(6329),i.inherits(o,n),o.prototype._transform=function(t,e,r){r(null,t)}},1137:(t,e,r)=>{"use strict";var n=r(2285),i=r(6600);t.exports=v;var o,s=r(9101);v.ReadableState=w;r(7284).EventEmitter;var a=function(t,e){return t.listeners(e).length},u=r(4526),h=r(39).Buffer,c=("undefined"!==typeof r.g?r.g:"undefined"!==typeof window?window:"undefined"!==typeof self?self:{}).Uint8Array||function(){};var l=Object.create(r(3525));l.inherits=r(6329);var f=r(2668),d=void 0;d=f&&f.debuglog?f.debuglog("stream"):function(){};var p,g=r(2249),m=r(6269);l.inherits(v,u);var y=["error","close","destroy","pause","resume"];function w(t,e){t=t||{};var n=e instanceof(o=o||r(6211));this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var i=t.highWaterMark,s=t.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(s||0===s)?s:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new g,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=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(p||(p=r(2942).I),this.decoder=new p(t.encoding),this.encoding=t.encoding)}function v(t){if(o=o||r(6211),!(this instanceof v))return new v(t);this._readableState=new w(t,this),this.readable=!0,t&&("function"===typeof t.read&&(this._read=t.read),"function"===typeof t.destroy&&(this._destroy=t.destroy)),u.call(this)}function b(t,e,r,n,i){var o,s=t._readableState;null===e?(s.reading=!1,function(t,e){if(e.ended)return;if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,M(t)}(t,s)):(i||(o=function(t,e){var r;n=e,h.isBuffer(n)||n instanceof c||"string"===typeof e||void 0===e||t.objectMode||(r=new TypeError("Invalid non-string/buffer chunk"));var n;return r}(s,e)),o?t.emit("error",o):s.objectMode||e&&e.length>0?("string"===typeof e||s.objectMode||Object.getPrototypeOf(e)===h.prototype||(e=function(t){return h.from(t)}(e)),n?s.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):_(t,s,e,!0):s.ended?t.emit("error",new Error("stream.push() after EOF")):(s.reading=!1,s.decoder&&!r?(e=s.decoder.write(e),s.objectMode||0!==e.length?_(t,s,e,!1):I(t,s)):_(t,s,e,!1))):n||(s.reading=!1));return function(t){return!t.ended&&(t.needReadable||t.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=E?t=E:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function M(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(d("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?i.nextTick(A,t):A(t))}function A(t){d("emit readable"),t.emit("readable"),T(t)}function I(t,e){e.readingMore||(e.readingMore=!0,i.nextTick(C,t,e))}function C(t,e){for(var r=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):r=function(t,e,r){var n;to.length?o.length:t;if(s===o.length?i+=o:i+=o.slice(0,t),0===(t-=s)){s===o.length?(++n,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=o.slice(s));break}++n}return e.length-=n,i}(t,e):function(t,e){var r=h.allocUnsafe(t),n=e.head,i=1;n.data.copy(r),t-=n.data.length;for(;n=n.next;){var o=n.data,s=t>o.length?o.length:t;if(o.copy(r,r.length-t,0,s),0===(t-=s)){s===o.length?(++i,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=o.slice(s));break}++i}return e.length-=i,r}(t,e);return n}(t,e.buffer,e.decoder),r);var r}function N(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,i.nextTick(B,e,t))}function B(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function R(t,e){for(var r=0,n=t.length;r=e.highWaterMark||e.ended))return d("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?N(this):M(this),null;if(0===(t=S(t,e))&&e.ended)return 0===e.length&&N(this),null;var n,i=e.needReadable;return d("need readable",i),(0===e.length||e.length-t0?O(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&N(this)),null!==n&&this.emit("data",n),n},v.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},v.prototype.pipe=function(t,e){var r=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=t;break;case 1:o.pipes=[o.pipes,t];break;default:o.pipes.push(t)}o.pipesCount+=1,d("pipe count=%d opts=%j",o.pipesCount,e);var u=(!e||!1!==e.end)&&t!==n.stdout&&t!==n.stderr?c:v;function h(e,n){d("onunpipe"),e===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,d("cleanup"),t.removeListener("close",y),t.removeListener("finish",w),t.removeListener("drain",l),t.removeListener("error",m),t.removeListener("unpipe",h),r.removeListener("end",c),r.removeListener("end",v),r.removeListener("data",g),f=!0,!o.awaitDrain||t._writableState&&!t._writableState.needDrain||l())}function c(){d("onend"),t.end()}o.endEmitted?i.nextTick(u):r.once("end",u),t.on("unpipe",h);var l=function(t){return function(){var e=t._readableState;d("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&a(t,"data")&&(e.flowing=!0,T(t))}}(r);t.on("drain",l);var f=!1;var p=!1;function g(e){d("ondata"),p=!1,!1!==t.write(e)||p||((1===o.pipesCount&&o.pipes===t||o.pipesCount>1&&-1!==R(o.pipes,t))&&!f&&(d("false write response, pause",o.awaitDrain),o.awaitDrain++,p=!0),r.pause())}function m(e){d("onerror",e),v(),t.removeListener("error",m),0===a(t,"error")&&t.emit("error",e)}function y(){t.removeListener("finish",w),v()}function w(){d("onfinish"),t.removeListener("close",y),v()}function v(){d("unpipe"),r.unpipe(t)}return r.on("data",g),function(t,e,r){if("function"===typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?s(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",m),t.once("close",y),t.once("finish",w),t.emit("pipe",r),o.flowing||(d("pipe resume"),r.resume()),t},v.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o{"use strict";t.exports=s;var n=r(6211),i=Object.create(r(3525));function o(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=e&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length{"use strict";var n=r(2285),i=r(6600);function o(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var n=t.entry;t.entry=null;for(;n;){var i=n.callback;e.pendingcb--,i(r),n=n.next}e.corkedRequestsFree.next=t}(e,t)}}t.exports=y;var s,a=!n.browser&&["v0.10","v0.9."].indexOf(n.version.slice(0,5))>-1?setImmediate:i.nextTick;y.WritableState=m;var u=Object.create(r(3525));u.inherits=r(6329);var h={deprecate:r(2390)},c=r(4526),l=r(39).Buffer,f=("undefined"!==typeof r.g?r.g:"undefined"!==typeof window?window:"undefined"!==typeof self?self:{}).Uint8Array||function(){};var d,p=r(6269);function g(){}function m(t,e){s=s||r(6211),t=t||{};var n=e instanceof s;this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var u=t.highWaterMark,h=t.writableHighWaterMark,c=this.objectMode?16:16384;this.highWaterMark=u||0===u?u:n&&(h||0===h)?h:c,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 l=!1===t.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,n=r.sync,o=r.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,n,o){--e.pendingcb,r?(i.nextTick(o,n),i.nextTick(S,t,e),t._writableState.errorEmitted=!0,t.emit("error",n)):(o(n),t._writableState.errorEmitted=!0,t.emit("error",n),S(t,e))}(t,r,n,e,o);else{var s=_(r);s||r.corked||r.bufferProcessing||!r.bufferedRequest||b(t,r),n?a(v,t,r,s,o):v(t,r,s,o)}}(e,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 o(this)}function y(t){if(s=s||r(6211),!d.call(y,this)&&!(this instanceof s))return new y(t);this._writableState=new m(t,this),this.writable=!0,t&&("function"===typeof t.write&&(this._write=t.write),"function"===typeof t.writev&&(this._writev=t.writev),"function"===typeof t.destroy&&(this._destroy=t.destroy),"function"===typeof t.final&&(this._final=t.final)),c.call(this)}function w(t,e,r,n,i,o,s){e.writelen=n,e.writecb=s,e.writing=!0,e.sync=!0,r?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function v(t,e,r,n){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,n(),S(t,e)}function b(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var n=e.bufferedRequestCount,i=new Array(n),s=e.corkedRequestsFree;s.entry=r;for(var a=0,u=!0;r;)i[a]=r,r.isBuf||(u=!1),r=r.next,a+=1;i.allBuffers=u,w(t,e,!0,e.length,i,"",s.finish),e.pendingcb++,e.lastBufferedRequest=null,s.next?(e.corkedRequestsFree=s.next,s.next=null):e.corkedRequestsFree=new o(e),e.bufferedRequestCount=0}else{for(;r;){var h=r.chunk,c=r.encoding,l=r.callback;if(w(t,e,!1,e.objectMode?1:h.length,h,c,l),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function _(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function E(t,e){t._final((function(r){e.pendingcb--,r&&t.emit("error",r),e.prefinished=!0,t.emit("prefinish"),S(t,e)}))}function S(t,e){var r=_(e);return r&&(!function(t,e){e.prefinished||e.finalCalled||("function"===typeof t._final?(e.pendingcb++,e.finalCalled=!0,i.nextTick(E,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),r}u.inherits(y,c),m.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(m.prototype,"buffer",{get:h.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"===typeof Symbol&&Symbol.hasInstance&&"function"===typeof Function.prototype[Symbol.hasInstance]?(d=Function.prototype[Symbol.hasInstance],Object.defineProperty(y,Symbol.hasInstance,{value:function(t){return!!d.call(this,t)||this===y&&(t&&t._writableState instanceof m)}})):d=function(t){return t instanceof this},y.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},y.prototype.write=function(t,e,r){var n,o=this._writableState,s=!1,a=!o.objectMode&&(n=t,l.isBuffer(n)||n instanceof f);return a&&!l.isBuffer(t)&&(t=function(t){return l.from(t)}(t)),"function"===typeof e&&(r=e,e=null),a?e="buffer":e||(e=o.defaultEncoding),"function"!==typeof r&&(r=g),o.ended?function(t,e){var r=new Error("write after end");t.emit("error",r),i.nextTick(e,r)}(this,r):(a||function(t,e,r,n){var o=!0,s=!1;return null===r?s=new TypeError("May not write null values to stream"):"string"===typeof r||void 0===r||e.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(t.emit("error",s),i.nextTick(n,s),o=!1),o}(this,o,t,r))&&(o.pendingcb++,s=function(t,e,r,n,i,o){if(!r){var s=function(t,e,r){t.objectMode||!1===t.decodeStrings||"string"!==typeof e||(e=l.from(e,r));return e}(e,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=e.objectMode?1:n.length;e.length+=a;var u=e.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(y.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),y.prototype._write=function(t,e,r){r(new Error("_write() is not implemented"))},y.prototype._writev=null,y.prototype.end=function(t,e,r){var n=this._writableState;"function"===typeof t?(r=t,t=null,e=null):"function"===typeof e&&(r=e,e=null),null!==t&&void 0!==t&&this.write(t,e),n.corked&&(n.corked=1,this.uncork()),n.ending||function(t,e,r){e.ending=!0,S(t,e),r&&(e.finished?i.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,n,r)},Object.defineProperty(y.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),y.prototype.destroy=p.destroy,y.prototype._undestroy=p.undestroy,y.prototype._destroy=function(t,e){this.end(),e(t)}},2249:(t,e,r)=>{"use strict";var n=r(39).Buffer,i=r(1638);t.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}return t.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r},t.prototype.concat=function(t){if(0===this.length)return n.alloc(0);for(var e,r,i,o=n.allocUnsafe(t>>>0),s=this.head,a=0;s;)e=s.data,r=o,i=a,e.copy(r,i),a+=s.data.length,s=s.next;return o},t}(),i&&i.inspect&&i.inspect.custom&&(t.exports.prototype[i.inspect.custom]=function(){var t=i.inspect({length:this.length});return this.constructor.name+" "+t})},6269:(t,e,r)=>{"use strict";var n=r(6600);function i(t,e){t.emit("error",e)}t.exports={destroy:function(t,e){var r=this,o=this._readableState&&this._readableState.destroyed,s=this._writableState&&this._writableState.destroyed;return o||s?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,n.nextTick(i,this,t)):n.nextTick(i,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!e&&t?r._writableState?r._writableState.errorEmitted||(r._writableState.errorEmitted=!0,n.nextTick(i,r,t)):n.nextTick(i,r,t):e&&e(t)})),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)}}},4526:(t,e,r)=>{t.exports=r(7284).EventEmitter},39:(t,e,r)=>{var n=r(6382),i=n.Buffer;function o(t,e){for(var r in t)e[r]=t[r]}function s(t,e,r){return i(t,e,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=n:(o(n,e),e.Buffer=s),o(i,s),s.from=function(t,e,r){if("number"===typeof t)throw new TypeError("Argument must not be a number");return i(t,e,r)},s.alloc=function(t,e,r){if("number"!==typeof t)throw new TypeError("Argument must be a number");var n=i(t);return void 0!==e?"string"===typeof r?n.fill(e,r):n.fill(e):n.fill(0),n},s.allocUnsafe=function(t){if("number"!==typeof t)throw new TypeError("Argument must be a number");return i(t)},s.allocUnsafeSlow=function(t){if("number"!==typeof t)throw new TypeError("Argument must be a number");return n.SlowBuffer(t)}},3486:(t,e,r)=>{(e=t.exports=r(1137)).Stream=e,e.Readable=e,e.Writable=r(9873),e.Duplex=r(6211),e.Transform=r(981),e.PassThrough=r(9135)},2942:(t,e,r)=>{"use strict";var n=r(2888).Buffer,i=n.isEncoding||function(t){switch((t=""+t)&&t.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 o(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){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 t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!==typeof e&&(n.isEncoding===i||!i(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=u,this.end=h,e=4;break;case"utf8":this.fillLast=a,e=4;break;case"base64":this.text=c,this.end=l,e=3;break;default:return this.write=f,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(e)}function s(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function a(t){var e=this.lastTotal-this.lastNeed,r=function(t,e,r){if(128!==(192&e[0]))return t.lastNeed=0,"\ufffd";if(t.lastNeed>1&&e.length>1){if(128!==(192&e[1]))return t.lastNeed=1,"\ufffd";if(t.lastNeed>2&&e.length>2&&128!==(192&e[2]))return t.lastNeed=2,"\ufffd"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function u(t,e){if((t.length-e)%2===0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function h(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function c(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function l(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function f(t){return t.toString(this.encoding)}function d(t){return t&&t.length?this.write(t):""}e.I=o,o.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0)return i>0&&(t.lastNeed=i-1),i;if(--n=0)return i>0&&(t.lastNeed=i-2),i;if(--n=0)return i>0&&(2===i?i=0:t.lastNeed=i-3),i;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)},o.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},2888:(t,e,r)=>{var n=r(6382),i=n.Buffer;function o(t,e){for(var r in t)e[r]=t[r]}function s(t,e,r){return i(t,e,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=n:(o(n,e),e.Buffer=s),o(i,s),s.from=function(t,e,r){if("number"===typeof t)throw new TypeError("Argument must not be a number");return i(t,e,r)},s.alloc=function(t,e,r){if("number"!==typeof t)throw new TypeError("Argument must be a number");var n=i(t);return void 0!==e?"string"===typeof r?n.fill(e,r):n.fill(e):n.fill(0),n},s.allocUnsafe=function(t){if("number"!==typeof t)throw new TypeError("Argument must be a number");return i(t)},s.allocUnsafeSlow=function(t){if("number"!==typeof t)throw new TypeError("Argument must be a number");return n.SlowBuffer(t)}},462:(t,e,r)=>{const n=r(6281);t.exports=n("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},597:(t,e,r)=>{"use strict";var n=r(462);t.exports=function(t){function e(e){var r=e.slice(0,-4),n=e.slice(-4),i=t(r);if(!(n[0]^i[0]|n[1]^i[1]|n[2]^i[2]|n[3]^i[3]))return r}return{encode:function(e){var r=Uint8Array.from(e),i=t(r),o=r.length+4,s=new Uint8Array(o);return s.set(r,0),s.set(i.subarray(0,4),r.length),n.encode(s,o)},decode:function(t){var r=e(n.decode(t));if(!r)throw new Error("Invalid checksum");return r},decodeUnsafe:function(t){var r=n.decodeUnsafe(t);if(r)return e(r)}}}},3630:(t,e,r)=>{"use strict";var{sha256:n}=r(1678),i=r(597);t.exports=i((function(t){return n(n(t))}))},5284:t=>{"use strict";class e extends Error{constructor(t){"string"===typeof t&&(t={message:t}),null!==t&&"object"===typeof t||(t={});let e=null,r="fail",n=Boolean(t.generatedMessage),i=null;var o;if(null!=t.message&&(e="string"===typeof(o=t.message)?o:b(o)?f(o):l(o)),"string"===typeof t.operator&&(r=t.operator),null==e){if("fail"===r)e="Assertion failed.";else{const n=l(t.actual),i=l(t.expected);e="".concat(n," ").concat(r," ").concat(i)}n=!0}"function"===typeof t.stackStartFunction?i=t.stackStartFunction:"function"===typeof t.stackStartFn&&(i=t.stackStartFn),super(e),this.generatedMessage=n,this.code="ERR_ASSERTION",this.actual=t.actual,this.expected=t.expected,this.operator=r,Object.defineProperty(this,"name",{value:"AssertionError [ERR_ASSERTION]",enumerable:!1,writable:!0,configurable:!0}),Error.captureStackTrace&&null!=i&&Error.captureStackTrace(this,i),this.stack,this.name="AssertionError"}toString(){return"".concat(this.name," [").concat(this.code,"]: ").concat(this.message)}}function r(t,n){if(!t){let i=!1;if(0===arguments.length)n="No value argument passed to `assert()`.",i=!0;else if(null==n)n="Assertion failed.",i=!0;else if(b(n))throw n;throw new e({message:n,actual:t,expected:!0,operator:"==",generatedMessage:i,stackStartFn:r})}}function n(t,r,i){if(!Object.is(t,r)){if(b(i))throw i;throw new e({message:i,actual:t,expected:r,operator:"strictEqual",stackStartFn:n})}}function i(t,r,n){if(Object.is(t,r)){if(b(n))throw n;throw new e({message:n,actual:t,expected:r,operator:"notStrictEqual",stackStartFn:i})}}function o(t,r,n){"string"===typeof r&&(n=r,r=void 0);let i=!1,s=null;c("function"===typeof t,"func","function");try{t()}catch(a){i=!0,s=a}if(i){if(d(s,r,n,o)){let t=!1;throw null==n&&(n="Got unwanted exception.",t=!0),new e({message:n,actual:s,expected:r,operator:"doesNotThrow",generatedMessage:t,stackStartFn:o})}throw s}}async function s(t,r,n){"string"===typeof r&&(n=r,r=void 0);let i=!1,o=null;"function"!==typeof t&&c(E(t),"func","promise");try{E(t)?await t:await t()}catch(a){i=!0,o=a}if(!i){let t=!1;throw null==n&&(n="Missing expected rejection.",t=!0),new e({message:n,actual:void 0,expected:r,operator:"rejects",generatedMessage:t,stackStartFn:s})}if(!d(o,r,n,s))throw o}async function a(t,r,n){"string"===typeof r&&(n=r,r=void 0);let i=!1,o=null;"function"!==typeof t&&c(E(t),"func","promise");try{E(t)?await t:await t()}catch(s){i=!0,o=s}if(i){if(d(o,r,n,a)){let t=!1;throw null==n&&(n="Got unwanted rejection.",t=!0),new e({message:n,actual:void 0,expected:r,operator:"doesNotReject",generatedMessage:t,stackStartFn:a})}throw o}}function u(t,r,n){if(!g(t,r,!1)){if(b(n))throw n;throw new e({message:n,actual:t,expected:r,operator:"deepStrictEqual",stackStartFn:u})}}function h(t,r,n){if(g(t,r,!0)){if(b(n))throw n;throw new e({message:n,actual:t,expected:r,operator:"notDeepStrictEqual",stackStartFn:h})}}function c(t,e,r){if(!t){let t;t=null==e?"Invalid type for parameter.":null==r?'Invalid type for "'.concat(e,'".'):'"'.concat(e,'" must be a(n) ').concat(r,".");const n=new TypeError(t);throw Error.captureStackTrace&&Error.captureStackTrace(n,c),n}}function l(t){switch(typeof t){case"undefined":return"undefined";case"object":return null===t?"null":"[".concat(function(t){const e=function(t){return w(t).slice(8,-1)}(t);if(null==t)return e;if("Object"!==e&&"Error"!==e)return e;let r,n;try{r=t.constructor}catch(i){}if(null==r)return e;try{n=r.name}catch(i){return e}return"string"!==typeof n||0===n.length?e:n}(t),"]");case"boolean":case"number":return"".concat(t);case"string":return t.length>80&&(t="".concat(t.substring(0,77),"...")),JSON.stringify(t);case"symbol":return f(t);case"function":return"[".concat(function(t){let e;try{e=t.name}catch(r){}return"string"!==typeof e||0===e.length?"Function":"Function: ".concat(e)}(t),"]");case"bigint":return"".concat(t,"n");default:return"[".concat(typeof t,"]")}}function f(t){try{return String(t)}catch(e){return"Object"}}function d(t,r,n,i){if(null==r)return!0;if(S(r))return r.test(t);if("function"!==typeof r){if(i===o||i===a)throw new TypeError('"expected" must not be an object.');if("object"!==typeof r)throw new TypeError('"expected" must be an object.');let u=!1;if(null==n){n="Missing expected ".concat(i===s?"rejection":"exception","."),u=!0}if(null==t||"object"!==typeof t)throw new e({actual:t,expected:r,message:n,operator:i.name,generatedMessage:u,stackStartFn:i});const h=Object.keys(r);if(b(r)&&h.push("name","message"),0===h.length)throw new TypeError('"expected" may not be an empty object.');for(const o of h){const s=r[o],a=t[o];if(("string"!==typeof a||!S(s)||!s.test(a))&&(!(o in t)||!g(a,s,!1)))throw new e({actual:t,expected:r,message:n,operator:i.name,generatedMessage:u,stackStartFn:i})}return!0}return void 0!==r.prototype&&t instanceof r||!Error.isPrototypeOf(r)&&!0===r.call({},t)}function p(t,r,n,i,o){if(c("string"===typeof t,"string","string"),c(S(r),"regexp","RegExp"),r.test(t)!==o){if(b(n))throw n;let s=!1;throw null==n&&(n="The input ".concat(o?"did":"was expected to"," ")+"not match the regular expression ".concat(r,". ")+"Input:\n\n".concat(l(t),"\n"),s=!0),new e({actual:t,expected:r,message:n,operator:i.name,generatedMessage:s,stackStartFn:i})}}function g(t,e,r){try{return m(t,e,null)}catch(n){return r}}function m(t,e,r){if(Object.is(t,e))return!0;if(!_(t)||!_(e))return!1;if(w(t)!==w(e))return!1;if(Object.getPrototypeOf(t)!==Object.getPrototypeOf(e))return!1;if(v(t)&&v(e))return t.equals(e);if(t instanceof Date)return Object.is(t.getTime(),e.getTime());if(S(t))return t.source===e.source&&t.flags===e.flags;if(b(t)&&t.message!==e.message)return!1;if(function(t){return t instanceof ArrayBuffer}(t)&&(t=new Uint8Array(t),e=new Uint8Array(e)),function(t){return ArrayBuffer.isView(t)}(t)&&!v(t)){if(v(e))return!1;const r=new Uint8Array(t.buffer,t.byteOffset,t.byteLength),n=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);if(r.length!==n.length)return!1;for(let t=0;t9)return!1;switch(t.toLowerCase()){case"ascii":case"binary":case"base64":case"base64url":case"hex":case"latin1":case"ucs2":case"utf8":case"utf16le":case"ucs-2":case"utf-8":case"utf-16le":return!0}return!1}function A(t,e,r){if("string"===typeof e){if(!v(t))return null;const{constructor:n}=t;if(!n||"function"!==typeof n.from)return null;if(!M(r))return null;const i=n.from(e,r);return 3===r.length&&2*i.length!==e.length?null:i}return e}e.prototype.name="AssertionError",e.prototype.type="AssertionError",r.AssertionError=e,r.assert=r,r.strict=r,r.ok=r,r.equal=n,r.notEqual=i,r.strictEqual=n,r.notStrictEqual=i,r.fail=function t(r){let n=!1;if(b(r))throw r;throw null==r&&(r="Assertion failed.",n=!0),new e({message:r,actual:!1,expected:!0,operator:"fail",generatedMessage:n,stackStartFn:t})},r.throws=function t(r,n,i){"string"===typeof n&&(i=n,n=void 0);let o=!1,s=null;c("function"===typeof r,"func","function");try{r()}catch(a){o=!0,s=a}if(!o){let r=!1;throw null==i&&(i="Missing expected exception.",r=!0),new e({message:i,actual:void 0,expected:n,operator:"throws",generatedMessage:r,stackStartFn:t})}if(!d(s,n,i,t))throw s},r.doesNotThrow=o,r.rejects=s,r.doesNotReject=a,r.ifError=function t(r){if(null!=r){let n="ifError got unwanted exception: ";throw"object"===typeof r&&"string"===typeof r.message?0===r.message.length&&r.constructor?n+=r.constructor.name:n+=r.message:n+=l(r),new e({message:n,actual:r,expected:null,operator:"ifError",generatedMessage:!0,stackStartFn:t})}},r.match=function t(e,r,n){p(e,r,n,t,!0)},r.doesNotMatch=function t(e,r,n){p(e,r,n,t,!1)},r.deepEqual=u,r.notDeepEqual=h,r.deepStrictEqual=u,r.notDeepStrictEqual=h,r.bufferEqual=function t(r,n,i,o){if(M(i)||(o=i,i=null),null==i&&(i="hex"),n=A(r,n,i),c(v(r),"actual","buffer"),c(v(n),"expected","buffer"),r!==n&&!r.equals(n)){if(b(o))throw o;throw new e({message:o,actual:r.toString(i),expected:n.toString(i),operator:"bufferEqual",stackStartFn:t})}},r.notBufferEqual=function t(r,n,i,o){if(M(i)||(o=i,i=null),null==i&&(i="hex"),n=A(r,n,i),c(v(r),"actual","buffer"),c(v(n),"expected","buffer"),r===n||r.equals(n)){if(b(o))throw o;throw new e({message:o,actual:r.toString(i),expected:n.toString(i),operator:"notBufferEqual",stackStartFn:t})}},r.enforce=c,r.range=function t(e,r){if(!e){const e=null!=r?'"'.concat(r,'" is out of range.'):"Parameter is out of range.",n=new RangeError(e);throw Error.captureStackTrace&&Error.captureStackTrace(n,t),n}},t.exports=r},8586:(t,e,r)=>{var n=r(6382).Buffer;t.exports=function(t,e){for(var r=Math.min(t.length,e.length),i=new n(r),o=0;o{"use strict";const n=r(4445),i=r(6900),o="function"===typeof Symbol&&"function"===typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=u,e.SlowBuffer=function(t){+t!=t&&(t=0);return u.alloc(+t)},e.INSPECT_MAX_BYTES=50;const s=2147483647;function a(t){if(t>s)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,u.prototype),e}function u(t,e,r){if("number"===typeof t){if("string"===typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return l(t)}return h(t,e,r)}function h(t,e,r){if("string"===typeof t)return function(t,e){"string"===typeof e&&""!==e||(e="utf8");if(!u.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const r=0|g(t,e);let n=a(r);const i=n.write(t,e);i!==r&&(n=n.slice(0,i));return n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(Z(t,Uint8Array)){const e=new Uint8Array(t);return d(e.buffer,e.byteOffset,e.byteLength)}return f(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Z(t,ArrayBuffer)||t&&Z(t.buffer,ArrayBuffer))return d(t,e,r);if("undefined"!==typeof SharedArrayBuffer&&(Z(t,SharedArrayBuffer)||t&&Z(t.buffer,SharedArrayBuffer)))return d(t,e,r);if("number"===typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return u.from(n,e,r);const i=function(t){if(u.isBuffer(t)){const e=0|p(t.length),r=a(e);return 0===r.length||t.copy(r,0,0,e),r}if(void 0!==t.length)return"number"!==typeof t.length||Y(t.length)?a(0):f(t);if("Buffer"===t.type&&Array.isArray(t.data))return f(t.data)}(t);if(i)return i;if("undefined"!==typeof Symbol&&null!=Symbol.toPrimitive&&"function"===typeof t[Symbol.toPrimitive])return u.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function c(t){if("number"!==typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function l(t){return c(t),a(t<0?0:0|p(t))}function f(t){const e=t.length<0?0:0|p(t.length),r=a(e);for(let n=0;n=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|t}function g(t,e){if(u.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Z(t,ArrayBuffer))return t.byteLength;if("string"!==typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return K(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return G(t).length;default:if(i)return n?-1:K(t).length;e=(""+e).toLowerCase(),i=!0}}function m(t,e,r){let n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return T(this,e,r);case"utf8":case"utf-8":return I(this,e,r);case"ascii":return k(this,e,r);case"latin1":case"binary":return x(this,e,r);case"base64":return A(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function y(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function w(t,e,r,n,i){if(0===t.length)return-1;if("string"===typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),Y(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"===typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:v(t,e,r,n,i);if("number"===typeof e)return e&=255,"function"===typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):v(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function v(t,e,r,n,i){let o,s=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,r/=2}function h(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){let n=-1;for(o=r;oa&&(r=a-u),o=r;o>=0;o--){let r=!0;for(let n=0;ni&&(n=i):n=i;const o=e.length;let s;for(n>o/2&&(n=o/2),s=0;s>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function A(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function I(t,e,r){r=Math.min(t.length,r);const n=[];let i=e;for(;i239?4:e>223?3:e>191?2:1;if(i+s<=r){let r,n,a,u;switch(s){case 1:e<128&&(o=e);break;case 2:r=t[i+1],128===(192&r)&&(u=(31&e)<<6|63&r,u>127&&(o=u));break;case 3:r=t[i+1],n=t[i+2],128===(192&r)&&128===(192&n)&&(u=(15&e)<<12|(63&r)<<6|63&n,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:r=t[i+1],n=t[i+2],a=t[i+3],128===(192&r)&&128===(192&n)&&128===(192&a)&&(u=(15&e)<<18|(63&r)<<12|(63&n)<<6|63&a,u>65535&&u<1114112&&(o=u))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=s}return function(t){const e=t.length;if(e<=C)return String.fromCharCode.apply(String,t);let r="",n=0;for(;nn.length?(u.isBuffer(e)||(e=u.from(e)),e.copy(n,i)):Uint8Array.prototype.set.call(n,e,i);else{if(!u.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(n,i)}i+=e.length}return n},u.byteLength=g,u.prototype._isBuffer=!0,u.prototype.swap16=function(){const t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;er&&(t+=" ... "),""},o&&(u.prototype[o]=u.prototype.inspect),u.prototype.compare=function(t,e,r,n,i){if(Z(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;let o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0);const a=Math.min(o,s),h=this.slice(n,i),c=t.slice(e,r);for(let u=0;u>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return b(this,t,e,r);case"utf8":case"utf-8":return _(this,t,e,r);case"ascii":case"latin1":case"binary":return E(this,t,e,r);case"base64":return S(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const C=4096;function k(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;in)&&(r=n);let i="";for(let o=e;or)throw new RangeError("Trying to access beyond buffer length")}function B(t,e,r,n,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function R(t,e,r,n,i){z(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,r}function P(t,e,r,n,i){z(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r+7]=o,o>>=8,t[r+6]=o,o>>=8,t[r+5]=o,o>>=8,t[r+4]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=s,s>>=8,t[r+2]=s,s>>=8,t[r+1]=s,s>>=8,t[r]=s,r+8}function L(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(t,e,r,n,o){return e=+e,r>>>=0,o||L(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function U(t,e,r,n,o){return e=+e,r>>>=0,o||L(t,0,r,8),i.write(t,e,r,n,52,8),r+8}u.prototype.slice=function(t,e){const r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||N(t,e,this.length);let n=this[t],i=1,o=0;for(;++o>>=0,e>>>=0,r||N(t,e,this.length);let n=this[t+--e],i=1;for(;e>0&&(i*=256);)n+=this[t+--e]*i;return n},u.prototype.readUint8=u.prototype.readUInt8=function(t,e){return t>>>=0,e||N(t,1,this.length),this[t]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(t,e){return t>>>=0,e||N(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(t,e){return t>>>=0,e||N(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(t,e){return t>>>=0,e||N(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(t,e){return t>>>=0,e||N(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readBigUInt64LE=J((function(t){V(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||q(t,this.length-8);const n=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+r*2**24;return BigInt(n)+(BigInt(i)<>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||q(t,this.length-8);const n=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+r;return(BigInt(n)<>>=0,e>>>=0,r||N(t,e,this.length);let n=this[t],i=1,o=0;for(;++o=i&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||N(t,e,this.length);let n=e,i=1,o=this[t+--n];for(;n>0&&(i*=256);)o+=this[t+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return t>>>=0,e||N(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){t>>>=0,e||N(t,2,this.length);const r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){t>>>=0,e||N(t,2,this.length);const r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return t>>>=0,e||N(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return t>>>=0,e||N(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readBigInt64LE=J((function(t){V(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||q(t,this.length-8);const n=this[t+4]+256*this[t+5]+65536*this[t+6]+(r<<24);return(BigInt(n)<>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||q(t,this.length-8);const n=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(n)<>>=0,e||N(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return t>>>=0,e||N(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return t>>>=0,e||N(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return t>>>=0,e||N(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){B(this,t,e,r,Math.pow(2,8*r)-1,0)}let i=1,o=0;for(this[e]=255&t;++o>>=0,r>>>=0,!n){B(this,t,e,r,Math.pow(2,8*r)-1,0)}let i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},u.prototype.writeUint8=u.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,1,255,0),this[e]=255&t,e+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeBigUInt64LE=J((function(t){return R(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeBigUInt64BE=J((function(t){return P(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);B(this,t,e,r,n-1,-n)}let i=0,o=1,s=0;for(this[e]=255&t;++i>>=0,!n){const n=Math.pow(2,8*r-1);B(this,t,e,r,n-1,-n)}let i=r-1,o=1,s=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/o|0)-s&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeBigInt64LE=J((function(t){return R(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeBigInt64BE=J((function(t){return P(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeFloatLE=function(t,e,r){return D(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return D(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return U(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return U(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(!u.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"===typeof t)for(i=e;i=n+4;r-=3)e="_".concat(t.slice(r-3,r)).concat(e);return"".concat(t.slice(0,r)).concat(e)}function z(t,e,r,n,i,o){if(t>r||t3?0===e||e===BigInt(0)?">= 0".concat(n," and < 2").concat(n," ** ").concat(8*(o+1)).concat(n):">= -(2".concat(n," ** ").concat(8*(o+1)-1).concat(n,") and < 2 ** ")+"".concat(8*(o+1)-1).concat(n):">= ".concat(e).concat(n," and <= ").concat(r).concat(n),new j.ERR_OUT_OF_RANGE("value",i,t)}!function(t,e,r){V(e,"offset"),void 0!==t[e]&&void 0!==t[e+r]||q(e,t.length-(r+1))}(n,i,o)}function V(t,e){if("number"!==typeof t)throw new j.ERR_INVALID_ARG_TYPE(e,"number",t)}function q(t,e,r){if(Math.floor(t)!==t)throw V(t,r),new j.ERR_OUT_OF_RANGE(r||"offset","an integer",t);if(e<0)throw new j.ERR_BUFFER_OUT_OF_BOUNDS;throw new j.ERR_OUT_OF_RANGE(r||"offset",">= ".concat(r?1:0," and <= ").concat(e),t)}F("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?"".concat(t," is outside of buffer bounds"):"Attempt to access memory outside buffer bounds"}),RangeError),F("ERR_INVALID_ARG_TYPE",(function(t,e){return'The "'.concat(t,'" argument must be of type number. Received type ').concat(typeof e)}),TypeError),F("ERR_OUT_OF_RANGE",(function(t,e,r){let n='The value of "'.concat(t,'" is out of range.'),i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=H(String(r)):"bigint"===typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=H(i)),i+="n"),n+=" It must be ".concat(e,". Received ").concat(i),n}),RangeError);const W=/[^+/0-9A-Za-z-_]/g;function K(t,e){let r;e=e||1/0;const n=t.length;let i=null;const o=[];for(let s=0;s55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function G(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(W,"")).length<2)return"";for(;t.length%4!==0;)t+="=";return t}(t))}function X(t,e,r,n){let i;for(i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Z(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function Y(t){return t!==t}const Q=function(){const t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let i=0;i<16;++i)e[n+i]=t[r]+t[i]}return e}();function J(t){return"undefined"===typeof BigInt?$:t}function $(){throw new Error("BigInt not supported")}},1760:(t,e,r)=>{"use strict";var n=r(6382).Buffer;const i=r(6923),o=r(5544),s=r(6671),a=r(419),u=r(2342),h=r(1334),c=r(6636),l=r(8508);function f(t,e){return function(r,i){if(s(n.isBuffer(r),"data","buffer"),s(i>>>0===i,"off","integer"),i+e>r.length)throw new a(i,"Out of bounds read");return t(r,i)}}function d(t){return function(e,r,i){if(s(n.isBuffer(e),"data","buffer"),s(r>>>0===r,"off","integer"),s(i>>>0===i,"len","integer"),r+i>e.length)throw new a(r,"Out of bounds read");return t(e,r,i)}}function p(t){return function(e,r){return s(n.isBuffer(e),"data","buffer"),s(r>>>0===r,"off","integer"),t(e,r)}}function g(t,e){return function(r,i,o){if(s(n.isBuffer(r),"data","buffer"),s(o>>>0===o,"off","integer"),o+e>r.length)throw new a(o,"Out of bounds write");return t(r,i,o)}}function m(t){return function(e,r,i,o){if(s(n.isBuffer(e),"data","buffer"),s(i>>>0===i,"off","integer"),s(o>>>0===o,"len","integer"),i+o>e.length)throw new a(i,"Out of bounds write");return t(e,r,i,o)}}function y(t,e){return function(r,i,o){if(s(n.isBuffer(r),"data","buffer"),s(o>>>0===o,"off","integer"),o+e(i)>r.length)throw new a(o,"Out of bounds write");return t(r,i,o)}}e.custom=i,e.encoding=o,e.EncodingError=a,e.BufferReader=u,e.BufferWriter=h,e.StaticWriter=c,e.Struct=l,e.read=function(t,e){return new u(t,e)},e.write=function(t){return null!=t?new c(t):new h},e.pool=function(t){return c.pool(t)},e.readU=d(o.readU),e.readU64=f(o.readU64,8),e.readU56=f(o.readU56,7),e.readU48=f(o.readU48,6),e.readU40=f(o.readU40,5),e.readU32=f(o.readU32,4),e.readU24=f(o.readU24,3),e.readU16=f(o.readU16,2),e.readU8=f(o.readU8,1),e.readUBE=d(o.readUBE),e.readU64BE=f(o.readU64BE,8),e.readU56BE=f(o.readU56BE,7),e.readU48BE=f(o.readU48BE,6),e.readU40BE=f(o.readU40BE,5),e.readU32BE=f(o.readU32BE,4),e.readU24BE=f(o.readU24BE,3),e.readU16BE=f(o.readU16BE,2),e.readI=d(o.readI),e.readI64=f(o.readI64,8),e.readI56=f(o.readI56,7),e.readI48=f(o.readI48,6),e.readI40=f(o.readI40,5),e.readI32=f(o.readI32,4),e.readI24=f(o.readI24,3),e.readI16=f(o.readI16,2),e.readI8=f(o.readI8,1),e.readIBE=d(o.readIBE),e.readI64BE=f(o.readI64BE,8),e.readI56BE=f(o.readI56BE,7),e.readI48BE=f(o.readI48BE,6),e.readI40BE=f(o.readI40BE,5),e.readI32BE=f(o.readI32BE,4),e.readI24BE=f(o.readI24BE,3),e.readI16BE=f(o.readI16BE,2),e.readFloat=f(o.readFloat,4),e.readFloatBE=f(o.readFloatBE,4),e.readDouble=f(o.readDouble,8),e.readDoubleBE=f(o.readDoubleBE,8),e.writeU=m(o.writeU),e.writeU64=g(o.writeU64,8),e.writeU56=g(o.writeU56,7),e.writeU48=g(o.writeU48,6),e.writeU40=g(o.writeU40,5),e.writeU32=g(o.writeU32,4),e.writeU24=g(o.writeU24,3),e.writeU16=g(o.writeU16,2),e.writeU8=g(o.writeU8,1),e.writeUBE=m(o.writeUBE),e.writeU64BE=g(o.writeU64BE,8),e.writeU56BE=g(o.writeU56BE,7),e.writeU48BE=g(o.writeU48BE,6),e.writeU40BE=g(o.writeU40BE,5),e.writeU32BE=g(o.writeU32BE,4),e.writeU24BE=g(o.writeU24BE,3),e.writeU16BE=g(o.writeU16BE,2),e.writeI=m(o.writeI),e.writeI64=g(o.writeI64,8),e.writeI56=g(o.writeI56,7),e.writeI48=g(o.writeI48,6),e.writeI40=g(o.writeI40,5),e.writeI32=g(o.writeI32,4),e.writeI24=g(o.writeI24,3),e.writeI16=g(o.writeI16,2),e.writeI8=g(o.writeI8,1),e.writeIBE=m(o.writeIBE),e.writeI64BE=g(o.writeI64BE,8),e.writeI56BE=g(o.writeI56BE,7),e.writeI48BE=g(o.writeI48BE,6),e.writeI40BE=g(o.writeI40BE,5),e.writeI32BE=g(o.writeI32BE,4),e.writeI24BE=g(o.writeI24BE,3),e.writeI16BE=g(o.writeI16BE,2),e.writeFloat=g(o.writeFloat,4),e.writeFloatBE=g(o.writeFloatBE,4),e.writeDouble=g(o.writeDouble,8),e.writeDoubleBE=g(o.writeDoubleBE,8),e.readVarint=p(o.readVarint),e.writeVarint=y(o.writeVarint,o.sizeVarint),e.sizeVarint=o.sizeVarint,e.readVarint2=p(o.readVarint2),e.writeVarint2=y(o.writeVarint2,o.sizeVarint2),e.sizeVarint2=o.sizeVarint2,e.sliceBytes=o.sliceBytes,e.readBytes=o.readBytes,e.writeBytes=o.writeBytes,e.readString=o.readString,e.writeString=o.writeString,e.realloc=o.realloc,e.copy=o.copy,e.concat=o.concat,e.sizeVarBytes=o.sizeVarBytes,e.sizeVarlen=o.sizeVarlen,e.sizeVarString=o.sizeVarString},6923:(t,e)=>{"use strict";e.custom="inspect"},5544:(t,e,r)=>{"use strict";var n=r(6382).Buffer;const i=r(6671),o=r(419),s=1/4294967296,{MAX_SAFE_INTEGER:a}=Number,u=new Float32Array(1),h=new Uint8Array(u.buffer),c=new Float64Array(1),l=new Uint8Array(c.buffer);u[0]=-1;const f=0===h[3];function d(t,e){const r=y(t,e+4),n=y(t,e);return Nt(0===(4292870144&r),e,"Number exceeds 2^53-1"),4294967296*r+n}function p(t,e){const r=w(t,e+4),n=y(t,e);return Nt(0===(4292870144&r),e,"Number exceeds 2^53-1"),4294967296*r+n}function g(t,e){return t[e++]+256*t[e++]+65536*t[e++]+16777216*t[e++]+4294967296*t[e++]+1099511627776*t[e]}function m(t,e){return t[e++]+256*t[e++]+65536*t[e++]+16777216*t[e++]+4294967296*t[e]}function y(t,e){return t[e++]+256*t[e++]+65536*t[e++]+16777216*t[e]}function w(t,e){return t[e++]+256*t[e++]+65536*t[e]}function v(t,e){return t[e++]+256*t[e]}function b(t,e){return t[e]}function _(t,e){const r=A(t,e),n=A(t,e+4);return Nt(0===(4292870144&r),e,"Number exceeds 2^53-1"),4294967296*r+n}function E(t,e){const r=I(t,e),n=A(t,e+3);return Nt(0===(4292870144&r),e,"Number exceeds 2^53-1"),4294967296*r+n}function S(t,e){return 1099511627776*t[e++]+4294967296*t[e++]+16777216*t[e++]+65536*t[e++]+256*t[e++]+t[e]}function M(t,e){return 4294967296*t[e++]+16777216*t[e++]+65536*t[e++]+256*t[e++]+t[e]}function A(t,e){return 16777216*t[e++]+65536*t[e++]+256*t[e++]+t[e]}function I(t,e){return 65536*t[e++]+256*t[e++]+t[e]}function C(t,e){return 256*t[e++]+t[e]}function k(t,e){const r=N(t,e+4),n=y(t,e);return Nt(It(r,n),"Number exceeds 2^53-1"),4294967296*r+n}function x(t,e){const r=B(t,e+4),n=y(t,e);return Nt(It(r,n),"Number exceeds 2^53-1"),4294967296*r+n}function T(t,e){const r=t[e+4]+256*t[e+5];return t[e++]+256*t[e++]+65536*t[e++]+16777216*t[e]+4294967296*(r|131070*(32768&r))}function O(t,e){return t[e++]+256*t[e++]+65536*t[e++]+16777216*t[e++]+4294967296*(t[e]|33554430*(128&t[e]))}function N(t,e){return t[e++]+256*t[e++]+65536*t[e++]+(t[e]<<24)}function B(t,e){const r=t[e++]+256*t[e++]+65536*t[e];return r|510*(8388608&r)}function R(t,e){const r=t[e++]+256*t[e];return r|131070*(32768&r)}function P(t,e){const r=t[e];return r|33554430*(128&r)}function L(t,e){const r=F(t,e),n=A(t,e+4);return Nt(It(r,n),"Number exceeds 2^53-1"),4294967296*r+n}function D(t,e){const r=H(t,e),n=A(t,e+3);return Nt(It(r,n),"Number exceeds 2^53-1"),4294967296*r+n}function U(t,e){const r=256*t[e++]+t[e++];return 4294967296*(r|131070*(32768&r))+16777216*t[e++]+65536*t[e++]+256*t[e++]+t[e]}function j(t,e){const r=t[e++];return 4294967296*(r|33554430*(128&r))+16777216*t[e++]+65536*t[e++]+256*t[e++]+t[e]}function F(t,e){return(t[e++]<<24)+65536*t[e++]+256*t[e++]+t[e]}function H(t,e){const r=65536*t[e++]+256*t[e++]+t[e];return r|510*(8388608&r)}function z(t,e){const r=256*t[e++]+t[e];return r|131070*(32768&r)}function V(t,e){return h[3]=t[e++],h[2]=t[e++],h[1]=t[e++],h[0]=t[e],u[0]}function q(t,e){return h[0]=t[e++],h[1]=t[e++],h[2]=t[e++],h[3]=t[e],u[0]}function W(t,e){return l[7]=t[e++],l[6]=t[e++],l[5]=t[e++],l[4]=t[e++],l[3]=t[e++],l[2]=t[e++],l[1]=t[e++],l[0]=t[e],c[0]}function K(t,e){return l[0]=t[e++],l[1]=t[e++],l[2]=t[e++],l[3]=t[e++],l[4]=t[e++],l[5]=t[e++],l[6]=t[e++],l[7]=t[e],c[0]}const G=f?V:q,X=f?q:V,Z=f?W:K,Y=f?K:W;function Q(t,e,r){return i(Number.isSafeInteger(e),"num","integer"),Ct(t,e,r,!1)}function J(t,e,r){return i(Number.isSafeInteger(e),"num","integer"),kt(t,e,r,!1)}function $(t,e,r){i(Number.isSafeInteger(e),"num","integer");const n=e*s|0;return t[r++]=e,e>>>=8,t[r++]=e,e>>>=8,t[r++]=e,e>>>=8,t[r++]=e,t[r++]=n,t[r++]=n>>>8,r}function tt(t,e,r){i(Number.isSafeInteger(e),"num","integer");const n=e*s|0;return t[r++]=e,e>>>=8,t[r++]=e,e>>>=8,t[r++]=e,e>>>=8,t[r++]=e,t[r++]=n,r}function et(t,e,r){return i(Number.isSafeInteger(e),"num","integer"),t[r++]=e,e>>>=8,t[r++]=e,e>>>=8,t[r++]=e,e>>>=8,t[r++]=e,r}function rt(t,e,r){return i(Number.isSafeInteger(e),"num","integer"),t[r++]=e,e>>>=8,t[r++]=e,e>>>=8,t[r++]=e,r}function nt(t,e,r){return i(Number.isSafeInteger(e),"num","integer"),t[r++]=e,t[r++]=e>>>8,r}function it(t,e,r){return i(Number.isSafeInteger(e),"num","integer"),t[r]=e,r+1}function ot(t,e,r){return i(Number.isSafeInteger(e),"num","integer"),Ct(t,e,r,!0)}function st(t,e,r){return i(Number.isSafeInteger(e),"num","integer"),kt(t,e,r,!0)}function at(t,e,r){i(Number.isSafeInteger(e),"num","integer");const n=e*s|0;return t[r++]=n>>>8,t[r++]=n,t[r+3]=e,e>>>=8,t[r+2]=e,e>>>=8,t[r+1]=e,e>>>=8,t[r]=e,r+4}function ut(t,e,r){i(Number.isSafeInteger(e),"num","integer");const n=e*s|0;return t[r++]=n,t[r+3]=e,e>>>=8,t[r+2]=e,e>>>=8,t[r+1]=e,e>>>=8,t[r]=e,r+4}function ht(t,e,r){return i(Number.isSafeInteger(e),"num","integer"),t[r+3]=e,e>>>=8,t[r+2]=e,e>>>=8,t[r+1]=e,e>>>=8,t[r]=e,r+4}function ct(t,e,r){return i(Number.isSafeInteger(e),"num","integer"),t[r+2]=e,e>>>=8,t[r+1]=e,e>>>=8,t[r]=e,r+3}function lt(t,e,r){return i(Number.isSafeInteger(e),"num","integer"),t[r++]=e>>>8,t[r++]=e,r}function ft(t,e,r){return et(t,e,r)}function dt(t,e,r){return rt(t,e,r)}function pt(t,e,r){return ht(t,e,r)}function gt(t,e,r){return ct(t,e,r)}function mt(t,e,r){return i(Tt(e),"num","number"),c[0]=e,t[r++]=l[0],t[r++]=l[1],t[r++]=l[2],t[r++]=l[3],t[r++]=l[4],t[r++]=l[5],t[r++]=l[6],t[r++]=l[7],r}function yt(t,e,r){return i(Tt(e),"num","number"),c[0]=e,t[r++]=l[7],t[r++]=l[6],t[r++]=l[5],t[r++]=l[4],t[r++]=l[3],t[r++]=l[2],t[r++]=l[1],t[r++]=l[0],r}function wt(t,e,r){return i(Tt(e),"num","number"),u[0]=e,t[r++]=h[0],t[r++]=h[1],t[r++]=h[2],t[r++]=h[3],r}function vt(t,e,r){return i(Tt(e),"num","number"),u[0]=e,t[r++]=h[3],t[r++]=h[2],t[r++]=h[1],t[r++]=h[0],r}const bt=f?vt:wt,_t=f?wt:vt,Et=f?yt:mt,St=f?mt:yt;function Mt(t){return i(Number.isSafeInteger(t),"num","integer"),t<253?1:t<=65535?3:t<=4294967295?5:9}function At(t,e){i(n.isBuffer(t),"data","buffer");const r=n.allocUnsafeSlow(e);return t.copy(r,0),r}function It(t,e){return t<0&&(t=~t,0===e&&(t+=1)),0===(4292870144&t)}function Ct(t,e,r,n){let i=!1;e<0&&(e=-e,i=!0);let o=e*s|0,a=0|e;return i&&(0===a?o=1+~o|0:(o=~o,a=1+~a)),n?(r=pt(t,o,r),r=pt(t,a,r)):(r=ft(t,a,r),r=ft(t,o,r)),r}function kt(t,e,r,n){let i=!1;e<0&&(e=-e,i=!0);let o=e*s|0,a=0|e;return i&&(0===a?o=1+~o|0:(o=~o,a=1+~a)),r=n?pt(t,a,r=gt(t,o,r)):dt(t,o,r=ft(t,a,r))}class xt{constructor(t,e){this.size=t,this.value=e}}function Tt(t){return"number"===typeof t&&isFinite(t)}function Ot(t,e){if(!t)throw new o(e,"Out of bounds read",Ot)}function Nt(t,e,r){if(!t)throw new o(e,r,Nt)}e.readU=function(t,e,r){switch(r){case 8:return d(t,e);case 7:return p(t,e);case 6:return g(t,e);case 5:return m(t,e);case 4:return y(t,e);case 3:return w(t,e);case 2:return v(t,e);case 1:return b(t,e);default:throw new o(e,"Invalid read length")}},e.readU64=d,e.readU56=p,e.readU48=g,e.readU40=m,e.readU32=y,e.readU24=w,e.readU16=v,e.readU8=b,e.readUBE=function(t,e,r){switch(r){case 8:return _(t,e);case 7:return E(t,e);case 6:return S(t,e);case 5:return M(t,e);case 4:return A(t,e);case 3:return I(t,e);case 2:return C(t,e);case 1:return b(t,e);default:throw new o(e,"Invalid read length")}},e.readU64BE=_,e.readU56BE=E,e.readU48BE=S,e.readU40BE=M,e.readU32BE=A,e.readU24BE=I,e.readU16BE=C,e.readI=function(t,e,r){switch(r){case 8:return k(t,e);case 7:return x(t,e);case 6:return T(t,e);case 5:return O(t,e);case 4:return N(t,e);case 3:return B(t,e);case 2:return R(t,e);case 1:return P(t,e);default:throw new o(e,"Invalid read length")}},e.readI64=k,e.readI56=x,e.readI48=T,e.readI40=O,e.readI32=N,e.readI24=B,e.readI16=R,e.readI8=P,e.readIBE=function(t,e,r){switch(r){case 8:return L(t,e);case 7:return D(t,e);case 6:return U(t,e);case 5:return j(t,e);case 4:return F(t,e);case 3:return H(t,e);case 2:return z(t,e);case 1:return P(t,e);default:throw new o(e,"Invalid read length")}},e.readI64BE=L,e.readI56BE=D,e.readI48BE=U,e.readI40BE=j,e.readI32BE=F,e.readI24BE=H,e.readI16BE=z,e.readFloat=G,e.readFloatBE=X,e.readDouble=Z,e.readDoubleBE=Y,e.writeU=function(t,e,r,n){switch(n){case 8:return Q(t,e,r);case 7:return J(t,e,r);case 6:return $(t,e,r);case 5:return tt(t,e,r);case 4:return et(t,e,r);case 3:return rt(t,e,r);case 2:return nt(t,e,r);case 1:return it(t,e,r);default:throw new o(r,"Invalid write length")}},e.writeU64=Q,e.writeU56=J,e.writeU48=$,e.writeU40=tt,e.writeU32=et,e.writeU24=rt,e.writeU16=nt,e.writeU8=it,e.writeUBE=function(t,e,r,n){switch(n){case 8:return ot(t,e,r);case 7:return st(t,e,r);case 6:return at(t,e,r);case 5:return ut(t,e,r);case 4:return ht(t,e,r);case 3:return ct(t,e,r);case 2:return lt(t,e,r);case 1:return it(t,e,r);default:throw new o(r,"Invalid write length")}},e.writeU64BE=ot,e.writeU56BE=st,e.writeU48BE=at,e.writeU40BE=ut,e.writeU32BE=ht,e.writeU24BE=ct,e.writeU16BE=lt,e.writeI=function(t,e,r,n){switch(n){case 8:return Q(t,e,r);case 7:return J(t,e,r);case 6:return $(t,e,r);case 5:return tt(t,e,r);case 4:return rt(t,e,r);case 3:return et(t,e,r);case 2:return nt(t,e,r);case 1:return it(t,e,r);default:throw new o(r,"Invalid write length")}},e.writeI64=function(t,e,r){return Q(t,e,r)},e.writeI56=function(t,e,r){return J(t,e,r)},e.writeI48=function(t,e,r){return $(t,e,r)},e.writeI40=function(t,e,r){return tt(t,e,r)},e.writeI32=ft,e.writeI24=dt,e.writeI16=function(t,e,r){return nt(t,e,r)},e.writeI8=function(t,e,r){return it(t,e,r)},e.writeIBE=function(t,e,r,n){switch(n){case 8:return ot(t,e,r);case 7:return st(t,e,r);case 6:return at(t,e,r);case 5:return ut(t,e,r);case 4:return ht(t,e,r);case 3:return ct(t,e,r);case 2:return lt(t,e,r);case 1:return it(t,e,r);default:throw new o(r,"Invalid write length")}},e.writeI64BE=function(t,e,r){return ot(t,e,r)},e.writeI56BE=function(t,e,r){return st(t,e,r)},e.writeI48BE=function(t,e,r){return at(t,e,r)},e.writeI40BE=function(t,e,r){return ut(t,e,r)},e.writeI32BE=pt,e.writeI24BE=gt,e.writeI16BE=function(t,e,r){return lt(t,e,r)},e.writeFloat=bt,e.writeFloatBE=_t,e.writeDouble=Et,e.writeDoubleBE=St,e.readVarint=function(t,e){let r,n;switch(Ot(e4294967295,e,"Non-canonical varint");break;case 254:n=5,Ot(e+n<=t.length,e),r=y(t,e+1),Nt(r>65535,e,"Non-canonical varint");break;case 253:n=3,Ot(e+n<=t.length,e),r=v(t,e+1),Nt(r>=253,e,"Non-canonical varint");break;default:n=1,r=t[e]}return new xt(n,r)},e.writeVarint=function(t,e,r){return i(Number.isSafeInteger(e),"num","integer"),e<253?(t[r++]=e,r):e<=65535?(t[r++]=253,nt(t,e,r)):e<=4294967295?(t[r++]=254,et(t,e,r)):(t[r++]=255,Q(t,e,r))},e.sizeVarint=Mt,e.readVarint2=function(t,e){let r=0,n=0;for(;;){Ot(e>>0===e,"off","integer"),i(r>>>0===r,"size","integer"),e+r>t.length)throw new o(e,"Out of bounds read");return t.slice(e,e+r)},e.readBytes=function(t,e,r){if(i(n.isBuffer(t),"data","buffer"),i(e>>>0===e,"off","integer"),i(r>>>0===r,"size","integer"),e+r>t.length)throw new o(e,"Out of bounds read");const s=n.allocUnsafeSlow(r);return t.copy(s,0,e,e+r),s},e.writeBytes=function(t,e,r){if(i(n.isBuffer(t),"data","buffer"),i(n.isBuffer(e),"value","buffer"),i(r>>>0===r,"off","integer"),r+e.length>t.length)throw new o(r,"Out of bounds write");return e.copy(t,r,0,e.length)},e.readString=function(t,e,r,s){if(null==s&&(s="binary"),i(n.isBuffer(t),"data","buffer"),i(e>>>0===e,"off","integer"),i(r>>>0===r,"size","integer"),i("string"===typeof s,"enc","string"),e+r>t.length)throw new o(e,"Out of bounds read");return t.toString(s,e,e+r)},e.writeString=function(t,e,r,s){if(null==s&&(s="binary"),i(n.isBuffer(t),"data","buffer"),i("string"===typeof e,"str","string"),i(r>>>0===r,"off","integer"),i("string"===typeof s,"enc","string"),0===e.length)return 0;if(r+n.byteLength(e,s)>t.length)throw new o(r,"Out of bounds write");return t.write(e,r,s)},e.realloc=At,e.copy=function(t){return i(n.isBuffer(t),"data","buffer"),At(t,t.length)},e.concat=function(t,e){i(n.isBuffer(t),"a","buffer"),i(n.isBuffer(e),"b","buffer");const r=t.length+e.length,o=n.allocUnsafeSlow(r);return t.copy(o,0),e.copy(o,t.length),o},e.sizeVarBytes=function(t){return i(n.isBuffer(t),"data","buffer"),Mt(t.length)+t.length},e.sizeVarlen=function(t){return Mt(t)+t},e.sizeVarString=function(t,e){if(null==e&&(e="binary"),i("string"===typeof t,"str","string"),i("string"===typeof e,"enc","string"),0===t.length)return 1;const r=n.byteLength(t,e);return Mt(r)+r}},6671:t=>{"use strict";t.exports=function t(e,r,n){if(!e){const e=new TypeError("'".concat(r,"' must be a(n) ").concat(n,"."));throw Error.captureStackTrace&&Error.captureStackTrace(e,t),e}}},419:t=>{"use strict";class e extends Error{constructor(t,r,n){super(),this.type="EncodingError",this.name="EncodingError",this.code="ERR_ENCODING",this.message="".concat(r," (offset=").concat(t,")."),Error.captureStackTrace&&Error.captureStackTrace(this,n||e)}}t.exports=e},2342:(t,e,r)=>{"use strict";var n=r(6382).Buffer;const i=r(6671),o=r(5544),s=r(419),a=n.alloc(0);t.exports=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];i(n.isBuffer(t),"data","buffer"),i("boolean"===typeof e,"zeroCopy","boolean"),this.data=t,this.offset=0,this.zeroCopy=e,this.stack=[]}check(t){if(this.offset+t>this.data.length)throw new s(this.offset,"Out of bounds read",this.check)}getSize(){return this.data.length}left(){return this.check(0),this.data.length-this.offset}seek(t){if(i(Number.isSafeInteger(t),"off","integer"),this.offset+t<0)throw new s(this.offset,"Out of bounds read");return this.check(t),this.offset+=t,this}start(){return this.stack.push(this.offset),this.offset}end(){if(0===this.stack.length)throw new Error("Cannot end without a stack item.");const t=this.stack.pop();return this.offset-t}endData(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(i("boolean"===typeof t,"zeroCopy","boolean"),0===this.stack.length)throw new Error("Cannot end without a stack item.");const e=this.stack.pop(),r=this.offset,o=r-e,s=this.data;if(o===s.length)return s;if(this.zeroCopy||t)return s.slice(e,r);const a=n.allocUnsafeSlow(o);return s.copy(a,0,e,r),a}destroy(){return this.data=a,this.offset=0,this.stack.length=0,this}readU8(){this.check(1);const t=this.data[this.offset];return this.offset+=1,t}readU16(){this.check(2);const t=o.readU16(this.data,this.offset);return this.offset+=2,t}readU16BE(){this.check(2);const t=o.readU16BE(this.data,this.offset);return this.offset+=2,t}readU24(){this.check(3);const t=o.readU24(this.data,this.offset);return this.offset+=3,t}readU24BE(){this.check(3);const t=o.readU24BE(this.data,this.offset);return this.offset+=3,t}readU32(){this.check(4);const t=o.readU32(this.data,this.offset);return this.offset+=4,t}readU32BE(){this.check(4);const t=o.readU32BE(this.data,this.offset);return this.offset+=4,t}readU40(){this.check(5);const t=o.readU40(this.data,this.offset);return this.offset+=5,t}readU40BE(){this.check(5);const t=o.readU40BE(this.data,this.offset);return this.offset+=5,t}readU48(){this.check(6);const t=o.readU48(this.data,this.offset);return this.offset+=6,t}readU48BE(){this.check(6);const t=o.readU48BE(this.data,this.offset);return this.offset+=6,t}readU56(){this.check(7);const t=o.readU56(this.data,this.offset);return this.offset+=7,t}readU56BE(){this.check(7);const t=o.readU56BE(this.data,this.offset);return this.offset+=7,t}readU64(){this.check(8);const t=o.readU64(this.data,this.offset);return this.offset+=8,t}readU64BE(){this.check(8);const t=o.readU64BE(this.data,this.offset);return this.offset+=8,t}readI8(){this.check(1);const t=o.readI8(this.data,this.offset);return this.offset+=1,t}readI16(){this.check(2);const t=o.readI16(this.data,this.offset);return this.offset+=2,t}readI16BE(){this.check(2);const t=o.readI16BE(this.data,this.offset);return this.offset+=2,t}readI24(){this.check(3);const t=o.readI24(this.data,this.offset);return this.offset+=3,t}readI24BE(){this.check(3);const t=o.readI24BE(this.data,this.offset);return this.offset+=3,t}readI32(){this.check(4);const t=o.readI32(this.data,this.offset);return this.offset+=4,t}readI32BE(){this.check(4);const t=o.readI32BE(this.data,this.offset);return this.offset+=4,t}readI40(){this.check(5);const t=o.readI40(this.data,this.offset);return this.offset+=5,t}readI40BE(){this.check(5);const t=o.readI40BE(this.data,this.offset);return this.offset+=5,t}readI48(){this.check(6);const t=o.readI48(this.data,this.offset);return this.offset+=6,t}readI48BE(){this.check(6);const t=o.readI48BE(this.data,this.offset);return this.offset+=6,t}readI56(){this.check(7);const t=o.readI56(this.data,this.offset);return this.offset+=7,t}readI56BE(){this.check(7);const t=o.readI56BE(this.data,this.offset);return this.offset+=7,t}readI64(){this.check(8);const t=o.readI64(this.data,this.offset);return this.offset+=8,t}readI64BE(){this.check(8);const t=o.readI64BE(this.data,this.offset);return this.offset+=8,t}readFloat(){this.check(4);const t=o.readFloat(this.data,this.offset);return this.offset+=4,t}readFloatBE(){this.check(4);const t=o.readFloatBE(this.data,this.offset);return this.offset+=4,t}readDouble(){this.check(8);const t=o.readDouble(this.data,this.offset);return this.offset+=8,t}readDoubleBE(){this.check(8);const t=o.readDoubleBE(this.data,this.offset);return this.offset+=8,t}readVarint(){const{size:t,value:e}=o.readVarint(this.data,this.offset);return this.offset+=t,e}readVarint2(){const{size:t,value:e}=o.readVarint2(this.data,this.offset);return this.offset+=t,e}readBytes(t){let e,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return i(t>>>0===t,"size","integer"),i("boolean"===typeof r,"zeroCopy","boolean"),this.check(t),this.zeroCopy||r?e=this.data.slice(this.offset,this.offset+t):(e=n.allocUnsafeSlow(t),this.data.copy(e,0,this.offset,this.offset+t)),this.offset+=t,e}readVarBytes(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.readBytes(this.readVarint(),t)}readChild(t){i(t>>>0===t,"size","integer"),this.check(t);const e=this.data.slice(0,this.offset+t),r=new this.constructor(e);return r.offset=this.offset,this.offset+=t,r}readString(t,e){null==e&&(e="binary"),i(t>>>0===t,"size","integer"),i("string"===typeof e,"enc","string"),this.check(t);const r=this.data.toString(e,this.offset,this.offset+t);return this.offset+=t,r}readHash(t){return t?this.readString(32,t):this.readBytes(32)}readVarString(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;null==t&&(t="binary"),i("string"===typeof t,"enc","string"),i(e>>>0===e,"limit","integer");const r=this.readVarint();if(0!==e&&r>e)throw new s(this.offset,"String exceeds limit");return this.readString(r,t)}readNullString(t){null==t&&(t="binary"),i("string"===typeof t,"enc","string");let e=this.offset;for(;e0&&(e=this.stack[this.stack.length-1]);const r=this.data.slice(e,this.offset),n=t.digest?t.digest(r):t(r);return o.readU32(n,0)}verifyChecksum(t){const e=this.createChecksum(t);if(e!==this.readU32())throw new s(this.offset,"Checksum mismatch");return e}}},6636:(t,e,r)=>{"use strict";var n=r(6382).Buffer;const i=r(6671),o=r(5544),s=r(419),a=n.alloc(0),u=102400;let h=null;class c{constructor(t){this.data=a,this.offset=0,null!=t&&this.init(t)}check(t){if(this.offset+t>this.data.length)throw new s(this.offset,"Out of bounds write",this.check)}init(t){return n.isBuffer(t)?(this.data=t,this.offset=0,this):(i(t>>>0===t,"size","integer"),this.data=n.allocUnsafeSlow(t),this.offset=0,this)}static pool(t){if(i(t>>>0===t,"size","integer"),t<=u){h||(h=n.allocUnsafeSlow(u));const e=new c;return e.data=h.slice(0,t),e}return new c(t)}render(){const{data:t,offset:e}=this;if(e!==t.length)throw new s(e,"Out of bounds write");return this.destroy(),t}slice(){const{data:t,offset:e}=this;if(e>t.length)throw new s(e,"Out of bounds write");return this.destroy(),t.slice(0,e)}getSize(){return this.offset}seek(t){if(i(Number.isSafeInteger(t),"off","integer"),this.offset+t<0)throw new s(this.offset,"Out of bounds write");return this.check(t),this.offset+=t,this}destroy(){return this.data=a,this.offset=0,this}writeU8(t){return this.check(1),this.offset=o.writeU8(this.data,t,this.offset),this}writeU16(t){return this.check(2),this.offset=o.writeU16(this.data,t,this.offset),this}writeU16BE(t){return this.check(2),this.offset=o.writeU16BE(this.data,t,this.offset),this}writeU24(t){return this.check(3),this.offset=o.writeU24(this.data,t,this.offset),this}writeU24BE(t){return this.check(3),this.offset=o.writeU24BE(this.data,t,this.offset),this}writeU32(t){return this.check(4),this.offset=o.writeU32(this.data,t,this.offset),this}writeU32BE(t){return this.check(4),this.offset=o.writeU32BE(this.data,t,this.offset),this}writeU40(t){return this.check(5),this.offset=o.writeU40(this.data,t,this.offset),this}writeU40BE(t){return this.check(5),this.offset=o.writeU40BE(this.data,t,this.offset),this}writeU48(t){return this.check(6),this.offset=o.writeU48(this.data,t,this.offset),this}writeU48BE(t){return this.check(6),this.offset=o.writeU48BE(this.data,t,this.offset),this}writeU56(t){return this.check(7),this.offset=o.writeU56(this.data,t,this.offset),this}writeU56BE(t){return this.check(7),this.offset=o.writeU56BE(this.data,t,this.offset),this}writeU64(t){return this.check(8),this.offset=o.writeU64(this.data,t,this.offset),this}writeU64BE(t){return this.check(8),this.offset=o.writeU64BE(this.data,t,this.offset),this}writeI8(t){return this.check(1),this.offset=o.writeI8(this.data,t,this.offset),this}writeI16(t){return this.check(2),this.offset=o.writeI16(this.data,t,this.offset),this}writeI16BE(t){return this.check(2),this.offset=o.writeI16BE(this.data,t,this.offset),this}writeI24(t){return this.check(3),this.offset=o.writeI24(this.data,t,this.offset),this}writeI24BE(t){return this.check(3),this.offset=o.writeI24BE(this.data,t,this.offset),this}writeI32(t){return this.check(4),this.offset=o.writeI32(this.data,t,this.offset),this}writeI32BE(t){return this.check(4),this.offset=o.writeI32BE(this.data,t,this.offset),this}writeI40(t){return this.check(5),this.offset=o.writeI40(this.data,t,this.offset),this}writeI40BE(t){return this.check(5),this.offset=o.writeI40BE(this.data,t,this.offset),this}writeI48(t){return this.check(6),this.offset=o.writeI48(this.data,t,this.offset),this}writeI48BE(t){return this.check(6),this.offset=o.writeI48BE(this.data,t,this.offset),this}writeI56(t){return this.check(7),this.offset=o.writeI56(this.data,t,this.offset),this}writeI56BE(t){return this.check(7),this.offset=o.writeI56BE(this.data,t,this.offset),this}writeI64(t){return this.check(8),this.offset=o.writeI64(this.data,t,this.offset),this}writeI64BE(t){return this.check(8),this.offset=o.writeI64BE(this.data,t,this.offset),this}writeFloat(t){return this.check(4),this.offset=o.writeFloat(this.data,t,this.offset),this}writeFloatBE(t){return this.check(4),this.offset=o.writeFloatBE(this.data,t,this.offset),this}writeDouble(t){return this.check(8),this.offset=o.writeDouble(this.data,t,this.offset),this}writeDoubleBE(t){return this.check(8),this.offset=o.writeDoubleBE(this.data,t,this.offset),this}writeVarint(t){return this.offset=o.writeVarint(this.data,t,this.offset),this}writeVarint2(t){return this.offset=o.writeVarint2(this.data,t,this.offset),this}writeBytes(t){return i(n.isBuffer(t),"value","buffer"),this.check(t.length),this.offset+=t.copy(this.data,this.offset),this}writeVarBytes(t){return i(n.isBuffer(t),"value","buffer"),this.writeVarint(t.length),this.writeBytes(t),this}copy(t,e,r){return i(n.isBuffer(t),"value","buffer"),i(e>>>0===e,"start","integer"),i(r>>>0===r,"end","integer"),i(r>=e,"start","integer"),this.check(r-e),this.offset+=t.copy(this.data,this.offset,e,r),this}writeString(t,e){if(null==e&&(e="binary"),i("string"===typeof t,"value","string"),i("string"===typeof e,"enc","string"),0===t.length)return this;const r=n.byteLength(t,e);return this.check(r),this.offset+=this.data.write(t,this.offset,e),this}writeHash(t){return"string"!==typeof t?(i(n.isBuffer(t),"value","buffer"),i(32===t.length,"value","32-byte hash"),this.writeBytes(t),this):(i(64===t.length,"value","32-byte hash"),this.check(32),this.offset+=this.data.write(t,this.offset,"hex"),this)}writeVarString(t,e){if(null==e&&(e="binary"),i("string"===typeof t,"value","string"),i("string"===typeof e,"enc","string"),0===t.length)return this.writeVarint(0),this;const r=n.byteLength(t,e);return this.writeVarint(r),this.check(r),this.offset+=this.data.write(t,this.offset,e),this}writeNullString(t,e){return this.writeString(t,e),this.writeU8(0),this}writeChecksum(t){t&&"function"===typeof t.digest||i("function"===typeof t,"hash","function"),this.check(4);const e=this.data.slice(0,this.offset);return(t.digest?t.digest(e):t(e)).copy(this.data,this.offset,0,4),this.offset+=4,this}fill(t,e){return i((255&t)===t,"value","byte"),i(e>>>0===e,"size","integer"),this.check(e),this.data.fill(t,this.offset,this.offset+e),this.offset+=e,this}}t.exports=c},8508:(t,e,r)=>{"use strict";var n=r(6382).Buffer;const i=r(6671),o=r(2342),s=r(1334),a=r(6636),{custom:u}=r(6923);t.exports=class{constructor(){}inject(t){return i(t instanceof this.constructor,"obj","struct"),this.decode(t.encode())}clone(){return(new this.constructor).inject(this)}getSize(t){return-1}write(t,e){return t}read(t,e){return this}toString(){return Object.prototype.toString.call(this)}fromString(t,e){return this}getJSON(){return this}fromJSON(t,e){return this}fromOptions(t,e){return this}from(t,e){return this.fromOptions(t,e)}format(){return this.getJSON()}encode(t){const e=this.getSize(t),r=-1===e?new s:new a(e);return this.write(r,t),r.render()}decode(t,e){const r=new o(t);return this.read(r,e),this}toHex(t){return this.encode(t).toString("hex")}fromHex(t,e){i("string"===typeof t,"str","string");const r=t.length>>>1,o=n.from(t,"hex");if(o.length!==r)throw new Error("Invalid hex string.");return this.decode(o,e)}toBase64(t){return this.encode(t).toString("base64")}fromBase64(t,e){i("string"===typeof t,"str","string");const r=n.from(t,"base64");if(t.length>(4*r.length/3+3&-4)>>>0)throw new Error("Invalid base64 string.");return this.decode(r,e)}toJSON(){return this.getJSON()}[u](){return this.format()}static read(t,e){return(new this).read(t,e)}static decode(t,e){return(new this).decode(t,e)}static fromHex(t,e){return(new this).fromHex(t,e)}static fromBase64(t,e){return(new this).fromBase64(t,e)}static fromString(t,e){return(new this).fromString(t,e)}static fromJSON(t,e){return(new this).fromJSON(t,e)}static fromOptions(t,e){return(new this).fromOptions(t,e)}static from(t,e){return(new this).from(t,e)}toWriter(t,e){return this.write(t,e)}fromReader(t,e){return this.read(t,e)}toRaw(t){return this.encode(t)}fromRaw(t,e){return this.decode(t,e)}static fromReader(t,e){return this.read(t,e)}static fromRaw(t,e){return this.decode(t,e)}}},1334:(t,e,r)=>{"use strict";var n=r(6382).Buffer;const i=r(6671),o=r(5544),s=r(419);class a{constructor(t){this.type=t}}class u extends a{constructor(t,e){super(t),this.value=e}}class h extends a{constructor(t,e){super(t),this.data=e}}class c extends a{constructor(t,e,r){super(t),this.value=e,this.enc=r}}class l extends a{constructor(t,e){super(t),this.func=e}}class f extends a{constructor(t,e,r){super(t),this.value=e,this.size=r}}t.exports=class{constructor(){this.ops=[],this.offset=0}render(){const t=n.allocUnsafeSlow(this.offset);let e=0;for(const r of this.ops)switch(r.type){case 0:e+=r.value;break;case 1:e=o.writeU8(t,r.value,e);break;case 2:e=o.writeU16(t,r.value,e);break;case 3:e=o.writeU16BE(t,r.value,e);break;case 4:e=o.writeU24(t,r.value,e);break;case 5:e=o.writeU24BE(t,r.value,e);break;case 6:e=o.writeU32(t,r.value,e);break;case 7:e=o.writeU32BE(t,r.value,e);break;case 8:e=o.writeU40(t,r.value,e);break;case 9:e=o.writeU40BE(t,r.value,e);break;case 10:e=o.writeU48(t,r.value,e);break;case 11:e=o.writeU48BE(t,r.value,e);break;case 12:e=o.writeU56(t,r.value,e);break;case 13:e=o.writeU56BE(t,r.value,e);break;case 14:e=o.writeU64(t,r.value,e);break;case 15:e=o.writeU64BE(t,r.value,e);break;case 16:e=o.writeI8(t,r.value,e);break;case 17:e=o.writeI16(t,r.value,e);break;case 18:e=o.writeI16BE(t,r.value,e);break;case 19:e=o.writeI24(t,r.value,e);break;case 20:e=o.writeI24BE(t,r.value,e);break;case 21:e=o.writeI32(t,r.value,e);break;case 22:e=o.writeI32BE(t,r.value,e);break;case 23:e=o.writeI40(t,r.value,e);break;case 24:e=o.writeI40BE(t,r.value,e);break;case 25:e=o.writeI48(t,r.value,e);break;case 26:e=o.writeI48BE(t,r.value,e);break;case 27:e=o.writeI56(t,r.value,e);break;case 28:e=o.writeI56BE(t,r.value,e);break;case 29:e=o.writeI64(t,r.value,e);break;case 30:e=o.writeI64BE(t,r.value,e);break;case 31:e=o.writeFloat(t,r.value,e);break;case 32:e=o.writeFloatBE(t,r.value,e);break;case 33:e=o.writeDouble(t,r.value,e);break;case 34:e=o.writeDoubleBE(t,r.value,e);break;case 35:e=o.writeVarint(t,r.value,e);break;case 36:e=o.writeVarint2(t,r.value,e);break;case 37:e+=r.data.copy(t,e);break;case 38:e+=t.write(r.value,e,r.enc);break;case 39:e+=r.func(t.slice(0,e)).copy(t,e,0,4);break;case 40:t.fill(r.value,e,e+r.size),e+=r.size;break;default:throw new Error("Invalid type.")}if(e!==t.length)throw new s(e,"Out of bounds write");return this.destroy(),t}getSize(){return this.offset}seek(t){if(i(Number.isSafeInteger(t),"off","integer"),this.offset+t<0)throw new s(this.offset,"Out of bounds write");return this.offset+=t,this.ops.push(new u(0,t)),this}destroy(){return this.ops.length=0,this.offset=0,this}writeU8(t){return this.offset+=1,this.ops.push(new u(1,t)),this}writeU16(t){return this.offset+=2,this.ops.push(new u(2,t)),this}writeU16BE(t){return this.offset+=2,this.ops.push(new u(3,t)),this}writeU24(t){return this.offset+=3,this.ops.push(new u(4,t)),this}writeU24BE(t){return this.offset+=3,this.ops.push(new u(5,t)),this}writeU32(t){return this.offset+=4,this.ops.push(new u(6,t)),this}writeU32BE(t){return this.offset+=4,this.ops.push(new u(7,t)),this}writeU40(t){return this.offset+=5,this.ops.push(new u(8,t)),this}writeU40BE(t){return this.offset+=5,this.ops.push(new u(9,t)),this}writeU48(t){return this.offset+=6,this.ops.push(new u(10,t)),this}writeU48BE(t){return this.offset+=6,this.ops.push(new u(11,t)),this}writeU56(t){return this.offset+=7,this.ops.push(new u(12,t)),this}writeU56BE(t){return this.offset+=7,this.ops.push(new u(13,t)),this}writeU64(t){return this.offset+=8,this.ops.push(new u(14,t)),this}writeU64BE(t){return this.offset+=8,this.ops.push(new u(15,t)),this}writeI8(t){return this.offset+=1,this.ops.push(new u(16,t)),this}writeI16(t){return this.offset+=2,this.ops.push(new u(17,t)),this}writeI16BE(t){return this.offset+=2,this.ops.push(new u(18,t)),this}writeI24(t){return this.offset+=3,this.ops.push(new u(19,t)),this}writeI24BE(t){return this.offset+=3,this.ops.push(new u(20,t)),this}writeI32(t){return this.offset+=4,this.ops.push(new u(21,t)),this}writeI32BE(t){return this.offset+=4,this.ops.push(new u(22,t)),this}writeI40(t){return this.offset+=5,this.ops.push(new u(23,t)),this}writeI40BE(t){return this.offset+=5,this.ops.push(new u(24,t)),this}writeI48(t){return this.offset+=6,this.ops.push(new u(25,t)),this}writeI48BE(t){return this.offset+=6,this.ops.push(new u(26,t)),this}writeI56(t){return this.offset+=7,this.ops.push(new u(27,t)),this}writeI56BE(t){return this.offset+=7,this.ops.push(new u(28,t)),this}writeI64(t){return this.offset+=8,this.ops.push(new u(29,t)),this}writeI64BE(t){return this.offset+=8,this.ops.push(new u(30,t)),this}writeFloat(t){return this.offset+=4,this.ops.push(new u(31,t)),this}writeFloatBE(t){return this.offset+=4,this.ops.push(new u(32,t)),this}writeDouble(t){return this.offset+=8,this.ops.push(new u(33,t)),this}writeDoubleBE(t){return this.offset+=8,this.ops.push(new u(34,t)),this}writeVarint(t){return this.offset+=o.sizeVarint(t),this.ops.push(new u(35,t)),this}writeVarint2(t){return this.offset+=o.sizeVarint2(t),this.ops.push(new u(36,t)),this}writeBytes(t){return i(n.isBuffer(t),"value","buffer"),0===t.length||(this.offset+=t.length,this.ops.push(new h(37,t))),this}writeVarBytes(t){return i(n.isBuffer(t),"value","buffer"),this.offset+=o.sizeVarint(t.length),this.ops.push(new u(35,t.length)),0===t.length||(this.offset+=t.length,this.ops.push(new h(37,t))),this}copy(t,e,r){i(n.isBuffer(t),"value","buffer"),i(e>>>0===e,"start","integer"),i(r>>>0===r,"end","integer"),i(r>=e,"start","integer");const o=t.slice(e,r);return this.writeBytes(o),this}writeString(t,e){return null==e&&(e="binary"),i("string"===typeof t,"value","string"),i("string"===typeof e,"enc","string"),0===t.length||(this.offset+=n.byteLength(t,e),this.ops.push(new c(38,t,e))),this}writeHash(t){return"string"!==typeof t?(i(n.isBuffer(t),"value","buffer"),i(32===t.length,"value","32-byte hash"),this.writeBytes(t),this):(i(64===t.length,"value","32-byte hash"),this.writeString(t,"hex"),this)}writeVarString(t,e){if(null==e&&(e="binary"),i("string"===typeof t,"value","string"),i("string"===typeof e,"enc","string"),0===t.length)return this.ops.push(new u(35,0)),this;const r=n.byteLength(t,e);return this.offset+=o.sizeVarint(r),this.offset+=r,this.ops.push(new u(35,r)),this.ops.push(new c(38,t,e)),this}writeNullString(t,e){return this.writeString(t,e),this.writeU8(0),this}writeChecksum(t){return t&&"function"===typeof t.digest&&(t=t.digest.bind(t)),i("function"===typeof t,"hash","function"),this.offset+=4,this.ops.push(new l(39,t)),this}fill(t,e){return i((255&t)===t,"value","byte"),i(e>>>0===e,"size","integer"),0===e||(this.offset+=e,this.ops.push(new f(40,t,e))),this}}},6239:(t,e,r)=>{var n=r(9966).Buffer,i=r(1781).Transform,o=r(8694).I;function s(t){i.call(this),this.hashMode="string"===typeof t,this.hashMode?this[t]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}r(6329)(s,i),s.prototype.update=function(t,e,r){"string"===typeof t&&(t=n.from(t,e));var i=this._update(t);return this.hashMode?this:(r&&(i=this._toString(i,r)),i)},s.prototype.setAutoPadding=function(){},s.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},s.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},s.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},s.prototype._transform=function(t,e,r){var n;try{this.hashMode?this._update(t):this.push(this._update(t))}catch(i){n=i}finally{r(n)}},s.prototype._flush=function(t){var e;try{this.push(this.__final())}catch(r){e=r}t(e)},s.prototype._finalOrDigest=function(t){var e=this.__final()||n.alloc(0);return t&&(e=this._toString(e,t,!0)),e},s.prototype._toString=function(t,e,r){if(this._decoder||(this._decoder=new o(e),this._encoding=e),this._encoding!==e)throw new Error("can't switch encodings");var n=this._decoder.write(t);return r&&(n+=this._decoder.end()),n},t.exports=s},3525:(t,e,r)=>{function n(t){return Object.prototype.toString.call(t)}e.isArray=function(t){return Array.isArray?Array.isArray(t):"[object Array]"===n(t)},e.isBoolean=function(t){return"boolean"===typeof t},e.isNull=function(t){return null===t},e.isNullOrUndefined=function(t){return null==t},e.isNumber=function(t){return"number"===typeof t},e.isString=function(t){return"string"===typeof t},e.isSymbol=function(t){return"symbol"===typeof t},e.isUndefined=function(t){return void 0===t},e.isRegExp=function(t){return"[object RegExp]"===n(t)},e.isObject=function(t){return"object"===typeof t&&null!==t},e.isDate=function(t){return"[object Date]"===n(t)},e.isError=function(t){return"[object Error]"===n(t)||t instanceof Error},e.isFunction=function(t){return"function"===typeof t},e.isPrimitive=function(t){return null===t||"boolean"===typeof t||"number"===typeof t||"string"===typeof t||"symbol"===typeof t||"undefined"===typeof t},e.isBuffer=r(6382).Buffer.isBuffer},8231:(t,e,r)=>{var n=r(6382).Buffer,i=r(8086),o=r(1894);t.exports=function(t){return new a(t)};var s={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 a(t){this.curveType=s[t],this.curveType||(this.curveType={name:t}),this.curve=new i.ec(this.curveType.name),this.keys=void 0}function u(t,e,r){Array.isArray(t)||(t=t.toArray());var i=new n(t);if(r&&i.length=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function u(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function h(t,e,r,n){for(var i=0,o=Math.min(t.length,r),s=e;s=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"===typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"===typeof t)return this._initNumber(t,e,r);if("object"===typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n=e;n-=2)i=u(t,e,n)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2===0?e+1:e;n=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,c=r;c1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var c=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var h=1;h>>26,l=67108863&u,f=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=f;d++){var p=h-d|0;c+=(s=(i=0|t.words[p])*(o=0|e.words[d])+l)/67108864|0,l=67108863&s}r.words[h]=0|l,u=0|c}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,s=0;s>>24-i&16777215)||s!==this.length-1?c[6-u.length]+u+r:u+r,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!==0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var h=l[t],d=f[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var g=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?g+r:c[h-g.length]+g+r}for(this.isZero()&&(r="0"+r);r.length%e!==0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return n("undefined"!==typeof s),this.toArrayLike(s,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,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 s,a,u="le"===e,h=new t(o),c=this.clone();if(u){for(a=0;!c.isZero();a++)s=c.andln(255),c.iushrn(8),h[a]=s;for(;a=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0===(8191&e)&&(r+=13,e>>>=13),0===(127&e)&&(r+=7,e>>>=7),0===(15&e)&&(r+=4,e>>>=4),0===(3&e)&&(r+=2,e>>>=2),0===(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"===typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"===typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,d=0|s[1],p=8191&d,g=d>>>13,m=0|s[2],y=8191&m,w=m>>>13,v=0|s[3],b=8191&v,_=v>>>13,E=0|s[4],S=8191&E,M=E>>>13,A=0|s[5],I=8191&A,C=A>>>13,k=0|s[6],x=8191&k,T=k>>>13,O=0|s[7],N=8191&O,B=O>>>13,R=0|s[8],P=8191&R,L=R>>>13,D=0|s[9],U=8191&D,j=D>>>13,F=0|a[0],H=8191&F,z=F>>>13,V=0|a[1],q=8191&V,W=V>>>13,K=0|a[2],G=8191&K,X=K>>>13,Z=0|a[3],Y=8191&Z,Q=Z>>>13,J=0|a[4],$=8191&J,tt=J>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,ht=at>>>13,ct=0|a[8],lt=8191&ct,ft=ct>>>13,dt=0|a[9],pt=8191&dt,gt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(h+(n=Math.imul(l,H))|0)+((8191&(i=(i=Math.imul(l,z))+Math.imul(f,H)|0))<<13)|0;h=((o=Math.imul(f,z))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(p,H),i=(i=Math.imul(p,z))+Math.imul(g,H)|0,o=Math.imul(g,z);var yt=(h+(n=n+Math.imul(l,q)|0)|0)+((8191&(i=(i=i+Math.imul(l,W)|0)+Math.imul(f,q)|0))<<13)|0;h=((o=o+Math.imul(f,W)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(y,H),i=(i=Math.imul(y,z))+Math.imul(w,H)|0,o=Math.imul(w,z),n=n+Math.imul(p,q)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(g,q)|0,o=o+Math.imul(g,W)|0;var wt=(h+(n=n+Math.imul(l,G)|0)|0)+((8191&(i=(i=i+Math.imul(l,X)|0)+Math.imul(f,G)|0))<<13)|0;h=((o=o+Math.imul(f,X)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(b,H),i=(i=Math.imul(b,z))+Math.imul(_,H)|0,o=Math.imul(_,z),n=n+Math.imul(y,q)|0,i=(i=i+Math.imul(y,W)|0)+Math.imul(w,q)|0,o=o+Math.imul(w,W)|0,n=n+Math.imul(p,G)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(g,G)|0,o=o+Math.imul(g,X)|0;var vt=(h+(n=n+Math.imul(l,Y)|0)|0)+((8191&(i=(i=i+Math.imul(l,Q)|0)+Math.imul(f,Y)|0))<<13)|0;h=((o=o+Math.imul(f,Q)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(S,H),i=(i=Math.imul(S,z))+Math.imul(M,H)|0,o=Math.imul(M,z),n=n+Math.imul(b,q)|0,i=(i=i+Math.imul(b,W)|0)+Math.imul(_,q)|0,o=o+Math.imul(_,W)|0,n=n+Math.imul(y,G)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(w,G)|0,o=o+Math.imul(w,X)|0,n=n+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,Q)|0)+Math.imul(g,Y)|0,o=o+Math.imul(g,Q)|0;var bt=(h+(n=n+Math.imul(l,$)|0)|0)+((8191&(i=(i=i+Math.imul(l,tt)|0)+Math.imul(f,$)|0))<<13)|0;h=((o=o+Math.imul(f,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(I,H),i=(i=Math.imul(I,z))+Math.imul(C,H)|0,o=Math.imul(C,z),n=n+Math.imul(S,q)|0,i=(i=i+Math.imul(S,W)|0)+Math.imul(M,q)|0,o=o+Math.imul(M,W)|0,n=n+Math.imul(b,G)|0,i=(i=i+Math.imul(b,X)|0)+Math.imul(_,G)|0,o=o+Math.imul(_,X)|0,n=n+Math.imul(y,Y)|0,i=(i=i+Math.imul(y,Q)|0)+Math.imul(w,Y)|0,o=o+Math.imul(w,Q)|0,n=n+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(g,$)|0,o=o+Math.imul(g,tt)|0;var _t=(h+(n=n+Math.imul(l,rt)|0)|0)+((8191&(i=(i=i+Math.imul(l,nt)|0)+Math.imul(f,rt)|0))<<13)|0;h=((o=o+Math.imul(f,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(x,H),i=(i=Math.imul(x,z))+Math.imul(T,H)|0,o=Math.imul(T,z),n=n+Math.imul(I,q)|0,i=(i=i+Math.imul(I,W)|0)+Math.imul(C,q)|0,o=o+Math.imul(C,W)|0,n=n+Math.imul(S,G)|0,i=(i=i+Math.imul(S,X)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,X)|0,n=n+Math.imul(b,Y)|0,i=(i=i+Math.imul(b,Q)|0)+Math.imul(_,Y)|0,o=o+Math.imul(_,Q)|0,n=n+Math.imul(y,$)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(w,$)|0,o=o+Math.imul(w,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(g,rt)|0,o=o+Math.imul(g,nt)|0;var Et=(h+(n=n+Math.imul(l,ot)|0)|0)+((8191&(i=(i=i+Math.imul(l,st)|0)+Math.imul(f,ot)|0))<<13)|0;h=((o=o+Math.imul(f,st)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(N,H),i=(i=Math.imul(N,z))+Math.imul(B,H)|0,o=Math.imul(B,z),n=n+Math.imul(x,q)|0,i=(i=i+Math.imul(x,W)|0)+Math.imul(T,q)|0,o=o+Math.imul(T,W)|0,n=n+Math.imul(I,G)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(C,G)|0,o=o+Math.imul(C,X)|0,n=n+Math.imul(S,Y)|0,i=(i=i+Math.imul(S,Q)|0)+Math.imul(M,Y)|0,o=o+Math.imul(M,Q)|0,n=n+Math.imul(b,$)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(_,$)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(y,rt)|0,i=(i=i+Math.imul(y,nt)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(g,ot)|0,o=o+Math.imul(g,st)|0;var St=(h+(n=n+Math.imul(l,ut)|0)|0)+((8191&(i=(i=i+Math.imul(l,ht)|0)+Math.imul(f,ut)|0))<<13)|0;h=((o=o+Math.imul(f,ht)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(P,H),i=(i=Math.imul(P,z))+Math.imul(L,H)|0,o=Math.imul(L,z),n=n+Math.imul(N,q)|0,i=(i=i+Math.imul(N,W)|0)+Math.imul(B,q)|0,o=o+Math.imul(B,W)|0,n=n+Math.imul(x,G)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,X)|0,n=n+Math.imul(I,Y)|0,i=(i=i+Math.imul(I,Q)|0)+Math.imul(C,Y)|0,o=o+Math.imul(C,Q)|0,n=n+Math.imul(S,$)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,tt)|0,n=n+Math.imul(b,rt)|0,i=(i=i+Math.imul(b,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,st)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ht)|0)+Math.imul(g,ut)|0,o=o+Math.imul(g,ht)|0;var Mt=(h+(n=n+Math.imul(l,lt)|0)|0)+((8191&(i=(i=i+Math.imul(l,ft)|0)+Math.imul(f,lt)|0))<<13)|0;h=((o=o+Math.imul(f,ft)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(U,H),i=(i=Math.imul(U,z))+Math.imul(j,H)|0,o=Math.imul(j,z),n=n+Math.imul(P,q)|0,i=(i=i+Math.imul(P,W)|0)+Math.imul(L,q)|0,o=o+Math.imul(L,W)|0,n=n+Math.imul(N,G)|0,i=(i=i+Math.imul(N,X)|0)+Math.imul(B,G)|0,o=o+Math.imul(B,X)|0,n=n+Math.imul(x,Y)|0,i=(i=i+Math.imul(x,Q)|0)+Math.imul(T,Y)|0,o=o+Math.imul(T,Q)|0,n=n+Math.imul(I,$)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(C,$)|0,o=o+Math.imul(C,tt)|0,n=n+Math.imul(S,rt)|0,i=(i=i+Math.imul(S,nt)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,nt)|0,n=n+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ht)|0)+Math.imul(w,ut)|0,o=o+Math.imul(w,ht)|0,n=n+Math.imul(p,lt)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(g,lt)|0,o=o+Math.imul(g,ft)|0;var At=(h+(n=n+Math.imul(l,pt)|0)|0)+((8191&(i=(i=i+Math.imul(l,gt)|0)+Math.imul(f,pt)|0))<<13)|0;h=((o=o+Math.imul(f,gt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(U,q),i=(i=Math.imul(U,W))+Math.imul(j,q)|0,o=Math.imul(j,W),n=n+Math.imul(P,G)|0,i=(i=i+Math.imul(P,X)|0)+Math.imul(L,G)|0,o=o+Math.imul(L,X)|0,n=n+Math.imul(N,Y)|0,i=(i=i+Math.imul(N,Q)|0)+Math.imul(B,Y)|0,o=o+Math.imul(B,Q)|0,n=n+Math.imul(x,$)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(T,$)|0,o=o+Math.imul(T,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,nt)|0,n=n+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,n=n+Math.imul(b,ut)|0,i=(i=i+Math.imul(b,ht)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,ht)|0,n=n+Math.imul(y,lt)|0,i=(i=i+Math.imul(y,ft)|0)+Math.imul(w,lt)|0,o=o+Math.imul(w,ft)|0;var It=(h+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,gt)|0)+Math.imul(g,pt)|0))<<13)|0;h=((o=o+Math.imul(g,gt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(U,G),i=(i=Math.imul(U,X))+Math.imul(j,G)|0,o=Math.imul(j,X),n=n+Math.imul(P,Y)|0,i=(i=i+Math.imul(P,Q)|0)+Math.imul(L,Y)|0,o=o+Math.imul(L,Q)|0,n=n+Math.imul(N,$)|0,i=(i=i+Math.imul(N,tt)|0)+Math.imul(B,$)|0,o=o+Math.imul(B,tt)|0,n=n+Math.imul(x,rt)|0,i=(i=i+Math.imul(x,nt)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,st)|0,n=n+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,ht)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ht)|0,n=n+Math.imul(b,lt)|0,i=(i=i+Math.imul(b,ft)|0)+Math.imul(_,lt)|0,o=o+Math.imul(_,ft)|0;var Ct=(h+(n=n+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,gt)|0)+Math.imul(w,pt)|0))<<13)|0;h=((o=o+Math.imul(w,gt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(U,Y),i=(i=Math.imul(U,Q))+Math.imul(j,Y)|0,o=Math.imul(j,Q),n=n+Math.imul(P,$)|0,i=(i=i+Math.imul(P,tt)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,tt)|0,n=n+Math.imul(N,rt)|0,i=(i=i+Math.imul(N,nt)|0)+Math.imul(B,rt)|0,o=o+Math.imul(B,nt)|0,n=n+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,n=n+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,ht)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,ht)|0,n=n+Math.imul(S,lt)|0,i=(i=i+Math.imul(S,ft)|0)+Math.imul(M,lt)|0,o=o+Math.imul(M,ft)|0;var kt=(h+(n=n+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,gt)|0)+Math.imul(_,pt)|0))<<13)|0;h=((o=o+Math.imul(_,gt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(U,$),i=(i=Math.imul(U,tt))+Math.imul(j,$)|0,o=Math.imul(j,tt),n=n+Math.imul(P,rt)|0,i=(i=i+Math.imul(P,nt)|0)+Math.imul(L,rt)|0,o=o+Math.imul(L,nt)|0,n=n+Math.imul(N,ot)|0,i=(i=i+Math.imul(N,st)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,st)|0,n=n+Math.imul(x,ut)|0,i=(i=i+Math.imul(x,ht)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ht)|0,n=n+Math.imul(I,lt)|0,i=(i=i+Math.imul(I,ft)|0)+Math.imul(C,lt)|0,o=o+Math.imul(C,ft)|0;var xt=(h+(n=n+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,gt)|0)+Math.imul(M,pt)|0))<<13)|0;h=((o=o+Math.imul(M,gt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(U,rt),i=(i=Math.imul(U,nt))+Math.imul(j,rt)|0,o=Math.imul(j,nt),n=n+Math.imul(P,ot)|0,i=(i=i+Math.imul(P,st)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,st)|0,n=n+Math.imul(N,ut)|0,i=(i=i+Math.imul(N,ht)|0)+Math.imul(B,ut)|0,o=o+Math.imul(B,ht)|0,n=n+Math.imul(x,lt)|0,i=(i=i+Math.imul(x,ft)|0)+Math.imul(T,lt)|0,o=o+Math.imul(T,ft)|0;var Tt=(h+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,gt)|0)+Math.imul(C,pt)|0))<<13)|0;h=((o=o+Math.imul(C,gt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(U,ot),i=(i=Math.imul(U,st))+Math.imul(j,ot)|0,o=Math.imul(j,st),n=n+Math.imul(P,ut)|0,i=(i=i+Math.imul(P,ht)|0)+Math.imul(L,ut)|0,o=o+Math.imul(L,ht)|0,n=n+Math.imul(N,lt)|0,i=(i=i+Math.imul(N,ft)|0)+Math.imul(B,lt)|0,o=o+Math.imul(B,ft)|0;var Ot=(h+(n=n+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,gt)|0)+Math.imul(T,pt)|0))<<13)|0;h=((o=o+Math.imul(T,gt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(U,ut),i=(i=Math.imul(U,ht))+Math.imul(j,ut)|0,o=Math.imul(j,ht),n=n+Math.imul(P,lt)|0,i=(i=i+Math.imul(P,ft)|0)+Math.imul(L,lt)|0,o=o+Math.imul(L,ft)|0;var Nt=(h+(n=n+Math.imul(N,pt)|0)|0)+((8191&(i=(i=i+Math.imul(N,gt)|0)+Math.imul(B,pt)|0))<<13)|0;h=((o=o+Math.imul(B,gt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(U,lt),i=(i=Math.imul(U,ft))+Math.imul(j,lt)|0,o=Math.imul(j,ft);var Bt=(h+(n=n+Math.imul(P,pt)|0)|0)+((8191&(i=(i=i+Math.imul(P,gt)|0)+Math.imul(L,pt)|0))<<13)|0;h=((o=o+Math.imul(L,gt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863;var Rt=(h+(n=Math.imul(U,pt))|0)+((8191&(i=(i=Math.imul(U,gt))+Math.imul(j,pt)|0))<<13)|0;return h=((o=Math.imul(j,gt))+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,u[0]=mt,u[1]=yt,u[2]=wt,u[3]=vt,u[4]=bt,u[5]=_t,u[6]=Et,u[7]=St,u[8]=Mt,u[9]=At,u[10]=It,u[11]=Ct,u[12]=kt,u[13]=xt,u[14]=Tt,u[15]=Ot,u[16]=Nt,u[17]=Bt,u[18]=Rt,0!==h&&(u[19]=h,r.length++),r};function g(t,e,r){return(new m).mulp(t,e,r)}function m(t,e){this.x=t,this.y=e}Math.imul||(p=d),o.prototype.mulTo=function(t,e){var r,n=this.length+t.length;return r=10===this.length&&10===t.length?p(this,t,e):n<63?d(this,t,e):n<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,t,e):g(this,t,e),r},m.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n>=1;return n},m.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,e+=i/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,h=0;h=0&&(0!==c||h>=i);h--){var l=0|this.words[h];this.words[h]=c<<26-o|l>>>o,c=l&a}return u&&0!==c&&(u.words[u.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"===typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"===typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===a)return this.strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,s=0|i.words[i.length-1];0!==(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var h=0;h=0;l--){var f=67108864*(0|n.words[i.length+l])+(0|n.words[i.length+l-1]);for(f=Math.min(f/s|0,67108863),n._ishlnsubmul(i,f,l);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(i,1,l),n.isZero()||(n.negative^=1);a&&(a.words[l]=f)}return a&&a.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!==(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},o.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),h=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++h;for(var c=r.clone(),l=e.clone();!e.isZero();){for(var f=0,d=1;0===(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(c),s.isub(l)),i.iushrn(1),s.iushrn(1);for(var p=0,g=1;0===(r.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(c),u.isub(l)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),s.isub(u)):(r.isub(e),a.isub(i),u.isub(s))}return{a:a,b:u,gcd:r.iushln(h)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var h=0,c=1;0===(e.words[0]&c)&&h<26;++h,c<<=1);if(h>0)for(e.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var l=0,f=1;0===(r.words[0]&f)&&l<26;++l,f<<=1);if(l>0)for(r.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0===(1&this.words[0])},o.prototype.isOdd=function(){return 1===(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"===typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new S(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var y={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(t){if("string"===typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function M(t){S.call(this,t),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},i(v,w),v.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},v.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(y[t])return y[t];var e;if("k256"===t)e=new v;else if("p224"===t)e=new b;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new E}return y[t]=e,e},S.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},S.prototype._verify2=function(t,e){n(0===(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2===1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),h=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new o(2*c*c).toRed(this);0!==this.pow(c,h).cmp(u);)c.redIAdd(u);for(var l=this.pow(c,i),f=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(a);){for(var g=d,m=0;0!==g.cmp(a);m++)g=g.redSqr();n(m=0;n--){for(var h=e.words[n],c=u-1;c>=0;c--){var l=h>>c&1;i!==r[0]&&(i=this.sqr(i)),0!==l||0!==s?(s<<=1,s|=l,(4===++a||0===n&&0===c)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}u=26}return i},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new M(t)},i(M,S),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},6059:(t,e,r)=>{"use strict";var n=r(6329),i=r(1237),o=r(2108),s=r(307),a=r(6239);function u(t){a.call(this,"digest"),this._hash=t}n(u,a),u.prototype._update=function(t){this._hash.update(t)},u.prototype._final=function(){return this._hash.digest()},t.exports=function(t){return"md5"===(t=t.toLowerCase())?new i:"rmd160"===t||"ripemd160"===t?new o:new u(s(t))}},3839:(t,e,r)=>{var n=r(1237);t.exports=function(t){return(new n).update(t).digest()}},2080:(t,e,r)=>{"use strict";var n=r(6329),i=r(9181),o=r(6239),s=r(9966).Buffer,a=r(3839),u=r(2108),h=r(307),c=s.alloc(128);function l(t,e){o.call(this,"digest"),"string"===typeof e&&(e=s.from(e));var r="sha512"===t||"sha384"===t?128:64;(this._alg=t,this._key=e,e.length>r)?e=("rmd160"===t?new u:h(t)).update(e).digest():e.length{"use strict";var n=r(6329),i=r(9966).Buffer,o=r(6239),s=i.alloc(128),a=64;function u(t,e){o.call(this,"digest"),"string"===typeof e&&(e=i.from(e)),this._alg=t,this._key=e,e.length>a?e=t(e):e.length{"use strict";r(5838),r(6059),r(2080);var n=r(9096),i=Object.keys(n),o=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(i);var s=r(1973);s.pbkdf2,s.pbkdf2Sync;var a=r(4014);a.Cipher,a.createCipher,a.Cipheriv,e.Tt=a.createCipheriv,a.Decipher,a.createDecipher,a.Decipheriv,e._7=a.createDecipheriv,a.getCiphers,a.listCiphers;var u=r(4729);u.DiffieHellmanGroup,u.createDiffieHellmanGroup,u.getDiffieHellman,u.createDiffieHellman,u.DiffieHellman;var h=r(7207);h.createSign,h.Sign,h.createVerify,h.Verify,r(8231);var c=r(1477);c.publicEncrypt,c.privateEncrypt,c.publicDecrypt,c.privateDecrypt;var l=r(2450);l.randomFill,l.randomFillSync},3325:(t,e,r)=>{"use strict";e.utils=r(8119),e.Cipher=r(1611),e.DES=r(1142),e.CBC=r(4256),e.EDE=r(7418)},4256:(t,e,r)=>{"use strict";var n=r(5482),i=r(6329),o={};function s(t){n.equal(t.length,8,"Invalid IV length"),this.iv=new Array(8);for(var e=0;e{"use strict";var n=r(5482);function i(t){this.options=t,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=new Array(this.blockSize),this.bufferOff=0,this.padding=!1!==t.padding}t.exports=i,i.prototype._init=function(){},i.prototype.update=function(t){return 0===t.length?[]:"decrypt"===this.type?this._updateDecrypt(t):this._updateEncrypt(t)},i.prototype._buffer=function(t,e){for(var r=Math.min(this.buffer.length-this.bufferOff,t.length-e),n=0;n0;n--)e+=this._buffer(t,e),r+=this._flushBuffer(i,r);return e+=this._buffer(t,e),i},i.prototype.final=function(t){var e,r;return t&&(e=this.update(t)),r="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),e?e.concat(r):r},i.prototype._pad=function(t,e){if(0===e)return!1;for(;e{"use strict";var n=r(5482),i=r(6329),o=r(8119),s=r(1611);function a(){this.tmp=new Array(2),this.keys=null}function u(t){s.call(this,t);var e=new a;this._desState=e,this.deriveKeys(e,t.key)}i(u,s),t.exports=u,u.create=function(t){return new u(t)};var h=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];u.prototype.deriveKeys=function(t,e){t.keys=new Array(32),n.equal(e.length,this.blockSize,"Invalid key length");var r=o.readUInt32BE(e,0),i=o.readUInt32BE(e,4);o.pc1(r,i,t.tmp,0),r=t.tmp[0],i=t.tmp[1];for(var s=0;s>>1];r=o.r28shl(r,a),i=o.r28shl(i,a),o.pc2(r,i,t.keys,s)}},u.prototype._update=function(t,e,r,n){var i=this._desState,s=o.readUInt32BE(t,e),a=o.readUInt32BE(t,e+4);o.ip(s,a,i.tmp,0),s=i.tmp[0],a=i.tmp[1],"encrypt"===this.type?this._encrypt(i,s,a,i.tmp,0):this._decrypt(i,s,a,i.tmp,0),s=i.tmp[0],a=i.tmp[1],o.writeUInt32BE(r,s,n),o.writeUInt32BE(r,a,n+4)},u.prototype._pad=function(t,e){if(!1===this.padding)return!1;for(var r=t.length-e,n=e;n>>0,s=f}o.rip(a,s,n,i)},u.prototype._decrypt=function(t,e,r,n,i){for(var s=r,a=e,u=t.keys.length-2;u>=0;u-=2){var h=t.keys[u],c=t.keys[u+1];o.expand(s,t.tmp,0),h^=t.tmp[0],c^=t.tmp[1];var l=o.substitute(h,c),f=s;s=(a^o.permute(l))>>>0,a=f}o.rip(s,a,n,i)}},7418:(t,e,r)=>{"use strict";var n=r(5482),i=r(6329),o=r(1611),s=r(1142);function a(t,e){n.equal(e.length,24,"Invalid key length");var r=e.slice(0,8),i=e.slice(8,16),o=e.slice(16,24);this.ciphers="encrypt"===t?[s.create({type:"encrypt",key:r}),s.create({type:"decrypt",key:i}),s.create({type:"encrypt",key:o})]:[s.create({type:"decrypt",key:o}),s.create({type:"encrypt",key:i}),s.create({type:"decrypt",key:r})]}function u(t){o.call(this,t);var e=new a(this.type,this.options.key);this._edeState=e}i(u,o),t.exports=u,u.create=function(t){return new u(t)},u.prototype._update=function(t,e,r,n){var i=this._edeState;i.ciphers[0]._update(t,e,r,n),i.ciphers[1]._update(r,n,r,n),i.ciphers[2]._update(r,n,r,n)},u.prototype._pad=s.prototype._pad,u.prototype._unpad=s.prototype._unpad},8119:(t,e)=>{"use strict";e.readUInt32BE=function(t,e){return(t[0+e]<<24|t[1+e]<<16|t[2+e]<<8|t[3+e])>>>0},e.writeUInt32BE=function(t,e,r){t[0+r]=e>>>24,t[1+r]=e>>>16&255,t[2+r]=e>>>8&255,t[3+r]=255&e},e.ip=function(t,e,r,n){for(var i=0,o=0,s=6;s>=0;s-=2){for(var a=0;a<=24;a+=8)i<<=1,i|=e>>>a+s&1;for(a=0;a<=24;a+=8)i<<=1,i|=t>>>a+s&1}for(s=6;s>=0;s-=2){for(a=1;a<=25;a+=8)o<<=1,o|=e>>>a+s&1;for(a=1;a<=25;a+=8)o<<=1,o|=t>>>a+s&1}r[n+0]=i>>>0,r[n+1]=o>>>0},e.rip=function(t,e,r,n){for(var i=0,o=0,s=0;s<4;s++)for(var a=24;a>=0;a-=8)i<<=1,i|=e>>>a+s&1,i<<=1,i|=t>>>a+s&1;for(s=4;s<8;s++)for(a=24;a>=0;a-=8)o<<=1,o|=e>>>a+s&1,o<<=1,o|=t>>>a+s&1;r[n+0]=i>>>0,r[n+1]=o>>>0},e.pc1=function(t,e,r,n){for(var i=0,o=0,s=7;s>=5;s--){for(var a=0;a<=24;a+=8)i<<=1,i|=e>>a+s&1;for(a=0;a<=24;a+=8)i<<=1,i|=t>>a+s&1}for(a=0;a<=24;a+=8)i<<=1,i|=e>>a+s&1;for(s=1;s<=3;s++){for(a=0;a<=24;a+=8)o<<=1,o|=e>>a+s&1;for(a=0;a<=24;a+=8)o<<=1,o|=t>>a+s&1}for(a=0;a<=24;a+=8)o<<=1,o|=t>>a+s&1;r[n+0]=i>>>0,r[n+1]=o>>>0},e.r28shl=function(t,e){return t<>>28-e};var r=[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];e.pc2=function(t,e,n,i){for(var o=0,s=0,a=r.length>>>1,u=0;u>>r[u]&1;for(u=a;u>>r[u]&1;n[i+0]=o>>>0,n[i+1]=s>>>0},e.expand=function(t,e,r){var n=0,i=0;n=(1&t)<<5|t>>>27;for(var o=23;o>=15;o-=4)n<<=6,n|=t>>>o&63;for(o=11;o>=3;o-=4)i|=t>>>o&63,i<<=6;i|=(31&t)<<1|t>>>31,e[r+0]=n>>>0,e[r+1]=i>>>0};var n=[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];e.substitute=function(t,e){for(var r=0,i=0;i<4;i++){r<<=4,r|=n[64*i+(t>>>18-6*i&63)]}for(i=0;i<4;i++){r<<=4,r|=n[256+64*i+(e>>>18-6*i&63)]}return r>>>0};var i=[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];e.permute=function(t){for(var e=0,r=0;r>>i[r]&1;return e>>>0},e.padSplit=function(t,e,r){for(var n=t.toString(2);n.length{var n=r(6382).Buffer,i=r(247),o=r(3241),s=r(9505);var a={binary:!0,hex:!0,base64:!0};e.DiffieHellmanGroup=e.createDiffieHellmanGroup=e.getDiffieHellman=function(t){var e=new n(o[t].prime,"hex"),r=new n(o[t].gen,"hex");return new s(e,r)},e.createDiffieHellman=e.DiffieHellman=function t(e,r,o,u){return n.isBuffer(r)||void 0===a[r]?t(e,"binary",r,o):(r=r||"binary",u=u||"binary",o=o||new n([2]),n.isBuffer(o)||(o=new n(o,u)),"number"===typeof e?new s(i(e,o),o,!0):(n.isBuffer(e)||(e=new n(e,r)),new s(e,o,!0)))}},9505:(t,e,r)=>{var n=r(6382).Buffer,i=r(2984),o=new(r(1235)),s=new i(24),a=new i(11),u=new i(10),h=new i(3),c=new i(7),l=r(247),f=r(5838);function d(t,e){return e=e||"utf8",n.isBuffer(t)||(t=new n(t,e)),this._pub=new i(t),this}function p(t,e){return e=e||"utf8",n.isBuffer(t)||(t=new n(t,e)),this._priv=new i(t),this}t.exports=m;var g={};function m(t,e,r){this.setGenerator(e),this.__prime=new i(t),this._prime=i.mont(this.__prime),this._primeLen=t.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,r?(this.setPublicKey=d,this.setPrivateKey=p):this._primeCode=8}function y(t,e){var r=new n(t.toArray());return e?r.toString(e):r}Object.defineProperty(m.prototype,"verifyError",{enumerable:!0,get:function(){return"number"!==typeof this._primeCode&&(this._primeCode=function(t,e){var r=e.toString("hex"),n=[r,t.toString(16)].join("_");if(n in g)return g[n];var i,f=0;if(t.isEven()||!l.simpleSieve||!l.fermatTest(t)||!o.test(t))return f+=1,f+="02"===r||"05"===r?8:4,g[n]=f,f;switch(o.test(t.shrn(1))||(f+=2),r){case"02":t.mod(s).cmp(a)&&(f+=8);break;case"05":(i=t.mod(u)).cmp(h)&&i.cmp(c)&&(f+=8);break;default:f+=4}return g[n]=f,f}(this.__prime,this.__gen)),this._primeCode}}),m.prototype.generateKeys=function(){return this._priv||(this._priv=new i(f(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},m.prototype.computeSecret=function(t){var e=(t=(t=new i(t)).toRed(this._prime)).redPow(this._priv).fromRed(),r=new n(e.toArray()),o=this.getPrime();if(r.length{var n=r(5838);t.exports=w,w.simpleSieve=m,w.fermatTest=y;var i=r(2984),o=new i(24),s=new(r(1235)),a=new i(1),u=new i(2),h=new i(5),c=(new i(16),new i(8),new i(10)),l=new i(3),f=(new i(7),new i(11)),d=new i(4),p=(new i(12),null);function g(){if(null!==p)return p;var t=[];t[0]=2;for(var e=1,r=3;r<1048576;r+=2){for(var n=Math.ceil(Math.sqrt(r)),i=0;it;)r.ishrn(1);if(r.isEven()&&r.iadd(a),r.testn(1)||r.iadd(u),e.cmp(u)){if(!e.cmp(h))for(;r.mod(c).cmp(l);)r.iadd(d)}else for(;r.mod(o).cmp(f);)r.iadd(d);if(m(p=r.shrn(1))&&m(r)&&y(p)&&y(r)&&s.test(p)&&s.test(r))return r}}},2984:function(t,e,r){!function(t,e){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var s;"object"===typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!==typeof window&&"undefined"!==typeof window.Buffer?window.Buffer:r(6089).Buffer}catch(A){}function a(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function u(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function h(t,e,r,n){for(var i=0,o=Math.min(t.length,r),s=e;s=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"===typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"===typeof t)return this._initNumber(t,e,r);if("object"===typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n=e;n-=2)i=u(t,e,n)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2===0?e+1:e;n=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,c=r;c1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var c=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var h=1;h>>26,l=67108863&u,f=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=f;d++){var p=h-d|0;c+=(s=(i=0|t.words[p])*(o=0|e.words[d])+l)/67108864|0,l=67108863&s}r.words[h]=0|l,u=0|c}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,s=0;s>>24-i&16777215)||s!==this.length-1?c[6-u.length]+u+r:u+r,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!==0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var h=l[t],d=f[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var g=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?g+r:c[h-g.length]+g+r}for(this.isZero()&&(r="0"+r);r.length%e!==0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return n("undefined"!==typeof s),this.toArrayLike(s,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,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 s,a,u="le"===e,h=new t(o),c=this.clone();if(u){for(a=0;!c.isZero();a++)s=c.andln(255),c.iushrn(8),h[a]=s;for(;a=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0===(8191&e)&&(r+=13,e>>>=13),0===(127&e)&&(r+=7,e>>>=7),0===(15&e)&&(r+=4,e>>>=4),0===(3&e)&&(r+=2,e>>>=2),0===(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"===typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"===typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,d=0|s[1],p=8191&d,g=d>>>13,m=0|s[2],y=8191&m,w=m>>>13,v=0|s[3],b=8191&v,_=v>>>13,E=0|s[4],S=8191&E,M=E>>>13,A=0|s[5],I=8191&A,C=A>>>13,k=0|s[6],x=8191&k,T=k>>>13,O=0|s[7],N=8191&O,B=O>>>13,R=0|s[8],P=8191&R,L=R>>>13,D=0|s[9],U=8191&D,j=D>>>13,F=0|a[0],H=8191&F,z=F>>>13,V=0|a[1],q=8191&V,W=V>>>13,K=0|a[2],G=8191&K,X=K>>>13,Z=0|a[3],Y=8191&Z,Q=Z>>>13,J=0|a[4],$=8191&J,tt=J>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,ht=at>>>13,ct=0|a[8],lt=8191&ct,ft=ct>>>13,dt=0|a[9],pt=8191&dt,gt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(h+(n=Math.imul(l,H))|0)+((8191&(i=(i=Math.imul(l,z))+Math.imul(f,H)|0))<<13)|0;h=((o=Math.imul(f,z))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(p,H),i=(i=Math.imul(p,z))+Math.imul(g,H)|0,o=Math.imul(g,z);var yt=(h+(n=n+Math.imul(l,q)|0)|0)+((8191&(i=(i=i+Math.imul(l,W)|0)+Math.imul(f,q)|0))<<13)|0;h=((o=o+Math.imul(f,W)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(y,H),i=(i=Math.imul(y,z))+Math.imul(w,H)|0,o=Math.imul(w,z),n=n+Math.imul(p,q)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(g,q)|0,o=o+Math.imul(g,W)|0;var wt=(h+(n=n+Math.imul(l,G)|0)|0)+((8191&(i=(i=i+Math.imul(l,X)|0)+Math.imul(f,G)|0))<<13)|0;h=((o=o+Math.imul(f,X)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(b,H),i=(i=Math.imul(b,z))+Math.imul(_,H)|0,o=Math.imul(_,z),n=n+Math.imul(y,q)|0,i=(i=i+Math.imul(y,W)|0)+Math.imul(w,q)|0,o=o+Math.imul(w,W)|0,n=n+Math.imul(p,G)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(g,G)|0,o=o+Math.imul(g,X)|0;var vt=(h+(n=n+Math.imul(l,Y)|0)|0)+((8191&(i=(i=i+Math.imul(l,Q)|0)+Math.imul(f,Y)|0))<<13)|0;h=((o=o+Math.imul(f,Q)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(S,H),i=(i=Math.imul(S,z))+Math.imul(M,H)|0,o=Math.imul(M,z),n=n+Math.imul(b,q)|0,i=(i=i+Math.imul(b,W)|0)+Math.imul(_,q)|0,o=o+Math.imul(_,W)|0,n=n+Math.imul(y,G)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(w,G)|0,o=o+Math.imul(w,X)|0,n=n+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,Q)|0)+Math.imul(g,Y)|0,o=o+Math.imul(g,Q)|0;var bt=(h+(n=n+Math.imul(l,$)|0)|0)+((8191&(i=(i=i+Math.imul(l,tt)|0)+Math.imul(f,$)|0))<<13)|0;h=((o=o+Math.imul(f,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(I,H),i=(i=Math.imul(I,z))+Math.imul(C,H)|0,o=Math.imul(C,z),n=n+Math.imul(S,q)|0,i=(i=i+Math.imul(S,W)|0)+Math.imul(M,q)|0,o=o+Math.imul(M,W)|0,n=n+Math.imul(b,G)|0,i=(i=i+Math.imul(b,X)|0)+Math.imul(_,G)|0,o=o+Math.imul(_,X)|0,n=n+Math.imul(y,Y)|0,i=(i=i+Math.imul(y,Q)|0)+Math.imul(w,Y)|0,o=o+Math.imul(w,Q)|0,n=n+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(g,$)|0,o=o+Math.imul(g,tt)|0;var _t=(h+(n=n+Math.imul(l,rt)|0)|0)+((8191&(i=(i=i+Math.imul(l,nt)|0)+Math.imul(f,rt)|0))<<13)|0;h=((o=o+Math.imul(f,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(x,H),i=(i=Math.imul(x,z))+Math.imul(T,H)|0,o=Math.imul(T,z),n=n+Math.imul(I,q)|0,i=(i=i+Math.imul(I,W)|0)+Math.imul(C,q)|0,o=o+Math.imul(C,W)|0,n=n+Math.imul(S,G)|0,i=(i=i+Math.imul(S,X)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,X)|0,n=n+Math.imul(b,Y)|0,i=(i=i+Math.imul(b,Q)|0)+Math.imul(_,Y)|0,o=o+Math.imul(_,Q)|0,n=n+Math.imul(y,$)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(w,$)|0,o=o+Math.imul(w,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(g,rt)|0,o=o+Math.imul(g,nt)|0;var Et=(h+(n=n+Math.imul(l,ot)|0)|0)+((8191&(i=(i=i+Math.imul(l,st)|0)+Math.imul(f,ot)|0))<<13)|0;h=((o=o+Math.imul(f,st)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(N,H),i=(i=Math.imul(N,z))+Math.imul(B,H)|0,o=Math.imul(B,z),n=n+Math.imul(x,q)|0,i=(i=i+Math.imul(x,W)|0)+Math.imul(T,q)|0,o=o+Math.imul(T,W)|0,n=n+Math.imul(I,G)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(C,G)|0,o=o+Math.imul(C,X)|0,n=n+Math.imul(S,Y)|0,i=(i=i+Math.imul(S,Q)|0)+Math.imul(M,Y)|0,o=o+Math.imul(M,Q)|0,n=n+Math.imul(b,$)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(_,$)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(y,rt)|0,i=(i=i+Math.imul(y,nt)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(g,ot)|0,o=o+Math.imul(g,st)|0;var St=(h+(n=n+Math.imul(l,ut)|0)|0)+((8191&(i=(i=i+Math.imul(l,ht)|0)+Math.imul(f,ut)|0))<<13)|0;h=((o=o+Math.imul(f,ht)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(P,H),i=(i=Math.imul(P,z))+Math.imul(L,H)|0,o=Math.imul(L,z),n=n+Math.imul(N,q)|0,i=(i=i+Math.imul(N,W)|0)+Math.imul(B,q)|0,o=o+Math.imul(B,W)|0,n=n+Math.imul(x,G)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,X)|0,n=n+Math.imul(I,Y)|0,i=(i=i+Math.imul(I,Q)|0)+Math.imul(C,Y)|0,o=o+Math.imul(C,Q)|0,n=n+Math.imul(S,$)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,tt)|0,n=n+Math.imul(b,rt)|0,i=(i=i+Math.imul(b,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,st)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ht)|0)+Math.imul(g,ut)|0,o=o+Math.imul(g,ht)|0;var Mt=(h+(n=n+Math.imul(l,lt)|0)|0)+((8191&(i=(i=i+Math.imul(l,ft)|0)+Math.imul(f,lt)|0))<<13)|0;h=((o=o+Math.imul(f,ft)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(U,H),i=(i=Math.imul(U,z))+Math.imul(j,H)|0,o=Math.imul(j,z),n=n+Math.imul(P,q)|0,i=(i=i+Math.imul(P,W)|0)+Math.imul(L,q)|0,o=o+Math.imul(L,W)|0,n=n+Math.imul(N,G)|0,i=(i=i+Math.imul(N,X)|0)+Math.imul(B,G)|0,o=o+Math.imul(B,X)|0,n=n+Math.imul(x,Y)|0,i=(i=i+Math.imul(x,Q)|0)+Math.imul(T,Y)|0,o=o+Math.imul(T,Q)|0,n=n+Math.imul(I,$)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(C,$)|0,o=o+Math.imul(C,tt)|0,n=n+Math.imul(S,rt)|0,i=(i=i+Math.imul(S,nt)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,nt)|0,n=n+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ht)|0)+Math.imul(w,ut)|0,o=o+Math.imul(w,ht)|0,n=n+Math.imul(p,lt)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(g,lt)|0,o=o+Math.imul(g,ft)|0;var At=(h+(n=n+Math.imul(l,pt)|0)|0)+((8191&(i=(i=i+Math.imul(l,gt)|0)+Math.imul(f,pt)|0))<<13)|0;h=((o=o+Math.imul(f,gt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(U,q),i=(i=Math.imul(U,W))+Math.imul(j,q)|0,o=Math.imul(j,W),n=n+Math.imul(P,G)|0,i=(i=i+Math.imul(P,X)|0)+Math.imul(L,G)|0,o=o+Math.imul(L,X)|0,n=n+Math.imul(N,Y)|0,i=(i=i+Math.imul(N,Q)|0)+Math.imul(B,Y)|0,o=o+Math.imul(B,Q)|0,n=n+Math.imul(x,$)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(T,$)|0,o=o+Math.imul(T,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,nt)|0,n=n+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,n=n+Math.imul(b,ut)|0,i=(i=i+Math.imul(b,ht)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,ht)|0,n=n+Math.imul(y,lt)|0,i=(i=i+Math.imul(y,ft)|0)+Math.imul(w,lt)|0,o=o+Math.imul(w,ft)|0;var It=(h+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,gt)|0)+Math.imul(g,pt)|0))<<13)|0;h=((o=o+Math.imul(g,gt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(U,G),i=(i=Math.imul(U,X))+Math.imul(j,G)|0,o=Math.imul(j,X),n=n+Math.imul(P,Y)|0,i=(i=i+Math.imul(P,Q)|0)+Math.imul(L,Y)|0,o=o+Math.imul(L,Q)|0,n=n+Math.imul(N,$)|0,i=(i=i+Math.imul(N,tt)|0)+Math.imul(B,$)|0,o=o+Math.imul(B,tt)|0,n=n+Math.imul(x,rt)|0,i=(i=i+Math.imul(x,nt)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,st)|0,n=n+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,ht)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ht)|0,n=n+Math.imul(b,lt)|0,i=(i=i+Math.imul(b,ft)|0)+Math.imul(_,lt)|0,o=o+Math.imul(_,ft)|0;var Ct=(h+(n=n+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,gt)|0)+Math.imul(w,pt)|0))<<13)|0;h=((o=o+Math.imul(w,gt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(U,Y),i=(i=Math.imul(U,Q))+Math.imul(j,Y)|0,o=Math.imul(j,Q),n=n+Math.imul(P,$)|0,i=(i=i+Math.imul(P,tt)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,tt)|0,n=n+Math.imul(N,rt)|0,i=(i=i+Math.imul(N,nt)|0)+Math.imul(B,rt)|0,o=o+Math.imul(B,nt)|0,n=n+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,n=n+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,ht)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,ht)|0,n=n+Math.imul(S,lt)|0,i=(i=i+Math.imul(S,ft)|0)+Math.imul(M,lt)|0,o=o+Math.imul(M,ft)|0;var kt=(h+(n=n+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,gt)|0)+Math.imul(_,pt)|0))<<13)|0;h=((o=o+Math.imul(_,gt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(U,$),i=(i=Math.imul(U,tt))+Math.imul(j,$)|0,o=Math.imul(j,tt),n=n+Math.imul(P,rt)|0,i=(i=i+Math.imul(P,nt)|0)+Math.imul(L,rt)|0,o=o+Math.imul(L,nt)|0,n=n+Math.imul(N,ot)|0,i=(i=i+Math.imul(N,st)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,st)|0,n=n+Math.imul(x,ut)|0,i=(i=i+Math.imul(x,ht)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ht)|0,n=n+Math.imul(I,lt)|0,i=(i=i+Math.imul(I,ft)|0)+Math.imul(C,lt)|0,o=o+Math.imul(C,ft)|0;var xt=(h+(n=n+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,gt)|0)+Math.imul(M,pt)|0))<<13)|0;h=((o=o+Math.imul(M,gt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(U,rt),i=(i=Math.imul(U,nt))+Math.imul(j,rt)|0,o=Math.imul(j,nt),n=n+Math.imul(P,ot)|0,i=(i=i+Math.imul(P,st)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,st)|0,n=n+Math.imul(N,ut)|0,i=(i=i+Math.imul(N,ht)|0)+Math.imul(B,ut)|0,o=o+Math.imul(B,ht)|0,n=n+Math.imul(x,lt)|0,i=(i=i+Math.imul(x,ft)|0)+Math.imul(T,lt)|0,o=o+Math.imul(T,ft)|0;var Tt=(h+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,gt)|0)+Math.imul(C,pt)|0))<<13)|0;h=((o=o+Math.imul(C,gt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(U,ot),i=(i=Math.imul(U,st))+Math.imul(j,ot)|0,o=Math.imul(j,st),n=n+Math.imul(P,ut)|0,i=(i=i+Math.imul(P,ht)|0)+Math.imul(L,ut)|0,o=o+Math.imul(L,ht)|0,n=n+Math.imul(N,lt)|0,i=(i=i+Math.imul(N,ft)|0)+Math.imul(B,lt)|0,o=o+Math.imul(B,ft)|0;var Ot=(h+(n=n+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,gt)|0)+Math.imul(T,pt)|0))<<13)|0;h=((o=o+Math.imul(T,gt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(U,ut),i=(i=Math.imul(U,ht))+Math.imul(j,ut)|0,o=Math.imul(j,ht),n=n+Math.imul(P,lt)|0,i=(i=i+Math.imul(P,ft)|0)+Math.imul(L,lt)|0,o=o+Math.imul(L,ft)|0;var Nt=(h+(n=n+Math.imul(N,pt)|0)|0)+((8191&(i=(i=i+Math.imul(N,gt)|0)+Math.imul(B,pt)|0))<<13)|0;h=((o=o+Math.imul(B,gt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(U,lt),i=(i=Math.imul(U,ft))+Math.imul(j,lt)|0,o=Math.imul(j,ft);var Bt=(h+(n=n+Math.imul(P,pt)|0)|0)+((8191&(i=(i=i+Math.imul(P,gt)|0)+Math.imul(L,pt)|0))<<13)|0;h=((o=o+Math.imul(L,gt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863;var Rt=(h+(n=Math.imul(U,pt))|0)+((8191&(i=(i=Math.imul(U,gt))+Math.imul(j,pt)|0))<<13)|0;return h=((o=Math.imul(j,gt))+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,u[0]=mt,u[1]=yt,u[2]=wt,u[3]=vt,u[4]=bt,u[5]=_t,u[6]=Et,u[7]=St,u[8]=Mt,u[9]=At,u[10]=It,u[11]=Ct,u[12]=kt,u[13]=xt,u[14]=Tt,u[15]=Ot,u[16]=Nt,u[17]=Bt,u[18]=Rt,0!==h&&(u[19]=h,r.length++),r};function g(t,e,r){return(new m).mulp(t,e,r)}function m(t,e){this.x=t,this.y=e}Math.imul||(p=d),o.prototype.mulTo=function(t,e){var r,n=this.length+t.length;return r=10===this.length&&10===t.length?p(this,t,e):n<63?d(this,t,e):n<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,t,e):g(this,t,e),r},m.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n>=1;return n},m.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,e+=i/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,h=0;h=0&&(0!==c||h>=i);h--){var l=0|this.words[h];this.words[h]=c<<26-o|l>>>o,c=l&a}return u&&0!==c&&(u.words[u.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"===typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"===typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===a)return this.strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,s=0|i.words[i.length-1];0!==(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var h=0;h=0;l--){var f=67108864*(0|n.words[i.length+l])+(0|n.words[i.length+l-1]);for(f=Math.min(f/s|0,67108863),n._ishlnsubmul(i,f,l);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(i,1,l),n.isZero()||(n.negative^=1);a&&(a.words[l]=f)}return a&&a.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!==(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},o.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),h=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++h;for(var c=r.clone(),l=e.clone();!e.isZero();){for(var f=0,d=1;0===(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(c),s.isub(l)),i.iushrn(1),s.iushrn(1);for(var p=0,g=1;0===(r.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(c),u.isub(l)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),s.isub(u)):(r.isub(e),a.isub(i),u.isub(s))}return{a:a,b:u,gcd:r.iushln(h)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var h=0,c=1;0===(e.words[0]&c)&&h<26;++h,c<<=1);if(h>0)for(e.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var l=0,f=1;0===(r.words[0]&f)&&l<26;++l,f<<=1);if(l>0)for(r.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0===(1&this.words[0])},o.prototype.isOdd=function(){return 1===(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"===typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new S(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var y={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(t){if("string"===typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function M(t){S.call(this,t),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},i(v,w),v.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},v.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(y[t])return y[t];var e;if("k256"===t)e=new v;else if("p224"===t)e=new b;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new E}return y[t]=e,e},S.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},S.prototype._verify2=function(t,e){n(0===(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2===1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),h=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new o(2*c*c).toRed(this);0!==this.pow(c,h).cmp(u);)c.redIAdd(u);for(var l=this.pow(c,i),f=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(a);){for(var g=d,m=0;0!==g.cmp(a);m++)g=g.redSqr();n(m=0;n--){for(var h=e.words[n],c=u-1;c>=0;c--){var l=h>>c&1;i!==r[0]&&(i=this.sqr(i)),0!==l||0!==s?(s<<=1,s|=l,(4===++a||0===n&&0===c)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}u=26}return i},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new M(t)},i(M,S),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},8086:(t,e,r)=>{"use strict";var n=e;n.version=r(1636).rE,n.utils=r(6864),n.rand=r(8462),n.curve=r(7849),n.curves=r(6697),n.ec=r(7794),n.eddsa=r(4661)},6588:(t,e,r)=>{"use strict";var n=r(2835),i=r(6864),o=i.getNAF,s=i.getJSF,a=i.assert;function u(t,e){this.type=t,this.p=new n(e.p,16),this.red=e.prime?n.red(e.prime):n.mont(this.p),this.zero=new n(0).toRed(this.red),this.one=new n(1).toRed(this.red),this.two=new n(2).toRed(this.red),this.n=e.n&&new n(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function h(t,e){this.curve=t,this.type=e,this.precomputed=null}t.exports=u,u.prototype.point=function(){throw new Error("Not implemented")},u.prototype.validate=function(){throw new Error("Not implemented")},u.prototype._fixedNafMul=function(t,e){a(t.precomputed);var r=t._getDoubles(),n=o(e,1,this._bitLength),i=(1<=s;c--)u=(u<<1)+n[c];h.push(u)}for(var l=this.jpoint(null,null,null),f=this.jpoint(null,null,null),d=i;d>0;d--){for(s=0;s=0;h--){for(var c=0;h>=0&&0===s[h];h--)c++;if(h>=0&&c++,u=u.dblp(c),h<0)break;var l=s[h];a(0!==l),u="affine"===t.type?l>0?u.mixedAdd(i[l-1>>1]):u.mixedAdd(i[-l-1>>1].neg()):l>0?u.add(i[l-1>>1]):u.add(i[-l-1>>1].neg())}return"affine"===t.type?u.toP():u},u.prototype._wnafMulAdd=function(t,e,r,n,i){var a,u,h,c=this._wnafT1,l=this._wnafT2,f=this._wnafT3,d=0;for(a=0;a=1;a-=2){var g=a-1,m=a;if(1===c[g]&&1===c[m]){var y=[e[g],null,null,e[m]];0===e[g].y.cmp(e[m].y)?(y[1]=e[g].add(e[m]),y[2]=e[g].toJ().mixedAdd(e[m].neg())):0===e[g].y.cmp(e[m].y.redNeg())?(y[1]=e[g].toJ().mixedAdd(e[m]),y[2]=e[g].add(e[m].neg())):(y[1]=e[g].toJ().mixedAdd(e[m]),y[2]=e[g].toJ().mixedAdd(e[m].neg()));var w=[-3,-1,-5,-7,0,7,5,1,3],v=s(r[g],r[m]);for(d=Math.max(v[0].length,d),f[g]=new Array(d),f[m]=new Array(d),u=0;u=0;a--){for(var M=0;a>=0;){var A=!0;for(u=0;u=0&&M++,E=E.dblp(M),a<0)break;for(u=0;u0?h=l[u][I-1>>1]:I<0&&(h=l[u][-I-1>>1].neg()),E="affine"===h.type?E.mixedAdd(h):E.add(h))}}for(a=0;a=Math.ceil((t.bitLength()+1)/e.step)},h.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i{"use strict";var n=r(6864),i=r(2835),o=r(6329),s=r(6588),a=n.assert;function u(t){this.twisted=1!==(0|t.a),this.mOneA=this.twisted&&-1===(0|t.a),this.extended=this.mOneA,s.call(this,"edwards",t),this.a=new i(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new i(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new i(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),a(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1===(0|t.c)}function h(t,e,r,n,o){s.BasePoint.call(this,t,"projective"),null===e&&null===r&&null===n?(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 i(e,16),this.y=new i(r,16),this.z=n?new i(n,16):this.curve.one,this.t=o&&new i(o,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()))))}o(u,s),t.exports=u,u.prototype._mulA=function(t){return this.mOneA?t.redNeg():this.a.redMul(t)},u.prototype._mulC=function(t){return this.oneC?t:this.c.redMul(t)},u.prototype.jpoint=function(t,e,r,n){return this.point(t,e,r,n)},u.prototype.pointFromX=function(t,e){(t=new i(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),n=this.c2.redSub(this.a.redMul(r)),o=this.one.redSub(this.c2.redMul(this.d).redMul(r)),s=n.redMul(o.redInvm()),a=s.redSqrt();if(0!==a.redSqr().redSub(s).cmp(this.zero))throw new Error("invalid point");var u=a.fromRed().isOdd();return(e&&!u||!e&&u)&&(a=a.redNeg()),this.point(t,a)},u.prototype.pointFromY=function(t,e){(t=new i(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr(),n=r.redSub(this.c2),o=r.redMul(this.d).redMul(this.c2).redSub(this.a),s=n.redMul(o.redInvm());if(0===s.cmp(this.zero)){if(e)throw new Error("invalid point");return this.point(this.zero,t)}var a=s.redSqrt();if(0!==a.redSqr().redSub(s).cmp(this.zero))throw new Error("invalid point");return a.fromRed().isOdd()!==e&&(a=a.redNeg()),this.point(a,t)},u.prototype.validate=function(t){if(t.isInfinity())return!0;t.normalize();var e=t.x.redSqr(),r=t.y.redSqr(),n=e.redMul(this.a).redAdd(r),i=this.c2.redMul(this.one.redAdd(this.d.redMul(e).redMul(r)));return 0===n.cmp(i)},o(h,s.BasePoint),u.prototype.pointFromJSON=function(t){return h.fromJSON(this,t)},u.prototype.point=function(t,e,r,n){return new h(this,t,e,r,n)},h.fromJSON=function(t,e){return new h(t,e[0],e[1],e[2])},h.prototype.inspect=function(){return this.isInfinity()?"":""},h.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},h.prototype._extDbl=function(){var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(t),i=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),o=n.redAdd(e),s=o.redSub(r),a=n.redSub(e),u=i.redMul(s),h=o.redMul(a),c=i.redMul(a),l=s.redMul(o);return this.curve.point(u,h,l,c)},h.prototype._projDbl=function(){var t,e,r,n,i,o,s=this.x.redAdd(this.y).redSqr(),a=this.x.redSqr(),u=this.y.redSqr();if(this.curve.twisted){var h=(n=this.curve._mulA(a)).redAdd(u);this.zOne?(t=s.redSub(a).redSub(u).redMul(h.redSub(this.curve.two)),e=h.redMul(n.redSub(u)),r=h.redSqr().redSub(h).redSub(h)):(i=this.z.redSqr(),o=h.redSub(i).redISub(i),t=s.redSub(a).redISub(u).redMul(o),e=h.redMul(n.redSub(u)),r=h.redMul(o))}else n=a.redAdd(u),i=this.curve._mulC(this.z).redSqr(),o=n.redSub(i).redSub(i),t=this.curve._mulC(s.redISub(n)).redMul(o),e=this.curve._mulC(n).redMul(a.redISub(u)),r=n.redMul(o);return this.curve.point(t,e,r)},h.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},h.prototype._extAdd=function(t){var e=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),r=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),n=this.t.redMul(this.curve.dd).redMul(t.t),i=this.z.redMul(t.z.redAdd(t.z)),o=r.redSub(e),s=i.redSub(n),a=i.redAdd(n),u=r.redAdd(e),h=o.redMul(s),c=a.redMul(u),l=o.redMul(u),f=s.redMul(a);return this.curve.point(h,c,f,l)},h.prototype._projAdd=function(t){var e,r,n=this.z.redMul(t.z),i=n.redSqr(),o=this.x.redMul(t.x),s=this.y.redMul(t.y),a=this.curve.d.redMul(o).redMul(s),u=i.redSub(a),h=i.redAdd(a),c=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(o).redISub(s),l=n.redMul(u).redMul(c);return this.curve.twisted?(e=n.redMul(h).redMul(s.redSub(this.curve._mulA(o))),r=u.redMul(h)):(e=n.redMul(h).redMul(s.redSub(o)),r=this.curve._mulC(u).redMul(h)),this.curve.point(l,e,r)},h.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},h.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},h.prototype.mulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!1)},h.prototype.jmulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!0)},h.prototype.normalize=function(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this},h.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},h.prototype.getX=function(){return this.normalize(),this.x.fromRed()},h.prototype.getY=function(){return this.normalize(),this.y.fromRed()},h.prototype.eq=function(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},h.prototype.eqXToP=function(t){var e=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(e))return!0;for(var r=t.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(n),0===this.x.cmp(e))return!0}},h.prototype.toP=h.prototype.normalize,h.prototype.mixedAdd=h.prototype.add},7849:(t,e,r)=>{"use strict";var n=e;n.base=r(6588),n.short=r(8475),n.mont=r(7043),n.edwards=r(5697)},7043:(t,e,r)=>{"use strict";var n=r(2835),i=r(6329),o=r(6588),s=r(6864);function a(t){o.call(this,"mont",t),this.a=new n(t.a,16).toRed(this.red),this.b=new n(t.b,16).toRed(this.red),this.i4=new n(4).toRed(this.red).redInvm(),this.two=new n(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function u(t,e,r){o.BasePoint.call(this,t,"projective"),null===e&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new n(e,16),this.z=new n(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}i(a,o),t.exports=a,a.prototype.validate=function(t){var e=t.normalize().x,r=e.redSqr(),n=r.redMul(e).redAdd(r.redMul(this.a)).redAdd(e);return 0===n.redSqrt().redSqr().cmp(n)},i(u,o.BasePoint),a.prototype.decodePoint=function(t,e){return this.point(s.toArray(t,e),1)},a.prototype.point=function(t,e){return new u(this,t,e)},a.prototype.pointFromJSON=function(t){return u.fromJSON(this,t)},u.prototype.precompute=function(){},u.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},u.fromJSON=function(t,e){return new u(t,e[0],e[1]||t.one)},u.prototype.inspect=function(){return this.isInfinity()?"":""},u.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},u.prototype.dbl=function(){var t=this.x.redAdd(this.z).redSqr(),e=this.x.redSub(this.z).redSqr(),r=t.redSub(e),n=t.redMul(e),i=r.redMul(e.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,i)},u.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.diffAdd=function(t,e){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),i=t.x.redAdd(t.z),o=t.x.redSub(t.z).redMul(r),s=i.redMul(n),a=e.z.redMul(o.redAdd(s).redSqr()),u=e.x.redMul(o.redISub(s).redSqr());return this.curve.point(a,u)},u.prototype.mul=function(t){for(var e=t.clone(),r=this,n=this.curve.point(null,null),i=[];0!==e.cmpn(0);e.iushrn(1))i.push(e.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},u.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.eq=function(t){return 0===this.getX().cmp(t.getX())},u.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},8475:(t,e,r)=>{"use strict";var n=r(6864),i=r(2835),o=r(6329),s=r(6588),a=n.assert;function u(t){s.call(this,"short",t),this.a=new i(t.a,16).toRed(this.red),this.b=new i(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function h(t,e,r,n){s.BasePoint.call(this,t,"affine"),null===e&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new i(e,16),this.y=new i(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function c(t,e,r,n){s.BasePoint.call(this,t,"jacobian"),null===e&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new i(0)):(this.x=new i(e,16),this.y=new i(r,16),this.z=new i(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}o(u,s),t.exports=u,u.prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,r;if(t.beta)e=new i(t.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);e=(e=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(t.lambda)r=new i(t.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(e))?r=o[0]:(r=o[1],a(0===this.g.mul(r).x.cmp(this.g.x.redMul(e))))}return{beta:e,lambda:r,basis:t.basis?t.basis.map((function(t){return{a:new i(t.a,16),b:new i(t.b,16)}})):this._getEndoBasis(r)}}},u.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:i.mont(t),r=new i(2).toRed(e).redInvm(),n=r.redNeg(),o=new i(3).toRed(e).redNeg().redSqrt().redMul(r);return[n.redAdd(o).fromRed(),n.redSub(o).fromRed()]},u.prototype._getEndoBasis=function(t){for(var e,r,n,o,s,a,u,h,c,l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),f=t,d=this.n.clone(),p=new i(1),g=new i(0),m=new i(0),y=new i(1),w=0;0!==f.cmpn(0);){var v=d.div(f);h=d.sub(v.mul(f)),c=m.sub(v.mul(p));var b=y.sub(v.mul(g));if(!n&&h.cmp(l)<0)e=u.neg(),r=p,n=h.neg(),o=c;else if(n&&2===++w)break;u=h,d=f,f=h,m=p,p=c,y=g,g=b}s=h.neg(),a=c;var _=n.sqr().add(o.sqr());return s.sqr().add(a.sqr()).cmp(_)>=0&&(s=e,a=r),n.negative&&(n=n.neg(),o=o.neg()),s.negative&&(s=s.neg(),a=a.neg()),[{a:n,b:o},{a:s,b:a}]},u.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],n=e[1],i=n.b.mul(t).divRound(this.n),o=r.b.neg().mul(t).divRound(this.n),s=i.mul(r.a),a=o.mul(n.a),u=i.mul(r.b),h=o.mul(n.b);return{k1:t.sub(s).sub(a),k2:u.add(h).neg()}},u.prototype.pointFromX=function(t,e){(t=new i(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var o=n.fromRed().isOdd();return(e&&!o||!e&&o)&&(n=n.redNeg()),this.point(t,n)},u.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,n=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},u.prototype._endoWnafMulAdd=function(t,e,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},h.prototype.isInfinity=function(){return this.inf},h.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),n=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},h.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),n=t.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),s=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},h.prototype.getX=function(){return this.x.fromRed()},h.prototype.getY=function(){return this.y.fromRed()},h.prototype.mul=function(t){return t=new i(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},h.prototype.mulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},h.prototype.jmulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},h.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},h.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,n=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return e},h.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},o(c,s.BasePoint),u.prototype.jpoint=function(t,e,r){return new c(this,t,e,r)},c.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),n=this.y.redMul(e).redMul(t);return this.curve.point(r,n)},c.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},c.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(e),i=t.x.redMul(r),o=this.y.redMul(e.redMul(t.z)),s=t.y.redMul(r.redMul(this.z)),a=n.redSub(i),u=o.redSub(s);if(0===a.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var h=a.redSqr(),c=h.redMul(a),l=n.redMul(h),f=u.redSqr().redIAdd(c).redISub(l).redISub(l),d=u.redMul(l.redISub(f)).redISub(o.redMul(c)),p=this.z.redMul(t.z).redMul(a);return this.curve.jpoint(f,d,p)},c.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,n=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),s=r.redSub(n),a=i.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),h=u.redMul(s),c=r.redMul(u),l=a.redSqr().redIAdd(h).redISub(c).redISub(c),f=a.redMul(c.redISub(l)).redISub(i.redMul(h)),d=this.z.redMul(s);return this.curve.jpoint(l,f,d)},c.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},c.prototype.inspect=function(){return this.isInfinity()?"":""},c.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},6697:(t,e,r)=>{"use strict";var n,i=e,o=r(3697),s=r(7849),a=r(6864).assert;function u(t){"short"===t.type?this.curve=new s.short(t):"edwards"===t.type?this.curve=new s.edwards(t):this.curve=new s.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,a(this.g.validate(),"Invalid curve"),a(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function h(t,e){Object.defineProperty(i,t,{configurable:!0,enumerable:!0,get:function(){var r=new u(e);return Object.defineProperty(i,t,{configurable:!0,enumerable:!0,value:r}),r}})}i.PresetCurve=u,h("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:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),h("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:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),h("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:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),h("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:o.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"]}),h("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:o.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"]}),h("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),h("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:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=r(9112)}catch(c){n=void 0}h("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:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})},7794:(t,e,r)=>{"use strict";var n=r(2835),i=r(1172),o=r(6864),s=r(6697),a=r(8462),u=o.assert,h=r(109),c=r(9300);function l(t){if(!(this instanceof l))return new l(t);"string"===typeof t&&(u(Object.prototype.hasOwnProperty.call(s,t),"Unknown curve "+t),t=s[t]),t instanceof s.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}t.exports=l,l.prototype.keyPair=function(t){return new h(this,t)},l.prototype.keyFromPrivate=function(t,e){return h.fromPrivate(this,t,e)},l.prototype.keyFromPublic=function(t,e){return h.fromPublic(this,t,e)},l.prototype.genKeyPair=function(t){t||(t={});for(var e=new i({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||a(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),o=this.n.sub(new n(2));;){var s=new n(e.generate(r));if(!(s.cmp(o)>0))return s.iaddn(1),this.keyFromPrivate(s)}},l.prototype._truncateToN=function(t,e){var r=8*t.byteLength()-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},l.prototype.sign=function(t,e,r,o){"object"===typeof r&&(o=r,r=null),o||(o={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new n(t,16));for(var s=this.n.byteLength(),a=e.getPrivate().toArray("be",s),u=t.toArray("be",s),h=new i({hash:this.hash,entropy:a,nonce:u,pers:o.pers,persEnc:o.persEnc||"utf8"}),l=this.n.sub(new n(1)),f=0;;f++){var d=o.k?o.k(f):new n(h.generate(this.n.byteLength()));if(!((d=this._truncateToN(d,!0)).cmpn(1)<=0||d.cmp(l)>=0)){var p=this.g.mul(d);if(!p.isInfinity()){var g=p.getX(),m=g.umod(this.n);if(0!==m.cmpn(0)){var y=d.invm(this.n).mul(m.mul(e.getPrivate()).iadd(t));if(0!==(y=y.umod(this.n)).cmpn(0)){var w=(p.getY().isOdd()?1:0)|(0!==g.cmp(m)?2:0);return o.canonical&&y.cmp(this.nh)>0&&(y=this.n.sub(y),w^=1),new c({r:m,s:y,recoveryParam:w})}}}}}},l.prototype.verify=function(t,e,r,i){t=this._truncateToN(new n(t,16)),r=this.keyFromPublic(r,i);var o=(e=new c(e,"hex")).r,s=e.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var a,u=s.invm(this.n),h=u.mul(t).umod(this.n),l=u.mul(o).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(h,r.getPublic(),l)).isInfinity()&&a.eqXToP(o):!(a=this.g.mulAdd(h,r.getPublic(),l)).isInfinity()&&0===a.getX().umod(this.n).cmp(o)},l.prototype.recoverPubKey=function(t,e,r,i){u((3&r)===r,"The recovery param is more than two bits"),e=new c(e,i);var o=this.n,s=new n(t),a=e.r,h=e.s,l=1&r,f=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&f)throw new Error("Unable to find sencond key candinate");a=f?this.curve.pointFromX(a.add(this.curve.n),l):this.curve.pointFromX(a,l);var d=e.r.invm(o),p=o.sub(s).mul(d).umod(o),g=h.mul(d).umod(o);return this.g.mulAdd(p,a,g)},l.prototype.getKeyRecoveryParam=function(t,e,r,n){if(null!==(e=new c(e,n)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch(t){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")}},109:(t,e,r)=>{"use strict";var n=r(2835),i=r(6864).assert;function o(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}t.exports=o,o.fromPublic=function(t,e,r){return e instanceof o?e:new o(t,{pub:e,pubEnc:r})},o.fromPrivate=function(t,e,r){return e instanceof o?e:new o(t,{priv:e,privEnc:r})},o.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},o.prototype.getPublic=function(t,e){return"string"===typeof t&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},o.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},o.prototype._importPrivate=function(t,e){this.priv=new n(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},o.prototype._importPublic=function(t,e){if(t.x||t.y)return"mont"===this.ec.curve.type?i(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(t.x&&t.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(t.x,t.y));this.pub=this.ec.curve.decodePoint(t,e)},o.prototype.derive=function(t){return t.validate()||i(t.validate(),"public point not validated"),t.mul(this.priv).getX()},o.prototype.sign=function(t,e,r){return this.ec.sign(t,this,e,r)},o.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},o.prototype.inspect=function(){return""}},9300:(t,e,r)=>{"use strict";var n=r(2835),i=r(6864),o=i.assert;function s(t,e){if(t instanceof s)return t;this._importDER(t,e)||(o(t.r&&t.s,"Signature without r or s"),this.r=new n(t.r,16),this.s=new n(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}function a(){this.place=0}function u(t,e){var r=t[e.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var i=0,o=0,s=e.place;o>>=0;return!(i<=127)&&(e.place=s,i)}function h(t){for(var e=0,r=t.length-1;!t[e]&&!(128&t[e+1])&&e>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}t.exports=s,s.prototype._importDER=function(t,e){t=i.toArray(t,e);var r=new a;if(48!==t[r.place++])return!1;var o=u(t,r);if(!1===o)return!1;if(o+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var s=u(t,r);if(!1===s)return!1;var h=t.slice(r.place,s+r.place);if(r.place+=s,2!==t[r.place++])return!1;var c=u(t,r);if(!1===c)return!1;if(t.length!==c+r.place)return!1;var l=t.slice(r.place,c+r.place);if(0===h[0]){if(!(128&h[1]))return!1;h=h.slice(1)}if(0===l[0]){if(!(128&l[1]))return!1;l=l.slice(1)}return this.r=new n(h),this.s=new n(l),this.recoveryParam=null,!0},s.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=h(e),r=h(r);!r[0]&&!(128&r[1]);)r=r.slice(1);var n=[2];c(n,e.length),(n=n.concat(e)).push(2),c(n,r.length);var o=n.concat(r),s=[48];return c(s,o.length),s=s.concat(o),i.encode(s,t)}},4661:(t,e,r)=>{"use strict";var n=r(3697),i=r(6697),o=r(6864),s=o.assert,a=o.parseBytes,u=r(5206),h=r(3035);function c(t){if(s("ed25519"===t,"only tested with ed25519 so far"),!(this instanceof c))return new c(t);t=i[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=n.sha512}t.exports=c,c.prototype.sign=function(t,e){t=a(t);var r=this.keyFromSecret(e),n=this.hashInt(r.messagePrefix(),t),i=this.g.mul(n),o=this.encodePoint(i),s=this.hashInt(o,r.pubBytes(),t).mul(r.priv()),u=n.add(s).umod(this.curve.n);return this.makeSignature({R:i,S:u,Rencoded:o})},c.prototype.verify=function(t,e,r){t=a(t),e=this.makeSignature(e);var n=this.keyFromPublic(r),i=this.hashInt(e.Rencoded(),n.pubBytes(),t),o=this.g.mul(e.S());return e.R().add(n.pub().mul(i)).eq(o)},c.prototype.hashInt=function(){for(var t=this.hash(),e=0;e{"use strict";var n=r(6864),i=n.assert,o=n.parseBytes,s=n.cachedProperty;function a(t,e){this.eddsa=t,this._secret=o(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=o(e.pub)}a.fromPublic=function(t,e){return e instanceof a?e:new a(t,{pub:e})},a.fromSecret=function(t,e){return e instanceof a?e:new a(t,{secret:e})},a.prototype.secret=function(){return this._secret},s(a,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),s(a,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),s(a,"privBytes",(function(){var t=this.eddsa,e=this.hash(),r=t.encodingLength-1,n=e.slice(0,t.encodingLength);return n[0]&=248,n[r]&=127,n[r]|=64,n})),s(a,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),s(a,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),s(a,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),a.prototype.sign=function(t){return i(this._secret,"KeyPair can only verify"),this.eddsa.sign(t,this)},a.prototype.verify=function(t,e){return this.eddsa.verify(t,e,this)},a.prototype.getSecret=function(t){return i(this._secret,"KeyPair is public only"),n.encode(this.secret(),t)},a.prototype.getPublic=function(t){return n.encode(this.pubBytes(),t)},t.exports=a},3035:(t,e,r)=>{"use strict";var n=r(2835),i=r(6864),o=i.assert,s=i.cachedProperty,a=i.parseBytes;function u(t,e){this.eddsa=t,"object"!==typeof e&&(e=a(e)),Array.isArray(e)&&(e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),o(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof n&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}s(u,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),s(u,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),s(u,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),s(u,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),u.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},u.prototype.toHex=function(){return i.encode(this.toBytes(),"hex").toUpperCase()},t.exports=u},9112:t=>{t.exports={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"]]}}},6864:(t,e,r)=>{"use strict";var n=e,i=r(2835),o=r(5482),s=r(9848);n.assert=o,n.toArray=s.toArray,n.zero2=s.zero2,n.toHex=s.toHex,n.encode=s.encode,n.getNAF=function(t,e,r){var n,i=new Array(Math.max(t.bitLength(),r)+1);for(n=0;n(o>>1)-1?(o>>1)-u:u,s.isubn(a)):a=0,i[n]=a,s.iushrn(1)}return i},n.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var n,i=0,o=0;t.cmpn(-i)>0||e.cmpn(-o)>0;){var s,a,u=t.andln(3)+i&3,h=e.andln(3)+o&3;3===u&&(u=-1),3===h&&(h=-1),s=0===(1&u)?0:3!==(n=t.andln(7)+i&7)&&5!==n||2!==h?u:-u,r[0].push(s),a=0===(1&h)?0:3!==(n=e.andln(7)+o&7)&&5!==n||2!==u?h:-h,r[1].push(a),2*i===s+1&&(i=1-i),2*o===a+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return r},n.cachedProperty=function(t,e,r){var n="_"+e;t.prototype[e]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},n.parseBytes=function(t){return"string"===typeof t?n.toArray(t,"hex"):t},n.intFromLE=function(t){return new i(t,"hex","le")}},2835:function(t,e,r){!function(t,e){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var s;"object"===typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!==typeof window&&"undefined"!==typeof window.Buffer?window.Buffer:r(9368).Buffer}catch(A){}function a(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function u(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function h(t,e,r,n){for(var i=0,o=Math.min(t.length,r),s=e;s=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"===typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"===typeof t)return this._initNumber(t,e,r);if("object"===typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n=e;n-=2)i=u(t,e,n)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2===0?e+1:e;n=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,c=r;c1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var c=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var h=1;h>>26,l=67108863&u,f=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=f;d++){var p=h-d|0;c+=(s=(i=0|t.words[p])*(o=0|e.words[d])+l)/67108864|0,l=67108863&s}r.words[h]=0|l,u=0|c}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,s=0;s>>24-i&16777215)||s!==this.length-1?c[6-u.length]+u+r:u+r,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!==0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var h=l[t],d=f[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var g=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?g+r:c[h-g.length]+g+r}for(this.isZero()&&(r="0"+r);r.length%e!==0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return n("undefined"!==typeof s),this.toArrayLike(s,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,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 s,a,u="le"===e,h=new t(o),c=this.clone();if(u){for(a=0;!c.isZero();a++)s=c.andln(255),c.iushrn(8),h[a]=s;for(;a=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0===(8191&e)&&(r+=13,e>>>=13),0===(127&e)&&(r+=7,e>>>=7),0===(15&e)&&(r+=4,e>>>=4),0===(3&e)&&(r+=2,e>>>=2),0===(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"===typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"===typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,d=0|s[1],p=8191&d,g=d>>>13,m=0|s[2],y=8191&m,w=m>>>13,v=0|s[3],b=8191&v,_=v>>>13,E=0|s[4],S=8191&E,M=E>>>13,A=0|s[5],I=8191&A,C=A>>>13,k=0|s[6],x=8191&k,T=k>>>13,O=0|s[7],N=8191&O,B=O>>>13,R=0|s[8],P=8191&R,L=R>>>13,D=0|s[9],U=8191&D,j=D>>>13,F=0|a[0],H=8191&F,z=F>>>13,V=0|a[1],q=8191&V,W=V>>>13,K=0|a[2],G=8191&K,X=K>>>13,Z=0|a[3],Y=8191&Z,Q=Z>>>13,J=0|a[4],$=8191&J,tt=J>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,ht=at>>>13,ct=0|a[8],lt=8191&ct,ft=ct>>>13,dt=0|a[9],pt=8191&dt,gt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(h+(n=Math.imul(l,H))|0)+((8191&(i=(i=Math.imul(l,z))+Math.imul(f,H)|0))<<13)|0;h=((o=Math.imul(f,z))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(p,H),i=(i=Math.imul(p,z))+Math.imul(g,H)|0,o=Math.imul(g,z);var yt=(h+(n=n+Math.imul(l,q)|0)|0)+((8191&(i=(i=i+Math.imul(l,W)|0)+Math.imul(f,q)|0))<<13)|0;h=((o=o+Math.imul(f,W)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(y,H),i=(i=Math.imul(y,z))+Math.imul(w,H)|0,o=Math.imul(w,z),n=n+Math.imul(p,q)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(g,q)|0,o=o+Math.imul(g,W)|0;var wt=(h+(n=n+Math.imul(l,G)|0)|0)+((8191&(i=(i=i+Math.imul(l,X)|0)+Math.imul(f,G)|0))<<13)|0;h=((o=o+Math.imul(f,X)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(b,H),i=(i=Math.imul(b,z))+Math.imul(_,H)|0,o=Math.imul(_,z),n=n+Math.imul(y,q)|0,i=(i=i+Math.imul(y,W)|0)+Math.imul(w,q)|0,o=o+Math.imul(w,W)|0,n=n+Math.imul(p,G)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(g,G)|0,o=o+Math.imul(g,X)|0;var vt=(h+(n=n+Math.imul(l,Y)|0)|0)+((8191&(i=(i=i+Math.imul(l,Q)|0)+Math.imul(f,Y)|0))<<13)|0;h=((o=o+Math.imul(f,Q)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(S,H),i=(i=Math.imul(S,z))+Math.imul(M,H)|0,o=Math.imul(M,z),n=n+Math.imul(b,q)|0,i=(i=i+Math.imul(b,W)|0)+Math.imul(_,q)|0,o=o+Math.imul(_,W)|0,n=n+Math.imul(y,G)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(w,G)|0,o=o+Math.imul(w,X)|0,n=n+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,Q)|0)+Math.imul(g,Y)|0,o=o+Math.imul(g,Q)|0;var bt=(h+(n=n+Math.imul(l,$)|0)|0)+((8191&(i=(i=i+Math.imul(l,tt)|0)+Math.imul(f,$)|0))<<13)|0;h=((o=o+Math.imul(f,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(I,H),i=(i=Math.imul(I,z))+Math.imul(C,H)|0,o=Math.imul(C,z),n=n+Math.imul(S,q)|0,i=(i=i+Math.imul(S,W)|0)+Math.imul(M,q)|0,o=o+Math.imul(M,W)|0,n=n+Math.imul(b,G)|0,i=(i=i+Math.imul(b,X)|0)+Math.imul(_,G)|0,o=o+Math.imul(_,X)|0,n=n+Math.imul(y,Y)|0,i=(i=i+Math.imul(y,Q)|0)+Math.imul(w,Y)|0,o=o+Math.imul(w,Q)|0,n=n+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(g,$)|0,o=o+Math.imul(g,tt)|0;var _t=(h+(n=n+Math.imul(l,rt)|0)|0)+((8191&(i=(i=i+Math.imul(l,nt)|0)+Math.imul(f,rt)|0))<<13)|0;h=((o=o+Math.imul(f,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(x,H),i=(i=Math.imul(x,z))+Math.imul(T,H)|0,o=Math.imul(T,z),n=n+Math.imul(I,q)|0,i=(i=i+Math.imul(I,W)|0)+Math.imul(C,q)|0,o=o+Math.imul(C,W)|0,n=n+Math.imul(S,G)|0,i=(i=i+Math.imul(S,X)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,X)|0,n=n+Math.imul(b,Y)|0,i=(i=i+Math.imul(b,Q)|0)+Math.imul(_,Y)|0,o=o+Math.imul(_,Q)|0,n=n+Math.imul(y,$)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(w,$)|0,o=o+Math.imul(w,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(g,rt)|0,o=o+Math.imul(g,nt)|0;var Et=(h+(n=n+Math.imul(l,ot)|0)|0)+((8191&(i=(i=i+Math.imul(l,st)|0)+Math.imul(f,ot)|0))<<13)|0;h=((o=o+Math.imul(f,st)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(N,H),i=(i=Math.imul(N,z))+Math.imul(B,H)|0,o=Math.imul(B,z),n=n+Math.imul(x,q)|0,i=(i=i+Math.imul(x,W)|0)+Math.imul(T,q)|0,o=o+Math.imul(T,W)|0,n=n+Math.imul(I,G)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(C,G)|0,o=o+Math.imul(C,X)|0,n=n+Math.imul(S,Y)|0,i=(i=i+Math.imul(S,Q)|0)+Math.imul(M,Y)|0,o=o+Math.imul(M,Q)|0,n=n+Math.imul(b,$)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(_,$)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(y,rt)|0,i=(i=i+Math.imul(y,nt)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(g,ot)|0,o=o+Math.imul(g,st)|0;var St=(h+(n=n+Math.imul(l,ut)|0)|0)+((8191&(i=(i=i+Math.imul(l,ht)|0)+Math.imul(f,ut)|0))<<13)|0;h=((o=o+Math.imul(f,ht)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(P,H),i=(i=Math.imul(P,z))+Math.imul(L,H)|0,o=Math.imul(L,z),n=n+Math.imul(N,q)|0,i=(i=i+Math.imul(N,W)|0)+Math.imul(B,q)|0,o=o+Math.imul(B,W)|0,n=n+Math.imul(x,G)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,X)|0,n=n+Math.imul(I,Y)|0,i=(i=i+Math.imul(I,Q)|0)+Math.imul(C,Y)|0,o=o+Math.imul(C,Q)|0,n=n+Math.imul(S,$)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,tt)|0,n=n+Math.imul(b,rt)|0,i=(i=i+Math.imul(b,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,st)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ht)|0)+Math.imul(g,ut)|0,o=o+Math.imul(g,ht)|0;var Mt=(h+(n=n+Math.imul(l,lt)|0)|0)+((8191&(i=(i=i+Math.imul(l,ft)|0)+Math.imul(f,lt)|0))<<13)|0;h=((o=o+Math.imul(f,ft)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(U,H),i=(i=Math.imul(U,z))+Math.imul(j,H)|0,o=Math.imul(j,z),n=n+Math.imul(P,q)|0,i=(i=i+Math.imul(P,W)|0)+Math.imul(L,q)|0,o=o+Math.imul(L,W)|0,n=n+Math.imul(N,G)|0,i=(i=i+Math.imul(N,X)|0)+Math.imul(B,G)|0,o=o+Math.imul(B,X)|0,n=n+Math.imul(x,Y)|0,i=(i=i+Math.imul(x,Q)|0)+Math.imul(T,Y)|0,o=o+Math.imul(T,Q)|0,n=n+Math.imul(I,$)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(C,$)|0,o=o+Math.imul(C,tt)|0,n=n+Math.imul(S,rt)|0,i=(i=i+Math.imul(S,nt)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,nt)|0,n=n+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ht)|0)+Math.imul(w,ut)|0,o=o+Math.imul(w,ht)|0,n=n+Math.imul(p,lt)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(g,lt)|0,o=o+Math.imul(g,ft)|0;var At=(h+(n=n+Math.imul(l,pt)|0)|0)+((8191&(i=(i=i+Math.imul(l,gt)|0)+Math.imul(f,pt)|0))<<13)|0;h=((o=o+Math.imul(f,gt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(U,q),i=(i=Math.imul(U,W))+Math.imul(j,q)|0,o=Math.imul(j,W),n=n+Math.imul(P,G)|0,i=(i=i+Math.imul(P,X)|0)+Math.imul(L,G)|0,o=o+Math.imul(L,X)|0,n=n+Math.imul(N,Y)|0,i=(i=i+Math.imul(N,Q)|0)+Math.imul(B,Y)|0,o=o+Math.imul(B,Q)|0,n=n+Math.imul(x,$)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(T,$)|0,o=o+Math.imul(T,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,nt)|0,n=n+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,n=n+Math.imul(b,ut)|0,i=(i=i+Math.imul(b,ht)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,ht)|0,n=n+Math.imul(y,lt)|0,i=(i=i+Math.imul(y,ft)|0)+Math.imul(w,lt)|0,o=o+Math.imul(w,ft)|0;var It=(h+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,gt)|0)+Math.imul(g,pt)|0))<<13)|0;h=((o=o+Math.imul(g,gt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(U,G),i=(i=Math.imul(U,X))+Math.imul(j,G)|0,o=Math.imul(j,X),n=n+Math.imul(P,Y)|0,i=(i=i+Math.imul(P,Q)|0)+Math.imul(L,Y)|0,o=o+Math.imul(L,Q)|0,n=n+Math.imul(N,$)|0,i=(i=i+Math.imul(N,tt)|0)+Math.imul(B,$)|0,o=o+Math.imul(B,tt)|0,n=n+Math.imul(x,rt)|0,i=(i=i+Math.imul(x,nt)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,st)|0,n=n+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,ht)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ht)|0,n=n+Math.imul(b,lt)|0,i=(i=i+Math.imul(b,ft)|0)+Math.imul(_,lt)|0,o=o+Math.imul(_,ft)|0;var Ct=(h+(n=n+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,gt)|0)+Math.imul(w,pt)|0))<<13)|0;h=((o=o+Math.imul(w,gt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(U,Y),i=(i=Math.imul(U,Q))+Math.imul(j,Y)|0,o=Math.imul(j,Q),n=n+Math.imul(P,$)|0,i=(i=i+Math.imul(P,tt)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,tt)|0,n=n+Math.imul(N,rt)|0,i=(i=i+Math.imul(N,nt)|0)+Math.imul(B,rt)|0,o=o+Math.imul(B,nt)|0,n=n+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,n=n+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,ht)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,ht)|0,n=n+Math.imul(S,lt)|0,i=(i=i+Math.imul(S,ft)|0)+Math.imul(M,lt)|0,o=o+Math.imul(M,ft)|0;var kt=(h+(n=n+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,gt)|0)+Math.imul(_,pt)|0))<<13)|0;h=((o=o+Math.imul(_,gt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(U,$),i=(i=Math.imul(U,tt))+Math.imul(j,$)|0,o=Math.imul(j,tt),n=n+Math.imul(P,rt)|0,i=(i=i+Math.imul(P,nt)|0)+Math.imul(L,rt)|0,o=o+Math.imul(L,nt)|0,n=n+Math.imul(N,ot)|0,i=(i=i+Math.imul(N,st)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,st)|0,n=n+Math.imul(x,ut)|0,i=(i=i+Math.imul(x,ht)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ht)|0,n=n+Math.imul(I,lt)|0,i=(i=i+Math.imul(I,ft)|0)+Math.imul(C,lt)|0,o=o+Math.imul(C,ft)|0;var xt=(h+(n=n+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,gt)|0)+Math.imul(M,pt)|0))<<13)|0;h=((o=o+Math.imul(M,gt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(U,rt),i=(i=Math.imul(U,nt))+Math.imul(j,rt)|0,o=Math.imul(j,nt),n=n+Math.imul(P,ot)|0,i=(i=i+Math.imul(P,st)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,st)|0,n=n+Math.imul(N,ut)|0,i=(i=i+Math.imul(N,ht)|0)+Math.imul(B,ut)|0,o=o+Math.imul(B,ht)|0,n=n+Math.imul(x,lt)|0,i=(i=i+Math.imul(x,ft)|0)+Math.imul(T,lt)|0,o=o+Math.imul(T,ft)|0;var Tt=(h+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,gt)|0)+Math.imul(C,pt)|0))<<13)|0;h=((o=o+Math.imul(C,gt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(U,ot),i=(i=Math.imul(U,st))+Math.imul(j,ot)|0,o=Math.imul(j,st),n=n+Math.imul(P,ut)|0,i=(i=i+Math.imul(P,ht)|0)+Math.imul(L,ut)|0,o=o+Math.imul(L,ht)|0,n=n+Math.imul(N,lt)|0,i=(i=i+Math.imul(N,ft)|0)+Math.imul(B,lt)|0,o=o+Math.imul(B,ft)|0;var Ot=(h+(n=n+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,gt)|0)+Math.imul(T,pt)|0))<<13)|0;h=((o=o+Math.imul(T,gt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(U,ut),i=(i=Math.imul(U,ht))+Math.imul(j,ut)|0,o=Math.imul(j,ht),n=n+Math.imul(P,lt)|0,i=(i=i+Math.imul(P,ft)|0)+Math.imul(L,lt)|0,o=o+Math.imul(L,ft)|0;var Nt=(h+(n=n+Math.imul(N,pt)|0)|0)+((8191&(i=(i=i+Math.imul(N,gt)|0)+Math.imul(B,pt)|0))<<13)|0;h=((o=o+Math.imul(B,gt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(U,lt),i=(i=Math.imul(U,ft))+Math.imul(j,lt)|0,o=Math.imul(j,ft);var Bt=(h+(n=n+Math.imul(P,pt)|0)|0)+((8191&(i=(i=i+Math.imul(P,gt)|0)+Math.imul(L,pt)|0))<<13)|0;h=((o=o+Math.imul(L,gt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863;var Rt=(h+(n=Math.imul(U,pt))|0)+((8191&(i=(i=Math.imul(U,gt))+Math.imul(j,pt)|0))<<13)|0;return h=((o=Math.imul(j,gt))+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,u[0]=mt,u[1]=yt,u[2]=wt,u[3]=vt,u[4]=bt,u[5]=_t,u[6]=Et,u[7]=St,u[8]=Mt,u[9]=At,u[10]=It,u[11]=Ct,u[12]=kt,u[13]=xt,u[14]=Tt,u[15]=Ot,u[16]=Nt,u[17]=Bt,u[18]=Rt,0!==h&&(u[19]=h,r.length++),r};function g(t,e,r){return(new m).mulp(t,e,r)}function m(t,e){this.x=t,this.y=e}Math.imul||(p=d),o.prototype.mulTo=function(t,e){var r,n=this.length+t.length;return r=10===this.length&&10===t.length?p(this,t,e):n<63?d(this,t,e):n<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,t,e):g(this,t,e),r},m.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n>=1;return n},m.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,e+=i/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,h=0;h=0&&(0!==c||h>=i);h--){var l=0|this.words[h];this.words[h]=c<<26-o|l>>>o,c=l&a}return u&&0!==c&&(u.words[u.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"===typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"===typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===a)return this.strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,s=0|i.words[i.length-1];0!==(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var h=0;h=0;l--){var f=67108864*(0|n.words[i.length+l])+(0|n.words[i.length+l-1]);for(f=Math.min(f/s|0,67108863),n._ishlnsubmul(i,f,l);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(i,1,l),n.isZero()||(n.negative^=1);a&&(a.words[l]=f)}return a&&a.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!==(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},o.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),h=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++h;for(var c=r.clone(),l=e.clone();!e.isZero();){for(var f=0,d=1;0===(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(c),s.isub(l)),i.iushrn(1),s.iushrn(1);for(var p=0,g=1;0===(r.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(c),u.isub(l)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),s.isub(u)):(r.isub(e),a.isub(i),u.isub(s))}return{a:a,b:u,gcd:r.iushln(h)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var h=0,c=1;0===(e.words[0]&c)&&h<26;++h,c<<=1);if(h>0)for(e.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var l=0,f=1;0===(r.words[0]&f)&&l<26;++l,f<<=1);if(l>0)for(r.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0===(1&this.words[0])},o.prototype.isOdd=function(){return 1===(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"===typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new S(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var y={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(t){if("string"===typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function M(t){S.call(this,t),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},i(v,w),v.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},v.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(y[t])return y[t];var e;if("k256"===t)e=new v;else if("p224"===t)e=new b;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new E}return y[t]=e,e},S.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},S.prototype._verify2=function(t,e){n(0===(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2===1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),h=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new o(2*c*c).toRed(this);0!==this.pow(c,h).cmp(u);)c.redIAdd(u);for(var l=this.pow(c,i),f=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(a);){for(var g=d,m=0;0!==g.cmp(a);m++)g=g.redSqr();n(m=0;n--){for(var h=e.words[n],c=u-1;c>=0;c--){var l=h>>c&1;i!==r[0]&&(i=this.sqr(i)),0!==l||0!==s?(s<<=1,s|=l,(4===++a||0===n&&0===c)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}u=26}return i},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new M(t)},i(M,S),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},7284:t=>{"use strict";var e,r="object"===typeof Reflect?Reflect:null,n=r&&"function"===typeof r.apply?r.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};e=r&&"function"===typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var i=Number.isNaN||function(t){return t!==t};function o(){o.init.call(this)}t.exports=o,t.exports.once=function(t,e){return new Promise((function(r,n){function i(r){t.removeListener(e,o),n(r)}function o(){"function"===typeof t.removeListener&&t.removeListener("error",i),r([].slice.call(arguments))}g(t,e,o,{once:!0}),"error"!==e&&function(t,e,r){"function"===typeof t.on&&g(t,"error",e,r)}(t,i,{once:!0})}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var s=10;function a(t){if("function"!==typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function u(t){return void 0===t._maxListeners?o.defaultMaxListeners:t._maxListeners}function h(t,e,r,n){var i,o,s,h;if(a(r),void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),o=t._events),s=o[e]),void 0===s)s=o[e]=r,++t._eventsCount;else if("function"===typeof s?s=o[e]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(i=u(t))>0&&s.length>i&&!s.warned){s.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=t,c.type=e,c.count=s.length,h=c,console&&console.warn&&console.warn(h)}return t}function c(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function l(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=c.bind(n);return i.listener=r,n.wrapFn=i,i}function f(t,e,r){var n=t._events;if(void 0===n)return[];var i=n[e];return void 0===i?[]:"function"===typeof i?r?[i.listener||i]:[i]:r?function(t){for(var e=new Array(t.length),r=0;r0&&(s=e[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var u=o[t];if(void 0===u)return!1;if("function"===typeof u)n(u,this,e);else{var h=u.length,c=p(u,h);for(r=0;r=0;o--)if(r[o]===e||r[o].listener===e){s=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(t,e){for(;e+1=0;n--)this.removeListener(t,e[n]);return this},o.prototype.listeners=function(t){return f(this,t,!0)},o.prototype.rawListeners=function(t){return f(this,t,!1)},o.listenerCount=function(t,e){return"function"===typeof t.listenerCount?t.listenerCount(e):d.call(t,e)},o.prototype.listenerCount=d,o.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]}},8451:(t,e,r)=>{var n=r(9966).Buffer,i=r(1237);t.exports=function(t,e,r,o){if(n.isBuffer(t)||(t=n.from(t,"binary")),e&&(n.isBuffer(e)||(e=n.from(e,"binary")),8!==e.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var s=r/8,a=n.alloc(s),u=n.alloc(o||0),h=n.alloc(0);s>0||o>0;){var c=new i;c.update(h),c.update(t),e&&c.update(e),h=c.digest();var l=0;if(s>0){var f=a.length-s;l=Math.min(s,h.length),h.copy(a,f,0,l),s-=l}if(l0){var d=u.length-o,p=Math.min(o,h.length-l);h.copy(u,d,l,l+p),o-=p}}return h.fill(0),{key:a,iv:u}}},6046:(t,e,r)=>{"use strict";var n=r(6382).Buffer;const i=r(5284),{U64:o}=r(6228),s=r(1219),{sipmod:a}=r(618),u=r(1760),h=r(1313),c=r(5509),l=n.alloc(0),f=new o(-1),d=new o(784931);function p(t,e,r){const[n,i]=a(t,e,r.hi,r.lo);return o.fromBits(n,i)}function g(t,e){return t.cmp(e)}function m(t){i(Array.isArray(t));const e=new Set,r=[];for(const o of t){i(n.isBuffer(o));const t=o.toString("binary");e.has(t)||(r.push(o),e.add(t))}return r}t.exports=class{constructor(){this.n=0,this.p=0,this.m=d,this.data=l}hash(t){const e=s.digest(this.toNBytes());return"hex"===t?e.toString("hex"):e}header(t){return s.root(this.hash(),t)}match(t,e){const r=new c(this.data),n=p(e,t,this.m);let i=new o(0);for(;i.lt(n);){const t=this.readU64(r);if(t===f)return!1;if(t.iadd(i),t.eq(n))return!0;i=t}return!1}matchAny(t,e){const r=m(e);i(r.length>0);const n=new c(this.data),s=new o(0),a=[];for(const i of r){const e=p(i,t,this.m);a.push(e)}a.sort(g);let u=a[0],h=1;for(;;){const t=s.cmp(u);if(0===t)break;if(t>0){if(h>>0===t),i(t>=0&&t<=32),i(n.isBuffer(e)),i(16===e.length);const s=m(r);i(s.length>=0),i(s.length<=4294967295),this.p=t,this.n=s.length,this.m=d.mul(new o(this.n));const a=[];for(const n of s){const t=p(n,e,this.m);a.push(t)}a.sort(g);const u=new h;let c=new o(0);for(const n of a){const t=n.sub(c).imaskn(this.p),e=n.sub(c).isub(t).ishrn(this.p);for(c=n;!e.isZero();)u.writeBit(1),e.isubn(1);u.writeBit(0),u.writeBits64(t,this.p)}return this.data=u.render(),this}fromBytes(t,e,r){return i(t>>>0===t),i(e>>>0===e),i(e>=0&&e<=32),i(n.isBuffer(r)),this.n=t,this.p=e,this.m=d.mul(new o(this.n)),this.data=r,this}fromNBytes(t,e){const r=u.read(e),n=r.readVarint(),i=r.readBytes(r.left(),!0);return this.fromBytes(n,t,i)}fromPBytes(t,e){i(n.isBuffer(e)),i(e.length>=1);const r=e.readUInt8(0);return this.fromBytes(t,r,e.slice(1))}fromNPBytes(t){i(n.isBuffer(t)),i(t.length>=5);const e=t.readUInt32BE(0),r=t.readUInt8(4);return this.fromBytes(e,r,t.slice(5))}fromRaw(t){return this.fromNBytes(19,t)}static fromItems(t,e,r){return(new this).fromItems(t,e,r)}static fromBytes(t,e,r){return(new this).fromBytes(t,e,r)}static fromNBytes(t,e){return(new this).fromNBytes(t,e)}static fromPBytes(t,e){return(new this).fromPBytes(t,e)}static fromNPBytes(t){return(new this).fromNPBytes(t)}static fromRaw(t){return(new this).fromRaw(t)}}},5509:(t,e,r)=>{"use strict";const n=r(5284),{U64:i}=r(6228);t.exports=class{constructor(t){this.stream=t,this.pos=0,this.remain=8}readBit(){if(this.pos>=this.stream.length)throw new Error("EOF");if(0===this.remain){if(this.pos+=1,this.pos>=this.stream.length)throw new Error("EOF");this.remain=8}return this.remain-=1,this.stream[this.pos]>>this.remain&1}readByte(){if(this.pos>=this.stream.length)throw new Error("EOF");if(0===this.remain){if(this.pos+=1,this.pos>=this.stream.length)throw new Error("EOF");this.remain=8}if(8===this.remain){const t=this.stream[this.pos];return this.pos+=1,t}let t=this.stream[this.pos]&(1<=this.stream.length)throw new Error("EOF");return t|=this.stream[this.pos]>>this.remain,t}readBits(t){n(t>=0),n(t<=32);let e=0;for(;t>=8;)e<<=8,e|=this.readByte(),t-=8;for(;t>0;)e<<=1,e|=this.readBit(),t-=1;return e}readBits64(t){n(t>=0),n(t<=64);const e=new i;return t>32?(e.hi=this.readBits(t-32),e.lo=this.readBits(32)):e.lo=this.readBits(t),e}}},1313:(t,e,r)=>{"use strict";var n=r(6382).Buffer;const i=r(5284);t.exports=class{constructor(){this.stream=[],this.remain=0}writeBit(t){if(0===this.remain&&(this.stream.push(0),this.remain=8),t){const t=this.stream.length-1;this.stream[t]|=1<>8-this.remain&255,this.stream.push(0),this.stream[e+1]=t<=0),i(e<=32),t<<=32-e;e>=8;){const r=t>>>24;this.writeByte(r),t<<=8,e-=8}for(;e>0;){const r=t>>>31;this.writeBit(r),t<<=1,e-=1}}writeBits64(t,e){i(e>=0),i(e<=64),e>32?(this.writeBits(t.hi,e-32),this.writeBits(t.lo,32)):this.writeBits(t.lo,e)}render(){const t=n.allocUnsafe(this.stream.length);for(let e=0;e{var n=e;n.utils=r(7643),n.common=r(2629),n.sha=r(2624),n.ripemd=r(1859),n.hmac=r(7355),n.sha1=n.sha.sha1,n.sha256=n.sha.sha256,n.sha224=n.sha.sha224,n.sha384=n.sha.sha384,n.sha512=n.sha.sha512,n.ripemd160=n.ripemd.ripemd160},2629:(t,e,r)=>{"use strict";var n=r(7643),i=r(5482);function o(){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}e.BlockHash=o,o.prototype.update=function(t,e){if(t=n.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var r=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-r,t.length),0===this.pending.length&&(this.pending=null),t=n.join32(t,0,t.length-r,this.endian);for(var i=0;i>>24&255,n[i++]=t>>>16&255,n[i++]=t>>>8&255,n[i++]=255&t}else for(n[i++]=255&t,n[i++]=t>>>8&255,n[i++]=t>>>16&255,n[i++]=t>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;o{"use strict";var n=r(7643),i=r(5482);function o(t,e,r){if(!(this instanceof o))return new o(t,e,r);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(n.toArray(e,r))}t.exports=o,o.prototype._init=function(t){t.length>this.blockSize&&(t=(new this.Hash).update(t).digest()),i(t.length<=this.blockSize);for(var e=t.length;e{"use strict";var n=r(7643),i=r(2629),o=n.rotl32,s=n.sum32,a=n.sum32_3,u=n.sum32_4,h=i.BlockHash;function c(){if(!(this instanceof c))return new c;h.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function l(t,e,r,n){return t<=15?e^r^n:t<=31?e&r|~e&n:t<=47?(e|~r)^n:t<=63?e&n|r&~n:e^(r|~n)}function f(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function d(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}n.inherits(c,h),e.ripemd160=c,c.blockSize=512,c.outSize=160,c.hmacStrength=192,c.padLength=64,c.prototype._update=function(t,e){for(var r=this.h[0],n=this.h[1],i=this.h[2],h=this.h[3],c=this.h[4],w=r,v=n,b=i,_=h,E=c,S=0;S<80;S++){var M=s(o(u(r,l(S,n,i,h),t[p[S]+e],f(S)),m[S]),c);r=c,c=h,h=o(i,10),i=n,n=M,M=s(o(u(w,l(79-S,v,b,_),t[g[S]+e],d(S)),y[S]),E),w=E,E=_,_=o(b,10),b=v,v=M}M=a(this.h[1],i,_),this.h[1]=a(this.h[2],h,E),this.h[2]=a(this.h[3],c,w),this.h[3]=a(this.h[4],r,v),this.h[4]=a(this.h[0],n,b),this.h[0]=M},c.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h,"little"):n.split32(this.h,"little")};var p=[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],g=[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],m=[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],y=[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]},2624:(t,e,r)=>{"use strict";e.sha1=r(2236),e.sha224=r(3291),e.sha256=r(3410),e.sha384=r(4282),e.sha512=r(2155)},2236:(t,e,r)=>{"use strict";var n=r(7643),i=r(2629),o=r(1510),s=n.rotl32,a=n.sum32,u=n.sum32_5,h=o.ft_1,c=i.BlockHash,l=[1518500249,1859775393,2400959708,3395469782];function f(){if(!(this instanceof f))return new f;c.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}n.inherits(f,c),t.exports=f,f.blockSize=512,f.outSize=160,f.hmacStrength=80,f.padLength=64,f.prototype._update=function(t,e){for(var r=this.W,n=0;n<16;n++)r[n]=t[e+n];for(;n{"use strict";var n=r(7643),i=r(3410);function o(){if(!(this instanceof o))return new o;i.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}n.inherits(o,i),t.exports=o,o.blockSize=512,o.outSize=224,o.hmacStrength=192,o.padLength=64,o.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h.slice(0,7),"big"):n.split32(this.h.slice(0,7),"big")}},3410:(t,e,r)=>{"use strict";var n=r(7643),i=r(2629),o=r(1510),s=r(5482),a=n.sum32,u=n.sum32_4,h=n.sum32_5,c=o.ch32,l=o.maj32,f=o.s0_256,d=o.s1_256,p=o.g0_256,g=o.g1_256,m=i.BlockHash,y=[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 w(){if(!(this instanceof w))return new w;m.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=y,this.W=new Array(64)}n.inherits(w,m),t.exports=w,w.blockSize=512,w.outSize=256,w.hmacStrength=192,w.padLength=64,w.prototype._update=function(t,e){for(var r=this.W,n=0;n<16;n++)r[n]=t[e+n];for(;n{"use strict";var n=r(7643),i=r(2155);function o(){if(!(this instanceof o))return new o;i.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}n.inherits(o,i),t.exports=o,o.blockSize=1024,o.outSize=384,o.hmacStrength=192,o.padLength=128,o.prototype._digest=function(t){return"hex"===t?n.toHex32(this.h.slice(0,12),"big"):n.split32(this.h.slice(0,12),"big")}},2155:(t,e,r)=>{"use strict";var n=r(7643),i=r(2629),o=r(5482),s=n.rotr64_hi,a=n.rotr64_lo,u=n.shr64_hi,h=n.shr64_lo,c=n.sum64,l=n.sum64_hi,f=n.sum64_lo,d=n.sum64_4_hi,p=n.sum64_4_lo,g=n.sum64_5_hi,m=n.sum64_5_lo,y=i.BlockHash,w=[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 v(){if(!(this instanceof v))return new v;y.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=w,this.W=new Array(160)}function b(t,e,r,n,i){var o=t&r^~t&i;return o<0&&(o+=4294967296),o}function _(t,e,r,n,i,o){var s=e&n^~e&o;return s<0&&(s+=4294967296),s}function E(t,e,r,n,i){var o=t&r^t&i^r&i;return o<0&&(o+=4294967296),o}function S(t,e,r,n,i,o){var s=e&n^e&o^n&o;return s<0&&(s+=4294967296),s}function M(t,e){var r=s(t,e,28)^s(e,t,2)^s(e,t,7);return r<0&&(r+=4294967296),r}function A(t,e){var r=a(t,e,28)^a(e,t,2)^a(e,t,7);return r<0&&(r+=4294967296),r}function I(t,e){var r=s(t,e,14)^s(t,e,18)^s(e,t,9);return r<0&&(r+=4294967296),r}function C(t,e){var r=a(t,e,14)^a(t,e,18)^a(e,t,9);return r<0&&(r+=4294967296),r}function k(t,e){var r=s(t,e,1)^s(t,e,8)^u(t,e,7);return r<0&&(r+=4294967296),r}function x(t,e){var r=a(t,e,1)^a(t,e,8)^h(t,e,7);return r<0&&(r+=4294967296),r}function T(t,e){var r=s(t,e,19)^s(e,t,29)^u(t,e,6);return r<0&&(r+=4294967296),r}function O(t,e){var r=a(t,e,19)^a(e,t,29)^h(t,e,6);return r<0&&(r+=4294967296),r}n.inherits(v,y),t.exports=v,v.blockSize=1024,v.outSize=512,v.hmacStrength=192,v.padLength=128,v.prototype._prepareBlock=function(t,e){for(var r=this.W,n=0;n<32;n++)r[n]=t[e+n];for(;n{"use strict";var n=r(7643).rotr32;function i(t,e,r){return t&e^~t&r}function o(t,e,r){return t&e^t&r^e&r}function s(t,e,r){return t^e^r}e.ft_1=function(t,e,r,n){return 0===t?i(e,r,n):1===t||3===t?s(e,r,n):2===t?o(e,r,n):void 0},e.ch32=i,e.maj32=o,e.p32=s,e.s0_256=function(t){return n(t,2)^n(t,13)^n(t,22)},e.s1_256=function(t){return n(t,6)^n(t,11)^n(t,25)},e.g0_256=function(t){return n(t,7)^n(t,18)^t>>>3},e.g1_256=function(t){return n(t,17)^n(t,19)^t>>>10}},7643:(t,e,r)=>{"use strict";var n=r(5482),i=r(6329);function o(t,e){return 55296===(64512&t.charCodeAt(e))&&(!(e<0||e+1>=t.length)&&56320===(64512&t.charCodeAt(e+1)))}function s(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function a(t){return 1===t.length?"0"+t:t}function u(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}e.inherits=i,e.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"===typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!==0&&(t="0"+t),i=0;i>6|192,r[n++]=63&s|128):o(t,i)?(s=65536+((1023&s)<<10)+(1023&t.charCodeAt(++i)),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=63&s|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=63&s|128)}else for(i=0;i>>0}return s},e.split32=function(t,e){for(var r=new Array(4*t.length),n=0,i=0;n>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r},e.rotr32=function(t,e){return t>>>e|t<<32-e},e.rotl32=function(t,e){return t<>>32-e},e.sum32=function(t,e){return t+e>>>0},e.sum32_3=function(t,e,r){return t+e+r>>>0},e.sum32_4=function(t,e,r,n){return t+e+r+n>>>0},e.sum32_5=function(t,e,r,n,i){return t+e+r+n+i>>>0},e.sum64=function(t,e,r,n){var i=t[e],o=n+t[e+1]>>>0,s=(o>>0,t[e+1]=o},e.sum64_hi=function(t,e,r,n){return(e+n>>>0>>0},e.sum64_lo=function(t,e,r,n){return e+n>>>0},e.sum64_4_hi=function(t,e,r,n,i,o,s,a){var u=0,h=e;return u+=(h=h+n>>>0)>>0)>>0)>>0},e.sum64_4_lo=function(t,e,r,n,i,o,s,a){return e+n+o+a>>>0},e.sum64_5_hi=function(t,e,r,n,i,o,s,a,u,h){var c=0,l=e;return c+=(l=l+n>>>0)>>0)>>0)>>0)>>0},e.sum64_5_lo=function(t,e,r,n,i,o,s,a,u,h){return e+n+o+a+h>>>0},e.rotr64_hi=function(t,e,r){return(e<<32-r|t>>>r)>>>0},e.rotr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0},e.shr64_hi=function(t,e,r){return t>>>r},e.shr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0}},1172:(t,e,r)=>{"use strict";var n=r(3697),i=r(9848),o=r(5482);function s(t){if(!(this instanceof s))return new s(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=i.toArray(t.entropy,t.entropyEnc||"hex"),r=i.toArray(t.nonce,t.nonceEnc||"hex"),n=i.toArray(t.pers,t.persEnc||"hex");o(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}t.exports=s,s.prototype._init=function(t,e,r){var n=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},s.prototype.generate=function(t,e,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!==typeof e&&(n=r,r=e,e=null),r&&(r=i.toArray(r,n||"hex"),this._update(r));for(var o=[];o.length{e.read=function(t,e,r,n,i){var o,s,a=8*i-n-1,u=(1<>1,c=-7,l=r?i-1:0,f=r?-1:1,d=t[e+l];for(l+=f,o=d&(1<<-c)-1,d>>=-c,c+=a;c>0;o=256*o+t[e+l],l+=f,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=n;c>0;s=256*s+t[e+l],l+=f,c-=8);if(0===o)o=1-h;else{if(o===u)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,n),o-=h}return(d?-1:1)*s*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var s,a,u,h=8*o-i-1,c=(1<>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=c):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+l>=1?f/u:f*Math.pow(2,1-l))*u>=2&&(s++,u/=2),s+l>=c?(a=0,s=c):s+l>=1?(a=(e*u-1)*Math.pow(2,i),s+=l):(a=e*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;t[r+d]=255&a,d+=p,a/=256,i-=8);for(s=s<0;t[r+d]=255&s,d+=p,s/=256,h-=8);t[r+d-p]|=128*g}},6329:t=>{"function"===typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}},1237:(t,e,r)=>{"use strict";var n=r(6329),i=r(8233),o=r(9966).Buffer,s=new Array(16);function a(){i.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function u(t,e){return t<>>32-e}function h(t,e,r,n,i,o,s){return u(t+(e&r|~e&n)+i+o|0,s)+e|0}function c(t,e,r,n,i,o,s){return u(t+(e&n|r&~n)+i+o|0,s)+e|0}function l(t,e,r,n,i,o,s){return u(t+(e^r^n)+i+o|0,s)+e|0}function f(t,e,r,n,i,o,s){return u(t+(r^(e|~n))+i+o|0,s)+e|0}n(a,i),a.prototype._update=function(){for(var t=s,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var r=this._a,n=this._b,i=this._c,o=this._d;r=h(r,n,i,o,t[0],3614090360,7),o=h(o,r,n,i,t[1],3905402710,12),i=h(i,o,r,n,t[2],606105819,17),n=h(n,i,o,r,t[3],3250441966,22),r=h(r,n,i,o,t[4],4118548399,7),o=h(o,r,n,i,t[5],1200080426,12),i=h(i,o,r,n,t[6],2821735955,17),n=h(n,i,o,r,t[7],4249261313,22),r=h(r,n,i,o,t[8],1770035416,7),o=h(o,r,n,i,t[9],2336552879,12),i=h(i,o,r,n,t[10],4294925233,17),n=h(n,i,o,r,t[11],2304563134,22),r=h(r,n,i,o,t[12],1804603682,7),o=h(o,r,n,i,t[13],4254626195,12),i=h(i,o,r,n,t[14],2792965006,17),r=c(r,n=h(n,i,o,r,t[15],1236535329,22),i,o,t[1],4129170786,5),o=c(o,r,n,i,t[6],3225465664,9),i=c(i,o,r,n,t[11],643717713,14),n=c(n,i,o,r,t[0],3921069994,20),r=c(r,n,i,o,t[5],3593408605,5),o=c(o,r,n,i,t[10],38016083,9),i=c(i,o,r,n,t[15],3634488961,14),n=c(n,i,o,r,t[4],3889429448,20),r=c(r,n,i,o,t[9],568446438,5),o=c(o,r,n,i,t[14],3275163606,9),i=c(i,o,r,n,t[3],4107603335,14),n=c(n,i,o,r,t[8],1163531501,20),r=c(r,n,i,o,t[13],2850285829,5),o=c(o,r,n,i,t[2],4243563512,9),i=c(i,o,r,n,t[7],1735328473,14),r=l(r,n=c(n,i,o,r,t[12],2368359562,20),i,o,t[5],4294588738,4),o=l(o,r,n,i,t[8],2272392833,11),i=l(i,o,r,n,t[11],1839030562,16),n=l(n,i,o,r,t[14],4259657740,23),r=l(r,n,i,o,t[1],2763975236,4),o=l(o,r,n,i,t[4],1272893353,11),i=l(i,o,r,n,t[7],4139469664,16),n=l(n,i,o,r,t[10],3200236656,23),r=l(r,n,i,o,t[13],681279174,4),o=l(o,r,n,i,t[0],3936430074,11),i=l(i,o,r,n,t[3],3572445317,16),n=l(n,i,o,r,t[6],76029189,23),r=l(r,n,i,o,t[9],3654602809,4),o=l(o,r,n,i,t[12],3873151461,11),i=l(i,o,r,n,t[15],530742520,16),r=f(r,n=l(n,i,o,r,t[2],3299628645,23),i,o,t[0],4096336452,6),o=f(o,r,n,i,t[7],1126891415,10),i=f(i,o,r,n,t[14],2878612391,15),n=f(n,i,o,r,t[5],4237533241,21),r=f(r,n,i,o,t[12],1700485571,6),o=f(o,r,n,i,t[3],2399980690,10),i=f(i,o,r,n,t[10],4293915773,15),n=f(n,i,o,r,t[1],2240044497,21),r=f(r,n,i,o,t[8],1873313359,6),o=f(o,r,n,i,t[15],4264355552,10),i=f(i,o,r,n,t[6],2734768916,15),n=f(n,i,o,r,t[13],1309151649,21),r=f(r,n,i,o,t[4],4149444226,6),o=f(o,r,n,i,t[11],3174756917,10),i=f(i,o,r,n,t[2],718787259,15),n=f(n,i,o,r,t[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+i|0,this._d=this._d+o|0},a.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 t=o.allocUnsafe(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t},t.exports=a},8233:(t,e,r)=>{"use strict";var n=r(9966).Buffer,i=r(3350).Transform;function o(t){i.call(this),this._block=n.allocUnsafe(t),this._blockSize=t,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}r(6329)(o,i),o.prototype._transform=function(t,e,r){var n=null;try{this.update(t,e)}catch(i){n=i}r(n)},o.prototype._flush=function(t){var e=null;try{this.push(this.digest())}catch(r){e=r}t(e)},o.prototype.update=function(t,e){if(function(t,e){if(!n.isBuffer(t)&&"string"!==typeof t)throw new TypeError(e+" must be a string or a buffer")}(t,"Data"),this._finalized)throw new Error("Digest already called");n.isBuffer(t)||(t=n.from(t,e));for(var r=this._block,i=0;this._blockOffset+t.length-i>=this._blockSize;){for(var o=this._blockOffset;o0;++s)this._length[s]+=a,(a=this._length[s]/4294967296|0)>0&&(this._length[s]-=4294967296*a);return this},o.prototype._update=function(){throw new Error("_update is not implemented")},o.prototype.digest=function(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var e=this._digest();void 0!==t&&(e=e.toString(t)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return e},o.prototype._digest=function(){throw new Error("_digest is not implemented")},t.exports=o},1235:(t,e,r)=>{var n=r(7735),i=r(8462);function o(t){this.rand=t||new i.Rand}t.exports=o,o.create=function(t){return new o(t)},o.prototype._randbelow=function(t){var e=t.bitLength(),r=Math.ceil(e/8);do{var i=new n(this.rand.generate(r))}while(i.cmp(t)>=0);return i},o.prototype._randrange=function(t,e){var r=e.sub(t);return t.add(this._randbelow(r))},o.prototype.test=function(t,e,r){var i=t.bitLength(),o=n.mont(t),s=new n(1).toRed(o);e||(e=Math.max(1,i/48|0));for(var a=t.subn(1),u=0;!a.testn(u);u++);for(var h=t.shrn(u),c=a.toRed(o);e>0;e--){var l=this._randrange(new n(2),a);r&&r(l);var f=l.toRed(o).redPow(h);if(0!==f.cmp(s)&&0!==f.cmp(c)){for(var d=1;d0;e--){var c=this._randrange(new n(2),s),l=t.gcd(c);if(0!==l.cmpn(1))return l;var f=c.toRed(i).redPow(u);if(0!==f.cmp(o)&&0!==f.cmp(h)){for(var d=1;d=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function u(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function h(t,e,r,n){for(var i=0,o=Math.min(t.length,r),s=e;s=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"===typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"===typeof t)return this._initNumber(t,e,r);if("object"===typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n=e;n-=2)i=u(t,e,n)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2===0?e+1:e;n=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,c=r;c1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var c=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var h=1;h>>26,l=67108863&u,f=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=f;d++){var p=h-d|0;c+=(s=(i=0|t.words[p])*(o=0|e.words[d])+l)/67108864|0,l=67108863&s}r.words[h]=0|l,u=0|c}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,s=0;s>>24-i&16777215)||s!==this.length-1?c[6-u.length]+u+r:u+r,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!==0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var h=l[t],d=f[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var g=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?g+r:c[h-g.length]+g+r}for(this.isZero()&&(r="0"+r);r.length%e!==0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return n("undefined"!==typeof s),this.toArrayLike(s,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,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 s,a,u="le"===e,h=new t(o),c=this.clone();if(u){for(a=0;!c.isZero();a++)s=c.andln(255),c.iushrn(8),h[a]=s;for(;a=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0===(8191&e)&&(r+=13,e>>>=13),0===(127&e)&&(r+=7,e>>>=7),0===(15&e)&&(r+=4,e>>>=4),0===(3&e)&&(r+=2,e>>>=2),0===(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"===typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"===typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,d=0|s[1],p=8191&d,g=d>>>13,m=0|s[2],y=8191&m,w=m>>>13,v=0|s[3],b=8191&v,_=v>>>13,E=0|s[4],S=8191&E,M=E>>>13,A=0|s[5],I=8191&A,C=A>>>13,k=0|s[6],x=8191&k,T=k>>>13,O=0|s[7],N=8191&O,B=O>>>13,R=0|s[8],P=8191&R,L=R>>>13,D=0|s[9],U=8191&D,j=D>>>13,F=0|a[0],H=8191&F,z=F>>>13,V=0|a[1],q=8191&V,W=V>>>13,K=0|a[2],G=8191&K,X=K>>>13,Z=0|a[3],Y=8191&Z,Q=Z>>>13,J=0|a[4],$=8191&J,tt=J>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,ht=at>>>13,ct=0|a[8],lt=8191&ct,ft=ct>>>13,dt=0|a[9],pt=8191&dt,gt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(h+(n=Math.imul(l,H))|0)+((8191&(i=(i=Math.imul(l,z))+Math.imul(f,H)|0))<<13)|0;h=((o=Math.imul(f,z))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(p,H),i=(i=Math.imul(p,z))+Math.imul(g,H)|0,o=Math.imul(g,z);var yt=(h+(n=n+Math.imul(l,q)|0)|0)+((8191&(i=(i=i+Math.imul(l,W)|0)+Math.imul(f,q)|0))<<13)|0;h=((o=o+Math.imul(f,W)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(y,H),i=(i=Math.imul(y,z))+Math.imul(w,H)|0,o=Math.imul(w,z),n=n+Math.imul(p,q)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(g,q)|0,o=o+Math.imul(g,W)|0;var wt=(h+(n=n+Math.imul(l,G)|0)|0)+((8191&(i=(i=i+Math.imul(l,X)|0)+Math.imul(f,G)|0))<<13)|0;h=((o=o+Math.imul(f,X)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(b,H),i=(i=Math.imul(b,z))+Math.imul(_,H)|0,o=Math.imul(_,z),n=n+Math.imul(y,q)|0,i=(i=i+Math.imul(y,W)|0)+Math.imul(w,q)|0,o=o+Math.imul(w,W)|0,n=n+Math.imul(p,G)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(g,G)|0,o=o+Math.imul(g,X)|0;var vt=(h+(n=n+Math.imul(l,Y)|0)|0)+((8191&(i=(i=i+Math.imul(l,Q)|0)+Math.imul(f,Y)|0))<<13)|0;h=((o=o+Math.imul(f,Q)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(S,H),i=(i=Math.imul(S,z))+Math.imul(M,H)|0,o=Math.imul(M,z),n=n+Math.imul(b,q)|0,i=(i=i+Math.imul(b,W)|0)+Math.imul(_,q)|0,o=o+Math.imul(_,W)|0,n=n+Math.imul(y,G)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(w,G)|0,o=o+Math.imul(w,X)|0,n=n+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,Q)|0)+Math.imul(g,Y)|0,o=o+Math.imul(g,Q)|0;var bt=(h+(n=n+Math.imul(l,$)|0)|0)+((8191&(i=(i=i+Math.imul(l,tt)|0)+Math.imul(f,$)|0))<<13)|0;h=((o=o+Math.imul(f,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(I,H),i=(i=Math.imul(I,z))+Math.imul(C,H)|0,o=Math.imul(C,z),n=n+Math.imul(S,q)|0,i=(i=i+Math.imul(S,W)|0)+Math.imul(M,q)|0,o=o+Math.imul(M,W)|0,n=n+Math.imul(b,G)|0,i=(i=i+Math.imul(b,X)|0)+Math.imul(_,G)|0,o=o+Math.imul(_,X)|0,n=n+Math.imul(y,Y)|0,i=(i=i+Math.imul(y,Q)|0)+Math.imul(w,Y)|0,o=o+Math.imul(w,Q)|0,n=n+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(g,$)|0,o=o+Math.imul(g,tt)|0;var _t=(h+(n=n+Math.imul(l,rt)|0)|0)+((8191&(i=(i=i+Math.imul(l,nt)|0)+Math.imul(f,rt)|0))<<13)|0;h=((o=o+Math.imul(f,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(x,H),i=(i=Math.imul(x,z))+Math.imul(T,H)|0,o=Math.imul(T,z),n=n+Math.imul(I,q)|0,i=(i=i+Math.imul(I,W)|0)+Math.imul(C,q)|0,o=o+Math.imul(C,W)|0,n=n+Math.imul(S,G)|0,i=(i=i+Math.imul(S,X)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,X)|0,n=n+Math.imul(b,Y)|0,i=(i=i+Math.imul(b,Q)|0)+Math.imul(_,Y)|0,o=o+Math.imul(_,Q)|0,n=n+Math.imul(y,$)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(w,$)|0,o=o+Math.imul(w,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(g,rt)|0,o=o+Math.imul(g,nt)|0;var Et=(h+(n=n+Math.imul(l,ot)|0)|0)+((8191&(i=(i=i+Math.imul(l,st)|0)+Math.imul(f,ot)|0))<<13)|0;h=((o=o+Math.imul(f,st)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(N,H),i=(i=Math.imul(N,z))+Math.imul(B,H)|0,o=Math.imul(B,z),n=n+Math.imul(x,q)|0,i=(i=i+Math.imul(x,W)|0)+Math.imul(T,q)|0,o=o+Math.imul(T,W)|0,n=n+Math.imul(I,G)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(C,G)|0,o=o+Math.imul(C,X)|0,n=n+Math.imul(S,Y)|0,i=(i=i+Math.imul(S,Q)|0)+Math.imul(M,Y)|0,o=o+Math.imul(M,Q)|0,n=n+Math.imul(b,$)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(_,$)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(y,rt)|0,i=(i=i+Math.imul(y,nt)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(g,ot)|0,o=o+Math.imul(g,st)|0;var St=(h+(n=n+Math.imul(l,ut)|0)|0)+((8191&(i=(i=i+Math.imul(l,ht)|0)+Math.imul(f,ut)|0))<<13)|0;h=((o=o+Math.imul(f,ht)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(P,H),i=(i=Math.imul(P,z))+Math.imul(L,H)|0,o=Math.imul(L,z),n=n+Math.imul(N,q)|0,i=(i=i+Math.imul(N,W)|0)+Math.imul(B,q)|0,o=o+Math.imul(B,W)|0,n=n+Math.imul(x,G)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,X)|0,n=n+Math.imul(I,Y)|0,i=(i=i+Math.imul(I,Q)|0)+Math.imul(C,Y)|0,o=o+Math.imul(C,Q)|0,n=n+Math.imul(S,$)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,tt)|0,n=n+Math.imul(b,rt)|0,i=(i=i+Math.imul(b,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,st)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ht)|0)+Math.imul(g,ut)|0,o=o+Math.imul(g,ht)|0;var Mt=(h+(n=n+Math.imul(l,lt)|0)|0)+((8191&(i=(i=i+Math.imul(l,ft)|0)+Math.imul(f,lt)|0))<<13)|0;h=((o=o+Math.imul(f,ft)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(U,H),i=(i=Math.imul(U,z))+Math.imul(j,H)|0,o=Math.imul(j,z),n=n+Math.imul(P,q)|0,i=(i=i+Math.imul(P,W)|0)+Math.imul(L,q)|0,o=o+Math.imul(L,W)|0,n=n+Math.imul(N,G)|0,i=(i=i+Math.imul(N,X)|0)+Math.imul(B,G)|0,o=o+Math.imul(B,X)|0,n=n+Math.imul(x,Y)|0,i=(i=i+Math.imul(x,Q)|0)+Math.imul(T,Y)|0,o=o+Math.imul(T,Q)|0,n=n+Math.imul(I,$)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(C,$)|0,o=o+Math.imul(C,tt)|0,n=n+Math.imul(S,rt)|0,i=(i=i+Math.imul(S,nt)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,nt)|0,n=n+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ht)|0)+Math.imul(w,ut)|0,o=o+Math.imul(w,ht)|0,n=n+Math.imul(p,lt)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(g,lt)|0,o=o+Math.imul(g,ft)|0;var At=(h+(n=n+Math.imul(l,pt)|0)|0)+((8191&(i=(i=i+Math.imul(l,gt)|0)+Math.imul(f,pt)|0))<<13)|0;h=((o=o+Math.imul(f,gt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(U,q),i=(i=Math.imul(U,W))+Math.imul(j,q)|0,o=Math.imul(j,W),n=n+Math.imul(P,G)|0,i=(i=i+Math.imul(P,X)|0)+Math.imul(L,G)|0,o=o+Math.imul(L,X)|0,n=n+Math.imul(N,Y)|0,i=(i=i+Math.imul(N,Q)|0)+Math.imul(B,Y)|0,o=o+Math.imul(B,Q)|0,n=n+Math.imul(x,$)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(T,$)|0,o=o+Math.imul(T,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,nt)|0,n=n+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,n=n+Math.imul(b,ut)|0,i=(i=i+Math.imul(b,ht)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,ht)|0,n=n+Math.imul(y,lt)|0,i=(i=i+Math.imul(y,ft)|0)+Math.imul(w,lt)|0,o=o+Math.imul(w,ft)|0;var It=(h+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,gt)|0)+Math.imul(g,pt)|0))<<13)|0;h=((o=o+Math.imul(g,gt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(U,G),i=(i=Math.imul(U,X))+Math.imul(j,G)|0,o=Math.imul(j,X),n=n+Math.imul(P,Y)|0,i=(i=i+Math.imul(P,Q)|0)+Math.imul(L,Y)|0,o=o+Math.imul(L,Q)|0,n=n+Math.imul(N,$)|0,i=(i=i+Math.imul(N,tt)|0)+Math.imul(B,$)|0,o=o+Math.imul(B,tt)|0,n=n+Math.imul(x,rt)|0,i=(i=i+Math.imul(x,nt)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,st)|0,n=n+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,ht)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ht)|0,n=n+Math.imul(b,lt)|0,i=(i=i+Math.imul(b,ft)|0)+Math.imul(_,lt)|0,o=o+Math.imul(_,ft)|0;var Ct=(h+(n=n+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,gt)|0)+Math.imul(w,pt)|0))<<13)|0;h=((o=o+Math.imul(w,gt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(U,Y),i=(i=Math.imul(U,Q))+Math.imul(j,Y)|0,o=Math.imul(j,Q),n=n+Math.imul(P,$)|0,i=(i=i+Math.imul(P,tt)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,tt)|0,n=n+Math.imul(N,rt)|0,i=(i=i+Math.imul(N,nt)|0)+Math.imul(B,rt)|0,o=o+Math.imul(B,nt)|0,n=n+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,n=n+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,ht)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,ht)|0,n=n+Math.imul(S,lt)|0,i=(i=i+Math.imul(S,ft)|0)+Math.imul(M,lt)|0,o=o+Math.imul(M,ft)|0;var kt=(h+(n=n+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,gt)|0)+Math.imul(_,pt)|0))<<13)|0;h=((o=o+Math.imul(_,gt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(U,$),i=(i=Math.imul(U,tt))+Math.imul(j,$)|0,o=Math.imul(j,tt),n=n+Math.imul(P,rt)|0,i=(i=i+Math.imul(P,nt)|0)+Math.imul(L,rt)|0,o=o+Math.imul(L,nt)|0,n=n+Math.imul(N,ot)|0,i=(i=i+Math.imul(N,st)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,st)|0,n=n+Math.imul(x,ut)|0,i=(i=i+Math.imul(x,ht)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ht)|0,n=n+Math.imul(I,lt)|0,i=(i=i+Math.imul(I,ft)|0)+Math.imul(C,lt)|0,o=o+Math.imul(C,ft)|0;var xt=(h+(n=n+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,gt)|0)+Math.imul(M,pt)|0))<<13)|0;h=((o=o+Math.imul(M,gt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(U,rt),i=(i=Math.imul(U,nt))+Math.imul(j,rt)|0,o=Math.imul(j,nt),n=n+Math.imul(P,ot)|0,i=(i=i+Math.imul(P,st)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,st)|0,n=n+Math.imul(N,ut)|0,i=(i=i+Math.imul(N,ht)|0)+Math.imul(B,ut)|0,o=o+Math.imul(B,ht)|0,n=n+Math.imul(x,lt)|0,i=(i=i+Math.imul(x,ft)|0)+Math.imul(T,lt)|0,o=o+Math.imul(T,ft)|0;var Tt=(h+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,gt)|0)+Math.imul(C,pt)|0))<<13)|0;h=((o=o+Math.imul(C,gt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(U,ot),i=(i=Math.imul(U,st))+Math.imul(j,ot)|0,o=Math.imul(j,st),n=n+Math.imul(P,ut)|0,i=(i=i+Math.imul(P,ht)|0)+Math.imul(L,ut)|0,o=o+Math.imul(L,ht)|0,n=n+Math.imul(N,lt)|0,i=(i=i+Math.imul(N,ft)|0)+Math.imul(B,lt)|0,o=o+Math.imul(B,ft)|0;var Ot=(h+(n=n+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,gt)|0)+Math.imul(T,pt)|0))<<13)|0;h=((o=o+Math.imul(T,gt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(U,ut),i=(i=Math.imul(U,ht))+Math.imul(j,ut)|0,o=Math.imul(j,ht),n=n+Math.imul(P,lt)|0,i=(i=i+Math.imul(P,ft)|0)+Math.imul(L,lt)|0,o=o+Math.imul(L,ft)|0;var Nt=(h+(n=n+Math.imul(N,pt)|0)|0)+((8191&(i=(i=i+Math.imul(N,gt)|0)+Math.imul(B,pt)|0))<<13)|0;h=((o=o+Math.imul(B,gt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(U,lt),i=(i=Math.imul(U,ft))+Math.imul(j,lt)|0,o=Math.imul(j,ft);var Bt=(h+(n=n+Math.imul(P,pt)|0)|0)+((8191&(i=(i=i+Math.imul(P,gt)|0)+Math.imul(L,pt)|0))<<13)|0;h=((o=o+Math.imul(L,gt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863;var Rt=(h+(n=Math.imul(U,pt))|0)+((8191&(i=(i=Math.imul(U,gt))+Math.imul(j,pt)|0))<<13)|0;return h=((o=Math.imul(j,gt))+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,u[0]=mt,u[1]=yt,u[2]=wt,u[3]=vt,u[4]=bt,u[5]=_t,u[6]=Et,u[7]=St,u[8]=Mt,u[9]=At,u[10]=It,u[11]=Ct,u[12]=kt,u[13]=xt,u[14]=Tt,u[15]=Ot,u[16]=Nt,u[17]=Bt,u[18]=Rt,0!==h&&(u[19]=h,r.length++),r};function g(t,e,r){return(new m).mulp(t,e,r)}function m(t,e){this.x=t,this.y=e}Math.imul||(p=d),o.prototype.mulTo=function(t,e){var r,n=this.length+t.length;return r=10===this.length&&10===t.length?p(this,t,e):n<63?d(this,t,e):n<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,t,e):g(this,t,e),r},m.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n>=1;return n},m.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,e+=i/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,h=0;h=0&&(0!==c||h>=i);h--){var l=0|this.words[h];this.words[h]=c<<26-o|l>>>o,c=l&a}return u&&0!==c&&(u.words[u.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"===typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"===typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===a)return this.strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,s=0|i.words[i.length-1];0!==(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var h=0;h=0;l--){var f=67108864*(0|n.words[i.length+l])+(0|n.words[i.length+l-1]);for(f=Math.min(f/s|0,67108863),n._ishlnsubmul(i,f,l);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(i,1,l),n.isZero()||(n.negative^=1);a&&(a.words[l]=f)}return a&&a.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!==(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},o.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),h=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++h;for(var c=r.clone(),l=e.clone();!e.isZero();){for(var f=0,d=1;0===(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(c),s.isub(l)),i.iushrn(1),s.iushrn(1);for(var p=0,g=1;0===(r.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(c),u.isub(l)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),s.isub(u)):(r.isub(e),a.isub(i),u.isub(s))}return{a:a,b:u,gcd:r.iushln(h)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var h=0,c=1;0===(e.words[0]&c)&&h<26;++h,c<<=1);if(h>0)for(e.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var l=0,f=1;0===(r.words[0]&f)&&l<26;++l,f<<=1);if(l>0)for(r.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0===(1&this.words[0])},o.prototype.isOdd=function(){return 1===(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"===typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new S(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var y={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(t){if("string"===typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function M(t){S.call(this,t),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},i(v,w),v.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},v.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(y[t])return y[t];var e;if("k256"===t)e=new v;else if("p224"===t)e=new b;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new E}return y[t]=e,e},S.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},S.prototype._verify2=function(t,e){n(0===(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2===1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),h=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new o(2*c*c).toRed(this);0!==this.pow(c,h).cmp(u);)c.redIAdd(u);for(var l=this.pow(c,i),f=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(a);){for(var g=d,m=0;0!==g.cmp(a);m++)g=g.redSqr();n(m=0;n--){for(var h=e.words[n],c=u-1;c>=0;c--){var l=h>>c&1;i!==r[0]&&(i=this.sqr(i)),0!==l||0!==s?(s<<=1,s|=l,(4===++a||0===n&&0===c)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}u=26}return i},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new M(t)},i(M,S),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},5482:t=>{function e(t,e){if(!t)throw new Error(e||"Assertion failed")}t.exports=e,e.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)}},9848:(t,e)=>{"use strict";var r=e;function n(t){return 1===t.length?"0"+t:t}function i(t){for(var e="",r=0;r>8,s=255&i;o?r.push(o,s):r.push(s)}return r},r.zero2=n,r.toHex=i,r.encode=function(t,e){return"hex"===e?i(t):t}},6228:(t,e)=>{"use strict";function r(t){a(this instanceof r,"this","N64"),a(0===t||1===t,"sign","bit"),this.hi=0,this.lo=0,this.sign=t}function n(t,e){if(!(this instanceof n))return new n(t,e);r.call(this,0),this.from(t,e)}function i(t,e){if(!(this instanceof i))return new i(t,e);r.call(this,1),this.from(t,e)}function o(t){if(null==t)return 10;if("number"===typeof t)return t;switch(t){case"bin":return 2;case"oct":return 8;case"dec":return 10;case"hex":return 16}return 0}function s(t){if(Math.clz32)return 32-Math.clz32(t);let e=31;for(;e>=0&&0===(t&1<>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24&255}function p(t,e,r){t[r]=e>>>24&255,t[r+1]=e>>>16&255,t[r+2]=e>>>8&255,t[r+3]=255&e}r.prototype._add=function(t,e){const r=this.hi,n=this.lo,i=n+e|0,o=n>>31,s=e>>31,a=(r+t|0)+(1&(o&s|~(i>>31)&(o^s)));return this.hi=0|a,this.lo=i,this},r.prototype.iadd=function(t){return a(r.isN64(t),"operand","int64"),this._add(t.hi,t.lo)},r.prototype.iaddn=function(t){return a(u(t),"operand","number"),this._add(t>>31&-this.sign,0|t)},r.prototype.add=function(t){return this.clone().iadd(t)},r.prototype.addn=function(t){return this.clone().iaddn(t)},r.prototype._sub=function(t,e){return t=~t,-1===(e=~e)?(e=0,t+=1,t|=0):e+=1,this._add(t,e)},r.prototype.isub=function(t){return a(r.isN64(t),"operand","int64"),this._sub(t.hi,t.lo)},r.prototype.isubn=function(t){return a(u(t),"operand","number"),this._sub(t>>31&-this.sign,0|t)},r.prototype.sub=function(t){return this.clone().isub(t)},r.prototype.subn=function(t){return this.clone().isubn(t)},r.prototype._mul=function(t,e){const r=this.hi,n=this.lo,i=65535&r,o=n>>>16,s=65535&n,a=65535&t,u=e>>>16,h=65535&e;let c=0,l=0,f=0,d=0;d+=s*h,f+=d>>>16,d&=65535,f+=o*h,l+=f>>>16,f&=65535,f+=s*u,l+=f>>>16,f&=65535,l+=i*h,c+=l>>>16,l&=65535,l+=o*u,c+=l>>>16,l&=65535,l+=s*a,c+=l>>>16,l&=65535,c+=(r>>>16)*h+i*u+o*a+s*(t>>>16),c&=65535;const p=c<<16|l,g=f<<16|d;return this.hi=p,this.lo=g,this},r.prototype.imul=function(t){return a(r.isN64(t),"multiplicand","int64"),this._mul(t.hi,t.lo)},r.prototype.imuln=function(t){return a(u(t),"multiplicand","number"),this._mul(t>>31&-this.sign,0|t)},r.prototype.mul=function(t){return this.clone().imul(t)},r.prototype.muln=function(t){return this.clone().imuln(t)},r.prototype.idiv=function(t){let e=this;if(a(r.isN64(t),"divisor","int64"),t.isZero())throw new Error("Cannot divide by zero.");if(e.isZero())return e;if(e.eq(t))return e.set(1);if(e.isSafe()&&t.isSafe()){const r=function(t){return t<0?-Math.floor(-t):Math.floor(t)}(e.toDouble()/t.toDouble());return e.set(r)}let i=!1;e.sign&&(e.hi<0?t.hi<0?(e=e.ineg(),t=t.neg()):(e=e.ineg(),i=!0):t.hi<0&&(t=t.neg(),i=!0));const o=e.toU64(),s=t.toU64();if(o.lt(s))return e.set(0);if(o.ushrn(1).lt(s))return e.set(i?-1:1);const u=new n,h=new n;let c=o.bitLength();for(;c--;)h.ishln(1),h.lo|=o.testn(c),h.gte(s)&&(h.isub(s),u.setn(c,1));return e.hi=u.hi,e.lo=u.lo,i&&e.ineg(),e},r.prototype.idivn=function(t){return a(u(t),"divisor","number"),this.idiv(this._small(t))},r.prototype.div=function(t){return this.clone().idiv(t)},r.prototype.divn=function(t){return this.clone().idivn(t)},r.prototype.imod=function(t){const e=this;if(a(r.isN64(t),"divisor","int64"),t.isZero())throw new Error("Cannot divide by zero.");if(e.isZero())return e;if(e.eq(t))return e.set(0);if(e.isSafe()&&t.isSafe()){const r=e.toDouble()%t.toDouble();return e.set(r)}return e.isub(e.div(t).imul(t))},r.prototype.imodn=function(t){return a(u(t),"divisor","number"),this.imod(this._small(t))},r.prototype.mod=function(t){return this.clone().imod(t)},r.prototype.modn=function(t){return this.clone().imodn(t)},r.prototype.ipow=function(t){return a(r.isN64(t),"exponent","int64"),this.ipown(t.lo)},r.prototype.ipown=function(t){if(a(u(t),"exponent","number"),this.isZero())return this;const e=this.clone(),r=this;let n=t>>>0;for(r.set(1);n>0;)1&n&&r.imul(e),n>>>=1,e.imul(e);return r},r.prototype.pow=function(t){return this.clone().ipow(t)},r.prototype.pown=function(t){return this.clone().ipown(t)},r.prototype.sqr=function(){return this.mul(this)},r.prototype.isqr=function(){return this.imul(this)},r.prototype.iand=function(t){return a(r.isN64(t),"operand","int64"),this.hi&=t.hi,this.lo&=t.lo,this},r.prototype.iandn=function(t){return a(u(t),"operand","number"),this.hi&=t>>31&-this.sign,this.lo&=0|t,this},r.prototype.and=function(t){return this.clone().iand(t)},r.prototype.andn=function(t){return this.clone().iandn(t)},r.prototype.ior=function(t){return a(r.isN64(t),"operand","int64"),this.hi|=t.hi,this.lo|=t.lo,this},r.prototype.iorn=function(t){return a(u(t),"operand","number"),this.hi|=t>>31&-this.sign,this.lo|=0|t,this},r.prototype.or=function(t){return this.clone().ior(t)},r.prototype.orn=function(t){return this.clone().iorn(t)},r.prototype.ixor=function(t){return a(r.isN64(t),"operand","int64"),this.hi^=t.hi,this.lo^=t.lo,this},r.prototype.ixorn=function(t){return a(u(t),"operand","number"),this.hi^=t>>31&-this.sign,this.lo^=0|t,this},r.prototype.xor=function(t){return this.clone().ixor(t)},r.prototype.xorn=function(t){return this.clone().ixorn(t)},r.prototype.inot=function(){return this.hi=~this.hi,this.lo=~this.lo,this},r.prototype.not=function(){return this.clone().inot()},r.prototype.ishl=function(t){return a(r.isN64(t),"bits","int64"),this.ishln(t.lo)},r.prototype.ishln=function(t){if(a(u(t),"bits","number"),0===(t&=63))return this;let e=this.hi,r=this.lo;return t<32?(e<<=t,e|=r>>>32-t,r<<=t):(e=r<>>=t,r|=e<<32-t,e>>=t):(r=e>>t-32,e>>=31),this.hi=e,this.lo=r,this},r.prototype.shr=function(t){return this.clone().ishr(t)},r.prototype.shrn=function(t){return this.clone().ishrn(t)},r.prototype.iushr=function(t){return a(r.isN64(t),"bits","int64"),this.iushrn(t.lo)},r.prototype.iushrn=function(t){if(a(u(t),"bits","number"),0===(t&=63))return this;let e=this.hi,r=this.lo;return t<32?(r>>>=t,r|=e<<32-t,e>>>=t):(r=e>>>t-32,e=0),this.hi=0|e,this.lo=0|r,this},r.prototype.ushr=function(t){return this.clone().iushr(t)},r.prototype.ushrn=function(t){return this.clone().iushrn(t)},r.prototype.setn=function(t,e){return a(u(t),"bit","number"),(t&=63)<32?e?this.lo|=1<>>t&1:this.hi>>>t-32&1},r.prototype.setb=function(t,e){return a(u(t),"pos","number"),a(u(e),"ch","number"),e&=255,(t&=7)<4?(this.lo&=~(255<<8*t),this.lo|=e<<8*t):(this.hi&=~(255<<8*(t-4)),this.hi|=e<<8*(t-4)),this},r.prototype.orb=function(t,e){return a(u(t),"pos","number"),a(u(e),"ch","number"),e&=255,(t&=7)<4?this.lo|=e<<8*t:this.hi|=e<<8*(t-4),this},r.prototype.getb=function(t){return a(u(t),"pos","number"),(t&=7)<4?this.lo>>8*t&255:this.hi>>8*(t-4)&255},r.prototype.imaskn=function(t){return a(u(t),"bit","number"),(t&=63)<32?(this.hi=0,this.lo&=(1<>>=0,t>>>=0),nt?1:(i>>>=0,i<(e>>>=0)?-1:1)},r.prototype.cmp=function(t){return a(r.isN64(t),"value","int64"),this._cmp(t.hi,t.lo)},r.prototype.cmpn=function(t){return a(u(t),"value","number"),this._cmp(t>>31&-this.sign,0|t)},r.prototype.eq=function(t){return a(r.isN64(t),"value","int64"),this.hi===t.hi&&this.lo===t.lo},r.prototype.eqn=function(t){return a(u(t),"value","number"),this.hi===(t>>31&-this.sign)&&this.lo===(0|t)},r.prototype.gt=function(t){return this.cmp(t)>0},r.prototype.gtn=function(t){return this.cmpn(t)>0},r.prototype.gte=function(t){return this.cmp(t)>=0},r.prototype.gten=function(t){return this.cmpn(t)>=0},r.prototype.lt=function(t){return this.cmp(t)<0},r.prototype.ltn=function(t){return this.cmpn(t)<0},r.prototype.lte=function(t){return this.cmp(t)<=0},r.prototype.lten=function(t){return this.cmpn(t)<=0},r.prototype.isZero=function(){return 0===this.hi&&0===this.lo},r.prototype.isNeg=function(){return 1===this.sign&&this.hi<0},r.prototype.isOdd=function(){return 1===(1&this.lo)},r.prototype.isEven=function(){return 0===(1&this.lo)},r.prototype.clone=function(){const t=new this.constructor;return t.hi=this.hi,t.lo=this.lo,t},r.prototype.inject=function(t){return a(r.isN64(t),"value","int64"),this.hi=t.hi,this.lo=t.lo,this},r.prototype.set=function(t){a(function(t){return Number.isSafeInteger?Number.isSafeInteger(t):u(t)&&Math.floor(t)===t&&t>=-9007199254740991&&t<=9007199254740991}(t),"number","integer");let e=!1;return t<0&&(t=-t,e=!0),this.hi=t*(1/4294967296)|0,this.lo=0|t,e&&this.ineg(),this},r.prototype.join=function(t,e){return a(u(t),"hi","number"),a(u(e),"lo","number"),this.hi=0|t,this.lo=0|e,this},r.prototype._small=function(t){const e=new this.constructor;return e.hi=t>>31&-this.sign,e.lo=0|t,e},r.prototype.bitLength=function(){let t=this;return this.isNeg()&&(t=this.neg()),0===t.hi?s(t.lo):s(t.hi)+32},r.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},r.prototype.isSafe=function(){let t=this.hi;return this.isNeg()&&(t=~t,0===this.lo&&(t+=1)),0===(4292870144&t)},r.prototype.inspect=function(){let t="I64";return this.sign||(t="U64"),"<".concat(t,": ").concat(this.toString(10),">")},r.prototype.readLE=function(t,e){return a(t&&"number"===typeof t.length,"data","arraylike"),a((e|0)===e,"offset","integer"),a(e+8<=t.length,"offset","valid offset"),this.lo=l(t,e),this.hi=l(t,e+4),e+8},r.prototype.readBE=function(t,e){return a(t&&"number"===typeof t.length,"data","arraylike"),a((e|0)===e,"offset","integer"),a(e+8<=t.length,"offset","valid offset"),this.hi=f(t,e),this.lo=f(t,e+4),e+8},r.prototype.readRaw=function(t,e){return this.readLE(t,e)},r.prototype.writeLE=function(t,e){return a(t&&"number"===typeof t.length,"data","arraylike"),a((e|0)===e,"offset","integer"),a(e+8<=t.length,"offset","valid offset"),d(t,this.lo,e),d(t,this.hi,e+4),e+8},r.prototype.writeBE=function(t,e){return a(t&&"number"===typeof t.length,"data","arraylike"),a((e|0)===e,"offset","integer"),a(e+8<=t.length,"offset","valid offset"),p(t,this.hi,e),p(t,this.lo,e+4),e+8},r.prototype.writeRaw=function(t,e){return this.writeLE(t,e)},r.prototype.toU64=function(){const t=new n;return t.hi=this.hi,t.lo=this.lo,t},r.prototype.toI64=function(){const t=new i;return t.hi=this.hi,t.lo=this.lo,t},r.prototype.toNumber=function(){if(!this.isSafe())throw new Error("Number exceeds 53 bits.");return this.toDouble()},r.prototype.toDouble=function(){let t=this.hi;return this.sign||(t>>>=0),4294967296*t+(this.lo>>>0)},r.prototype.toInt=function(){return this.sign?this.lo:this.lo>>>0},r.prototype.toBool=function(){return!this.isZero()},r.prototype.toBits=function(){return[this.hi,this.lo]},r.prototype.toObject=function(){return{hi:this.hi,lo:this.lo}},r.prototype.toString=function(t,e){if(null==e&&(e=0),a((t=o(t))>>>0===t,"base","integer"),a(e>>>0===e,"pad","integer"),t<2||t>16)throw new Error("Base ranges between 2 and 16.");if(e>64)throw new Error("Maximum padding is 64 characters.");let r=this,n=!1;r.isNeg()&&(r=r.neg(),n=!0);let i=r.hi>>>0,s=r.lo>>>0,u="";do{const e=i%t;i-=e,i/=t,s+=4294967296*e;const r=s%t;s-=r,s/=t;let n=r;n+=n<10?48:87,u=String.fromCharCode(n)+u}while(s>0||i>0);for(;u.length>>=0,n>>>=0;const i=new t(r);return i.ishln(32),i.iadd(new t(n)),e&&i.ineg(),i},r.prototype.toLE=function(t){a("function"===typeof t,"ArrayLike","constructor");const e=c(t,8);return this.writeLE(e,0),e},r.prototype.toBE=function(t){a("function"===typeof t,"ArrayLike","constructor");const e=c(t,8);return this.writeBE(e,0),e},r.prototype.toRaw=function(t){return this.toLE(t)},r.prototype.fromNumber=function(t){return this.set(t)},r.prototype.fromInt=function(t){return a(u(t),"integer","number"),this.join(t>>31&-this.sign,t)},r.prototype.fromBool=function(t){return a("boolean"===typeof t,"value","boolean"),this.hi=0,this.lo=t?1:0,this},r.prototype.fromBits=function(t,e){return this.join(t,e)},r.prototype.fromObject=function(t){return a(t&&"object"===typeof t,"number","object"),this.fromBits(t.hi,t.lo)},r.prototype.fromString=function(t,e){if(e=o(e),a("string"===typeof t,"string","string"),a(e>>>0===e,"base","integer"),e<2||e>16)throw new Error("Base ranges between 2 and 16.");let r=!1,n=0;if(t.length>0&&"-"===t[0]&&(n+=1,r=!0),t.length===n||t.length>n+64)throw new Error("Invalid string (bad length).");let i=0,s=0;for(;n=48&&r<=57?r-=48:r>=65&&r<=90?r-=55:r>=97&&r<=122?r-=87:r=e,r>=e)throw new Error("Invalid string (parse error).");if(s*=e,s+=r,i*=e,s>4294967295&&(r=s%4294967296,i+=(s-r)/4294967296,s=r),i>4294967295)throw new Error("Invalid string (overflow).")}return this.hi=0|i,this.lo=0|s,r&&this.ineg(),this},r.prototype.fromJSON=function(t){return this.fromString(t,16)},r.prototype.fromBN=function(t){a(t&&h(t.words),"number","big number");const e=this,r=t.clone(),n=r.isNeg();if(e.sign&&r.testn(63))throw new Error("Big number overflow.");let i=0;for(;!r.isZero();){if(8===i)throw new Error("Big number overflow.");e.orb(i,r.andln(255)),r.iushrn(8),i++}return n&&e.ineg(),e},r.prototype.fromLE=function(t){return this.readLE(t,0),this},r.prototype.fromBE=function(t){return this.readBE(t,0),this},r.prototype.fromRaw=function(t){return this.fromLE(t)},r.prototype.from=function(t,e){if(null==t)return this;if("number"===typeof t)return"number"===typeof e?this.fromBits(t,e):this.fromNumber(t);if("string"===typeof t)return this.fromString(t,e);if("object"===typeof t)return h(t.words)?this.fromBN(t):"number"===typeof t.length?this.fromRaw(t):this.fromObject(t);if("boolean"===typeof t)return this.fromBool(t);throw new TypeError("Non-numeric object passed to N64.")},r.min=function(t,e){return t.cmp(e)<0?t:e},r.max=function(t,e){return t.cmp(e)>0?t:e},r.random=function(){const t=new this;return t.hi=4294967296*Math.random()|0,t.lo=4294967296*Math.random()|0,t},r.pow=function(t,e){return(new this).fromInt(t).ipown(e)},r.shift=function(t,e){return(new this).fromInt(t).ishln(e)},r.readLE=function(t,e){const r=new this;return r.readLE(t,e),r},r.readBE=function(t,e){const r=new this;return r.readBE(t,e),r},r.readRaw=function(t,e){const r=new this;return r.readRaw(t,e),r},r.fromNumber=function(t){return(new this).fromNumber(t)},r.fromInt=function(t){return(new this).fromInt(t)},r.fromBool=function(t){return(new this).fromBool(t)},r.fromBits=function(t,e){return(new this).fromBits(t,e)},r.fromObject=function(t){return(new this).fromObject(t)},r.fromString=function(t,e){return(new this).fromString(t,e)},r.fromJSON=function(t){return(new this).fromJSON(t)},r.fromBN=function(t){return(new this).fromBN(t)},r.fromLE=function(t){return(new this).fromLE(t)},r.fromBE=function(t){return(new this).fromBE(t)},r.fromRaw=function(t){return(new this).fromRaw(t)},r.from=function(t,e){return(new this).from(t,e)},r.isN64=function(t){return t instanceof r},r.isU64=function(t){return t instanceof n},r.isI64=function(t){return t instanceof i},n.__proto__=r,n.prototype.__proto__=r.prototype,n.ULONG_MIN=0,n.ULONG_MAX=4294967295,n.UINT32_MIN=n(0,0),n.UINT32_MAX=n(0,4294967295),n.UINT64_MIN=n(0,0),n.UINT64_MAX=n(4294967295,4294967295),i.__proto__=r,i.prototype.__proto__=r.prototype,i.LONG_MIN=-2147483648,i.LONG_MAX=2147483647,i.INT32_MIN=i(4294967295,2147483648),i.INT32_MAX=i(0,2147483647),i.INT64_MIN=i(2147483648,0),i.INT64_MAX=i(2147483647,4294967295),e.N64=r,e.U64=n,e.I64=i},1762:(t,e,r)=>{"use strict";var n=r(9753);e.certificate=r(2004);var i=n.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())}));e.RSAPrivateKey=i;var o=n.define("RSAPublicKey",(function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())}));e.RSAPublicKey=o;var s=n.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())})),a=n.define("SubjectPublicKeyInfo",(function(){this.seq().obj(this.key("algorithm").use(s),this.key("subjectPublicKey").bitstr())}));e.PublicKey=a;var u=n.define("PrivateKeyInfo",(function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(s),this.key("subjectPrivateKey").octstr())}));e.PrivateKey=u;var h=n.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())}));e.EncryptedPrivateKey=h;var c=n.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())}));e.DSAPrivateKey=c,e.DSAparam=n.define("DSAparam",(function(){this.int()}));var l=n.define("ECParameters",(function(){this.choice({namedCurve:this.objid()})})),f=n.define("ECPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(l),this.key("publicKey").optional().explicit(1).bitstr())}));e.ECPrivateKey=f,e.signature=n.define("signature",(function(){this.seq().obj(this.key("r").int(),this.key("s").int())}))},2004:(t,e,r)=>{"use strict";var n=r(9753),i=n.define("Time",(function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})})),o=n.define("AttributeTypeValue",(function(){this.seq().obj(this.key("type").objid(),this.key("value").any())})),s=n.define("AlgorithmIdentifier",(function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional(),this.key("curve").objid().optional())})),a=n.define("SubjectPublicKeyInfo",(function(){this.seq().obj(this.key("algorithm").use(s),this.key("subjectPublicKey").bitstr())})),u=n.define("RelativeDistinguishedName",(function(){this.setof(o)})),h=n.define("RDNSequence",(function(){this.seqof(u)})),c=n.define("Name",(function(){this.choice({rdnSequence:this.use(h)})})),l=n.define("Validity",(function(){this.seq().obj(this.key("notBefore").use(i),this.key("notAfter").use(i))})),f=n.define("Extension",(function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())})),d=n.define("TBSCertificate",(function(){this.seq().obj(this.key("version").explicit(0).int().optional(),this.key("serialNumber").int(),this.key("signature").use(s),this.key("issuer").use(c),this.key("validity").use(l),this.key("subject").use(c),this.key("subjectPublicKeyInfo").use(a),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(f).optional())})),p=n.define("X509Certificate",(function(){this.seq().obj(this.key("tbsCertificate").use(d),this.key("signatureAlgorithm").use(s),this.key("signatureValue").bitstr())}));t.exports=p},7056:(t,e,r)=>{"use strict";var n=/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,i=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,o=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,s=r(8451),a=r(2428),u=r(9966).Buffer;t.exports=function(t,e){var r,h=t.toString(),c=h.match(n);if(c){var l="aes"+c[1],f=u.from(c[2],"hex"),d=u.from(c[3].replace(/[\r\n]/g,""),"base64"),p=s(e,f.slice(0,8),parseInt(c[1],10)).key,g=[],m=a.createDecipheriv(l,p,f);g.push(m.update(d)),g.push(m.final()),r=u.concat(g)}else{var y=h.match(o);r=u.from(y[2].replace(/[\r\n]/g,""),"base64")}return{tag:h.match(i)[1],data:r}}},4496:(t,e,r)=>{"use strict";var n=r(1762),i=r(5579),o=r(7056),s=r(2428),a=r(1973),u=r(9966).Buffer;function h(t){var e;"object"!==typeof t||u.isBuffer(t)||(e=t.passphrase,t=t.key),"string"===typeof t&&(t=u.from(t));var r,h,c=o(t,e),l=c.tag,f=c.data;switch(l){case"CERTIFICATE":h=n.certificate.decode(f,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(h||(h=n.PublicKey.decode(f,"der")),r=h.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return n.RSAPublicKey.decode(h.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return h.subjectPrivateKey=h.subjectPublicKey,{type:"ec",data:h};case"1.2.840.10040.4.1":return h.algorithm.params.pub_key=n.DSAparam.decode(h.subjectPublicKey.data,"der"),{type:"dsa",data:h.algorithm.params};default:throw new Error("unknown key id "+r)}case"ENCRYPTED PRIVATE KEY":f=function(t,e){var r=t.algorithm.decrypt.kde.kdeparams.salt,n=parseInt(t.algorithm.decrypt.kde.kdeparams.iters.toString(),10),o=i[t.algorithm.decrypt.cipher.algo.join(".")],h=t.algorithm.decrypt.cipher.iv,c=t.subjectPrivateKey,l=parseInt(o.split("-")[1],10)/8,f=a.pbkdf2Sync(e,r,n,l,"sha1"),d=s.createDecipheriv(o,f,h),p=[];return p.push(d.update(c)),p.push(d.final()),u.concat(p)}(f=n.EncryptedPrivateKey.decode(f,"der"),e);case"PRIVATE KEY":switch(r=(h=n.PrivateKey.decode(f,"der")).algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return n.RSAPrivateKey.decode(h.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:h.algorithm.curve,privateKey:n.ECPrivateKey.decode(h.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return h.algorithm.params.priv_key=n.DSAparam.decode(h.subjectPrivateKey,"der"),{type:"dsa",params:h.algorithm.params};default:throw new Error("unknown key id "+r)}case"RSA PUBLIC KEY":return n.RSAPublicKey.decode(f,"der");case"RSA PRIVATE KEY":return n.RSAPrivateKey.decode(f,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:n.DSAPrivateKey.decode(f,"der")};case"EC PRIVATE KEY":return{curve:(f=n.ECPrivateKey.decode(f,"der")).parameters.value,privateKey:f.privateKey};default:throw new Error("unknown key type "+l)}}h.signature=n.signature,t.exports=h},1973:(t,e,r)=>{e.pbkdf2=r(2861),e.pbkdf2Sync=r(4935)},2861:(t,e,r)=>{var n,i,o=r(9966).Buffer,s=r(7087),a=r(3408),u=r(4935),h=r(2115),c=r.g.crypto&&r.g.crypto.subtle,l={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"},f=[];function d(){return i||(i=r.g.process&&r.g.process.nextTick?r.g.process.nextTick:r.g.queueMicrotask?r.g.queueMicrotask:r.g.setImmediate?r.g.setImmediate:r.g.setTimeout)}function p(t,e,r,n,i){return c.importKey("raw",t,{name:"PBKDF2"},!1,["deriveBits"]).then((function(t){return c.deriveBits({name:"PBKDF2",salt:e,iterations:r,hash:{name:i}},t,n<<3)})).then((function(t){return o.from(t)}))}t.exports=function(t,e,i,g,m,y){"function"===typeof m&&(y=m,m=void 0);var w=l[(m=m||"sha1").toLowerCase()];if(w&&"function"===typeof r.g.Promise){if(s(i,g),t=h(t,a,"Password"),e=h(e,a,"Salt"),"function"!==typeof y)throw new Error("No callback provided to pbkdf2");!function(t,e){t.then((function(t){d()((function(){e(null,t)}))}),(function(t){d()((function(){e(t)}))}))}(function(t){if(r.g.process&&!r.g.process.browser)return Promise.resolve(!1);if(!c||!c.importKey||!c.deriveBits)return Promise.resolve(!1);if(void 0!==f[t])return f[t];var e=p(n=n||o.alloc(8),n,10,128,t).then((function(){return!0})).catch((function(){return!1}));return f[t]=e,e}(w).then((function(r){return r?p(t,e,i,g,w):u(t,e,i,g,m)})),y)}else d()((function(){var r;try{r=u(t,e,i,g,m)}catch(n){return y(n)}y(null,r)}))}},3408:(t,e,r)=>{var n,i=r(2285);if(r.g.process&&r.g.process.browser)n="utf-8";else if(r.g.process&&r.g.process.version){n=parseInt(i.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary"}else n="utf-8";t.exports=n},7087:t=>{var e=Math.pow(2,30)-1;t.exports=function(t,r){if("number"!==typeof t)throw new TypeError("Iterations not a number");if(t<0)throw new TypeError("Bad iterations");if("number"!==typeof r)throw new TypeError("Key length not a number");if(r<0||r>e||r!==r)throw new TypeError("Bad key length")}},4935:(t,e,r)=>{var n=r(3839),i=r(2108),o=r(307),s=r(9966).Buffer,a=r(7087),u=r(3408),h=r(2115),c=s.alloc(128),l={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function f(t,e,r){var a=function(t){function e(e){return o(t).update(e).digest()}function r(t){return(new i).update(t).digest()}return"rmd160"===t||"ripemd160"===t?r:"md5"===t?n:e}(t),u="sha512"===t||"sha384"===t?128:64;e.length>u?e=a(e):e.length{var n=r(9966).Buffer;t.exports=function(t,e,r){if(n.isBuffer(t))return t;if("string"===typeof t)return n.from(t,e);if(ArrayBuffer.isView(t))return n.from(t.buffer);throw new TypeError(r+" must be a string, a Buffer, a typed array or a DataView")}},6600:(t,e,r)=>{"use strict";var n=r(2285);"undefined"===typeof n||!n.version||0===n.version.indexOf("v0.")||0===n.version.indexOf("v1.")&&0!==n.version.indexOf("v1.8.")?t.exports={nextTick:function(t,e,r,i){if("function"!==typeof t)throw new TypeError('"callback" argument must be a function');var o,s,a=arguments.length;switch(a){case 0:case 1:return n.nextTick(t);case 2:return n.nextTick((function(){t.call(null,e)}));case 3:return n.nextTick((function(){t.call(null,e,r)}));case 4:return n.nextTick((function(){t.call(null,e,r,i)}));default:for(o=new Array(a-1),s=0;s{var e,r,n=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(t){if(e===setTimeout)return setTimeout(t,0);if((e===i||!e)&&setTimeout)return e=setTimeout,setTimeout(t,0);try{return e(t,0)}catch(r){try{return e.call(null,t,0)}catch(r){return e.call(this,t,0)}}}!function(){try{e="function"===typeof setTimeout?setTimeout:i}catch(t){e=i}try{r="function"===typeof clearTimeout?clearTimeout:o}catch(t){r=o}}();var a,u=[],h=!1,c=-1;function l(){h&&a&&(h=!1,a.length?u=a.concat(u):c=-1,u.length&&f())}function f(){if(!h){var t=s(l);h=!0;for(var e=u.length;e;){for(a=u,u=[];++c1)for(var r=1;r{"use strict";var n=r(837);function i(){}function o(){}o.resetWarningCache=i,t.exports=function(){function t(t,e,r,i,o,s){if(s!==n){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function e(){return t}t.isRequired=t;var r={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:o,resetWarningCache:i};return r.PropTypes=r,r}},5173:(t,e,r)=>{t.exports=r(1497)()},837:t=>{"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},1477:(t,e,r)=>{e.publicEncrypt=r(2339),e.privateDecrypt=r(6069),e.privateEncrypt=function(t,r){return e.publicEncrypt(t,r,!0)},e.publicDecrypt=function(t,r){return e.privateDecrypt(t,r,!0)}},6427:(t,e,r)=>{var n=r(6059),i=r(9966).Buffer;function o(t){var e=i.allocUnsafe(4);return e.writeUInt32BE(t,0),e}t.exports=function(t,e){for(var r,s=i.alloc(0),a=0;s.length=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function u(t,e,r){var n=a(t,r);return r-1>=e&&(n|=a(t,r-1)<<4),n}function h(t,e,r,n){for(var i=0,o=Math.min(t.length,r),s=e;s=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"===typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"===typeof t)return this._initNumber(t,e,r);if("object"===typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n=e;n-=2)i=u(t,e,n)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2===0?e+1:e;n=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,c=r;c1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var c=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var h=1;h>>26,l=67108863&u,f=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=f;d++){var p=h-d|0;c+=(s=(i=0|t.words[p])*(o=0|e.words[d])+l)/67108864|0,l=67108863&s}r.words[h]=0|l,u=0|c}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,s=0;s>>24-i&16777215)||s!==this.length-1?c[6-u.length]+u+r:u+r,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!==0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var h=l[t],d=f[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var g=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?g+r:c[h-g.length]+g+r}for(this.isZero()&&(r="0"+r);r.length%e!==0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return n("undefined"!==typeof s),this.toArrayLike(s,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,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 s,a,u="le"===e,h=new t(o),c=this.clone();if(u){for(a=0;!c.isZero();a++)s=c.andln(255),c.iushrn(8),h[a]=s;for(;a=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0===(8191&e)&&(r+=13,e>>>=13),0===(127&e)&&(r+=7,e>>>=7),0===(15&e)&&(r+=4,e>>>=4),0===(3&e)&&(r+=2,e>>>=2),0===(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"===typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"===typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s>26,this.words[s]=67108863&e;for(;0!==o&&s>26,this.words[s]=67108863&e;if(0===o&&s>>13,d=0|s[1],p=8191&d,g=d>>>13,m=0|s[2],y=8191&m,w=m>>>13,v=0|s[3],b=8191&v,_=v>>>13,E=0|s[4],S=8191&E,M=E>>>13,A=0|s[5],I=8191&A,C=A>>>13,k=0|s[6],x=8191&k,T=k>>>13,O=0|s[7],N=8191&O,B=O>>>13,R=0|s[8],P=8191&R,L=R>>>13,D=0|s[9],U=8191&D,j=D>>>13,F=0|a[0],H=8191&F,z=F>>>13,V=0|a[1],q=8191&V,W=V>>>13,K=0|a[2],G=8191&K,X=K>>>13,Z=0|a[3],Y=8191&Z,Q=Z>>>13,J=0|a[4],$=8191&J,tt=J>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,ht=at>>>13,ct=0|a[8],lt=8191&ct,ft=ct>>>13,dt=0|a[9],pt=8191&dt,gt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(h+(n=Math.imul(l,H))|0)+((8191&(i=(i=Math.imul(l,z))+Math.imul(f,H)|0))<<13)|0;h=((o=Math.imul(f,z))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(p,H),i=(i=Math.imul(p,z))+Math.imul(g,H)|0,o=Math.imul(g,z);var yt=(h+(n=n+Math.imul(l,q)|0)|0)+((8191&(i=(i=i+Math.imul(l,W)|0)+Math.imul(f,q)|0))<<13)|0;h=((o=o+Math.imul(f,W)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(y,H),i=(i=Math.imul(y,z))+Math.imul(w,H)|0,o=Math.imul(w,z),n=n+Math.imul(p,q)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(g,q)|0,o=o+Math.imul(g,W)|0;var wt=(h+(n=n+Math.imul(l,G)|0)|0)+((8191&(i=(i=i+Math.imul(l,X)|0)+Math.imul(f,G)|0))<<13)|0;h=((o=o+Math.imul(f,X)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(b,H),i=(i=Math.imul(b,z))+Math.imul(_,H)|0,o=Math.imul(_,z),n=n+Math.imul(y,q)|0,i=(i=i+Math.imul(y,W)|0)+Math.imul(w,q)|0,o=o+Math.imul(w,W)|0,n=n+Math.imul(p,G)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(g,G)|0,o=o+Math.imul(g,X)|0;var vt=(h+(n=n+Math.imul(l,Y)|0)|0)+((8191&(i=(i=i+Math.imul(l,Q)|0)+Math.imul(f,Y)|0))<<13)|0;h=((o=o+Math.imul(f,Q)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(S,H),i=(i=Math.imul(S,z))+Math.imul(M,H)|0,o=Math.imul(M,z),n=n+Math.imul(b,q)|0,i=(i=i+Math.imul(b,W)|0)+Math.imul(_,q)|0,o=o+Math.imul(_,W)|0,n=n+Math.imul(y,G)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(w,G)|0,o=o+Math.imul(w,X)|0,n=n+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,Q)|0)+Math.imul(g,Y)|0,o=o+Math.imul(g,Q)|0;var bt=(h+(n=n+Math.imul(l,$)|0)|0)+((8191&(i=(i=i+Math.imul(l,tt)|0)+Math.imul(f,$)|0))<<13)|0;h=((o=o+Math.imul(f,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(I,H),i=(i=Math.imul(I,z))+Math.imul(C,H)|0,o=Math.imul(C,z),n=n+Math.imul(S,q)|0,i=(i=i+Math.imul(S,W)|0)+Math.imul(M,q)|0,o=o+Math.imul(M,W)|0,n=n+Math.imul(b,G)|0,i=(i=i+Math.imul(b,X)|0)+Math.imul(_,G)|0,o=o+Math.imul(_,X)|0,n=n+Math.imul(y,Y)|0,i=(i=i+Math.imul(y,Q)|0)+Math.imul(w,Y)|0,o=o+Math.imul(w,Q)|0,n=n+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(g,$)|0,o=o+Math.imul(g,tt)|0;var _t=(h+(n=n+Math.imul(l,rt)|0)|0)+((8191&(i=(i=i+Math.imul(l,nt)|0)+Math.imul(f,rt)|0))<<13)|0;h=((o=o+Math.imul(f,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(x,H),i=(i=Math.imul(x,z))+Math.imul(T,H)|0,o=Math.imul(T,z),n=n+Math.imul(I,q)|0,i=(i=i+Math.imul(I,W)|0)+Math.imul(C,q)|0,o=o+Math.imul(C,W)|0,n=n+Math.imul(S,G)|0,i=(i=i+Math.imul(S,X)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,X)|0,n=n+Math.imul(b,Y)|0,i=(i=i+Math.imul(b,Q)|0)+Math.imul(_,Y)|0,o=o+Math.imul(_,Q)|0,n=n+Math.imul(y,$)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(w,$)|0,o=o+Math.imul(w,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(g,rt)|0,o=o+Math.imul(g,nt)|0;var Et=(h+(n=n+Math.imul(l,ot)|0)|0)+((8191&(i=(i=i+Math.imul(l,st)|0)+Math.imul(f,ot)|0))<<13)|0;h=((o=o+Math.imul(f,st)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(N,H),i=(i=Math.imul(N,z))+Math.imul(B,H)|0,o=Math.imul(B,z),n=n+Math.imul(x,q)|0,i=(i=i+Math.imul(x,W)|0)+Math.imul(T,q)|0,o=o+Math.imul(T,W)|0,n=n+Math.imul(I,G)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(C,G)|0,o=o+Math.imul(C,X)|0,n=n+Math.imul(S,Y)|0,i=(i=i+Math.imul(S,Q)|0)+Math.imul(M,Y)|0,o=o+Math.imul(M,Q)|0,n=n+Math.imul(b,$)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(_,$)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(y,rt)|0,i=(i=i+Math.imul(y,nt)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(g,ot)|0,o=o+Math.imul(g,st)|0;var St=(h+(n=n+Math.imul(l,ut)|0)|0)+((8191&(i=(i=i+Math.imul(l,ht)|0)+Math.imul(f,ut)|0))<<13)|0;h=((o=o+Math.imul(f,ht)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(P,H),i=(i=Math.imul(P,z))+Math.imul(L,H)|0,o=Math.imul(L,z),n=n+Math.imul(N,q)|0,i=(i=i+Math.imul(N,W)|0)+Math.imul(B,q)|0,o=o+Math.imul(B,W)|0,n=n+Math.imul(x,G)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,X)|0,n=n+Math.imul(I,Y)|0,i=(i=i+Math.imul(I,Q)|0)+Math.imul(C,Y)|0,o=o+Math.imul(C,Q)|0,n=n+Math.imul(S,$)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,tt)|0,n=n+Math.imul(b,rt)|0,i=(i=i+Math.imul(b,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,st)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ht)|0)+Math.imul(g,ut)|0,o=o+Math.imul(g,ht)|0;var Mt=(h+(n=n+Math.imul(l,lt)|0)|0)+((8191&(i=(i=i+Math.imul(l,ft)|0)+Math.imul(f,lt)|0))<<13)|0;h=((o=o+Math.imul(f,ft)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(U,H),i=(i=Math.imul(U,z))+Math.imul(j,H)|0,o=Math.imul(j,z),n=n+Math.imul(P,q)|0,i=(i=i+Math.imul(P,W)|0)+Math.imul(L,q)|0,o=o+Math.imul(L,W)|0,n=n+Math.imul(N,G)|0,i=(i=i+Math.imul(N,X)|0)+Math.imul(B,G)|0,o=o+Math.imul(B,X)|0,n=n+Math.imul(x,Y)|0,i=(i=i+Math.imul(x,Q)|0)+Math.imul(T,Y)|0,o=o+Math.imul(T,Q)|0,n=n+Math.imul(I,$)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(C,$)|0,o=o+Math.imul(C,tt)|0,n=n+Math.imul(S,rt)|0,i=(i=i+Math.imul(S,nt)|0)+Math.imul(M,rt)|0,o=o+Math.imul(M,nt)|0,n=n+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ht)|0)+Math.imul(w,ut)|0,o=o+Math.imul(w,ht)|0,n=n+Math.imul(p,lt)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(g,lt)|0,o=o+Math.imul(g,ft)|0;var At=(h+(n=n+Math.imul(l,pt)|0)|0)+((8191&(i=(i=i+Math.imul(l,gt)|0)+Math.imul(f,pt)|0))<<13)|0;h=((o=o+Math.imul(f,gt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(U,q),i=(i=Math.imul(U,W))+Math.imul(j,q)|0,o=Math.imul(j,W),n=n+Math.imul(P,G)|0,i=(i=i+Math.imul(P,X)|0)+Math.imul(L,G)|0,o=o+Math.imul(L,X)|0,n=n+Math.imul(N,Y)|0,i=(i=i+Math.imul(N,Q)|0)+Math.imul(B,Y)|0,o=o+Math.imul(B,Q)|0,n=n+Math.imul(x,$)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(T,$)|0,o=o+Math.imul(T,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,nt)|0,n=n+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,n=n+Math.imul(b,ut)|0,i=(i=i+Math.imul(b,ht)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,ht)|0,n=n+Math.imul(y,lt)|0,i=(i=i+Math.imul(y,ft)|0)+Math.imul(w,lt)|0,o=o+Math.imul(w,ft)|0;var It=(h+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,gt)|0)+Math.imul(g,pt)|0))<<13)|0;h=((o=o+Math.imul(g,gt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(U,G),i=(i=Math.imul(U,X))+Math.imul(j,G)|0,o=Math.imul(j,X),n=n+Math.imul(P,Y)|0,i=(i=i+Math.imul(P,Q)|0)+Math.imul(L,Y)|0,o=o+Math.imul(L,Q)|0,n=n+Math.imul(N,$)|0,i=(i=i+Math.imul(N,tt)|0)+Math.imul(B,$)|0,o=o+Math.imul(B,tt)|0,n=n+Math.imul(x,rt)|0,i=(i=i+Math.imul(x,nt)|0)+Math.imul(T,rt)|0,o=o+Math.imul(T,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,st)|0,n=n+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,ht)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ht)|0,n=n+Math.imul(b,lt)|0,i=(i=i+Math.imul(b,ft)|0)+Math.imul(_,lt)|0,o=o+Math.imul(_,ft)|0;var Ct=(h+(n=n+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,gt)|0)+Math.imul(w,pt)|0))<<13)|0;h=((o=o+Math.imul(w,gt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(U,Y),i=(i=Math.imul(U,Q))+Math.imul(j,Y)|0,o=Math.imul(j,Q),n=n+Math.imul(P,$)|0,i=(i=i+Math.imul(P,tt)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,tt)|0,n=n+Math.imul(N,rt)|0,i=(i=i+Math.imul(N,nt)|0)+Math.imul(B,rt)|0,o=o+Math.imul(B,nt)|0,n=n+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,n=n+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,ht)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,ht)|0,n=n+Math.imul(S,lt)|0,i=(i=i+Math.imul(S,ft)|0)+Math.imul(M,lt)|0,o=o+Math.imul(M,ft)|0;var kt=(h+(n=n+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,gt)|0)+Math.imul(_,pt)|0))<<13)|0;h=((o=o+Math.imul(_,gt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(U,$),i=(i=Math.imul(U,tt))+Math.imul(j,$)|0,o=Math.imul(j,tt),n=n+Math.imul(P,rt)|0,i=(i=i+Math.imul(P,nt)|0)+Math.imul(L,rt)|0,o=o+Math.imul(L,nt)|0,n=n+Math.imul(N,ot)|0,i=(i=i+Math.imul(N,st)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,st)|0,n=n+Math.imul(x,ut)|0,i=(i=i+Math.imul(x,ht)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ht)|0,n=n+Math.imul(I,lt)|0,i=(i=i+Math.imul(I,ft)|0)+Math.imul(C,lt)|0,o=o+Math.imul(C,ft)|0;var xt=(h+(n=n+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,gt)|0)+Math.imul(M,pt)|0))<<13)|0;h=((o=o+Math.imul(M,gt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(U,rt),i=(i=Math.imul(U,nt))+Math.imul(j,rt)|0,o=Math.imul(j,nt),n=n+Math.imul(P,ot)|0,i=(i=i+Math.imul(P,st)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,st)|0,n=n+Math.imul(N,ut)|0,i=(i=i+Math.imul(N,ht)|0)+Math.imul(B,ut)|0,o=o+Math.imul(B,ht)|0,n=n+Math.imul(x,lt)|0,i=(i=i+Math.imul(x,ft)|0)+Math.imul(T,lt)|0,o=o+Math.imul(T,ft)|0;var Tt=(h+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,gt)|0)+Math.imul(C,pt)|0))<<13)|0;h=((o=o+Math.imul(C,gt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(U,ot),i=(i=Math.imul(U,st))+Math.imul(j,ot)|0,o=Math.imul(j,st),n=n+Math.imul(P,ut)|0,i=(i=i+Math.imul(P,ht)|0)+Math.imul(L,ut)|0,o=o+Math.imul(L,ht)|0,n=n+Math.imul(N,lt)|0,i=(i=i+Math.imul(N,ft)|0)+Math.imul(B,lt)|0,o=o+Math.imul(B,ft)|0;var Ot=(h+(n=n+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,gt)|0)+Math.imul(T,pt)|0))<<13)|0;h=((o=o+Math.imul(T,gt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(U,ut),i=(i=Math.imul(U,ht))+Math.imul(j,ut)|0,o=Math.imul(j,ht),n=n+Math.imul(P,lt)|0,i=(i=i+Math.imul(P,ft)|0)+Math.imul(L,lt)|0,o=o+Math.imul(L,ft)|0;var Nt=(h+(n=n+Math.imul(N,pt)|0)|0)+((8191&(i=(i=i+Math.imul(N,gt)|0)+Math.imul(B,pt)|0))<<13)|0;h=((o=o+Math.imul(B,gt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(U,lt),i=(i=Math.imul(U,ft))+Math.imul(j,lt)|0,o=Math.imul(j,ft);var Bt=(h+(n=n+Math.imul(P,pt)|0)|0)+((8191&(i=(i=i+Math.imul(P,gt)|0)+Math.imul(L,pt)|0))<<13)|0;h=((o=o+Math.imul(L,gt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863;var Rt=(h+(n=Math.imul(U,pt))|0)+((8191&(i=(i=Math.imul(U,gt))+Math.imul(j,pt)|0))<<13)|0;return h=((o=Math.imul(j,gt))+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,u[0]=mt,u[1]=yt,u[2]=wt,u[3]=vt,u[4]=bt,u[5]=_t,u[6]=Et,u[7]=St,u[8]=Mt,u[9]=At,u[10]=It,u[11]=Ct,u[12]=kt,u[13]=xt,u[14]=Tt,u[15]=Ot,u[16]=Nt,u[17]=Bt,u[18]=Rt,0!==h&&(u[19]=h,r.length++),r};function g(t,e,r){return(new m).mulp(t,e,r)}function m(t,e){this.x=t,this.y=e}Math.imul||(p=d),o.prototype.mulTo=function(t,e){var r,n=this.length+t.length;return r=10===this.length&&10===t.length?p(this,t,e):n<63?d(this,t,e):n<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,t,e):g(this,t,e),r},m.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n>=1;return n},m.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s>=26,e+=i/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,h=0;h=0&&(0!==c||h>=i);h--){var l=0|this.words[h];this.words[h]=c<<26-o|l>>>o,c=l&a}return u&&0!==c&&(u.words[u.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"===typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"===typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===a)return this.strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,s=0|i.words[i.length-1];0!==(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==e){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var h=0;h=0;l--){var f=67108864*(0|n.words[i.length+l])+(0|n.words[i.length+l-1]);for(f=Math.min(f/s|0,67108863),n._ishlnsubmul(i,f,l);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(i,1,l),n.isZero()||(n.negative^=1);a&&(a.words[l]=f)}return a&&a.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:i,mod:s}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!==(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:a.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,s,a},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},o.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),h=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++h;for(var c=r.clone(),l=e.clone();!e.isZero();){for(var f=0,d=1;0===(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(c),s.isub(l)),i.iushrn(1),s.iushrn(1);for(var p=0,g=1;0===(r.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(c),u.isub(l)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),s.isub(u)):(r.isub(e),a.isub(i),u.isub(s))}return{a:a,b:u,gcd:r.iushln(h)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,s=new o(1),a=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var h=0,c=1;0===(e.words[0]&c)&&h<26;++h,c<<=1);if(h>0)for(e.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var l=0,f=1;0===(r.words[0]&f)&&l<26;++l,f<<=1);if(l>0)for(r.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(a)):(r.isub(e),a.isub(s))}return(i=0===e.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0===(1&this.words[0])},o.prototype.isOdd=function(){return 1===(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"===typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new S(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var y={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(t){if("string"===typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function M(t){S.call(this,t),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},i(v,w),v.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;i>>22,o=s}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},v.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(y[t])return y[t];var e;if("k256"===t)e=new v;else if("p224"===t)e=new b;else if("p192"===t)e=new _;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new E}return y[t]=e,e},S.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},S.prototype._verify2=function(t,e){n(0===(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},S.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},S.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},S.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},S.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},S.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},S.prototype.isqr=function(t){return this.imul(t,t.clone())},S.prototype.sqr=function(t){return this.mul(t,t)},S.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2===1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),h=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new o(2*c*c).toRed(this);0!==this.pow(c,h).cmp(u);)c.redIAdd(u);for(var l=this.pow(c,i),f=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=s;0!==d.cmp(a);){for(var g=d,m=0;0!==g.cmp(a);m++)g=g.redSqr();n(m=0;n--){for(var h=e.words[n],c=u-1;c>=0;c--){var l=h>>c&1;i!==r[0]&&(i=this.sqr(i)),0!==l||0!==s?(s<<=1,s|=l,(4===++a||0===n&&0===c)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}u=26}return i},S.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},S.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new M(t)},i(M,S),M.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},M.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},M.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},M.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},M.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},6069:(t,e,r)=>{var n=r(4496),i=r(6427),o=r(2076),s=r(3660),a=r(5721),u=r(6059),h=r(5176),c=r(9966).Buffer;t.exports=function(t,e,r){var l;l=t.padding?t.padding:r?1:4;var f,d=n(t),p=d.modulus.byteLength();if(e.length>p||new s(e).cmp(d.modulus)>=0)throw new Error("decryption error");f=r?h(new s(e),d):a(e,d);var g=c.alloc(p-f.length);if(f=c.concat([g,f],p),4===l)return function(t,e){var r=t.modulus.byteLength(),n=u("sha1").update(c.alloc(0)).digest(),s=n.length;if(0!==e[0])throw new Error("decryption error");var a=e.slice(1,s+1),h=e.slice(s+1),l=o(a,i(h,s)),f=o(h,i(l,r-s-1));if(function(t,e){t=c.from(t),e=c.from(e);var r=0,n=t.length;t.length!==e.length&&(r++,n=Math.min(t.length,e.length));var i=-1;for(;++i=e.length){o++;break}var s=e.slice(2,i-1);("0002"!==n.toString("hex")&&!r||"0001"!==n.toString("hex")&&r)&&o++;s.length<8&&o++;if(o)throw new Error("decryption error");return e.slice(i)}(0,f,r);if(3===l)return f;throw new Error("unknown padding")}},2339:(t,e,r)=>{var n=r(4496),i=r(5838),o=r(6059),s=r(6427),a=r(2076),u=r(3660),h=r(5176),c=r(5721),l=r(9966).Buffer;t.exports=function(t,e,r){var f;f=t.padding?t.padding:r?1:4;var d,p=n(t);if(4===f)d=function(t,e){var r=t.modulus.byteLength(),n=e.length,h=o("sha1").update(l.alloc(0)).digest(),c=h.length,f=2*c;if(n>r-f-2)throw new Error("message too long");var d=l.alloc(r-n-f-2),p=r-c-1,g=i(c),m=a(l.concat([h,d,l.alloc(1,1),e],p),s(g,p)),y=a(g,s(m,c));return new u(l.concat([l.alloc(1),y,m],r))}(p,e);else if(1===f)d=function(t,e,r){var n,o=e.length,s=t.modulus.byteLength();if(o>s-11)throw new Error("message too long");n=r?l.alloc(s-o-3,255):function(t){var e,r=l.allocUnsafe(t),n=0,o=i(2*t),s=0;for(;n=0)throw new Error("data too long for modulus")}return r?c(d,p):h(d,p)}},5176:(t,e,r)=>{var n=r(3660),i=r(9966).Buffer;t.exports=function(t,e){return i.from(t.toRed(n.mont(e.modulus)).redPow(new n(e.publicExponent)).fromRed().toArray())}},2076:t=>{t.exports=function(t,e){for(var r=t.length,n=-1;++n{var n=r(5957);function i(t){this.mode=n.MODE_8BIT_BYTE,this.data=t}i.prototype={getLength:function(t){return this.data.length},write:function(t){for(var e=0;e{function e(){this.buffer=new Array,this.length=0}e.prototype={get:function(t){var e=Math.floor(t/8);return 1==(this.buffer[e]>>>7-t%8&1)},put:function(t,e){for(var r=0;r>>e-r-1&1))},getLengthInBits:function(){return this.length},putBit:function(t){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}},t.exports=e},7742:t=>{t.exports={L:1,M:0,Q:3,H:2}},392:(t,e,r)=>{var n=r(4460);function i(t,e){if(void 0==t.length)throw new Error(t.length+"/"+e);for(var r=0;r{var n=r(3343),i=r(5436),o=r(8813),s=r(9898),a=r(392);function u(t,e){this.typeNumber=t,this.errorCorrectLevel=e,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}var h=u.prototype;h.addData=function(t){var e=new n(t);this.dataList.push(e),this.dataCache=null},h.isDark=function(t,e){if(t<0||this.moduleCount<=t||e<0||this.moduleCount<=e)throw new Error(t+","+e);return this.modules[t][e]},h.getModuleCount=function(){return this.moduleCount},h.make=function(){if(this.typeNumber<1){var t=1;for(t=1;t<40;t++){for(var e=i.getRSBlocks(t,this.errorCorrectLevel),r=new o,n=0,a=0;a=7&&this.setupTypeNumber(t),null==this.dataCache&&(this.dataCache=u.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,e)},h.setupPositionProbePattern=function(t,e){for(var r=-1;r<=7;r++)if(!(t+r<=-1||this.moduleCount<=t+r))for(var n=-1;n<=7;n++)e+n<=-1||this.moduleCount<=e+n||(this.modules[t+r][e+n]=0<=r&&r<=6&&(0==n||6==n)||0<=n&&n<=6&&(0==r||6==r)||2<=r&&r<=4&&2<=n&&n<=4)},h.getBestMaskPattern=function(){for(var t=0,e=0,r=0;r<8;r++){this.makeImpl(!0,r);var n=s.getLostPoint(this);(0==r||t>n)&&(t=n,e=r)}return e},h.createMovieClip=function(t,e,r){var n=t.createEmptyMovieClip(e,r);this.make();for(var i=0;i>r&1);this.modules[Math.floor(r/3)][r%3+this.moduleCount-8-3]=n}for(r=0;r<18;r++){n=!t&&1==(e>>r&1);this.modules[r%3+this.moduleCount-8-3][Math.floor(r/3)]=n}},h.setupTypeInfo=function(t,e){for(var r=this.errorCorrectLevel<<3|e,n=s.getBCHTypeInfo(r),i=0;i<15;i++){var o=!t&&1==(n>>i&1);i<6?this.modules[i][8]=o:i<8?this.modules[i+1][8]=o:this.modules[this.moduleCount-15+i][8]=o}for(i=0;i<15;i++){o=!t&&1==(n>>i&1);i<8?this.modules[8][this.moduleCount-i-1]=o:i<9?this.modules[8][15-i-1+1]=o:this.modules[8][15-i-1]=o}this.modules[this.moduleCount-8][8]=!t},h.mapData=function(t,e){for(var r=-1,n=this.moduleCount-1,i=7,o=0,a=this.moduleCount-1;a>0;a-=2)for(6==a&&a--;;){for(var u=0;u<2;u++)if(null==this.modules[n][a-u]){var h=!1;o>>i&1)),s.getMask(e,n,a-u)&&(h=!h),this.modules[n][a-u]=h,-1==--i&&(o++,i=7)}if((n+=r)<0||this.moduleCount<=n){n-=r,r=-r;break}}},u.PAD0=236,u.PAD1=17,u.createData=function(t,e,r){for(var n=i.getRSBlocks(t,e),a=new o,h=0;h8*l)throw new Error("code length overflow. ("+a.getLengthInBits()+">"+8*l+")");for(a.getLengthInBits()+4<=8*l&&a.put(0,4);a.getLengthInBits()%8!=0;)a.putBit(!1);for(;!(a.getLengthInBits()>=8*l)&&(a.put(u.PAD0,8),!(a.getLengthInBits()>=8*l));)a.put(u.PAD1,8);return u.createBytes(a,n)},u.createBytes=function(t,e){for(var r=0,n=0,i=0,o=new Array(e.length),u=new Array(e.length),h=0;h=0?p.get(g):0}}var m=0;for(f=0;f{var n=r(7742);function i(t,e){this.totalCount=t,this.dataCount=e}i.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],i.getRSBlocks=function(t,e){var r=i.getRsBlockTable(t,e);if(void 0==r)throw new Error("bad rs block @ typeNumber:"+t+"/errorCorrectLevel:"+e);for(var n=r.length/3,o=new Array,s=0;s{for(var e={glog:function(t){if(t<1)throw new Error("glog("+t+")");return e.LOG_TABLE[t]},gexp:function(t){for(;t<0;)t+=255;for(;t>=256;)t-=255;return e.EXP_TABLE[t]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},r=0;r<8;r++)e.EXP_TABLE[r]=1<{t.exports={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8}},9898:(t,e,r)=>{var n=r(5957),i=r(392),o=r(4460),s=0,a=1,u=2,h=3,c=4,l=5,f=6,d=7,p={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(t){for(var e=t<<10;p.getBCHDigit(e)-p.getBCHDigit(p.G15)>=0;)e^=p.G15<=0;)e^=p.G18<>>=1;return e},getPatternPosition:function(t){return p.PATTERN_POSITION_TABLE[t-1]},getMask:function(t,e,r){switch(t){case s:return(e+r)%2==0;case a:return e%2==0;case u:return r%3==0;case h:return(e+r)%3==0;case c:return(Math.floor(e/2)+Math.floor(r/3))%2==0;case l:return e*r%2+e*r%3==0;case f:return(e*r%2+e*r%3)%2==0;case d:return(e*r%3+(e+r)%2)%2==0;default:throw new Error("bad maskPattern:"+t)}},getErrorCorrectPolynomial:function(t){for(var e=new i([1],0),r=0;r5&&(r+=3+o-5)}for(n=0;n{"use strict";var n=r(2285),i=65536,o=4294967295;var s=r(9966).Buffer,a=r.g.crypto||r.g.msCrypto;a&&a.getRandomValues?t.exports=function(t,e){if(t>o)throw new RangeError("requested too many random bytes");var r=s.allocUnsafe(t);if(t>0)if(t>i)for(var u=0;u{"use strict";var n=r(2285);function i(){throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}var o=r(9966),s=r(5838),a=o.Buffer,u=o.kMaxLength,h=r.g.crypto||r.g.msCrypto,c=Math.pow(2,32)-1;function l(t,e){if("number"!==typeof t||t!==t)throw new TypeError("offset must be a number");if(t>c||t<0)throw new TypeError("offset must be a uint32");if(t>u||t>e)throw new RangeError("offset out of range")}function f(t,e,r){if("number"!==typeof t||t!==t)throw new TypeError("size must be a number");if(t>c||t<0)throw new TypeError("size must be a uint32");if(t+e>r||t>u)throw new RangeError("buffer too small")}function d(t,e,r,i){if(n.browser){var o=t.buffer,a=new Uint8Array(o,e,r);return h.getRandomValues(a),i?void n.nextTick((function(){i(null,t)})):t}if(!i)return s(r).copy(t,e),t;s(r,(function(r,n){if(r)return i(r);n.copy(t,e),i(null,t)}))}h&&h.getRandomValues||!n.browser?(e.randomFill=function(t,e,n,i){if(!a.isBuffer(t)&&!(t instanceof r.g.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if("function"===typeof e)i=e,e=0,n=t.length;else if("function"===typeof n)i=n,n=t.length-e;else if("function"!==typeof i)throw new TypeError('"cb" argument must be a function');return l(e,t.length),f(n,e,t.length),d(t,e,n,i)},e.randomFillSync=function(t,e,n){"undefined"===typeof e&&(e=0);if(!a.isBuffer(t)&&!(t instanceof r.g.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');l(e,t.length),void 0===n&&(n=t.length-e);return f(n,e,t.length),d(t,e,n)}):(e.randomFill=i,e.randomFillSync=i)},2730:(t,e,r)=>{"use strict";var n=r(5043),i=r(8853);function o(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,r=1;r