PageSourceSearch

https://old-rock-website-new-2026.vercel.app/_next/static/chunks/7012.7f818776e04148ab.js

js old-rock-website-new-2026.vercel.app collected 2026-10-03 07:27:05 UTC 276,326 bytes, 20 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7012],{97012:function(e,t,r){"use strict";let i;r.d(t,{EthereumProvider:function(){return sH}});var n,s=r(55445),o=r.n(s),a=r(5665);let c=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,l=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,h=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function u(e,t){if("__proto__"===e||"constructor"===e&&t&&"object"==typeof t&&"prototype"in t){console.warn(`[destr] Dropping "${e}" key to prevent prototype pollution.`);return}return t}function p(e,t={}){if("string"!=typeof e)return e;if('"'===e[0]&&'"'===e[e.length-1]&&-1===e.indexOf("\\"))return e.slice(1,-1);let r=e.trim();if(r.length<=9)switch(r.toLowerCase()){case"true":return!0;case"false":return!1;case"undefined":return;case"null":return null;case"nan":return Number.NaN;case"infinity":return Number.POSITIVE_INFINITY;case"-infinity":return Number.NEGATIVE_INFINITY}if(!h.test(e)){if(t.strict)throw SyntaxError("[destr] Invalid JSON");return e}try{if(c.test(e)||l.test(e)){if(t.strict)throw Error("[destr] Possible prototype pollution");return JSON.parse(e,u)}return JSON.parse(e)}catch(r){if(t.strict)throw r;return e}}var f=r(82957).Buffer;function d(e,...t){try{var r;return(r=e(...t))&&"function"==typeof r.then?r:Promise.resolve(r)}catch(e){return Promise.reject(e)}}function g(e){if(function(e){let t=typeof e;return null===e||"object"!==t&&"function"!==t}(e))return String(e);if(function(e){let t=Object.getPrototypeOf(e);return!t||t.isPrototypeOf(Object)}(e)||Array.isArray(e))return JSON.stringify(e);if("function"==typeof e.toJSON)return g(e.toJSON());throw Error("[unstorage] Cannot stringify value!")}let y="base64:";function v(e){return e&&e.split("?")[0]?.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,"")||""}function m(e){return(e=v(e))?e+":":""}let b=()=>{let e=new Map;return{name:"memory",getInstance:()=>e,hasItem:t=>e.has(t),getItem:t=>e.get(t)??null,getItemRaw:t=>e.get(t)??null,setItem(t,r){e.set(t,r)},setItemRaw(t,r){e.set(t,r)},removeItem(t){e.delete(t)},getKeys:()=>[...e.keys()],clear(){e.clear()},dispose(){e.clear()}}};function w(e,t,r){return e.watch?e.watch((e,i)=>t(e,r+i)):()=>{}}async function _(e){"function"==typeof e.dispose&&await d(e.dispose)}function E(e){return new Promise((t,r)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>r(e.error)})}function I(e,t){let r;let i=()=>{if(r)return r;let i=indexedDB.open(e);return i.onupgradeneeded=()=>i.result.createObjectStore(t),(r=E(i)).then(e=>{e.onclose=()=>r=void 0},()=>{}),r};return(e,r)=>i().then(i=>r(i.transaction(t,e).objectStore(t)))}function x(){return i||(i=I("keyval-store","keyval")),i}function P(e,t=x()){return t("readonly",t=>E(t.get(e)))}var S=r(80577),R=(e={})=>{let t;let r=e.base&&e.base.length>0?`${e.base}:`:"",i=e=>r+e;return e.dbName&&e.storeName&&(t=I(e.dbName,e.storeName)),{name:"idb-keyval",options:e,hasItem:async e=>!(typeof await P(i(e),t)>"u"),getItem:async e=>await P(i(e),t)??null,setItem:(e,r)=>(function(e,t,r=x()){return r("readwrite",r=>(r.put(t,e),E(r.transaction)))})(i(e),r,t),removeItem:e=>(function(e,t=x()){return t("readwrite",t=>(t.delete(e),E(t.transaction)))})(i(e),t),getKeys:()=>(function(e=x()){return e("readonly",e=>{var t;if(e.getAllKeys)return E(e.getAllKeys());let r=[];return(t=e=>r.push(e.key),e.openCursor().onsuccess=function(){this.result&&(t(this.result),this.result.continue())},E(e.transaction)).then(()=>r)})})(t),clear:()=>(function(e=x()){return e("readwrite",e=>(e.clear(),E(e.transaction)))})(t)}};class O{constructor(){this.indexedDb=function(e={}){let t={mounts:{"":e.driver||b()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=e=>{for(let r of t.mountpoints)if(e.startsWith(r))return{base:r,relativeKey:e.slice(r.length),driver:t.mounts[r]};return{base:"",relativeKey:e,driver:t.mounts[""]}},i=(e,r)=>t.mountpoints.filter(t=>t.startsWith(e)||r&&e.startsWith(t)).map(r=>({relativeBase:e.length>r.length?e.slice(r.length):void 0,mountpoint:r,driver:t.mounts[r]})),n=(e,r)=>{if(t.watching)for(let i of(r=v(r),t.watchListeners))i(e,r)},s=async()=>
1{if(!t.watching)for(let e in t.watching=!0,t.mounts)t.unwatch[e]=await w(t.mounts[e],n,e)},o=async()=>{if(t.watching){for(let e in t.unwatch)await t.unwatch[e]();t.unwatch={},t.watching=!1}},a=(e,t,i)=>{let n=new Map,s=e=>{let t=n.get(e.base);return t||(t={driver:e.driver,base:e.base,items:[]},n.set(e.base,t)),t};for(let i of e){let e="string"==typeof i,n=v(e?i:i.key),o=e?void 0:i.value,a=e||!i.options?t:{...t,...i.options},c=r(n);s(c).items.push({key:n,value:o,relativeKey:c.relativeKey,options:a})}return Promise.all([...n.values()].map(e=>i(e))).then(e=>e.flat())},c={hasItem(e,t={}){let{relativeKey:i,driver:n}=r(e=v(e));return d(n.hasItem,i,t)},getItem(e,t={}){let{relativeKey:i,driver:n}=r(e=v(e));return d(n.getItem,i,t).then(e=>p(e))},getItems:(e,t={})=>a(e,t,e=>e.driver.getItems?d(e.driver.getItems,e.items.map(e=>({key:e.relativeKey,options:e.options})),t).then(t=>t.map(t=>({key:function(...e){return v(e.join(":"))}(e.base,t.key),value:p(t.value)}))):Promise.all(e.items.map(t=>d(e.driver.getItem,t.relativeKey,t.options).then(e=>({key:t.key,value:p(e)}))))),getItemRaw(e,t={}){let{relativeKey:i,driver:n}=r(e=v(e));return n.getItemRaw?d(n.getItemRaw,i,t):d(n.getItem,i,t).then(e=>{var t;return"string"==typeof e&&e.startsWith(y)?(t=e.slice(y.length),globalThis.Buffer?f.from(t,"base64"):Uint8Array.from(globalThis.atob(t),e=>e.codePointAt(0))):e})},async setItem(e,t,i={}){if(void 0===t)return c.removeItem(e);let{relativeKey:s,driver:o}=r(e=v(e));o.setItem&&(await d(o.setItem,s,g(t),i),o.watch||n("update",e))},async setItems(e,t){await a(e,t,async e=>{if(e.driver.setItems)return d(e.driver.setItems,e.items.map(e=>({key:e.relativeKey,value:g(e.value),options:e.options})),t);e.driver.setItem&&await Promise.all(e.items.map(t=>d(e.driver.setItem,t.relativeKey,g(t.value),t.options)))})},async setItemRaw(e,t,i={}){if(void 0===t)return c.removeItem(e,i);let{relativeKey:s,driver:o}=r(e=v(e));if(o.setItemRaw)await d(o.setItemRaw,s,t,i);else{if(!o.setItem)return;await d(o.setItem,s,"string"==typeof t?t:y+(globalThis.Buffer?f.from(t).toString("base64"):globalThis.btoa(String.fromCodePoint(...t))),i)}o.watch||n("update",e)},async removeItem(e,t={}){"boolean"==typeof t&&(t={removeMeta:t});let{relativeKey:i,driver:s}=r(e=v(e));s.removeItem&&(await d(s.removeItem,i,t),(t.removeMeta||t.removeMata)&&await d(s.removeItem,i+"$",t),s.watch||n("remove",e))},async getMeta(e,t={}){"boolean"==typeof t&&(t={nativeOnly:t});let{relativeKey:i,driver:n}=r(e=v(e)),s=Object.create(null);if(n.getMeta&&Object.assign(s,await d(n.getMeta,i,t)),!t.nativeOnly){let e=await d(n.getItem,i+"$",t).then(e=>p(e));e&&"object"==typeof e&&("string"==typeof e.atime&&(e.atime=new Date(e.atime)),"string"==typeof e.mtime&&(e.mtime=new Date(e.mtime)),Object.assign(s,e))}return s},setMeta(e,t,r={}){return this.setItem(e+"$",t,r)},removeMeta(e,t={}){return this.removeItem(e+"$",t)},async getKeys(e,t={}){let r=i(e=m(e),!0),n=[],s=[],o=!0;for(let e of r){for(let r of(e.driver.flags?.maxDepth||(o=!1),await d(e.driver.getKeys,e.relativeBase,t))){let t=e.mountpoint+v(r);n.some(e=>t.startsWith(e))||s.push(t)}n=[e.mountpoint,...n.filter(t=>!t.startsWith(e.mountpoint))]}let a=void 0!==t.maxDepth&&!o;return s.filter(r=>{var i;return(!a||function(e,t){if(void 0===t)return!0;let r=0,i=e.indexOf(":");for(;i>-1;)r++,i=e.indexOf(":",i+1);return r<=t}(r,t.maxDepth))&&((i=e)?r.startsWith(i)&&"$"!==r[r.length-1]:"$"!==r[r.length-1])})},async clear(e,t={}){e=m(e),await Promise.all(i(e,!1).map(async e=>e.driver.clear?d(e.driver.clear,e.relativeBase,t):e.driver.removeItem?Promise.all((await e.driver.getKeys(e.relativeBase||"",t)).map(r=>e.driver.removeItem(r,t))):void 0))},async dispose(){await Promise.all(Object.values(t.mounts).map(e=>_(e)))},watch:async e=>(await s(),t.watchListeners.push(e),async()=>{t.watchListeners=t.watchListeners.filter(t=>t!==e),0===t.watchListeners.length&&await o()}),async unwatch(){t.watchListeners=[],await o()},mount(e,r){if((e=m(e))&&t.mounts[e])throw Error(`already mounted at ${e}`);return e&&(t.mountpoints.push(e),t.mountpoints.sort((e,t)=>t.length-e.length)),t.mounts[e]=r,t.watching&&Promise.resolve(w(r,n,e)).then(r=>{t.unwatch[e]=r}).catch(console.error),c},async unmount(e,r=!0){(e=m(e))&&t.mounts[e]&&(t.watching&&e in t.unwatch&&(t.unwatch[e]?.(),delete t.unwatch[e]),r&&await _(t.mounts[e]),t.mountpoints=t.mountpoints.filter(t=>t!==e),delete t.mounts[e])},getMount(e=""){let t=r(e=v(e)+":");return{driver:t.driver,base:t.base}},getMounts:(e="",t={})=>i(e=v(e),t.parents).map(e=>({driver:e.driver,base:e.mountpoint})),keys:(e,t={})=>c.getKeys(e,t),get:(e,t={})=>c.getItem(e,t),set:(e,t,r={})=>c.setItem(e,t,r),has:(e,t={})=>c.hasItem(e,t),del:(e,t={})=>c.removeItem(e,t),remove:(e,t={})=>c.removeItem(e,t)};return c}({driver:R({dbName:"WALLET_CONNECT_V2_INDEXED_DB",storeName:"keyvaluestorage"})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){let t=await this.indexedDb.getItem(e);if(null!==t)return t}async setItem(e,t){await this.indexedDb.setItem(e,(0,S.u)(t))}async removeItem(e){await this.indexedDb.removeItem(e)}}var A="u">typeof globalThis?globalThis:"u">typeof window?window:"u">typeof r.g?r.g:"u">typeof self?self:{},C={exports:{}};function N(e){var t;return[e[0],(0,S.D)(null!=(t=e[1])?t:"")]}!function(){function e(){}e.prototype.getItem=function(e){return this.hasOwnProperty(e)?String(this[e]):null},e.prototype.setItem=function(e,t){this[e]=String(t)},e.prototype.removeItem=function(e){delete this[e]},e.prototype.clear=function(){let e=this;Object.keys(e).forEach(function(t){e[t]=void 0,delete e[t]})},e.prototype.key=function(e){return e=e||0,Object.keys(this)[e]},e.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),"u">typeof A&&A.localStorage?C.exports=A.localStorage:"u">typeof window&&window.localStorage?C.exports=window.localStorage:C.exports=new e}();class q{constructor(){this.localStorage=C.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(N)}async getItem(e){let t=this.localStorage.getItem(e);if(null!==t)return(0,S.D)(t)}async setItem(e,t){this.localStorage.setItem(e,(0,S.u)(t))}async removeItem(e){this.localStorage.removeItem(e)}}let j=async(e,t,r)=>{let i="wc_storage_version",n=await t.getItem(i);if(n&&n>=1){r(t);return}let s=await e.getKeys();if(!s.length){r(t);return}let o=[];for(;s.length;){let r=s.shift();if(!r)continue;let i=r.toLowerCase();if(i.includes("wc@")||i.includes("walletconnect")||i.includes("wc_")||i.includes("wallet_connect")){let i=await e.getItem(r);await t.setItem(r,i),o.push(r)}}await t.setItem(i,1),r(t),T(e,o)},T=async(e,t)=>{t.length&&t.forEach(async t=>{await e.removeItem(t)})};class z{constructor(){this.initialized=!1,this.setInitialized=e=>{this.storage=e,this.initialized=!0};let e=new q;this.storage=e;try{let t=new O;j(e,t,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,t){return await this.initialize(),this.storage.setItem(e,t)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{let t=setInterval(()=>{this.initialized&&(clearInterval(t),e())},20)})}}
1var D=r(40632),k=r(97435),L=r.n(k);let $={level:"info"},U="custom_context";var M=Object.defineProperty,B=(e,t,r)=>t in e?M(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,H=Object.defineProperty,V=Object.defineProperties,K=Object.getOwnPropertyDescriptors,F=Object.getOwnPropertySymbols,Z=Object.prototype.hasOwnProperty,W=Object.prototype.propertyIsEnumerable,J=(e,t,r)=>t in e?H(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,G=(e,t)=>{for(var r in t||(t={}))Z.call(t,r)&&J(e,r,t[r]);if(F)for(var r of F(t))W.call(t,r)&&J(e,r,t[r]);return e},Q=(e,t)=>V(e,K(t));function Y(e){return Q(G({},e),{level:e?.level||$.level})}function X(e,t=U){return typeof e.bindings>"u"?function(e,t=U){return e[t]||""}(e,t):e.bindings().context||""}function ee(e,t,r=U){let i=function(e,t,r=U){let i=X(e,r);return i.trim()?`${i}/${t}`:t}(e,t,r);return function(e,t,r=U){return e[r]=t,e}(e.child({context:i}),i,r)}let et=null!=(n=L())?n:k;var er=r(93514);class ei extends er.q{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}}class en extends er.q{constructor(e,t){super(),this.core=e,this.logger=t,this.records=new Map}}class es{constructor(e,t){this.logger=e,this.core=t}}class eo extends er.q{constructor(e,t){super(),this.relayer=e,this.logger=t}}class ea extends er.q{constructor(e){super()}}
1class ec{constructor(e,t,r,i){this.core=e,this.logger=t,this.name=r}}class el extends er.q{constructor(e,t){super(),this.relayer=e,this.logger=t}}class eh extends er.q{constructor(e,t){super(),this.core=e,this.logger=t}}class eu{constructor(e,t){this.projectId=e,this.logger=t}}class ep{constructor(e,t){this.projectId=e,this.logger=t}}class ef{constructor(e){this.opts=e,this.protocol="wc",this.version=2}}class ed{constructor(e){this.client=e}}var eg=r(40537);function ey(e,...t){if(!(e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name))throw Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw Error("Uint8Array expected of length "+t+", got length="+e.length)}function ev(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}let em="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,eb=e=>new DataView(e.buffer,e.byteOffset,e.byteLength);function ew(e){return"string"==typeof e&&(e=function(e){if("string"!=typeof e)throw Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}(e)),ey(e),e}class e_{clone(){return this._cloneInto()}}function eE(e=32){if(em&&"function"==typeof em.getRandomValues)return em.getRandomValues(new Uint8Array(e));if(em&&"function"==typeof em.randomBytes)return em.randomBytes(e);throw Error("crypto.getRandomValues must be defined")}
1class eI extends e_{constructor(e,t,r,i){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=eb(this.buffer)}update(e){ev(this);let{view:t,buffer:r,blockLen:i}=this,n=(e=ew(e)).length;for(let s=0;s<n;){let o=Math.min(i-this.pos,n-s);if(o===i){let t=eb(e);for(;i<=n-s;s+=i)this.process(t,s);continue}r.set(e.subarray(s,s+o),this.pos),this.pos+=o,s+=o,this.pos===i&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){ev(this),function(e,t){ey(e);let r=t.outputLen;if(e.length<r)throw Error("digestInto() expects output buffer of length at least "+r)}(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:i,isLE:n}=this,{pos:s}=this;t[s++]=128,this.buffer.subarray(s).fill(0),this.padOffset>i-s&&(this.process(r,0),s=0);for(let e=s;e<i;e++)t[e]=0;(function(e,t,r,i){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,i);let n=BigInt(32),s=BigInt(4294967295),o=Number(r>>n&s),a=Number(r&s),c=i?4:0,l=i?0:4;e.setUint32(t+c,o,i),e.setUint32(t+l,a,i)})(r,i-8,BigInt(8*this.length),n),this.process(r,0);let o=eb(e),a=this.outputLen;if(a%4)throw Error("_sha2: outputLen should be aligned to 32bit");let c=a/4,l=this.get();if(c>l.length)throw Error("_sha2: outputLen bigger than state");for(let e=0;e<c;e++)o.setUint32(4*e,l[e],n)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:r,length:i,finished:n,destroyed:s,pos:o}=this;return e.length=i,e.pos=o,e.finished=n,e.destroyed=s,i%t&&e.buffer.set(r),e}}let ex=BigInt(4294967296-1),eP=BigInt(32),eS={split:function(e,t=!1){let r=new Uint32Array(e.length),i=new Uint32Array(e.length);for(let n=0;n<e.length;n++){let{h:s,l:o}=function(e,t=!1){return t?{h:Number(e&ex),l:Number(e>>eP&ex)}:{h:0|Number(e>>eP&ex),l:0|Number(e&ex)}}(e[n],t);[r[n],i[n]]=[s,o]}return[r,i]},shrSH:(e,t,r)=>e>>>r,shrSL:(e,t,r)=>e<<32-r|t>>>r,rotrSH:(e,t,r)=>e>>>r|t<<32-r,rotrSL:(e,t,r)=>e<<32-r|t>>>r,rotrBH:(e,t,r)=>e<<64-r|t>>>r-32,rotrBL:(e,t,r)=>e>>>r-32|t<<64-r,add:function(e,t,r,i){let n=(t>>
1>0)+(i>>>0);return{h:e+r+(n/4294967296|0)|0,l:0|n}},add3L:(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),add3H:(e,t,r,i)=>t+r+i+(e/4294967296|0)|0,add4L:(e,t,r,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(i>>>0),add4H:(e,t,r,i,n)=>t+r+i+n+(e/4294967296|0)|0,add5H:(e,t,r,i,n,s)=>t+r+i+n+s+(e/4294967296|0)|0,add5L:(e,t,r,i,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(i>>>0)+(n>>>0)},[eR,eO]=eS.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e3585
15771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))),eA=new Uint32Array(80),eC=new Uint32Array(80);class eN extends eI{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){let{Ah:e,Al:t,Bh:r,Bl:i,Ch:n,Cl:s,Dh:o,Dl:a,Eh:c,El:l,Fh:h,Fl:u,Gh:p,Gl:f,Hh:d,Hl:g}=this;return[e,t,r,i,n,s,o,a,c,l,h,u,p,f,d,g]}set(e,t,r,i,n,s,o,a,c,l,h,u,p,f,d,g){this.Ah=0|e,this.Al=0|t,this.Bh=0|r,this.Bl=0|i,this.Ch=0|n,this.Cl=0|s,this.Dh=0|o,this.Dl=0|a,this.Eh=0|c,this.El=0|l,this.Fh=0|h,this.Fl=0|u,this.Gh=0|p,this.Gl=0|f,this.Hh=0|d,this.Hl=0|g}process(e,t){for(let r=0;r<16;r++,t+=4)eA[r]=e.getUint32(t),eC[r]=e.getUint32(t+=4);for(let e=16;e<80;e++){let t=0|eA[e-15],r=0|eC[e-15],i=eS.rotrSH(t,r,1)^eS.rotrSH(t,r,8)^eS.shrSH(t,r,7),n=eS.rotrSL(t,r,1)^eS.rotrSL(t,r,8)^eS.shrSL(t,r,7),s=0|eA[e-2],o=0|eC[e-2],a=eS.rotrSH(s,o,19)^eS.rotrBH(s,o,61)^eS.shrSH(s,o,6),c=eS.rotrSL(s,o,19)^eS.rotrBL(s,o,61)^eS.shrSL(s,o,6),l=eS.add4L(n,c,eC[e-7],eC[e-16]),h=eS.add4H(l,i,a,eA[e-7],eA[e-16]);eA[e]=0|h,eC[e]=0|l}let{Ah:r,Al:i,Bh:n,Bl:s,Ch:o,Cl:a,Dh:c,Dl:l,Eh:h,El:u,Fh:p,Fl:f,Gh:d,Gl:g,Hh:y,Hl:v}=this;for(let e=0;e<80;e++){let t=eS.rotrSH(h,u,14)^eS.rotrSH(h,u,18)^eS.rotrBH(h,u,41),m=eS.rotrSL(h,u,14)^eS.rotrSL(h,u,18)^eS.rotrBL(h,u,41),b=h&p^~h&d,w=u&f^~u&g,_=eS.add5L(v,m,w,eO[e],eC[e]),E=eS.add5H(_,y,t,b,eR[e],eA[e]),I=0|_,x=eS.rotrSH(r,i,28)^eS.rotrBH(r,i,34)^eS.rotrBH(r,i,39),P=eS.rotrSL(r,i,28)^eS.rotrBL(r,i,34)^eS.rotrBL(r,i,39),S=r&n^r&o^n&o,R=i&s^i&a^s&a;y=0|d,v=0|g,d=0|p,g=0|f,p=0|h,f=0|u,({h:h,l:u}=eS.add(0|c,0|l,0|E,0|I)),c=0|o,l=0|a,o=0|n,a=0|s,n=0|r,s=0|i;let O=eS.add3L(I,P,R);r=eS.add3H(O,E,x,S),i=0|O}({h:r,l:i}=eS.add(0|this.Ah,0|this.Al,0|r,0|i)),({h:n,l:s}=eS.add(0|this.Bh,0|this.Bl,0|n,0|s)),({h:o,l:a}=eS.add(0|this.Ch,0|this.Cl,0|o,0|a)),({h:c,l:l}=eS.add(0|this.Dh,0|this.Dl,0|c,0|l)),({h:h,l:u}=eS.add(0|this.Eh,0|this.El,0|h,0|u)),({h:p,l:f}=eS.add(0|this.Fh,0|this.Fl,0|p,0|f)),({h:d,l:g}=eS.add(0|this.Gh,0|this.Gl,0|d,0|g)),({h:y,l:v}=eS.add(0|this.Hh,0|this.Hl,0|y,0|v)),this.set(r,i,n,s,o,a,c,l,h,u,p,f,d,g,y,v)}roundClean(){eA.fill(0),eC.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}let eq=function(e){let t=t=>e().update(ew(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}(()=>new eN),ej=BigInt(0),eT=BigInt(1),ez=BigInt(2);function eD(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function ek(e){if(!eD(e))throw Error("Uint8Array expected")}function eL(e,t){if("boolean"!=typeof t)throw Error(e+" boolean expected, got "+t)}let e$=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function eU(e){ek(e);let t="";for(let r=0;r<e.length;r++)t+=e$[e[r]];return t}function eM(e){if("string"!=typeof e)throw Error("hex string expected, got "+typeof e);return""===e?ej:BigInt("0x"+e)}let eB={_0:48,_9:57,A:65,F:70,a:97,f:102};function eH(e){return e>=eB._0&&e<=eB._9?e-eB._0:e>=eB.A&&e<=eB.F?e-(eB.A-10):e>=eB.a&&e<=eB.f?e-(eB.a-10):void 0}function eV(e){if("string"!=typeof e)throw Error("hex string expected, got "+typeof e);let t=e.length,r=t/2;if(t%2)throw Error("hex string expected, got unpadded hex of length "+t);let i=new Uint8Array(r);for(let t=0,n=0;t<r;t++,n+=2){let r=eH(e.charCodeAt(n)),s=eH(e.charCodeAt(n+1));if(void 0===r||void 0===s)throw Error('hex string expected, got non-hex character "'+(e[n]+e[n+1])+'" at index '+n);i[t]=16*r+s}return i}function eK(e){return ek(e),eM(eU(Uint8Array.from(e).reverse()))}function eF(e,t){return eV(e.toString(16).padStart(2*t,"0"))}function eZ(e,t){return eF(e,t).reverse()}function eW(e,t,r){let i;if("string"==typeof t)try{i=eV(t)}catch(t){throw Error(e+" must be hex string or Uint8Array, cause: "+t)}else if(eD(t))i=Uint8Array.from(t);else throw Error(e+" must be hex string or Uint8Array");let n=i.length;if("number"==typeof r&&n!==r)throw Error(e+" of length "+r+" expected, got "+n);return i}function eJ(...e){let t=0;for(let r=0;r<e.length;r++){let i=e[r];ek(i),t+=i.length}let r=new Uint8Array(t);for(let t=0,i=0;t<e.length;t++){let n=e[t];r.set(n,i),i+=n.length}return r}let eG=e=>"bigint"==typeof e&&ej<=e;function eQ(e,t,r,i){if(!(eG(t)&&eG(r)&&eG(i))||!(r<=t)||!(t<i))throw Error("expected valid "+e+": "+r+" <= n < "+i+", got "+t)}let eY=e=>(ez<<BigInt(e-1))-eT,eX={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,stringOrUint8Array:e=>"string"==typeof e||eD(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)};function e0(e,t,r={}){let i=(t,r,i)=>{let n=eX[r];if("function"!=typeof n)throw Error("invalid validator function");let s=e[t];if(!(i&&void 0===s)&&!n(s,e))throw Error("param "+String(t)+" is invali
1d. Expected "+r+", got "+s)};for(let[e,r]of Object.entries(t))i(e,r,!1);for(let[e,t]of Object.entries(r))i(e,t,!0);return e}function e1(e){let t=new WeakMap;return(r,...i)=>{let n=t.get(r);if(void 0!==n)return n;let s=e(r,...i);return t.set(r,s),s}}let e2=BigInt(0),e3=BigInt(1),e5=BigInt(2),e8=BigInt(3),e4=BigInt(4),e6=BigInt(5),e7=BigInt(8);function e9(e,t){let r=e%t;return r>=e2?r:t+r}function te(e,t,r){let i=e;for(;t-- >e2;)i*=i,i%=r;return i}function tt(e,t){if(e===e2)throw Error("invert: expected non-zero number");if(t<=e2)throw Error("invert: expected positive modulus, got "+t);let r=e9(e,t),i=t,n=e2,s=e3;for(;r!==e2;){let e=i/r,t=i%r,o=n-s*e;i=r,r=t,n=s,s=o}if(i!==e3)throw Error("invert: does not exist");return e9(n,t)}let tr=(e,t)=>(e9(e,t)&e3)===e3,ti=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function tn(e,t){let r=void 0!==t?t:e.toString(2).length;return{nBitLength:r,nByteLength:Math.ceil(r/8)}}function ts(e,t,r=!1,i={}){let n;if(e<=e2)throw Error("invalid field: expected ORDER > 0, got "+e);let{nBitLength:s,nByteLength:o}=tn(e,t);if(o>2048)throw Error("invalid field: expected ORDER of <= 2048 bytes");let a=Object.freeze({ORDER:e,isLE:r,BITS:s,BYTES:o,MASK:eY(s),ZERO:e2,ONE:e3,create:t=>e9(t,e),isValid:t=>{if("bigint"!=typeof t)throw Error("invalid field element: expected bigint, got "+typeof t);return e2<=t&&t<e},is0:e=>e===e2,isOdd:e=>(e&e3)===e3,neg:t=>e9(-t,e),eql:(e,t)=>e===t,sqr:t=>e9(t*t,e),add:(t,r)=>e9(t+r,e),sub:(t,r)=>e9(t-r,e),mul:(t,r)=>e9(t*r,e),pow:(e,t)=>(function(e,t,r){if(r<e2)throw Error("invalid exponent, negatives unsupported");if(r===e2)return e.ONE;if(r===e3)return t;let i=e.ONE,n=t;for(;r>e2;)r&e3&&(i=e.mul(i,n)),n=e.sqr(n),r>>=e3;return i})(a,e,t),div:(t,r)=>e9(t*tt(r,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>tt(t,e),sqrt:i.sqrt||(t=>(n||(n=function(e){if(e%e4===e8){let t=(e+e3)/e4;return function(e,r){let i=e.pow(r,t);if(!e.eql(e.sqr(i),r))throw Error("Cannot find square root");return i}}if(e%e7===e6){let t=(e-e6)/e7;return function(e,r){let i=e.mul(r,e5),n=e.pow(i,t),s=e.mul(r,n),o=e.mul(e.mul(s,e5),n),a=e.mul(s,e.sub(o,e.ONE));if(!e.eql(e.sqr(a),r))throw Error("Cannot find square root");return a}}return function(e){let t,r,i;let n=(e-e3)/e5;for(t=e-e3,r=0;t%e5===e2;t/=e5,r++);for(i=e5;i<e&&function(e,t,r){if(t<e2)throw Error("invalid exponent, negatives unsupported");if(r<=e2)throw Error("invalid modulus");if(r===e3)return e2;let i=e3;for(;t>e2;)t&e3&&(i=i*e%r),e=e*e%r,t>>=e3;return i}(i,n,e)!==e-e3;i++)if(i>1e3)throw Error("Cannot find square root: likely non-prime P");if(1===r){let t=(e+e3)/e4;return function(e,r){let i=e.pow(r,t);if(!e.eql(e.sqr(i),r))throw Error("Cannot find square root");return i}}let s=(t+e3)/e5;return function(e,o){if(e.pow(o,n)===e.neg(e.ONE))throw Error("Cannot find square root");let a=r,c=e.pow(e.mul(e.ONE,i),t),l=e.pow(o,s),h=e.pow(o,t);for(;!e.eql(h,e.ONE);){if(e.eql(h,e.ZERO))return e.ZERO;let t=1;for(let r=e.sqr(h);t<a&&!e.eql(r,e.ONE);t++)r=e.sqr(r);let r=e.pow(c,e3<<BigInt(a-t-1));c=e.sqr(r),l=e.mul(l,r),h=e.mul(h,c),a=t}return l}}(e)}(e)),n(a,t))),invertBatch:e=>(function(e,t){let r=Array(t.length),i=t.reduce((t,i,n)=>e.is0(i)?t:(r[n]=t,e.mul(t,i)),e.ONE),n=e.inv(i);return t.reduceRight((t,i,n)=>e.is0(i)?t:(r[n]=e.mul(t,r[n]),e.mul(t,i)),n),r})(a,e),cmov:(e,t,r)=>r?t:e,toBytes:e=>r?eZ(e,o):eF(e,o),fromBytes:e=>{if(e.length!==o)throw Error("Field.fromBytes: expected "+o+" bytes, got "+e.length);return r?eK(e):eM(eU(e))}});return Object.freeze(a)}let to=BigInt(0),ta=BigInt(1);function tc(e,t){let r=t.negate();return e?r:t}function tl(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw Error("invalid window size, expected [1.."+t+"], got W="+e)}function th(e,t){return tl(e,t),{windows:Math.ceil(t/e)+1,windowSize:2**(e-1)}}let tu=new WeakMap,tp=new WeakMap;function tf(e){return tp.get(e)||1}let td=BigInt(0),tg=BigInt(1),ty=BigInt(2),tv=BigInt(8),tm={zip215:!0};BigInt(0),BigInt(1);let tb=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),tw=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt(0);let t_=BigInt(1),tE=BigInt(2);BigInt(3);let tI=BigInt(5),tx=BigInt(8),tP=ts(tb,void 0,!0),tS=function(e){var t;let r=function(e){let t=(e0(e.Fp,ti.reduce((e,t)=>
1(e[t]="function",e),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),e0(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...tn(e.n,e.nBitLength),...e,p:e.Fp.ORDER}));return e0(e,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}(e),{Fp:i,n:n,prehash:s,hash:o,randomBytes:a,nByteLength:c,h:l}=r,h=ty<<BigInt(8*c)-tg,u=i.create,p=ts(r.n,r.nBitLength),f=r.uvRatio||((e,t)=>{try{return{isValid:!0,value:i.sqrt(e*i.inv(t))}}catch{return{isValid:!1,value:td}}}),d=r.adjustScalarBytes||(e=>e),g=r.domain||((e,t,r)=>{if(eL("phflag",r),t.length||r)throw Error("Contexts/pre-hash are not supported");return e});function y(e,t){eQ("coordinate "+e,t,td,h)}function v(e){if(!(e instanceof w))throw Error("ExtendedPoint expected")}let m=e1((e,t)=>{let{ex:r,ey:n,ez:s}=e,o=e.is0();null==t&&(t=o?tv:i.inv(s));let a=u(r*t),c=u(n*t),l=u(s*t);if(o)return{x:td,y:tg};if(l!==tg)throw Error("invZ was invalid");return{x:a,y:c}}),b=e1(e=>{let{a:t,d:i}=r;if(e.is0())throw Error("bad point: ZERO");let{ex:n,ey:s,ez:o,et:a}=e,c=u(n*n),l=u(s*s),h=u(o*o),p=u(h*h),f=u(c*t);if(u(h*u(f+l))!==u(p+u(i*u(c*l))))throw Error("bad point: equation left != right (1)");if(u(n*s)!==u(o*a))throw Error("bad point: equation left != right (2)");return!0});
1class w{constructor(e,t,r,i){this.ex=e,this.ey=t,this.ez=r,this.et=i,y("x",e),y("y",t),y("z",r),y("t",i),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(e){if(e instanceof w)throw Error("extended point not allowed");let{x:t,y:r}=e||{};return y("x",t),y("y",r),new w(t,r,tg,u(t*r))}static normalizeZ(e){let t=i.invertBatch(e.map(e=>e.ez));return e.map((e,r)=>e.toAffine(t[r])).map(w.fromAffine)}static msm(e,t){return function(e,t,r,i){if(function(e,t){if(!Array.isArray(e))throw Error("array expected");e.forEach((e,r)=>{if(!(e instanceof t))throw Error("invalid point at index "+r)})}(r,e),function(e,t){if(!Array.isArray(e))throw Error("array of scalars expected");e.forEach((e,r)=>{if(!t.isValid(e))throw Error("invalid scalar at index "+r)})}(i,t),r.length!==i.length)throw Error("arrays of points and scalars must have equal length");let n=e.ZERO,s=function(e){let t;for(t=0;e>ej;e>>=eT,t+=1);return t}(BigInt(r.length)),o=s>12?s-3:s>4?s-2:s?2:1,a=(1<<o)-1,c=Array(a+1).fill(n),l=Math.floor((t.BITS-1)/o)*o,h=n;for(let e=l;e>=0;e-=o){c.fill(n);for(let t=0;t<i.length;t++){let n=Number(i[t]>>BigInt(e)&BigInt(a));c[n]=c[n].add(r[t])}let t=n;for(let e=c.length-1,r=n;e>0;e--)r=r.add(c[e]),t=t.add(r);if(h=h.add(t),0!==e)for(let e=0;e<o;e++)h=h.double()}return h}(w,p,e,t)}_setWindowSize(e){I.setWindowSize(this,e)}assertValidity(){b(this)}equals(e){v(e);let{ex:t,ey:r,ez:i}=this,{ex:n,ey:s,ez:o}=e,a=u(t*o),c=u(n*i),l=u(r*o),h=u(s*i);return a===c&&l===h}is0(){return this.equals(w.ZERO)}negate(){return new w(u(-this.ex),this.ey,this.ez,u(-this.et))}double(){let{a:e}=r,{ex:t,ey:i,ez:n}=this,s=u(t*t),o=u(i*i),a=u(ty*u(n*n)),c=u(e*s),l=t+i,h=u(u(l*l)-s-o),p=c+o,f=p-a,d=c-o,g=u(h*f),y=u(p*d),v=u(h*d);return new w(g,y,u(f*p),v)}add(e){v(e);let{a:t,d:i}=r,{ex:n,ey:s,ez:o,et:a}=this,{ex:c,ey:l,ez:h,et:p}=e;if(t===BigInt(-1)){let e=u((s-n)*(l+c)),t=u((s+n)*(l-c)),r=u(t-e);if(r===td)return this.double();let i=u(o*ty*p),f=u(a*ty*h),d=f+i,g=t+e,y=f-i,v=u(d*r),m=u(g*y),b=u(d*y);return new w(v,m,u(r*g),b)}let f=u(n*c),d=u(s*l),g=u(a*i*p),y=u(o*h),m=u((n+s)*(c+l)-f-d),b=y-g,_=y+g,E=u(d-t*f),I=u(m*b),x=u(_*E),P=u(m*E);return new w(I,x,u(b*_),P)}subtract(e){return this.add(e.negate())}wNAF(e){return I.wNAFCached(this,e,w.normalizeZ)}multiply(e){eQ("scalar",e,tg,n);let{p:t,f:r}=this.wNAF(e);return w.normalizeZ([t,r])[0]}multiplyUnsafe(e,t=w.ZERO){return eQ("scalar",e,td,n),e===td?E:this.is0()||e===tg?this:I.wNAFCachedUnsafe(this,e,w.normalizeZ,t)}isSmallOrder(){return this.multiplyUnsafe(l).is0()}isTorsionFree(){return I.unsafeLadder(this,n).is0()}toAffine(e){return m(this,e)}clearCofactor(){let{h:e}=r;return e===tg?this:this.multiplyUnsafe(e)}static fromHex(e,t=!1){let{d:n,a:s}=r,o=i.BYTES;e=eW("pointHex",e,o),eL("zip215",t);let a=e.slice(),c=e[o-1];a[o-1]=-129&c;let l=eK(a);eQ("pointHex.y",l,td,t?h:i.ORDER);let p=u(l*l),{isValid:d,value:g}=f(u(p-tg),u(n*p-s));if(!d)throw Error("Point.fromHex: invalid y coordinate");let y=(g&tg)===tg,v=(128&c)!=0;if(!t&&g===td&&v)throw Error("Point.fromHex: x=0 and x_0=1");return v!==y&&(g=u(-g)),w.fromAffine({x:g,y:l})}static fromPrivateKey(e){return x(e).point}toRawBytes(){let{x:e,y:t}=this.toAffine(),r=eZ(t,i.BYTES);return r[r.length-1]|=e&tg?128:0,r}toHex(){return eU(this.toRawBytes())}}w.BASE=new w(r.Gx,r.Gy,tg,u(r.Gx*r.Gy)),w.ZERO=new w(td,tg,tg,td);let{BASE:_,ZERO:E}=w,I=(t=8*c,{constTimeNegate:tc,hasPrecomputes:e=>1!==tf(e),unsafeLadder(e,t,r=w.ZERO){let i=e;for(;t>to;)t&ta&&(r=r.add(i)),i=i.double(),t>>=ta;return r},precomputeWindow(e,r){let{windows:i,windowSize:n}=th(r,t),s=[],o=e,a=o;for(let e=0;e<i;e++){a=o,s.push(a);for(let e=1;e<n;e++)a=a.add(o),s.push(a);o=a.double()}return s},wNAF(e,r,i){let{windows:n,windowSize:s}=th(e,t),o=w.ZERO,a=w.BASE,c=BigInt(2**e-1),l=2**e,h=BigInt(e);for(let e=0;e<n;e++){let t=e*s,n=Number(i&c);i>>=h,n>s&&(n-=l,i+=ta);let u=t+Math.abs(n)-1,p=e%2!=0,f=n<0;0===n?a=a.add(tc(p,r[t])):o=o.add(tc(f,r[u]))}return{p:o,f:a}},wNAFUnsafe(e,r,i,n=w.ZERO){let{windows:s,windowSize:o}=th(e,t),a=BigInt(2**e-1),c=2**e,l=BigInt(e);for(let e=0;e<s;e++){let t=e*o;if(i===to)break;let s=Number(i&a);if(i>>=l,s>o&&(s-=c,i+=ta),0===s)continue;let h=r[t+Math.abs(s)-1];s<0&&(h=h.negate()),n=n.add(h)}return n},getPrecomputes(e,t,r){let i=tu.get(t);
1return i||(i=this.precomputeWindow(t,e),1!==e&&tu.set(t,r(i))),i},wNAFCached(e,t,r){let i=tf(e);return this.wNAF(i,this.getPrecomputes(i,e,r),t)},wNAFCachedUnsafe(e,t,r,i){let n=tf(e);return 1===n?this.unsafeLadder(e,t,i):this.wNAFUnsafe(n,this.getPrecomputes(n,e,r),t,i)},setWindowSize(e,r){tl(r,t),tp.set(e,r),tu.delete(e)}});function x(e){let t=i.BYTES;e=eW("private key",e,t);let r=eW("hashed private key",o(e),2*t),s=d(r.slice(0,t)),a=r.slice(t,2*t),c=e9(eK(s),n),l=_.multiply(c),h=l.toRawBytes();return{head:s,prefix:a,scalar:c,point:l,pointBytes:h}}function P(e=new Uint8Array,...t){return e9(eK(o(g(eJ(...t),eW("context",e),!!s))),n)}return _._setWindowSize(8),{CURVE:r,getPublicKey:function(e){return x(e).pointBytes},sign:function(e,t,r={}){e=eW("message",e),s&&(e=s(e));let{prefix:o,scalar:a,pointBytes:c}=x(t),l=P(r.context,o,e),h=_.multiply(l).toRawBytes(),u=e9(l+P(r.context,h,c,e)*a,n);return eQ("signature.s",u,td,n),eW("result",eJ(h,eZ(u,i.BYTES)),2*i.BYTES)},verify:function(e,t,r,n=tm){let o,a,c;let{context:l,zip215:h}=n,u=i.BYTES;e=eW("signature",e,2*u),t=eW("message",t),r=eW("publicKey",r,u),void 0!==h&&eL("zip215",h),s&&(t=s(t));let p=eK(e.slice(u,2*u));try{o=w.fromHex(r,h),a=w.fromHex(e.slice(0,u),h),c=_.multiplyUnsafe(p)}catch{return!1}if(!h&&o.isSmallOrder())return!1;let f=P(l,a.toRawBytes(),o.toRawBytes(),t);return a.add(o.multiplyUnsafe(f)).subtract(c).clearCofactor().equals(w.ZERO)},ExtendedPoint:w,utils:{getExtendedPublicKey:x,randomPrivateKey:()=>a(i.BYTES),precompute:(e=8,t=w.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)}}}({a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:tP,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:tx,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:eq,randomBytes:eE,adjustScalarBytes:function(e){return e[0]&=248,e[31]&=127,e[31]|=64,e},uvRatio:function(e,t){let r=e9(t*t*t,tb),i=function(e){let t=BigInt(10),r=BigInt(20),i=BigInt(40),n=BigInt(80),s=e*e%tb*e%tb,o=te(s,tE,tb)*s%tb,a=te(o,t_,tb)*e%tb,c=te(a,tI,tb)*a%tb,l=te(c,t,tb)*c%tb,h=te(l,r,tb)*l%tb,u=te(h,i,tb)*h%tb,p=te(u,n,tb)*u%tb,f=te(p,n,tb)*u%tb,d=te(f,t,tb)*c%tb;return{pow_p_5_8:te(d,tE,tb)*e%tb,b2:s}}(e*e9(r*r*t,tb)).pow_p_5_8,n=e9(e*r*i,tb),s=e9(t*n*n,tb),o=n,a=e9(n*tw,tb),c=s===e,l=s===e9(-e,tb),h=s===e9(-e*tw,tb);return c&&(n=o),(l||h)&&(n=a),tr(n,tb)&&(n=e9(-n,tb)),{isValid:c||l,value:n}}}),tR="base64url",tO="base58btc";function tA(e){return null!=globalThis.Buffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}function tC(e=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?tA(globalThis.Buffer.allocUnsafe(e)):new Uint8Array(e)}function tN(e,t){t||(t=e.reduce((e,t)=>e+t.length,0));let r=tC(t),i=0;for(let t of e)r.set(t,i),i+=t.length;return tA(r)}var tq=function(e,t){if(e.length>=255)throw TypeError("Alphabet too long");for(var r=new Uint8Array(256),i=0;i<r.length;i++)r[i]=255;for(var n=0;n<e.length;n++){var s=e.charAt(n),o=s.charCodeAt(0);if(255!==r[o])throw TypeError(s+" is ambiguous");r[o]=n}var a=e.length,c=e.charAt(0),l=Math.log(a)/Math.log(256),h=Math.log(256)/Math.log(a);function u(e){if("string"!=typeof e)throw TypeError("Expected String");if(0===e.length)return new Uint8Array;var t=0;if(" "!==e[0]){for(var i=0,n=0;e[t]===c;)i++,t++;for(var s=(e.length-t)*l+1>>>0,o=new Uint8Array(s);e[t];){var h=r[e.charCodeAt(t)];if(255===h)return;for(var u=0,p=s-1;(0!==h||u<n)&&-1!==p;p--,u++)h+=a*o[p]>>>0,o[p]=h%256>>>0,h=h/256>>>0;if(0!==h)throw Error("Non-zero carry");n=u,t++}if(" "!==e[t]){for(var f=s-n;f!==s&&0===o[f];)f++;for(var d=new Uint8Array(i+(s-f)),g=i;f!==s;)d[g++]=o[f++];return d}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,i=0,n=0,s=t.length;n!==s&&0===t[n];)n++,r++;for(var o=(s-n)*h+1>>>0,l=new Uint8Array(o);n!==s;){for(var u=t[n],p=0,f=o-1;(0!==u||p<i)&&-1!==f;f--,p++)u+=256*l[f]>>>0,l[f]=u%a>>>0,u=u/a>>>0;if(0!==u)throw Error("Non-zero carry");i=p,n++}for(var d=o-i;d!==o&&0===l[d];)d++;for(var g=c.repeat(r);d<o;++d)g+=e.charAt(l[d]);return g},decodeUnsafe:u,decode:function(e){var r=u(e);if(r)return r;throw Error(`Non-${t} character`)}}};let tj=e=>{if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw Error("Unknown type, must be binary type")},tT=e=>new TextEncoder().encode(e),tz=e=>new TextDecoder().decode(e);class tD{constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class tk{constructor(e,t,r){if(this.name=e,this.prefix=t,void 0===t.codePointAt(0))throw Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=r}decode(e){if("string"==typeof e){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name}
1 decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return t$(this,e)}}class tL{constructor(e){this.decoders=e}or(e){return t$(this,e)}decode(e){let t=e[0],r=this.decoders[t];if(r)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}let t$=(e,t)=>new tL({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class tU{constructor(e,t,r,i){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=i,this.encoder=new tD(e,t,r),this.decoder=new tk(e,t,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}let tM=({name:e,prefix:t,encode:r,decode:i})=>new tU(e,t,r,i),tB=({prefix:e,name:t,alphabet:r})=>{let{encode:i,decode:n}=tq(r,t);return tM({prefix:e,name:t,encode:i,decode:e=>tj(n(e))})},tH=(e,t,r,i)=>{let n={};for(let e=0;e<t.length;++e)n[t[e]]=e;let s=e.length;for(;"="===e[s-1];)--s;let o=new Uint8Array(s*r/8|0),a=0,c=0,l=0;for(let t=0;t<s;++t){let s=n[e[t]];if(void 0===s)throw SyntaxError(`Non-${i} character`);c=c<<r|s,(a+=r)>=8&&(a-=8,o[l++]=255&c>>a)}if(a>=r||255&c<<8-a)throw SyntaxError("Unexpected end of data");return o},tV=(e,t,r)=>{let i="="===t[t.length-1],n=(1<<r)-1,s="",o=0,a=0;for(let i=0;i<e.length;++i)for(a=a<<8|e[i],o+=8;o>r;)o-=r,s+=t[n&a>>o];if(o&&(s+=t[n&a<<r-o]),i)for(;s.length*r&7;)s+="=";return s},tK=({name:e,prefix:t,bitsPerChar:r,alphabet:i})=>tM({prefix:t,name:e,encode:e=>tV(e,i,r),decode:t=>tH(t,i,r,e)});var tF=Object.freeze({__proto__:null,identity:tM({prefix:"\0",name:"identity",encode:e=>tz(e),decode:e=>tT(e)})}),tZ=Object.freeze({__proto__:null,base2:tK({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})}),tW=Object.freeze({__proto__:null,base8:tK({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})}),tJ=Object.freeze({__proto__:null,base10:tB({prefix:"9",name:"base10",alphabet:"0123456789"})}),tG=Object.freeze({__proto__:null,base16:tK({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),base16upper:tK({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});let tQ=tK({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),tY=tK({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),tX=tK({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),t0=tK({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),t1=tK({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),t2=tK({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5});var t3=Object.freeze({__proto__:null,base32:tQ,base32upper:tY,base32pad:tX,base32padupper:t0,base32hex:t1,base32hexupper:t2,base32hexpad:tK({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),base32hexpadupper:tK({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),base32z:tK({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})}),t5=Object.freeze({__proto__:null,base36:tB({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),base36upper:tB({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})}),t8=Object.freeze({__proto__:null,base58btc:tB({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),base58flickr:tB({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});let t4=tK({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6});var t6=Object.freeze({__proto__:null,base64:t4,base64pad:tK({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),base64url:tK({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),base64urlpad:tK({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});let t7=Array.from("\uD83D\uDE80\uD83E\uDE90☄\uD83D\uDEF0\uD83C\uDF0C\uD83C\uDF11\uD83C\uDF12\uD83C\uDF13\uD83C\uDF14\uD83C\uDF15\uD83C\uDF16\uD83C\uDF17\uD83C\uDF18\uD83C\uDF0D\uD83C\uDF0F\uD83C\uDF0E\uD83D\uDC09☀\uD83D\uDCBB\uD83D\uDDA5\uD83D\uDCBE\uD83D\uDCBF\uD83D\uDE02❤\uD83D\uDE0D\uD83E\uDD23\uD83D\uDE0A\uD83D\uDE4F\uD83D\uDC95\uD83D\uDE2D\uD83D\uDE18\uD83D\uDC4D\uD83D\uDE05\uD83D\uDC4F\uD83D\uDE01\uD83D\uDD25\uD83E\uDD70\uD83D\uDC94\uD83D\uDC96\uD83D\uDC99\uD83D\uDE22\uD83E\uDD14\uD83D\uDE06\uD83D\uDE44\uD83D\uDCAA\uD83D\uDE09☺\uD83D\uDC4C\uD83E\uDD17\uD83D\uDC9C\uD83D\uDE14\uD83D\uDE0E\uD83D\uDE07\uD83C\uDF39\uD83E\uDD26\uD83C\uDF89\uD83D\uDC9E✌✨\uD83E\uDD37\uD83D\uDE31\uD83D\uDE0C\uD83C\uDF38\uD83D\uDE4C\uD83D\uDE0B\uD83D\uDC97\uD83D\uDC9A\uD83D\uDE0F\uD83D\uDC9B\uD83D\uDE42\uD83D\uDC93\uD83E\uDD29\uD83D\uDE04\uD83D\uDE00\uD83D\uDDA4\uD83D\uDE03\uD83D\uDCAF\uD83D\uDE48\uD83D\uDC47\uD83C\uDFB6\uD83D\uDE12\uD83E\uDD2D❣\uD83D\uDE1C\uD83D\uDC8B\uD83D\uDC40\uD83D\uDE2A\uD83D\uDE11\uD83D\uDCA5\uD83D\uDE4B\uD83D\uDE1E\uD83D\uDE29\uD83D\uDE21\uD83E\uDD2A\uD83D\uDC4A\uD83E\uDD73\uD83D\uDE25\uD83E\uDD24\uD83D\uDC49\uD83D\uDC83\uD83D\uDE33✋\uD83D\uDE1A\uD83D\uDE1D\uD83D\uDE34\uD83C\uDF1F\uD83D\uDE2C\uD83D\uDE43\uD83C\uDF40\uD83C\uDF37\uD83D\uDE3B\uD83D\uDE13⭐✅\uD83E\uDD7A\uD83C\uDF08\uD83D\uDE08\uD83E\uDD18\uD83D\uDCA6✔\uD83D\uDE23\uD83C\uDFC3\uD83D\uDC90☹\uD83C\uDF8A\uD83D\uDC98\uD83D\uDE20☝\uD83D\uDE15\uD83C\uDF3A\uD83C\uDF82\uD83C\uDF3B\uD83D\uDE10\uD83D\uDD95\uD83D\uDC9D\uD83D\uDE4A\uD83D\uDE39\uD83D\uDDE3\uD83D\uDCAB\uD83D\uDC80\uD83D\uDC51\uD83C\uDFB5\uD83E\uDD1E\uD83D\uDE1B\uD83D\uDD34\uD83D\uDE24\uD83C\uDF3C\uD83D\uDE2B⚽\uD83E\uDD19☕\uD83C\uDFC6\uD83E\uDD2B\uD83D\uDC48\uD83D\uDE2E\uD83D\uDE46\uD83C\uDF7B\uD83C\uDF43\uD83D\uDC36\uD83D\uDC81\uD83D\uDE32\uD83C\uDF3F\uD83E\uDDE1\uD83C\uDF81⚡\uD83C\uDF1E\uD83C\uDF88❌✊\uD83D\uDC4B\uD83D\uDE30\uD83E\uDD28\uD83D\uDE36\uD83E\uDD1D\uD83D\uDEB6\uD83D\uDCB0\uD83C\uDF53\uD83D\uDCA2\uD83E\uDD1F\uD83D\uDE41\uD83D\uDEA8\uD83D\uDCA8\uD83E\uDD2C✈\uD83C\uDF80\uD83C\uDF7A\uD83E\uDD13\uD83D\uDE19\uD83D\uDC9F\uD83C\uDF31\uD83D\uDE16\uD83D\uDC76\uD83E\uDD74▶➡❓\uD83D\uDC8E\uD83D\uDCB8⬇\uD83D\uDE28\uD83C\uDF1A\uD83E\uDD8B\uD83D\uDE37\uD83D\uDD7A⚠\uD83D\uDE45\uD83D\uDE1F\uD83D\uDE35\uD83D\uDC4E\uD83E\uDD32\uD83E\uDD20\uD83E\uDD27\uD83D\uDCCC\uD83D\uDD35\uD83D\uDC85\uD83E\uDDD0\uD83D\uDC3E\uD83C\uDF52\uD83D\uDE17\uD83E\uDD11\uD83C\uDF0A\uD83E\uDD2F\uD83D\uDC37☎\uD83D\uDCA7\uD83D\uDE2F\uD83D\uDC86\uD83D\uDC46\uD83C\uDFA4\uD83D\uDE47\uD83C\uDF51❄\uD83C\uDF34\uD83D\uDCA3\uD83D\uDC38\uD83D\uDC8C\uD83D\uDCCD\uD83E\uDD40\uD83E\uDD22\uD83D\uDC45\uD83D\uDCA1\uD83D\uDCA9\uD83D\uDC50\uD83D\uDCF8\uD83D\uDC7B\uD83E\uDD10\uD83E\uDD2E\uD83C\uDFBC\uD83E\uDD75\uD83D\uDEA9\uD83C\uDF4E\uD83C\uDF4A\uD83D\uDC7C\uD83D\uDC8D\uD83D\uDCE3\uD83E\uDD42"),t9=t7.reduce((e,t,r)=>(e[r]=t,e),[]),re=t7.reduce((e,t,r)=>(e[t.codePointAt(0)]=r,e),[]);var rt=Object.freeze({__proto__:null,base256emoji:tM({prefix:"\uD83D\uDE80",name:"base256emoji",encode:function(e){return e.reduce((e,t)=>
1e+=t9[t],"")},decode:function(e){let t=[];for(let r of e){let e=re[r.codePointAt(0)];if(void 0===e)throw Error(`Non-base256emoji character: ${r}`);t.push(e)}return new Uint8Array(t)}})});function rr(e,t){var r,i=0,t=t||0,n=0,s=t,o=e.length;do{if(s>=o)throw rr.bytes=0,RangeError("Could not decode varint");r=e[s++],i+=n<28?(127&r)<<n:(127&r)*Math.pow(2,n),n+=7}while(r>=128);return rr.bytes=s-t,i}var ri=function e(t,r,i){r=r||[],i=i||0;for(var n=i;t>=2147483648;)r[i++]=255&t|128,t/=128;for(;-128&t;)r[i++]=255&t|128,t>>>=7;return r[i]=0|t,e.bytes=i-n+1,r};let rn=(e,t,r=0)=>(ri(e,t,r),t),rs=e=>e<128?1:e<16384?2:e<2097152?3:e<268435456?4:e<34359738368?5:e<4398046511104?6:e<562949953421312?7:e<72057594037927940?8:e<0x7fffffffffffffff?9:10,ro=(e,t)=>{let r=t.byteLength,i=rs(e),n=i+rs(r),s=new Uint8Array(n+r);return rn(e,s,0),rn(r,s,i),s.set(t,n),new ra(e,r,t,s)};class ra{constructor(e,t,r,i){this.code=e,this.size=t,this.digest=r,this.bytes=i}}let rc=({name:e,code:t,encode:r})=>new rl(e,t,r);class rl{constructor(e,t,r){this.name=e,this.code=t,this.encode=r}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?ro(this.code,t):t.then(e=>ro(this.code,e))}throw Error("Unknown type, must be binary type")}}let rh=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t));var ru=Object.freeze({__proto__:null,sha256:rc({name:"sha2-256",code:18,encode:rh("SHA-256")}),sha512:rc({name:"sha2-512",code:19,encode:rh("SHA-512")})}),rp=Object.freeze({__proto__:null,identity:{code:0,name:"identity",encode:tj,digest:e=>ro(0,tj(e))}});new TextEncoder,new TextDecoder;let rf={...tF,...tZ,...tW,...tJ,...tG,...t3,...t5,...t8,...t6,...rt};function rd(e,t,r,i){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:i}}}({...ru,...rp});let rg=rd("utf8","u",e=>"u"+new TextDecoder("utf8").decode(e),e=>new TextEncoder().encode(e.substring(1))),ry=rd("ascii","a",e=>{let t="a";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t},e=>{let t=tC((e=e.substring(1)).length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}),rv={utf8:rg,"utf-8":rg,hex:rf.base16,latin1:ry,ascii:ry,binary:ry,...rf};
1function rm(e,t="utf8"){let r=rv[t];if(!r)throw Error(`Unsupported encoding "${t}"`);return("utf8"===t||"utf-8"===t)&&null!=globalThis.Buffer&&null!=globalThis.Buffer.from?globalThis.Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("utf8"):r.encoder.encode(e).substring(1)}function rb(e,t="utf8"){let r=rv[t];if(!r)throw Error(`Unsupported encoding "${t}"`);return("utf8"===t||"utf-8"===t)&&null!=globalThis.Buffer&&null!=globalThis.Buffer.from?tA(globalThis.Buffer.from(e,"utf-8")):r.decoder.decode(`${r.prefix}${e}`)}function rw(e){return rm(rb((0,S.u)(e),"utf8"),tR)}function r_(e){return["did","key","z"+rm(tN([rb("K36",tO),e]),tO)].join(":")}function rE(e=eE(32)){let t=tS.getPublicKey(e);return{secretKey:tN([e,t]),publicKey:t}}async function rI(e,t,r,i,n=(0,eg.fromMiliseconds)(Date.now())){var s,o;let a={alg:"EdDSA",typ:"JWT"},c={iss:r_(i.publicKey),sub:e,aud:t,iat:n,exp:n+r},l=rb([rw((s={header:a,payload:c}).header),rw(s.payload)].join("."),"utf8");return[rw((o={header:a,payload:c,signature:tS.sign(l,i.secretKey.slice(0,32))}).header),rw(o.payload),rm(o.signature,tR)].join(".")}var rx=r(98862),rP=r(5276);class rS extends rP.IJsonRpcProvider{constructor(e){super(e),this.events=new s.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async request(e,t){return this.requestStrict((0,rP.formatJsonRpcRequest)(e.method,e.params||[],e.id||(0,rP.getBigIntRpcId)().toString()),t)}async requestStrict(e,t){return new Promise(async(r,i)=>{if(!this.connection.connected)try{await this.open()}catch(e){i(e)}this.events.on(`${e.id}`,e=>{(0,rP.isJsonRpcError)(e)?i(e.error):r(e.result)});try{await this.connection.send(e,t)}catch(e){i(e)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),(0,rP.isJsonRpcResponse)(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&3e3===e.code&&this.events.emit("error",Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),"string"==typeof e&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}}let rR=()=>"u">typeof WebSocket||"u">typeof r.g&&"u">typeof r.g.WebSocket||"u">typeof window&&"u">typeof window.WebSocket||"u">typeof self&&"u">typeof self.WebSocket,rO=e=>e.split("?")[0],rA="u">typeof WebSocket?WebSocket:"u">typeof r.g&&"u">typeof r.g.WebSocket?r.g.WebSocket:"u">typeof window&&"u">typeof window.WebSocket?window.WebSocket:"u">typeof self&&"u">typeof self.WebSocket?self.WebSocket:r(16854);class rC{constructor(e){if(this.url=e,this.events=new s.EventEmitter,this.registering=!1,!(0,rP.isWsUrl)(e))throw Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return"u">typeof this.socket}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,t)=>{if(typeof this.socket>"u"){t(Error("Connection already closed"));return}this.socket.onclose=t=>{this.onClose(t),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send((0,S.u)(e))}catch(t){this.onError(e.id,t)}}register(e=this.url){if(!(0,rP.isWsUrl)(e))throw Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){let e=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=e||this.events.listenerCount("open")>=e)&&this.events.setMaxListeners(e+1),new Promise((e,t)=>
1{this.events.once("register_error",e=>{this.resetMaxListeners(),t(e)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return t(Error("WebSocket connection is missing or invalid"));e(this.socket)})})}return this.url=e,this.registering=!0,new Promise((t,r)=>{let i=new URLSearchParams(e).get("origin"),n=(0,rP.isReactNative)()?{headers:{origin:i}}:{rejectUnauthorized:!(0,rP.isLocalhostUrl)(e)},s=new rA(e,[],n);rR()?s.onerror=e=>{r(this.emitError(e.error))}:s.on("error",e=>{r(this.emitError(e))}),s.onopen=()=>{this.onOpen(s),t(s)}})}onOpen(e){e.onmessage=e=>this.onPayload(e),e.onclose=e=>this.onClose(e),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;let t="string"==typeof e.data?(0,S.D)(e.data):e.data;this.events.emit("payload",t)}onError(e,t){let r=this.parseError(t),i=r.message||r.toString(),n=(0,rP.formatJsonRpcError)(e,i);this.events.emit("payload",n)}parseError(e,t=this.url){return(0,rP.parseConnectionError)(e,rO(t),"WS")}resetMaxListeners(){this.events.getMaxListeners()>10&&this.events.setMaxListeners(10)}emitError(e){let t=this.parseError(Error(e?.message||`WebSocket connection failed for host: ${rO(this.url)}`));return this.events.emit("register_error",t),t}}var rN=r(15586),rq=r.n(rN),rj=r(52423),rT=r.n(rj),rz=r(40257),rD=function(e,t){if(e.length>=255)throw TypeError("Alphabet too long");for(var r=new Uint8Array(256),i=0;i<r.length;i++)r[i]=255;for(var n=0;n<e.length;n++){var s=e.charAt(n),o=s.charCodeAt(0);if(255!==r[o])throw TypeError(s+" is ambiguous");r[o]=n}var a=e.length,c=e.charAt(0),l=Math.log(a)/Math.log(256),h=Math.log(256)/Math.log(a);function u(e){if("string"!=typeof e)throw TypeError("Expected String");if(0===e.length)return new Uint8Array;var t=0;if(" "!==e[0]){for(var i=0,n=0;e[t]===c;)i++,t++;for(var s=(e.length-t)*l+1>>>0,o=new Uint8Array(s);e[t];){var h=r[e.charCodeAt(t)];if(255===h)return;for(var u=0,p=s-1;(0!==h||u<n)&&-1!==p;p--,u++)h+=a*o[p]>>>0,o[p]=h%256>>>0,h=h/256>>>0;if(0!==h)throw Error("Non-zero carry");n=u,t++}if(" "!==e[t]){for(var f=s-n;f!==s&&0===o[f];)f++;for(var d=new Uint8Array(i+(s-f)),g=i;f!==s;)d[g++]=o[f++];return d}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,i=0,n=0,s=t.length;n!==s&&0===t[n];)n++,r++;for(var o=(s-n)*h+1>>>0,l=new Uint8Array(o);n!==s;){for(var u=t[n],p=0,f=o-1;(0!==u||p<i)&&-1!==f;f--,p++)u+=256*l[f]>>>0,l[f]=u%a>>>0,u=u/a>>>0;if(0!==u)throw Error("Non-zero carry");i=p,n++}for(var d=o-i;d!==o&&0===l[d];)d++;for(var g=c.repeat(r);d<o;++d)g+=e.charAt(l[d]);return g},decodeUnsafe:u,decode:function(e){var r=u(e);if(r)return r;throw Error(`Non-${t} character`)}}};let rk=e=>{if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw Error("Unknown type, must be binary type")},rL=e=>new TextEncoder().encode(e),r$=e=>new TextDecoder().decode(e);class rU{constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class rM{constructor(e,t,r){if(this.name=e,this.prefix=t,void 0===t.codePointAt(0))throw Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=r}decode(e){if("string"==typeof e){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return rH(this,e)}}class rB{constructor(e){this.decoders=e}or(e){return rH(this,e)}decode(e){let t=e[0],r=this.decoders[t];if(r)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}
1, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}let rH=(e,t)=>new rB({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class rV{constructor(e,t,r,i){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=i,this.encoder=new rU(e,t,r),this.decoder=new rM(e,t,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}let rK=({name:e,prefix:t,encode:r,decode:i})=>new rV(e,t,r,i),rF=({prefix:e,name:t,alphabet:r})=>{let{encode:i,decode:n}=rD(r,t);return rK({prefix:e,name:t,encode:i,decode:e=>rk(n(e))})},rZ=(e,t,r,i)=>{let n={};for(let e=0;e<t.length;++e)n[t[e]]=e;let s=e.length;for(;"="===e[s-1];)--s;let o=new Uint8Array(s*r/8|0),a=0,c=0,l=0;for(let t=0;t<s;++t){let s=n[e[t]];if(void 0===s)throw SyntaxError(`Non-${i} character`);c=c<<r|s,(a+=r)>=8&&(a-=8,o[l++]=255&c>>a)}if(a>=r||255&c<<8-a)throw SyntaxError("Unexpected end of data");return o},rW=(e,t,r)=>{let i="="===t[t.length-1],n=(1<<r)-1,s="",o=0,a=0;for(let i=0;i<e.length;++i)for(a=a<<8|e[i],o+=8;o>r;)o-=r,s+=t[n&a>>o];if(o&&(s+=t[n&a<<r-o]),i)for(;s.length*r&7;)s+="=";return s},rJ=({name:e,prefix:t,bitsPerChar:r,alphabet:i})=>rK({prefix:t,name:e,encode:e=>rW(e,i,r),decode:t=>rZ(t,i,r,e)});var rG=Object.freeze({__proto__:null,identity:rK({prefix:"\0",name:"identity",encode:e=>r$(e),decode:e=>rL(e)})}),rQ=Object.freeze({__proto__:null,base2:rJ({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})}),rY=Object.freeze({__proto__:null,base8:rJ({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})}),rX=Object.freeze({__proto__:null,base10:rF({prefix:"9",name:"base10",alphabet:"0123456789"})}),r0=Object.freeze({__proto__:null,base16:rJ({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),base16upper:rJ({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});let r1=rJ({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),r2=rJ({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),r3=rJ({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),r5=rJ({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),r8=rJ({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),r4=rJ({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5});var r6=Object.freeze({__proto__:null,base32:r1,base32upper:r2,base32pad:r3,base32padupper:r5,base32hex:r8,base32hexupper:r4,base32hexpad:rJ({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),base32hexpadupper:rJ({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),base32z:rJ({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})}),r7=Object.freeze({__proto__:null,base36:rF({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),base36upper:rF({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})}),r9=Object.freeze({__proto__:null,base58btc:rF({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),base58flickr:rF({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});let ie=rJ({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6});var it=Object.freeze({__proto__:null,base64:ie,base64pad:rJ({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),base64url:rJ({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),base64urlpad:rJ({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});let ir=Array.from("\uD83D\uDE80\uD83E\uDE90☄\uD83D\uDEF0\uD83C\uDF0C\uD83C\uDF11\uD83C\uDF12\uD83C\uDF13\uD83C\uDF14\uD83C\uDF15\uD83C\uDF16\uD83C\uDF17\uD83C\uDF18\uD83C\uDF0D\uD83C\uDF0F\uD83C\uDF0E\uD83D\uDC09☀\uD83D\uDCBB\uD83D\uDDA5\uD83D\uDCBE\uD83D\uDCBF\uD83D\uDE02❤\uD83D\uDE0D\uD83E\uDD23\uD83D\uDE0A\uD83D\uDE4F\uD83D\uDC95\uD83D\uDE2D\uD83D\uDE18\uD83D\uDC4D\uD83D\uDE05\uD83D\uDC4F\uD83D\uDE01\uD83D\uDD25\uD83E\uDD70\uD83D\uDC94\uD83D\uDC96\uD83D\uDC99\uD83D\uDE22\uD83E\uDD14\uD83D\uDE06\uD83D\uDE44\uD83D\uDCAA\uD83D\uDE09☺\uD83D\uDC4C\uD83E\uDD17\uD83D\uDC9C\uD83D\uDE14\uD83D\uDE0E\uD83D\uDE07\uD83C\uDF39\uD83E\uDD26\uD83C\uDF89\uD83D\uDC9E✌✨\uD83E\uDD37\uD83D\uDE31\uD83D\uDE0C\uD83C\uDF38\uD83D\uDE4C\uD83D\uDE0B\uD83D\uDC97\uD83D\uDC9A\uD83D\uDE0F\uD83D\uDC9B\uD83D\uDE42\uD83D\uDC93\uD83E\uDD29\uD83D\uDE04\uD83D\uDE00\uD83D\uDDA4\uD83D\uDE03\uD83D\uDCAF\uD83D\uDE48\uD83D\uDC47\uD83C\uDFB6\uD83D\uDE12\uD83E\uDD2D❣\uD83D\uDE1C\uD83D\uDC8B\uD83D\uDC40\uD83D\uDE2A\uD83D\uDE11\uD83D\uDCA5\uD83D\uDE4B\uD83D\uDE1E\uD83D\uDE29\uD83D\uDE21\uD83E\uDD2A\uD83D\uDC4A\uD83E\uDD73\uD83D\uDE25\uD83E\uDD24\uD83D\uDC49\uD83D\uDC83\uD83D\uDE33✋\uD83D\uDE1A\uD83D\uDE1D\uD83D\uDE34\uD83C\uDF1F\uD83D\uDE2C\uD83D\uDE43\uD83C\uDF40\uD83C\uDF37\uD83D\uDE3B\uD83D\uDE13⭐✅\uD83E\uDD7A\uD83C\uDF08\uD83D\uDE08\uD83E\uDD18\uD83D\uDCA6✔\uD83D\uDE23\uD83C\uDFC3\uD83D\uDC90☹\uD83C\uDF8A\uD83D\uDC98\uD83D\uDE20☝\uD83D\uDE15\uD83C\uDF3A\uD83C\uDF82\uD83C\uDF3B\uD83D\uDE10\uD83D\uDD95\uD83D\uDC9D\uD83D\uDE4A\uD83D\uDE39\uD83D\uDDE3\uD83D\uDCAB\uD83D\uDC80\uD83D\uDC51\uD83C\uDFB5\uD83E\uDD1E\uD83D\uDE1B\uD83D\uDD34\uD83D\uDE24\uD83C\uDF3C\uD83D\uDE2B⚽\uD83E\uDD19☕\uD83C\uDFC6\uD83E\uDD2B\uD83D\uDC48\uD83D\uDE2E\uD83D\uDE46\uD83C\uDF7B\uD83C\uDF43\uD83D\uDC36\uD83D\uDC81\uD83D\uDE32\uD83C\uDF3F\uD83E\uDDE1\uD83C\uDF81⚡\uD83C\uDF1E\uD83C\uDF88❌✊\uD83D\uDC4B\uD83D\uDE30\uD83E\uDD28\uD83D\uDE36\uD83E\uDD1D\uD83D\uDEB6\uD83D\uDCB0\uD83C\uDF53\uD83D\uDCA2\uD83E\uDD1F\uD83D\uDE41\uD83D\uDEA8\uD83D\uDCA8\uD83E\uDD2C✈\uD83C\uDF80\uD83C\uDF7A\uD83E\uDD13\uD83D\uDE19\uD83D\uDC9F\uD83C\uDF31\uD83D\uDE16\uD83D\uDC76\uD83E\uDD74▶➡❓\uD83D\uDC8E\uD83D\uDCB8⬇\uD83D\uDE28\uD83C\uDF1A\uD83E\uDD8B\uD83D\uDE37\uD83D\uDD7A⚠\uD83D\uDE45\uD83D\uDE1F\uD83D\uDE35\uD83D\uDC4E\uD83E\uDD32\uD83E\uDD20\uD83E\uDD27\uD83D\uDCCC\uD83D\uDD35\uD83D\uDC85\uD83E\uDDD0\uD83D\uDC3E\uD83C\uDF52\uD83D\uDE17\uD83E\uDD11\uD83C\uDF0A\uD83E\uDD2F\uD83D\uDC37☎\uD83D\uDCA7\uD83D\uDE2F\uD83D\uDC86\uD83D\uDC46\uD83C\uDFA4\uD83D\uDE47\uD83C\uDF51❄\uD83C\uDF34\uD83D\uDCA3\uD83D\uDC38\uD83D\uDC8C\uD83D\uDCCD\uD83E\uDD40\uD83E\uDD22\uD83D\uDC45\uD83D\uDCA1\uD83D\uDCA9\uD83D\uDC50\uD83D\uDCF8\uD83D\uDC7B\uD83E\uDD10\uD83E\uDD2E\uD83C\uDFBC\uD83E\uDD75\uD83D\uDEA9\uD83C\uDF4E\uD83C\uDF4A\uD83D\uDC7C\uD83D\uDC8D\uD83D\uDCE3\uD83E\uDD42"),ii=ir.reduce((e,t,r)=>(e[r]=t,e),[]),is=ir.reduce((e,t,r)=>(e[t.codePointAt(0)]=r,e),[]);var io=Object.freeze({__proto__:null,base256emoji:rK({prefix:"\uD83D\uDE80",name:"base256emoji",encode:function(e){return e.reduce((e,t)=>
1e+=ii[t],"")},decode:function(e){let t=[];for(let r of e){let e=is[r.codePointAt(0)];if(void 0===e)throw Error(`Non-base256emoji character: ${r}`);t.push(e)}return new Uint8Array(t)}})});function ia(e,t){var r,i=0,t=t||0,n=0,s=t,o=e.length;do{if(s>=o)throw ia.bytes=0,RangeError("Could not decode varint");r=e[s++],i+=n<28?(127&r)<<n:(127&r)*Math.pow(2,n),n+=7}while(r>=128);return ia.bytes=s-t,i}var ic=function e(t,r,i){r=r||[],i=i||0;for(var n=i;t>=2147483648;)r[i++]=255&t|128,t/=128;for(;-128&t;)r[i++]=255&t|128,t>>>=7;return r[i]=0|t,e.bytes=i-n+1,r};let il=(e,t,r=0)=>(ic(e,t,r),t),ih=e=>e<128?1:e<16384?2:e<2097152?3:e<268435456?4:e<34359738368?5:e<4398046511104?6:e<562949953421312?7:e<72057594037927940?8:e<0x7fffffffffffffff?9:10,iu=(e,t)=>{let r=t.byteLength,i=ih(e),n=i+ih(r),s=new Uint8Array(n+r);return il(e,s,0),il(r,s,i),s.set(t,n),new ip(e,r,t,s)};class ip{constructor(e,t,r,i){this.code=e,this.size=t,this.digest=r,this.bytes=i}}let id=({name:e,code:t,encode:r})=>new ig(e,t,r);class ig{constructor(e,t,r){this.name=e,this.code=t,this.encode=r}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?iu(this.code,t):t.then(e=>iu(this.code,e))}throw Error("Unknown type, must be binary type")}}let iy=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t));var iv=Object.freeze({__proto__:null,sha256:id({name:"sha2-256",code:18,encode:iy("SHA-256")}),sha512:id({name:"sha2-512",code:19,encode:iy("SHA-512")})}),im=Object.freeze({__proto__:null,identity:{code:0,name:"identity",encode:rk,digest:e=>iu(0,rk(e))}});new TextEncoder,new TextDecoder;let ib={...rG,...rQ,...rY,...rX,...r0,...r6,...r7,...r9,...it,...io};function iw(e){return null!=globalThis.Buffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}function i_(e,t,r,i){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:i}}}({...iv,...im});let iE=i_("utf8","u",e=>"u"+new TextDecoder("utf8").decode(e),e=>new TextEncoder().encode(e.substring(1))),iI=i_("ascii","a",e=>{let t="a";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t},e=>{let t=function(e=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?iw(globalThis.Buffer.allocUnsafe(e)):new Uint8Array(e)}((e=e.substring(1)).length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}),ix={utf8:iE,"utf-8":iE,hex:ib.base16,latin1:iI,ascii:iI,binary:iI,...ib},iP="core",iS=`wc@2:${iP}:`,iR={logger:"error"},iO={database:":memory:"},iA="client_ed25519_seed",iC=eg.ONE_DAY,iN=eg.SIX_HOURS,iq="wss://relay.walletconnect.com",ij="wss://relay.walletconnect.org",iT={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",publish:"relayer_publish"},iz={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},iD=eg.ONE_SECOND,ik={created:"subscription_created",deleted:"subscription_deleted",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},iL=1e3*eg.FIVE_SECONDS,i$={wc_pairingDelete:{req:{ttl:eg.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:eg.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:eg.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:eg.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:eg.ONE_DAY,prompt:!1,tag:0},res:{ttl:eg.ONE_DAY,prompt:!1,tag:0}}},iU={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},iM={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},iB={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},iH="verify-api",iV="https://verify.walletconnect.com",iK="https://verify.walletconnect.org",iF=[iV,iK];class iZ{constructor(e,t){this.core=e,this.logger=t,this.keychain=new Map,this.name="keychain",this.version="0.3",this.initialized=!1,this.storagePrefix=iS,this.init=async()=>{if(!this.initialized){let e=await this.getKeyChain();"u">typeof e&&(this.keychain=e),this.initialized=!0}},this.has=e=>(this.isInitialized(),this.keychain.has(e)),this.set=async(e,t)=>{this.isInitialized(),this.keychain.set(e,t),await this.persist()},this.get=e=>{this.isInitialized();let t=this.keychain.get(e);if(typeof t>"u"){let{message:t}=(0,a.Z7)("NO_MATCHING_KEY",`${this.name}: ${e}`);throw Error(t)}return t},this.del=async e=>{this.isInitialized(),this.keychain.delete(e),await this.persist()},this.core=e,this.logger=ee(t,this.name)}get context(){return X(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,(0,a.KC)(e))}async getKeyChain(){let e=await this.core.storage.getItem(this.storageKey);return"u">typeof e?(0,a.IP)(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){let{message:e}=(0,a.Z7)("NOT_INITIALIZED",this.name);throw Error(e)}}}class iW{constructor(e,t,r){this.core=e,this.logger=t,this.name="crypto",this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=e=>(this.isInitialized(),this.keychain.has(e)),this.getClientId=async()=>(this.isInitialized(),r_(rE(await this.getClientSeed()).publicKey)),this.generateKeyPair=()=>{this.isInitialized();let e=(0,a.Au)();return this.setPrivateKey(e.publicKey,e.privateKey)},this.signJWT=async e=>{this.isInitialized();let t=rE(await this.getClientSeed()),r=(0,a.jd)();return await rI(r,e,iC,t)},this.generateSharedKey=(e,t,r)=>{this.isInitialized();let i=this.getPrivateKey(e),n=(0,a.m$)(i,t);return this.setSymKey(n,r)},this.setSymKey=async(e,t)=>{this.isInitialized();let r=t||(0,a.Ym)(e);return await this.keychain.set(r,e),r},this.deleteKeyPair=async e=>{this.isInitialized(),await this.keychain.del(e)},this.deleteSymKey=async e=>{this.isInitialized(),await this.keychain.del(e)},this.encode=async(e,t,r)=>{this.isInitialized();let i=(0,a.EN)(r),n=(0,S.u)(t);if((0,a.Q8)(i)){let t=i.senderPublicKey,r=i.receiverPublicKey;e=await this.generateSharedKey(t,r)}let s=this.getSymKey(e),{type:o,senderPublicKey:c}=i;return(0,a.HI)({type:o,symKey:s,message:n,senderPublicKey:c})},this.decode=async(e,t,r)=>{this.isInitialized();let i=(0,a.Ll)(t,r);if((0,a.Q8)(i)){let t=i.receiverPublicKey,r=i.senderPublicKey;e=await this.generateSharedKey(t,r)}try{let r=this.getSymKey(e),i=(0,a.pe)({symKey:r,encoded:t});return(0,S.D)(i)}catch(t){this.logger.error(`Failed to decode message from topic: '${e}', clientId: '${await this.getClientId()}'`),this.logger.error(t)}},this.getPayloadType=e=>{let t=(0,a.vB)(e);return(0,a.WG)(t.type)},this.getPayloadSenderPublicKey=e=>{let t=(0,a.vB)(e);return t.senderPublicKey?(0,rx.BB)(t.senderPublicKey,a.AW):void 0},this.core=e,this.logger=ee(t,this.name),this.keychain=r||new iZ(this.core,this.logger)}get context(){return X(this.logger)}async setPrivateKey(e,t){return await this.keychain.set(e,t),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(iA)}catch{e=(0,a.jd)(),await this.keychain.set(iA,e)}return function(e,t="utf8"){let r=ix[t];if(!r)throw Error(`Unsupported encoding "${t}"`);return("utf8"===t||"utf-8"===t)&&null!=globalThis.Buffer&&null!=globalThis.Buffer.from?iw(globalThis.Buffer.from(e,"utf-8")):r.decoder.decode(`${r.prefix}${e}`)}(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){let{message:e}=(0,a.Z7)("NOT_INITIALIZED",this.name);throw Error(e)}}}class iJ extends es{constructor(e,t){super(e,t),this.logger=e,this.core=t,this.messages=new Map,this.name="messages",this.version="0.3",this.initialized=!1,this.storagePrefix=iS,this.init=async()=>
1{if(!this.initialized){this.logger.trace("Initialized");try{let e=await this.getRelayerMessages();"u">typeof e&&(this.messages=e),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}finally{this.initialized=!0}}},this.set=async(e,t)=>{this.isInitialized();let r=(0,a.rj)(t),i=this.messages.get(e);return typeof i>"u"&&(i={}),"u">typeof i[r]||(i[r]=t,this.messages.set(e,i),await this.persist()),r},this.get=e=>{this.isInitialized();let t=this.messages.get(e);return typeof t>"u"&&(t={}),t},this.has=(e,t)=>(this.isInitialized(),"u">typeof this.get(e)[(0,a.rj)(t)]),this.del=async e=>{this.isInitialized(),this.messages.delete(e),await this.persist()},this.logger=ee(e,this.name),this.core=t}get context(){return X(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,(0,a.KC)(e))}async getRelayerMessages(){let e=await this.core.storage.getItem(this.storageKey);return"u">typeof e?(0,a.IP)(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){let{message:e}=(0,a.Z7)("NOT_INITIALIZED",this.name);throw Error(e)}}}class iG extends eo{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.events=new s.EventEmitter,this.name="publisher",this.queue=new Map,this.publishTimeout=(0,eg.toMiliseconds)(eg.TEN_SECONDS),this.needsTransportRestart=!1,this.publish=async(e,t,r)=>{var i;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:e,message:t,opts:r}});try{let n=r?.ttl||iN,s=(0,a._H)(r),o=r?.prompt||!1,c=r?.tag||0,l=r?.id||(0,rP.getBigIntRpcId)().toString(),h={topic:e,message:t,opts:{ttl:n,relay:s,prompt:o,tag:c,id:l}},u=setTimeout(()=>this.queue.set(l,h),this.publishTimeout);try{await await (0,a.hF)(this.rpcPublish(e,t,n,s,o,c,l),this.publishTimeout,"Failed to publish payload, please try again."),this.removeRequestFromQueue(l),this.relayer.events.emit(iT.publish,h)}catch(e){if(this.logger.debug("Publishing Payload stalled"),this.needsTransportRestart=!0,null!=(i=r?.internal)&&i.throwOnFailedPublish)throw this.removeRequestFromQueue(l),e;return}finally{clearTimeout(u)}this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:e,message:t,opts:r}})}catch(e){throw this.logger.debug("Failed to Publish Payload"),this.logger.error(e),e}},this.on=(e,t)=>{this.events.on(e,t)},this.once=(e,t)=>{this.events.once(e,t)},this.off=(e,t)=>{this.events.off(e,t)},this.removeListener=(e,t)=>{this.events.removeListener(e,t)},this.relayer=e,this.logger=ee(t,this.name),this.registerEventListeners()}get context(){return X(this.logger)}rpcPublish(e,t,r,i,n,s,o){var c,l,h,u;let p={method:(0,a.cO)(i.protocol).publish,params:{topic:e,message:t,ttl:r,prompt:n,tag:s},id:o};return(0,a.o8)(null==(c=p.params)?void 0:c.prompt)&&(null==(l=p.params)||delete l.prompt),(0,a.o8)(null==(h=p.params)?void 0:h.tag)&&(null==(u=p.params)||delete u.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:p}),this.relayer.request(p)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{let{topic:t,message:r,opts:i}=e;await this.publish(t,r,i)})}registerEventListeners(){this.relayer.core.heartbeat.on(D.HEARTBEAT_EVENTS.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(iT.connection_stalled);return}this.checkQueue()}),this.relayer.on(iT.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}class iQ{constructor(){this.map=new Map,this.set=(e,t)=>{let r=this.get(e);this.exists(e,t)||this.map.set(e,[...r,t])},this.get=e=>this.map.get(e)||[],this.exists=(e,t)=>this.get(e).includes(t),this.delete=(e,t)=>{if(typeof t>"u"){this.map.delete(e);return}if(!this.map.has(e))return;let r=this.get(e);if(!this.exists(e,t))return;let i=r.filter(e=>e!==t);if(!i.length){this.map.delete(e);return}this.map.set(e,i)},this.clear=()=>{this.map.clear()}}
1get topics(){return Array.from(this.map.keys())}}var iY=Object.defineProperty,iX=Object.defineProperties,i0=Object.getOwnPropertyDescriptors,i1=Object.getOwnPropertySymbols,i2=Object.prototype.hasOwnProperty,i3=Object.prototype.propertyIsEnumerable,i5=(e,t,r)=>t in e?iY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,i8=(e,t)=>{for(var r in t||(t={}))i2.call(t,r)&&i5(e,r,t[r]);if(i1)for(var r of i1(t))i3.call(t,r)&&i5(e,r,t[r]);return e},i4=(e,t)=>iX(e,i0(t));class i6 extends el{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.subscriptions=new Map,this.topicMap=new iQ,this.events=new s.EventEmitter,this.name="subscription",this.version="0.3",this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=iS,this.subscribeTimeout=1e4,this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId())},this.subscribe=async(e,t)=>{await this.restartToComplete(),this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:e,opts:t}});try{let r=(0,a._H)(t),i={topic:e,relay:r};this.pending.set(e,i);let n=await this.rpcSubscribe(e,r);return this.onSubscribe(n,i),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:e,opts:t}}),n}catch(e){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(e),e}},this.unsubscribe=async(e,t)=>{await this.restartToComplete(),this.isInitialized(),"u">typeof t?.id?await this.unsubscribeById(e,t.id,t):await this.unsubscribeByTopic(e,t)},this.isSubscribed=async e=>!!this.topics.includes(e)||await new Promise((t,r)=>{let i=new eg.Watch;i.start(this.pendingSubscriptionWatchLabel);let n=setInterval(()=>{!this.pending.has(e)&&this.topics.includes(e)&&(clearInterval(n),i.stop(this.pendingSubscriptionWatchLabel),t(!0)),i.elapsed(this.pendingSubscriptionWatchLabel)>=iL&&(clearInterval(n),i.stop(this.pendingSubscriptionWatchLabel),r(Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1),this.on=(e,t)=>{this.events.on(e,t)},this.once=(e,t)=>{this.events.once(e,t)},this.off=(e,t)=>{this.events.off(e,t)},this.removeListener=(e,t)=>{this.events.removeListener(e,t)},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=ee(t,this.name),this.clientId=""}get context(){return X(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,t){let r=!1;try{r=this.getSubscription(e).topic===t}catch{}return r}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,t){let r=this.topicMap.get(e);await Promise.all(r.map(async r=>await this.unsubscribeById(e,r,t)))}async unsubscribeById(e,t,r){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:r}});try{let i=(0,a._H)(r);await this.rpcUnsubscribe(e,t,i);let n=(0,a.D6)("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,t,n),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:r}})}catch(e){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(e),e}}async rpcSubscribe(e,t){let r={method:(0,a.cO)(t.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r});try{await await (0,a.hF)(this.relayer.request(r),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(iT.connection_stalled)}return(0,a.rj)(e+this.clientId)}async rpcBatchSubscribe(e){if(!e.length)return;let t=e[0].relay,r={method:(0,a.cO)(t.protocol).batchSubscribe,params:{topics:e.map(e=>e.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r});try{return await await (0,a.hF)(this.relayer.request(r),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Payload stalled"),this.relayer.events.emit(iT.connection_stalled)}}rpcUnsubscribe(e,t,r){let i={method:(0,a.cO)(r.protocol).unsubscribe,params:{topic:e,id:t}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,t){this.setSubscription(e,i4(i8({},t),{id:e})),this.pending.delete(t.topic)}
1onBatchSubscribe(e){e.length&&e.forEach(e=>{this.setSubscription(e.id,i8({},e)),this.pending.delete(e.topic)})}async onUnsubscribe(e,t,r){this.events.removeAllListeners(t),this.hasSubscription(t,e)&&this.deleteSubscription(t,r),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,t){this.subscriptions.has(e)||(this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:t}),this.addSubscription(e,t))}addSubscription(e,t){this.subscriptions.set(e,i8({},t)),this.topicMap.set(t.topic,e),this.events.emit(ik.created,t)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});let t=this.subscriptions.get(e);if(!t){let{message:t}=(0,a.Z7)("NO_MATCHING_KEY",`${this.name}: ${e}`);throw Error(t)}return t}deleteSubscription(e,t){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:t});let r=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(r.topic,e),this.events.emit(ik.deleted,i4(i8({},r),{reason:t}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(ik.sync)}async reset(){if(this.cached.length){let e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let t=0;t<e;t++){let e=this.cached.splice(0,this.batchSubscribeTopicsLimit);await this.batchSubscribe(e)}}this.events.emit(ik.resubscribed)}async restore(){try{let e=await this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size){let{message:e}=(0,a.Z7)("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),Error(e)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;let t=await this.rpcBatchSubscribe(e);(0,a.qt)(t)&&this.onBatchSubscribe(t.map((t,r)=>i4(i8({},e[r]),{id:t})))}async onConnect(){this.restartInProgress||(await this.restart(),this.onEnable())}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||this.relayer.transportExplicitlyClosed)return;let e=[];this.pending.forEach(t=>{e.push(t)}),await this.batchSubscribe(e)}registerEventListeners(){this.relayer.core.heartbeat.on(D.HEARTBEAT_EVENTS.pulse,async()=>{await this.checkPending()}),this.relayer.on(iT.connect,async()=>{await this.onConnect()}),this.relayer.on(iT.disconnect,()=>{this.onDisconnect()}),this.events.on(ik.created,async e=>{let t=ik.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()}),this.events.on(ik.deleted,async e=>{let t=ik.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=(0,a.Z7)("NOT_INITIALIZED",this.name);throw Error(e)}}async restartToComplete(){this.restartInProgress&&await new Promise(e=>{let t=setInterval(()=>{this.restartInProgress||(clearInterval(t),e())},this.pollingInterval)})}}var i7=Object.defineProperty,i9=Object.getOwnPropertySymbols,ne=Object.prototype.hasOwnProperty,nt=Object.prototype.propertyIsEnumerable,nr=(e,t,r)=>t in e?i7(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ni=(e,t)=>{for(var r in t||(t={}))ne.call(t,r)&&nr(e,r,t[r]);if(i9)for(var r of i9(t))nt.call(t,r)&&nr(e,r,t[r]);return e};class nn extends ea{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new s.EventEmitter,this.name="relayer",this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","socket stalled"],this.hasExperiencedNetworkDisruption=!1,this.request=async e=>{this.logger.debug("Publishing Request Payload");try{return await this.toEstablishConnection(),await this.provider.request(e)}catch(e){throw this.logger.debug("Failed to Publish Request"),this.logger.error(e),e}},this.onPayloadHandler=e=>{this.onProviderPayload(e)},this.onConnectHandler=()=>{this.events.emit(iT.connect)},this.onDisconnectHandler=()=>{this.onProviderDisconnect()},this.onProviderErrorHandler=e=>{this.logger.error(e),this.events.emit(iT.error,e),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(iz.payload,this.onPayloadHandler),this.provider.on(iz.connect,this.onConnectHandler),this.provider.on(iz.disconnect,this.onDisconnectHandler),this.provider.on(iz.error,this.onProviderErrorHandler)},this.core=e.core,this.logger="u">typeof e.logger&&"string"!=typeof e.logger?ee(e.logger,this.name):et(Y({level:e.logger||"error"})),this.messages=new iJ(this.logger,e.core),this.subscriber=new i6(this,this.logger),this.publisher=new iG(this,this.logger),this.relayUrl=e?.relayUrl||iq,this.projectId=e.projectId,this.bundleId=(0,a.X_)(),this.provider={}}
1async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await this.createProvider(),await Promise.all([this.messages.init(),this.subscriber.init()]);try{await this.transportOpen()}catch{this.logger.warn(`Connection via ${this.relayUrl} failed, attempting to connect via failover domain ${ij}...`),await this.restartTransport(ij)}this.initialized=!0,setTimeout(async()=>{0===this.subscriber.topics.length&&(this.logger.info("No topics subscribed to after init, closing transport"),await this.transportClose(),this.transportExplicitlyClosed=!1)},1e4)}get context(){return X(this.logger)}get connected(){return this.provider.connection.connected}get connecting(){return this.provider.connection.connecting}async publish(e,t,r){this.isInitialized(),await this.publisher.publish(e,t,r),await this.recordMessageEvent({topic:e,message:t,publishedAt:Date.now()})}async subscribe(e,t){var r;let i;this.isInitialized();let n=(null==(r=this.subscriber.topicMap.get(e))?void 0:r[0])||"";if(n)return n;let s=t=>{t.topic===e&&(this.subscriber.off(ik.created,s),i())};return await Promise.all([new Promise(e=>{i=e,this.subscriber.on(ik.created,s)}),new Promise(async r=>{n=await this.subscriber.subscribe(e,t),r()})]),n}async unsubscribe(e,t){this.isInitialized(),await this.subscriber.unsubscribe(e,t)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async transportClose(){this.transportExplicitlyClosed=!0,this.hasExperiencedNetworkDisruption&&this.connected?await (0,a.hF)(this.provider.disconnect(),1e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.connected&&await this.provider.disconnect()}async transportOpen(e){if(this.transportExplicitlyClosed=!1,await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress){e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportClose(),await this.createProvider()),this.connectionAttemptInProgress=!0;try{await Promise.all([new Promise(e=>{if(!this.initialized)return e();this.subscriber.once(ik.resubscribed,()=>{e()})}),new Promise(async(e,t)=>{try{await (0,a.hF)(this.provider.connect(),1e4,`Socket stalled when trying to connect to ${this.relayUrl}`)}catch(e){t(e);return}e()})])}catch(e){if(this.logger.error(e),!this.isConnectionStalled(e.message))throw e;this.provider.events.emit(iz.disconnect)}finally{this.connectionAttemptInProgress=!1,this.hasExperiencedNetworkDisruption=!1}}}async restartTransport(e){await this.confirmOnlineStateOrThrow(),this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.transportClose(),await this.createProvider(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await (0,a.Gg)())throw Error("No internet connection detected. Please restart your network and try again.")}isConnectionStalled(e){return this.staleConnectionErrors.some(t=>e.includes(t))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();let e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new rS(new rC((0,a.$0)({sdkVersion:"2.11.0",protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){let{topic:t,message:r}=e;await this.messages.set(t,r)}async shouldIgnoreMessageEvent(e){let{topic:t,message:r}=e;if(!r||0===r.length)return this.logger.debug(`Ignoring invalid/empty message: ${r}`),!0;if(!await this.subscriber.isSubscribed(t))return this.logger.debug(`Ignoring message for non-subscribed topic ${t}`),!0;let i=this.messages.has(t,r);return i&&this.logger.debug(`Ignoring duplicate message: ${r}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),(0,rP.isJsonRpcRequest)(e)){if(!e.method.endsWith("_subscription"))return;let t=e.params,{topic:r,message:i,publishedAt:n}=t.data,s={topic:r,message:i,publishedAt:n};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(ni({type:"event",event:t.id}
1,s)),this.events.emit(t.id,s),await this.acknowledgePayload(e),await this.onMessageEvent(s)}else(0,rP.isJsonRpcResponse)(e)&&this.events.emit(iT.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(iT.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){let t=(0,rP.formatJsonRpcResult)(e.id,!0);await this.provider.connection.send(t)}unregisterProviderListeners(){this.provider.off(iz.payload,this.onPayloadHandler),this.provider.off(iz.connect,this.onConnectHandler),this.provider.off(iz.disconnect,this.onDisconnectHandler),this.provider.off(iz.error,this.onProviderErrorHandler)}async registerEventListeners(){this.events.on(iT.connection_stalled,()=>{this.restartTransport().catch(e=>this.logger.error(e))});let e=await (0,a.Gg)();(0,a.uw)(async t=>{this.initialized&&e!==t&&(e=t,t?await this.restartTransport().catch(e=>this.logger.error(e)):(this.hasExperiencedNetworkDisruption=!0,await this.transportClose().catch(e=>this.logger.error(e))))})}onProviderDisconnect(){this.events.emit(iT.disconnect),this.attemptToReconnect()}attemptToReconnect(){this.transportExplicitlyClosed||(this.logger.info("attemptToReconnect called. Connecting..."),setTimeout(async()=>{await this.restartTransport().catch(e=>this.logger.error(e))},(0,eg.toMiliseconds)(iD)))}isInitialized(){if(!this.initialized){let{message:e}=(0,a.Z7)("NOT_INITIALIZED",this.name);throw Error(e)}}async toEstablishConnection(){if(await this.confirmOnlineStateOrThrow(),!this.connected){if(this.connectionAttemptInProgress)return await new Promise(e=>{let t=setInterval(()=>{this.connected&&(clearInterval(t),e())},this.connectionStatusPollingInterval)});await this.restartTransport()}}}var ns=Object.defineProperty,no=Object.getOwnPropertySymbols,na=Object.prototype.hasOwnProperty,nc=Object.prototype.propertyIsEnumerable,nl=(e,t,r)=>t in e?ns(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,nh=(e,t)=>{for(var r in t||(t={}))na.call(t,r)&&nl(e,r,t[r]);if(no)for(var r of no(t))nc.call(t,r)&&nl(e,r,t[r]);return e};class nu extends ec{constructor(e,t,r,i=iS,n){super(e,t,r,i),this.core=e,this.logger=t,this.name=r,this.map=new Map,this.version="0.3",this.cached=[],this.initialized=!1,this.storagePrefix=iS,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(e=>{this.getKey&&null!==e&&!(0,a.o8)(e)?this.map.set(this.getKey(e),e):(0,a.xW)(e)?this.map.set(e.id,e):(0,a.h1)(e)&&this.map.set(e.topic,e)}),this.cached=[],this.initialized=!0)},this.set=async(e,t)=>{this.isInitialized(),this.map.has(e)?await this.update(e,t):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:e,value:t}),this.map.set(e,t),await this.persist())},this.get=e=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:e}),this.getData(e)),this.getAll=e=>(this.isInitialized(),e?this.values.filter(t=>Object.keys(e).every(r=>rq()(t[r],e[r]))):this.values),this.update=async(e,t)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:e,update:t});let r=nh(nh({},this.getData(e)),t);this.map.set(e,r),await this.persist()},this.delete=async(e,t)=>{this.isInitialized(),this.map.has(e)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:e,reason:t}),this.map.delete(e),await this.persist())},this.logger=ee(t,this.name),this.storagePrefix=i,this.getKey=n}get context(){return X(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){let t=this.map.get(e);if(!t){let{message:t}=(0,a.Z7)("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(t),Error(t)}return t}async persist(){await this.setDataStore(this.values)}
1async restore(){try{let e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){let{message:e}=(0,a.Z7)("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),Error(e)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){let{message:e}=(0,a.Z7)("NOT_INITIALIZED",this.name);throw Error(e)}}}class np{constructor(e,t){this.core=e,this.logger=t,this.name="pairing",this.version="0.3",this.events=new(o()),this.initialized=!1,this.storagePrefix=iS,this.ignoredPayloadTypes=[a.rV],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:e})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...e])]},this.create=async()=>{this.isInitialized();let e=(0,a.jd)(),t=await this.core.crypto.setSymKey(e),r=(0,a.gn)(eg.FIVE_MINUTES),i={protocol:"irn"},n=(0,a.Bv)({protocol:this.core.protocol,version:this.core.version,topic:t,symKey:e,relay:i});return await this.pairings.set(t,{topic:t,expiry:r,relay:i,active:!1}),await this.core.relayer.subscribe(t),this.core.expirer.set(t,r),{topic:t,uri:n}},this.pair=async e=>{this.isInitialized(),this.isValidPair(e);let{topic:t,symKey:r,relay:i}=(0,a.he)(e.uri);if(this.pairings.keys.includes(t)&&this.pairings.get(t).active)throw Error(`Pairing already exists: ${t}. Please try again with a new connection URI.`);let n=(0,a.gn)(eg.FIVE_MINUTES),s={topic:t,relay:i,expiry:n,active:!1};return await this.pairings.set(t,s),this.core.expirer.set(t,n),e.activatePairing&&await this.activate({topic:t}),this.events.emit(iU.create,s),this.core.crypto.keychain.has(t)||(await this.core.crypto.setSymKey(r,t),await this.core.relayer.subscribe(t,{relay:i})),s},this.activate=async({topic:e})=>{this.isInitialized();let t=(0,a.gn)(eg.THIRTY_DAYS);await this.pairings.update(e,{active:!0,expiry:t}),this.core.expirer.set(e,t)},this.ping=async e=>{this.isInitialized(),await this.isValidPing(e);let{topic:t}=e;if(this.pairings.keys.includes(t)){let e=await this.sendRequest(t,"wc_pairingPing",{}),{done:r,resolve:i,reject:n}=(0,a.H1)();this.events.once((0,a.E0)("pairing_ping",e),({error:e})=>{e?n(e):i()}),await r()}},this.updateExpiry=async({topic:e,expiry:t})=>{this.isInitialized(),await this.pairings.update(e,{expiry:t})},this.updateMetadata=async({topic:e,metadata:t})=>{this.isInitialized(),await this.pairings.update(e,{peerMetadata:t})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async e=>{this.isInitialized(),await this.isValidDisconnect(e);let{topic:t}=e;this.pairings.keys.includes(t)&&(await this.sendRequest(t,"wc_pairingDelete",(0,a.D6)("USER_DISCONNECTED")),await this.deletePairing(t))},this.sendRequest=async(e,t,r)=>{let i=(0,rP.formatJsonRpcRequest)(t,r),n=await this.core.crypto.encode(e,i),s=i$[t].req;return this.core.history.set(e,i),this.core.relayer.publish(e,n,s),i.id},this.sendResult=async(e,t,r)=>{let i=(0,rP.formatJsonRpcResult)(e,r),n=await this.core.crypto.encode(t,i),s=i$[(await this.core.history.get(t,e)).request.method].res;await this.core.relayer.publish(t,n,s),await this.core.history.resolve(i)},this.sendError=async(e,t,r)=>{let i=(0,rP.formatJsonRpcError)(e,r),n=await this.core.crypto.encode(t,i),s=await this.core.history.get(t,e),o=i$[s.request.method]?i$[s.request.method].res:i$.unregistered_method.res;await this.core.relayer.publish(t,n,o),await this.core.history.resolve(i)},this.deletePairing=async(e,t)=>{await this.core.relayer.unsubscribe(e),await Promise.all([this.pairings.delete(e,(0,a.D6)("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(e),t?Promise.resolve():this.core.expirer.del(e)])},this.cleanup=async()=>{let e=this.pairings.getAll().filter(e=>(0,a.Bw)(e.expiry));await Promise.all(e.map(e=>this.deletePairing(e.topic)))},this.onRelayEventRequest=e=>{let{topic:t,payload:r}=e;switch(r.method){case"wc_pairingPing":return this.onPairingPingRequest(t,r);case"wc_pairingDelete":return this.onPairingDeleteRequest(t,r);default:return this.onUnknownRpcMethodRequest(t,r)}},this.onRelayEventResponse=async e=>{let{topic:t,payload:r}=e,i=(await this.core.history.get(t,r.id)).request.method;return"wc_pairingPing"===i?this.onPairingPingResponse(t,r):this.onUnknownRpcMethodResponse(i)},this.onPairingPingRequest=async(e,t)=>{let{id:r}=t;try{this.isValidPing({topic:e}),await this.sendResult(r,e,!0),this.events.emit(iU.ping,{id:r,topic:e})}catch(t){await this.sendError(r,e,t),this.logger.error(t)}},this.onPairingPingResponse=(e,t)=>{let{id:r}=t;setTimeout(()=>{(0,rP.isJsonRpcResult)(t)?this.events.emit((0,a.E0)("pairing_ping",r),{}):(0,rP.isJsonRpcError)(t)&&this.events.emit((0,a.E0)("pairing_ping",r),{error:t.error})},500)},this.onPairingDeleteRequest=async(e,t)=>{let{id:r}=t;try{this.isValidDisconnect({topic:e}),await this.deletePairing(e),this.events.emit(iU.delete,{id:r,topic:e})}catch(t){await this.sendError(r,e,t),this.logger.error(t)}},this.onUnknownRpcMethodRequest=async(e,t)=>{let{id:r,method:i}=t;try{if(this.registeredMethods.includes(i))return;let t=(0,a.D6)("WC_METHOD_UNSUPPORTED",i);await this.sendError(r,e,t),this.logger.error(t)}catch(t){await this.sendError(r,e,t),this.logger.error(t)}},this.onUnknownRpcMethodResponse=e=>{this.registeredMethods.includes(e)||this.logger.error((0,a.D6)("WC_METHOD_UNSUPPORTED",e))},this.isValidPair=e=>{var t;if(!(0,a.EJ)(e)){let{message:t}=(0,a.Z7)("MISSING_OR_INVALID",`pair() params: ${e}`);throw Error(t)}if(!(0,a.jv)(e.uri)){let{message:t}=(0,a.Z7)("MISSING_OR_INVALID",`pair() uri: ${e.uri}`);throw Error(t)}let r=(0,a.he)(e.uri);if(!(null!=(t=r?.relay)&&t.protocol)){let{message:e}=(0,a.Z7)("MISSING_OR_INVALID","pair() uri#relay-protocol");throw Error(e)}if(!(null!=r&&r.symKey)){let{message:e}=(0,a.Z7)("MISSING_OR_INVALID","pair() uri#symKey");throw Error(e)}},this.isValidPing=async e=>{if(!(0,a.EJ)(e)){let{message:t}=(0,a.Z7)("MISSING_OR_INVALID",`ping() params: ${e}`);throw Error(t)}let{topic:t}=e;await this.isValidPairingTopic(t)},this.isValidDisconnect=async e=>{if(!(0,a.EJ)(e)){let{message:t}=(0,a.Z7)("MISSING_OR_INVALID",`disconnect() params: ${e}`);throw Error(t)}let{topic:t}=e;await this.isValidPairingTopic(t)},this.isValidPairingTopic=async e=>{if(!(0,a.M_)(e,!1)){let{message:t}=(0,a.Z7)("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw Error(t)}if(!this.pairings.keys.includes(e)){let{message:t}=(0,a.Z7)("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw Error(t)}if((0,a.Bw)(this.pairings.get(e).expiry)){await this.deletePairing(e);let{message:t}=(0,a.Z7)("EXPIRED",`pairing topic: ${e}`);throw Error(t)}},this.core=e,this.logger=ee(t,this.name),this.pairings=new nu(this.core,this.logger,this.name,this.storagePrefix)}get context(){return X(this.logger)}isInitialized(){if(!this.initialized){let{message:e}=(0,a.Z7)("NOT_INITIALIZED",this.name);throw Error(e)}}registerRelayerEvents(){this.core.relayer.on(iT.message,async e=>{let{topic:t,message:r}=e;if(!this.pairings.keys.includes(t)||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(r)))return;let i=await this.core.crypto.decode(t,r);try{(0,rP.isJsonRpcRequest)(i)?(this.core.history.set(t,i),this.onRelayEventRequest({topic:t,payload:i})):(0,rP.isJsonRpcResponse)(i)&&(await this.core.history.resolve(i),await this.onRelayEventResponse({topic:t,payload:i}),this.core.history.delete(t,i.id))}catch(e){this.logger.error(e)}})}registerExpirerEvents(){this.core.expirer.on(iB.expired,async e=>{let{topic:t}=(0,a.iP)(e.target);t&&this.pairings.keys.includes(t)&&(await this.deletePairing(t,!0),this.events.emit(iU.expire,{topic:t}))})}}class nf extends en{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.records=new Map,this.events=new s.EventEmitter,this.name="history",this.version="0.3",this.cached=[],this.initialized=!1,this.storagePrefix=iS,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(
1),this.cached.forEach(e=>this.records.set(e.id,e)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(e,t,r)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:e,request:t,chainId:r}),this.records.has(t.id))return;let i={id:t.id,topic:e,request:{method:t.method,params:t.params||null},chainId:r,expiry:(0,a.gn)(eg.THIRTY_DAYS)};this.records.set(i.id,i),this.events.emit(iM.created,i)},this.resolve=async e=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:e}),!this.records.has(e.id))return;let t=await this.getRecord(e.id);typeof t.response>"u"&&(t.response=(0,rP.isJsonRpcError)(e)?{error:e.error}:{result:e.result},this.records.set(t.id,t),this.events.emit(iM.updated,t))},this.get=async(e,t)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:e,id:t}),await this.getRecord(t)),this.delete=(e,t)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:t}),this.values.forEach(r=>{r.topic!==e||"u">typeof t&&r.id!==t||(this.records.delete(r.id),this.events.emit(iM.deleted,r))})},this.exists=async(e,t)=>(this.isInitialized(),!!this.records.has(t)&&(await this.getRecord(t)).topic===e),this.on=(e,t)=>{this.events.on(e,t)},this.once=(e,t)=>{this.events.once(e,t)},this.off=(e,t)=>{this.events.off(e,t)},this.removeListener=(e,t)=>{this.events.removeListener(e,t)},this.logger=ee(t,this.name)}get context(){return X(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){let e=[];return this.values.forEach(t=>{if("u">typeof t.response)return;let r={topic:t.topic,request:(0,rP.formatJsonRpcRequest)(t.request.method,t.request.params,t.id),chainId:t.chainId};return e.push(r)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();let t=this.records.get(e);if(!t){let{message:t}=(0,a.Z7)("NO_MATCHING_KEY",`${this.name}: ${e}`);throw Error(t)}return t}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(iM.sync)}async restore(){try{let e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){let{message:e}=(0,a.Z7)("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),Error(e)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(iM.created,e=>{let t=iM.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e}),this.persist()}),this.events.on(iM.updated,e=>{let t=iM.updated;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e}),this.persist()}),this.events.on(iM.deleted,e=>{let t=iM.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e}),this.persist()}),this.core.heartbeat.on(D.HEARTBEAT_EVENTS.pulse,()=>{this.cleanup()})}cleanup(){try{this.records.forEach(e=>{(0,eg.toMiliseconds)(e.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${e.id}`),this.delete(e.topic,e.id))})}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){let{message:e}=(0,a.Z7)("NOT_INITIALIZED",this.name);throw Error(e)}}}class nd extends eh{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.expirations=new Map,this.events=new s.EventEmitter,this.name="expirer",this.version="0.3",this.cached=[],this.initialized=!1,this.storagePrefix=iS,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(
1),this.cached.forEach(e=>this.expirations.set(e.target,e)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=e=>{try{let t=this.formatTarget(e);return"u">typeof this.getExpiration(t)}catch{return!1}},this.set=(e,t)=>{this.isInitialized();let r=this.formatTarget(e),i={target:r,expiry:t};this.expirations.set(r,i),this.checkExpiry(r,i),this.events.emit(iB.created,{target:r,expiration:i})},this.get=e=>{this.isInitialized();let t=this.formatTarget(e);return this.getExpiration(t)},this.del=e=>{if(this.isInitialized(),this.has(e)){let t=this.formatTarget(e),r=this.getExpiration(t);this.expirations.delete(t),this.events.emit(iB.deleted,{target:t,expiration:r})}},this.on=(e,t)=>{this.events.on(e,t)},this.once=(e,t)=>{this.events.once(e,t)},this.off=(e,t)=>{this.events.off(e,t)},this.removeListener=(e,t)=>{this.events.removeListener(e,t)},this.logger=ee(t,this.name)}get context(){return X(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if("string"==typeof e)return(0,a.Z4)(e);if("number"==typeof e)return(0,a.Gq)(e);let{message:t}=(0,a.Z7)("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw Error(t)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(iB.sync)}async restore(){try{let e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){let{message:e}=(0,a.Z7)("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),Error(e)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){let t=this.expirations.get(e);if(!t){let{message:t}=(0,a.Z7)("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(t),Error(t)}return t}checkExpiry(e,t){let{expiry:r}=t;(0,eg.toMiliseconds)(r)-Date.now()<=0&&this.expire(e,t)}expire(e,t){this.expirations.delete(e),this.events.emit(iB.expired,{target:e,expiration:t})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,t)=>this.checkExpiry(t,e))}registerEventListeners(){this.core.heartbeat.on(D.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(iB.created,e=>{let t=iB.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(iB.expired,e=>{let t=iB.expired;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(iB.deleted,e=>{let t=iB.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=(0,a.Z7)("NOT_INITIALIZED",this.name);throw Error(e)}}}class ng extends eu{constructor(e,t){super(e,t),this.projectId=e,this.logger=t,this.name=iH,this.initialized=!1,this.queue=[],this.verifyDisabled=!1,this.init=async e=>{if(this.verifyDisabled||(0,a.b$)()||!(0,a.jU)())return;let t=this.getVerifyUrl(e?.verifyUrl);this.verifyUrl!==t&&this.removeIframe(),this.verifyUrl=t;try{await this.createIframe()}catch(e){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(e)}if(!this.initialized){this.removeIframe(),this.verifyUrl=iK;try{await this.createIframe()}catch(e){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(e),this.verifyDisabled=!0}}},this.register=async e=>{this.initialized?this.sendPost(e.attestationId):(this.addToQueue(e.attestationId),await this.init())},this.resolve=async e=>{let t;if(this.isDevEnv)return"";let r=this.getVerifyUrl(e?.verifyUrl);try{t=await this.fetchAttestation(e.attestationId,r)}catch(i){this.logger.info(`failed to resolve attestation: ${e.attestationId} from url: ${r}`),this.logger.info(i),t=await this.fetchAttestation(e.attestationId,iK)}return t},this.fetchAttestation=async(e,t)=>{this.logger.info(`resolving attestation: ${e} from url: ${t}`);let r=this.startAbortTimer(2*eg.ONE_SECOND),i=await fetch(`${t}/attestation/${e}`,{signal:this.abortController.signal});return clearTimeout(r),200===i.status?await i.json():void 0},this.addToQueue=e=>{this.queue.push(e)},this.processQueue=()=>
1{0!==this.queue.length&&(this.queue.forEach(e=>this.sendPost(e)),this.queue=[])},this.sendPost=e=>{var t;try{if(!this.iframe)return;null==(t=this.iframe.contentWindow)||t.postMessage(e,"*"),this.logger.info(`postMessage sent: ${e} ${this.verifyUrl}`)}catch{}},this.createIframe=async()=>{let e;let t=r=>{"verify_ready"===r.data&&(this.initialized=!0,this.processQueue(),window.removeEventListener("message",t),e())};await Promise.race([new Promise(r=>{if(document.getElementById(iH))return r();window.addEventListener("message",t);let i=document.createElement("iframe");i.id=iH,i.src=`${this.verifyUrl}/${this.projectId}`,i.style.display="none",document.body.append(i),this.iframe=i,e=r}),new Promise((e,r)=>setTimeout(()=>{window.removeEventListener("message",t),r("verify iframe load timeout")},(0,eg.toMiliseconds)(eg.FIVE_SECONDS)))])},this.removeIframe=()=>{this.iframe&&(this.iframe.remove(),this.iframe=void 0,this.initialized=!1)},this.getVerifyUrl=e=>{let t=e||iV;return iF.includes(t)||(this.logger.info(`verify url: ${t}, not included in trusted list, assigning default: ${iV}`),t=iV),t},this.logger=ee(t,this.name),this.verifyUrl=iV,this.abortController=new AbortController,this.isDevEnv=(0,a.UG)()&&rz.env.IS_VITEST}get context(){return X(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),(0,eg.toMiliseconds)(e))}}class ny extends ep{constructor(e,t){super(e,t),this.projectId=e,this.logger=t,this.context="echo",this.registerDeviceToken=async e=>{let{clientId:t,token:r,notificationType:i,enableEncrypted:n=!1}=e,s=`https://echo.walletconnect.com/${this.projectId}/clients`;await rT()(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:t,type:i,token:r,always_raw:n})})},this.logger=ee(t,this.context)}}var nv=Object.defineProperty,nm=Object.getOwnPropertySymbols,nb=Object.prototype.hasOwnProperty,nw=Object.prototype.propertyIsEnumerable,n_=(e,t,r)=>t in e?nv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,nE=(e,t)=>{for(var r in t||(t={}))nb.call(t,r)&&n_(e,r,t[r]);if(nm)for(var r of nm(t))nw.call(t,r)&&n_(e,r,t[r]);return e};class nI extends ei{constructor(e){super(e),this.protocol="wc",this.version=2,this.name=iP,this.events=new s.EventEmitter,this.initialized=!1,this.on=(e,t)=>this.events.on(e,t),this.once=(e,t)=>this.events.once(e,t),this.off=(e,t)=>this.events.off(e,t),this.removeListener=(e,t)=>this.events.removeListener(e,t),this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||iq,this.customStoragePrefix=null!=e&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";let t="u">typeof e?.logger&&"string"!=typeof e?.logger?e.logger:et(Y({level:e?.logger||iR.logger}));this.logger=ee(t,this.name),this.heartbeat=new D.HeartBeat,this.crypto=new iW(this,this.logger,e?.keychain),this.history=new nf(this,this.logger),this.expirer=new nd(this,this.logger),this.storage=null!=e&&e.storage?e.storage:new z(nE(nE({},iO),e?.storageOptions)),this.relayer=new nn({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new np(this,this.logger),this.verify=new ng(this.projectId||"",this.logger),this.echoClient=new ny(this.projectId||"",this.logger)}static async init(e){let t=new nI(e);await t.initialize();let r=await t.crypto.getClientId();return await t.storage.setItem("WALLETCONNECT_CLIENT_ID",r),t}get context(){return X(this.logger)}async start(){this.initialized||await this.initialize()}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}}let nx="client",nP=`wc@2:${nx}:`,nS={name:nx,logger:"error"},nR="WALLETCONNECT_DEEPLINK_CHOICE",nO="Proposal expired",nA=eg.SEVEN_DAYS,nC={wc_sessionPropose:{req:{ttl:eg.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:eg.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:eg.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:eg.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:eg.ONE_DAY,prompt:!1,tag:1104},res:{ttl:eg.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:eg.ONE_DAY,prompt:!1,tag:1106},res:{ttl:eg.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:eg.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:eg.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:eg.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:eg.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:eg.ONE_DAY,prompt:!1,tag:1112},res:{ttl:eg.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:eg.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:eg.THIRTY_SECONDS,prompt:!1,tag:1115}}},nN={min:eg.FIVE_MINUTES,max:eg.SEVEN_DAYS},nq={idle:"IDLE",active:"ACTIVE"},nj=["wc_sessionPropose","wc_sessionRequest","wc_authRequest"];var nT=Object.defineProperty,nz=Object.defineProperties,nD=Object.getOwnPropertyDescriptors,nk=Object.getOwnPropertySymbols,nL=Object.prototype.hasOwnProperty,n$=Object.prototype.propertyIsEnumerable,nU=(e,t,r)=>t in e?nT(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,nM=(e,t)=>{for(var r in t||(t={}))nL.call(t,r)&&nU(e,r,t[r]);if(nk)for(var r of nk(t))n$.call(t,r)&&nU(e,r,t[r]);return e},nB=(e,t)=>nz(e,nD(t));
1class nH extends ed{constructor(e){super(e),this.name="engine",this.events=new(o()),this.initialized=!1,this.ignoredPayloadTypes=[a.rV],this.requestQueue={state:nq.idle,queue:[]},this.sessionRequestQueue={state:nq.idle,queue:[]},this.requestQueueDelay=eg.ONE_SECOND,this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),this.client.core.pairing.register({methods:Object.keys(nC)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},(0,eg.toMiliseconds)(this.requestQueueDelay)))},this.connect=async e=>{await this.isInitialized();let t=nB(nM({},e),{requiredNamespaces:e.requiredNamespaces||{},optionalNamespaces:e.optionalNamespaces||{}});await this.isValidConnect(t);let{pairingTopic:r,requiredNamespaces:i,optionalNamespaces:n,sessionProperties:s,relays:o}=t,c=r,l,h=!1;if(c&&(h=this.client.core.pairing.pairings.get(c).active),!c||!h){let{topic:e,uri:t}=await this.client.core.pairing.create();c=e,l=t}let u=await this.client.core.crypto.generateKeyPair(),p=nM({requiredNamespaces:i,optionalNamespaces:n,relays:o??[{protocol:"irn"}],proposer:{publicKey:u,metadata:this.client.metadata}},s&&{sessionProperties:s}),{reject:f,resolve:d,done:g}=(0,a.H1)(eg.FIVE_MINUTES,nO);if(this.events.once((0,a.E0)("session_connect"),async({error:e,session:t})=>{if(e)f(e);else if(t){t.self.publicKey=u;let e=nB(nM({},t),{requiredNamespaces:t.requiredNamespaces,optionalNamespaces:t.optionalNamespaces});await this.client.session.set(t.topic,e),await this.setExpiry(t.topic,t.expiry),c&&await this.client.core.pairing.updateMetadata({topic:c,metadata:t.peer.metadata}),d(e)}}),!c){let{message:e}=(0,a.Z7)("NO_MATCHING_KEY",`connect() pairing topic: ${c}`);throw Error(e)}let y=await this.sendRequest({topic:c,method:"wc_sessionPropose",params:p}),v=(0,a.gn)(eg.FIVE_MINUTES);return await this.setProposal(y,nM({id:y,expiry:v},p)),{uri:l,approval:g}},this.pair=async e=>(await this.isInitialized(),await this.client.core.pairing.pair(e)),this.approve=async e=>{await this.isInitialized(),await this.isValidApprove(e);let{id:t,relayProtocol:r,namespaces:i,sessionProperties:n}=e,{pairingTopic:s,proposer:o,requiredNamespaces:c,optionalNamespaces:l}=this.client.proposal.get(t);s=s||"",(0,a.L5)(c)||(c=(0,a.fc)(i,"approve()"));let h=await this.client.core.crypto.generateKeyPair(),u=o.publicKey,p=await this.client.core.crypto.generateSharedKey(h,u);s&&t&&(await this.client.core.pairing.updateMetadata({topic:s,metadata:o.metadata}),await this.sendResult({id:t,topic:s,result:{relay:{protocol:r??"irn"},responderPublicKey:h}}),await this.client.proposal.delete(t,(0,a.D6)("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:s}));let f=nM({relay:{protocol:r??"irn"},namespaces:i,requiredNamespaces:c,optionalNamespaces:l,pairingTopic:s,controller:{publicKey:h,metadata:this.client.metadata},expiry:(0,a.gn)(nA)},n&&{sessionProperties:n});await this.client.core.relayer.subscribe(p),await this.sendRequest({topic:p,method:"wc_sessionSettle",params:f,throwOnFailedPublish:!0});let d=nB(nM({},f),{topic:p,pairingTopic:s,acknowledged:!1,self:f.controller,peer:{publicKey:o.publicKey,metadata:o.metadata},controller:h});return await this.client.session.set(p,d),await this.setExpiry(p,(0,a.gn)(nA)),{topic:p,acknowledged:()=>new Promise(e=>setTimeout(()=>e(this.client.session.get(p)),500))}},this.reject=async e=>{await this.isInitialized(),await this.isValidReject(e);let{id:t,reason:r}=e,{pairingTopic:i}=this.client.proposal.get(t);i&&(await this.sendError(t,i,r),await this.client.proposal.delete(t,(0,a.D6)("USER_DISCONNECTED")))},this.update=async e=>{await this.isInitialized(),await this.isValidUpdate(e);let{topic:t,namespaces:r}=e,i=await this.sendRequest({topic:t,method:"wc_sessionUpdate",params:{namespaces:r}}),{done:n,resolve:s,reject:o}=(0,a.H1)();return this.events.once((0,a.E0)("session_update",i),({error:e})=>{e?o(e):s()}),await this.client.session.update(t,{namespaces:r}),{acknowledged:n}},this.extend=async e=>{await this.isInitialized(),await this.isValidExtend(e);let{topic:t}=e,r=await this.sendRequest({topic:t,method:"wc_sessionExtend",params:{}}),{done:i,resolve:n,reject:s}=(0,a.H1)();return this.events.once((0,a.E0)("session_extend",r),({error:e})=>{e?s(e):n()}),await this.setExpiry(t,(0,a.gn)(nA)),{acknowledged:i}},this.request=async e=>{await this.isInitialized(),await this.isValidRequest(e);let{chainId:t,request:r,topic:i,expiry:n}=e,s=(0,rP.payloadId)(),{done:o,resolve:c,reject:l}=(0,a.H1)(n,"Request expired. Please try again.");return this.events.once((0,a.E0)("session_request",s),({error:e,result:t})=>{e?l(e):c(t)}),await Promise.all([new Promise(async e=>{await this.sendRequest({clientRpcId:s,topic:i,method:"wc_sessionRequest",params:{request:r,chainId:t},expiry:n,throwOnFailedPublish:!0}).catch(e=>l(e)),this.client.events.emit("session_request_sent",{topic:i,request:r,chainId:t,id:s}),e()}),new Promise(async e=>{let t=await (0,a.bW)(this.client.core.storage,nR);(0,a.Hh)({id:s,topic:i,wcDeepLink:t}),e()}),o()]).then(e=>e[2])},this.respond=async e=>{await this.isInitialized(),await this.isValidRespond(e);let{topic:t,response:r}=e,{id:i}=r;(0,rP.isJsonRpcResult)(r)?await this.sendResult({id:i,topic:t,result:r.result,throwOnFailedPublish:!0}):(0,rP.isJsonRpcError)(r)&&await this.sendError(i,t,r.error),this.cleanupAfterResponse(e)},this.ping=async e=>{await this.isInitialized(),await this.isValidPing(e);let{topic:t}=e;if(this.client.session.keys.includes(t)){let e=await this.sendRequest({topic:t,method:"wc_sessionPing",params:{}}),{done:r,resolve:i,reject:n}=(0,a.H1)();this.events.once((0,a.E0)("session_ping",e),({error:e})=>{e?n(e):i()}),await r()}else this.client.core.pairing.pairings.keys.includes(t)&&await this.client.core.pairing.ping({topic:t})},this.emit=async e=>{await this.isInitialized(),await this.isValidEmit(e);let{topic:t,event:r,chainId:i}=e;await this.sendRequest({topic:t,method:"wc_sessionEvent",params:{event:r,chainId:i}})},this.disconnect=async e=>{await this.isInitialized(),await this.isValidDisconnect(e);let{topic:t}=e;this.client.session.keys.includes(t)?(await this.sendRequest({topic:t,method:"wc_sessionDelete",params:(0,a.D6)("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession(t)):await this.client.core.pairing.disconnect({topic:t})},this.find=e=>(this.isInitialized(),this.client.session.getAll().filter(t=>(0,a.Ih)(t,e))),this.getPendingSessionRequests=()=>
1(this.isInitialized(),this.client.pendingRequest.getAll()),this.cleanupDuplicatePairings=async e=>{if(e.pairingTopic)try{let t=this.client.core.pairing.pairings.get(e.pairingTopic),r=this.client.core.pairing.pairings.getAll().filter(r=>{var i,n;return(null==(i=r.peerMetadata)?void 0:i.url)&&(null==(n=r.peerMetadata)?void 0:n.url)===e.peer.metadata.url&&r.topic&&r.topic!==t.topic});if(0===r.length)return;this.client.logger.info(`Cleaning up ${r.length} duplicate pairing(s)`),await Promise.all(r.map(e=>this.client.core.pairing.disconnect({topic:e.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(e){this.client.logger.error(e)}},this.deleteSession=async(e,t)=>{let{self:r}=this.client.session.get(e);await this.client.core.relayer.unsubscribe(e),this.client.session.delete(e,(0,a.D6)("USER_DISCONNECTED")),this.client.core.crypto.keychain.has(r.publicKey)&&await this.client.core.crypto.deleteKeyPair(r.publicKey),this.client.core.crypto.keychain.has(e)&&await this.client.core.crypto.deleteSymKey(e),t||this.client.core.expirer.del(e),this.client.core.storage.removeItem(nR).catch(e=>this.client.logger.warn(e)),this.getPendingSessionRequests().forEach(t=>{t.topic===e&&this.deletePendingSessionRequest(t.id,(0,a.D6)("USER_DISCONNECTED"))})},this.deleteProposal=async(e,t)=>{await Promise.all([this.client.proposal.delete(e,(0,a.D6)("USER_DISCONNECTED")),t?Promise.resolve():this.client.core.expirer.del(e)])},this.deletePendingSessionRequest=async(e,t,r=!1)=>{await Promise.all([this.client.pendingRequest.delete(e,t),r?Promise.resolve():this.client.core.expirer.del(e)]),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(t=>t.id!==e),r&&(this.sessionRequestQueue.state=nq.idle)},this.setExpiry=async(e,t)=>{this.client.session.keys.includes(e)&&await this.client.session.update(e,{expiry:t}),this.client.core.expirer.set(e,t)},this.setProposal=async(e,t)=>{await this.client.proposal.set(e,t),this.client.core.expirer.set(e,t.expiry)},this.setPendingSessionRequest=async e=>{let t=nC.wc_sessionRequest.req.ttl,{id:r,topic:i,params:n,verifyContext:s}=e;await this.client.pendingRequest.set(r,{id:r,topic:i,params:n,verifyContext:s}),t&&this.client.core.expirer.set(r,(0,a.gn)(t))},this.sendRequest=async e=>{let{topic:t,method:r,params:i,expiry:n,relayRpcId:s,clientRpcId:o,throwOnFailedPublish:c}=e,l=(0,rP.formatJsonRpcRequest)(r,i,o);if((0,a.jU)()&&nj.includes(r)){let e=(0,a.rj)(JSON.stringify(l));this.client.core.verify.register({attestationId:e})}let h=await this.client.core.crypto.encode(t,l),u=nC[r].req;return n&&(u.ttl=n),s&&(u.id=s),this.client.core.history.set(t,l),c?(u.internal=nB(nM({},u.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(t,h,u)):this.client.core.relayer.publish(t,h,u).catch(e=>this.client.logger.error(e)),l.id},this.sendResult=async e=>{let{id:t,topic:r,result:i,throwOnFailedPublish:n}=e,s=(0,rP.formatJsonRpcResult)(t,i),o=await this.client.core.crypto.encode(r,s),a=nC[(await this.client.core.history.get(r,t)).request.method].res;n?(a.internal=nB(nM({},a.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(r,o,a)):this.client.core.relayer.publish(r,o,a).catch(e=>this.client.logger.error(e)),await this.client.core.history.resolve(s)},this.sendError=async(e,t,r)=>{let i=(0,rP.formatJsonRpcError)(e,r),n=await this.client.core.crypto.encode(t,i),s=nC[(await this.client.core.history.get(t,e)).request.method].res;this.client.core.relayer.publish(t,n,s),await this.client.core.history.resolve(i)},this.cleanup=async()=>{let e=[],t=[];this.client.session.getAll().forEach(t=>{(0,a.Bw)(t.expiry)&&e.push(t.topic)}),this.client.proposal.getAll().forEach(e=>{(0,a.Bw)(e.expiry)&&t.push(e.id)}),await Promise.all([...e.map(e=>this.deleteSession(e)),...t.map(e=>this.deleteProposal(e))])},this.onRelayEventRequest=async e=>{this.requestQueue.queue.push(e),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===nq.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=nq.active;let e=this.requestQueue.queue.shift();if(e)try{this.processRequest(e),await new Promise(e=>
1setTimeout(e,300))}catch(e){this.client.logger.warn(e)}}this.requestQueue.state=nq.idle},this.processRequest=e=>{let{topic:t,payload:r}=e,i=r.method;switch(i){case"wc_sessionPropose":return this.onSessionProposeRequest(t,r);case"wc_sessionSettle":return this.onSessionSettleRequest(t,r);case"wc_sessionUpdate":return this.onSessionUpdateRequest(t,r);case"wc_sessionExtend":return this.onSessionExtendRequest(t,r);case"wc_sessionPing":return this.onSessionPingRequest(t,r);case"wc_sessionDelete":return this.onSessionDeleteRequest(t,r);case"wc_sessionRequest":return this.onSessionRequest(t,r);case"wc_sessionEvent":return this.onSessionEventRequest(t,r);default:return this.client.logger.info(`Unsupported request method ${i}`)}},this.onRelayEventResponse=async e=>{let{topic:t,payload:r}=e,i=(await this.client.core.history.get(t,r.id)).request.method;switch(i){case"wc_sessionPropose":return this.onSessionProposeResponse(t,r);case"wc_sessionSettle":return this.onSessionSettleResponse(t,r);case"wc_sessionUpdate":return this.onSessionUpdateResponse(t,r);case"wc_sessionExtend":return this.onSessionExtendResponse(t,r);case"wc_sessionPing":return this.onSessionPingResponse(t,r);case"wc_sessionRequest":return this.onSessionRequestResponse(t,r);default:return this.client.logger.info(`Unsupported response method ${i}`)}},this.onRelayEventUnknownPayload=e=>{let{topic:t}=e,{message:r}=(0,a.Z7)("MISSING_OR_INVALID",`Decoded payload on topic ${t} is not identifiable as a JSON-RPC request or a response.`);throw Error(r)},this.onSessionProposeRequest=async(e,t)=>{let{params:r,id:i}=t;try{this.isValidConnect(nM({},t.params));let n=(0,a.gn)(eg.FIVE_MINUTES),s=nM({id:i,pairingTopic:e,expiry:n},r);await this.setProposal(i,s);let o=(0,a.rj)(JSON.stringify(t)),c=await this.getVerifyContext(o,s.proposer.metadata);this.client.events.emit("session_proposal",{id:i,params:s,verifyContext:c})}catch(t){await this.sendError(i,e,t),this.client.logger.error(t)}},this.onSessionProposeResponse=async(e,t)=>{let{id:r}=t;if((0,rP.isJsonRpcResult)(t)){let{result:i}=t;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:i});let n=this.client.proposal.get(r);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:n});let s=n.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:s});let o=i.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:o});let a=await this.client.core.crypto.generateSharedKey(s,o);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:a});let c=await this.client.core.relayer.subscribe(a);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:c}),await this.client.core.pairing.activate({topic:e})}else(0,rP.isJsonRpcError)(t)&&(await this.client.proposal.delete(r,(0,a.D6)("USER_DISCONNECTED")),this.events.emit((0,a.E0)("session_connect"),{error:t.error}))},this.onSessionSettleRequest=async(e,t)=>{let{id:r,params:i}=t;try{this.isValidSessionSettleRequest(i);let{relay:r,controller:n,expiry:s,namespaces:o,requiredNamespaces:c,optionalNamespaces:l,sessionProperties:h,pairingTopic:u}=t.params,p=nM({topic:e,relay:r,expiry:s,namespaces:o,acknowledged:!0,pairingTopic:u,requiredNamespaces:c,optionalNamespaces:l,controller:n.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:n.publicKey,metadata:n.metadata}},h&&{sessionProperties:h});await this.sendResult({id:t.id,topic:e,result:!0}),this.events.emit((0,a.E0)("session_connect"),{session:p}),this.cleanupDuplicatePairings(p)}catch(t){await this.sendError(r,e,t),this.client.logger.error(t)}},this.onSessionSettleResponse=async(e,t)=>{let{id:r}=t;(0,rP.isJsonRpcResult)(t)?(await this.client.session.update(e,{acknowledged:!0}),this.events.emit((0,a.E0)("session_approve",r),{})):(0,rP.isJsonRpcError)(t)&&(await this.client.session.delete(e,(0,a.D6)("USER_DISCONNECTED")),this.events.emit((0,a.E0)("session_approve",r),{error:t.error}))},this.onSessionUpdateRequest=async(e,t)=>{let{params:r,id:i}=t;try{let t=`${e}_session_update`,n=a.O6.get(t);if(n&&this.isRequestOutOfSync(n,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidUpdate(nM({topic:e},r)),await this.client.session.update(e,{namespaces:r.namespaces}),await this.sendResult({id:i,topic:e,result:!0}),this.client.events.emit("session_update",{id:i,topic:e,params:r}),a.O6.set(t,i)}catch(t){await this.sendError(i,e,t),this.client.logger.error(t)}},this.isRequestOutOfSync=(e,t)=>parseInt(t.toString().slice(0,-3))<=parseInt(e.toString().slice(0,-3)),this.onSessionUpdateResponse=(e,t)=>{let{id:r}=t;(0,rP.isJsonRpcResult)(t)?this.events.emit((0,a.E0)("session_update",r),{}):(0,rP.isJsonRpcError)(t)&&this.events.emit((0,a.E0)("session_update",r),{error:t.error})},this.onSessionExtendRequest=async(e,t)=>{let{id:r}=t;try{this.isValidExtend({topic:e}),await this.setExpiry(e,(0,a.gn)(nA)),await this.sendResult({id:r,topic:e,result:!0}),this.client.events.emit("session_extend",{id:r,topic:e})}catch(t){await this.sendError(r,e,t),this.client.logger.error(t)}},this.onSessionExtendResponse=(e,t)=>{let{id:r}=t;(0,rP.isJsonRpcResult)(t)?this.events.emit((0,a.E0)("session_extend",r),{}):(0,rP.isJsonRpcError)(t)&&this.events.emit((0,a.E0)("session_extend",r),{error:t.error})},this.onSessionPingRequest=async(e,t)=>{let{id:r}=t;try{this.isValidPing({topic:e}),await this.sendResult({id:r,topic:e,result:!0}),this.client.events.emit("session_ping",{id:r,topic:e})}catch(t){await this.sendError(r,e,t),this.client.logger.error(t)}},this.onSessionPingResponse=(e,t)=>{let{id:r}=t;setTimeout(()=>{(0,rP.isJsonRpcResult)(t)?this.events.emit((0,a.E0)("session_ping",r),{}):(0,rP.isJsonRpcError)(t)&&this.events.emit((0,a.E0)("session_ping",r),{error:t.error})},500)},this.onSessionDeleteRequest=async(e,t)=>{let{id:r}=t;try{this.isValidDisconnect({topic:e,reason:t.params}),await Promise.all([new Promise(t=>{this.client.core.relayer.once(iT.publish,async()=>{t(await this.deleteSession(e))})}),this.sendResult({id:r,topic:e,result:!0})]),this.client.events.emit("session_delete",{id:r,topic:e})}catch(e){this.client.logger.error(e)}},this.onSessionRequest=async(e,t)=>{let{id:r,params:i}=t;try{this.isValidRequest(nM({topic:e},i));let t=(0,a.rj)(JSON.stringify((0,rP.formatJsonRpcRequest)("wc_sessionRequest",i,r))),n=this.client.session.get(e),s=await this.getVerifyContext(t,n.peer.metadata),o={id:r,topic:e,params:i,verifyContext:s};await this.setPendingSessionRequest(o),this.addSessionRequestToSessionRequestQueue(o),this.processSessionRequestQueue()}catch(t){await this.sendError(r,e,t),this.client.logger.error(t)}},this.onSessionRequestResponse=(e,t)=>{let{id:r}=t;(0,rP.isJsonRpcResult)(t)?this.events.emit((0,a.E0)("session_request",r),{result:t.result}):(0,rP.isJsonRpcError)(t)&&this.events.emit((0,a.E0)("session_request",r),{error:t.error})},this.onSessionEventRequest=async(e,t)=>{let{id:r,params:i}=t;try{let t=`${e}_session_event_${i.event.name}`,n=a.O6.get(t);if(n&&this.isRequestOutOfSync(n,r)){this.client.logger.info(`Discarding out of sync request - ${r}`);return}this.isValidEmit(nM({topic:e},i)),this.client.events.emit("session_event",{id:r,topic:e,params:i}),a.O6.set(t,r)}catch(t){await this.sendError(r,e,t),this.client.logger.error(t)}},this.addSessionRequestToSessionRequestQueue=e=>{this.sessionRequestQueue.queue.push(e)},this.cleanupAfterResponse=e=>{this.deletePendingSessionRequest(e.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=nq.idle,this.processSessionRequestQueue()},(0,eg.toMiliseconds)(this.requestQueueDelay))},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===nq.active){this.client.logger.info("session request queue is already active.");return}let e=this.sessionRequestQueue.queue[0];if(!e){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=nq.active,this.client.events.emit("session_request",e)}catch(e){this.client.logger.error(e)}}
1,this.onPairingCreated=e=>{if(e.active)return;let t=this.client.proposal.getAll().find(t=>t.pairingTopic===e.topic);t&&this.onSessionProposeRequest(e.topic,(0,rP.formatJsonRpcRequest)("wc_sessionPropose",{requiredNamespaces:t.requiredNamespaces,optionalNamespaces:t.optionalNamespaces,relays:t.relays,proposer:t.proposer,sessionProperties:t.sessionProperties},t.id))},this.isValidConnect=async e=>{if(!(0,a.EJ)(e)){let{message:t}=(0,a.Z7)("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(e)}`);throw Error(t)}let{pairingTopic:t,requiredNamespaces:r,optionalNamespaces:i,sessionProperties:n,relays:s}=e;if((0,a.o8)(t)||await this.isValidPairingTopic(t),!(0,a.PM)(s,!0)){let{message:e}=(0,a.Z7)("MISSING_OR_INVALID",`connect() relays: ${s}`);throw Error(e)}(0,a.o8)(r)||0===(0,a.L5)(r)||this.validateNamespaces(r,"requiredNamespaces"),(0,a.o8)(i)||0===(0,a.L5)(i)||this.validateNamespaces(i,"optionalNamespaces"),(0,a.o8)(n)||this.validateSessionProps(n,"sessionProperties")},this.validateNamespaces=(e,t)=>{let r=(0,a.n)(e,"connect()",t);if(r)throw Error(r.message)},this.isValidApprove=async e=>{if(!(0,a.EJ)(e))throw Error((0,a.Z7)("MISSING_OR_INVALID",`approve() params: ${e}`).message);let{id:t,namespaces:r,relayProtocol:i,sessionProperties:n}=e;await this.isValidProposalId(t);let s=this.client.proposal.get(t),o=(0,a.in)(r,"approve()");if(o)throw Error(o.message);let c=(0,a.rF)(s.requiredNamespaces,r,"approve()");if(c)throw Error(c.message);if(!(0,a.M_)(i,!0)){let{message:e}=(0,a.Z7)("MISSING_OR_INVALID",`approve() relayProtocol: ${i}`);throw Error(e)}(0,a.o8)(n)||this.validateSessionProps(n,"sessionProperties")},this.isValidReject=async e=>{if(!(0,a.EJ)(e)){let{message:t}=(0,a.Z7)("MISSING_OR_INVALID",`reject() params: ${e}`);throw Error(t)}let{id:t,reason:r}=e;if(await this.isValidProposalId(t),!(0,a.$t)(r)){let{message:e}=(0,a.Z7)("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(r)}`);throw Error(e)}},this.isValidSessionSettleRequest=e=>{if(!(0,a.EJ)(e)){let{message:t}=(0,a.Z7)("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${e}`);throw Error(t)}
1let{relay:t,controller:r,namespaces:i,expiry:n}=e;if(!(0,a.Z2)(t)){let{message:e}=(0,a.Z7)("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw Error(e)}let s=(0,a.Dd)(r,"onSessionSettleRequest()");if(s)throw Error(s.message);let o=(0,a.in)(i,"onSessionSettleRequest()");if(o)throw Error(o.message);if((0,a.Bw)(n)){let{message:e}=(0,a.Z7)("EXPIRED","onSessionSettleRequest()");throw Error(e)}},this.isValidUpdate=async e=>{if(!(0,a.EJ)(e)){let{message:t}=(0,a.Z7)("MISSING_OR_INVALID",`update() params: ${e}`);throw Error(t)}let{topic:t,namespaces:r}=e;await this.isValidSessionTopic(t);let i=this.client.session.get(t),n=(0,a.in)(r,"update()");if(n)throw Error(n.message);let s=(0,a.rF)(i.requiredNamespaces,r,"update()");if(s)throw Error(s.message)},this.isValidExtend=async e=>{if(!(0,a.EJ)(e)){let{message:t}=(0,a.Z7)("MISSING_OR_INVALID",`extend() params: ${e}`);throw Error(t)}let{topic:t}=e;await this.isValidSessionTopic(t)},this.isValidRequest=async e=>{if(!(0,a.EJ)(e)){let{message:t}=(0,a.Z7)("MISSING_OR_INVALID",`request() params: ${e}`);throw Error(t)}let{topic:t,request:r,chainId:i,expiry:n}=e;await this.isValidSessionTopic(t);let{namespaces:s}=this.client.session.get(t);if(!(0,a.p8)(s,i)){let{message:e}=(0,a.Z7)("MISSING_OR_INVALID",`request() chainId: ${i}`);throw Error(e)}if(!(0,a.hH)(r)){let{message:e}=(0,a.Z7)("MISSING_OR_INVALID",`request() ${JSON.stringify(r)}`);throw Error(e)}if(!(0,a.al)(s,i,r.method)){let{message:e}=(0,a.Z7)("MISSING_OR_INVALID",`request() method: ${r.method}`);throw Error(e)}if(n&&!(0,a.ON)(n,nN)){let{message:e}=(0,a.Z7)("MISSING_OR_INVALID",`request() expiry: ${n}. Expiry must be a number (in seconds) between ${nN.min} and ${nN.max}`);throw Error(e)}},this.isValidRespond=async e=>{var t;if(!(0,a.EJ)(e)){let{message:t}=(0,a.Z7)("MISSING_OR_INVALID",`respond() params: ${e}`);throw Error(t)}let{topic:r,response:i}=e;try{await this.isValidSessionTopic(r)}catch(r){throw null!=(t=e?.response)&&t.id&&this.cleanupAfterResponse(e),r}if(!(0,a.JT)(i)){let{message:e}=(0,a.Z7)("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(i)}`);throw Error(e)}},this.isValidPing=async e=>{if(!(0,a.EJ)(e)){let{message:t}=(0,a.Z7)("MISSING_OR_INVALID",`ping() params: ${e}`);throw Error(t)}let{topic:t}=e;await this.isValidSessionOrPairingTopic(t)},this.isValidEmit=async e=>{if(!(0,a.EJ)(e)){let{message:t}=(0,a.Z7)("MISSING_OR_INVALID",`emit() params: ${e}`);throw Error(t)}let{topic:t,event:r,chainId:i}=e;await this.isValidSessionTopic(t);let{namespaces:n}=this.client.session.get(t);if(!(0,a.p8)(n,i)){let{message:e}=(0,a.Z7)("MISSING_OR_INVALID",`emit() chainId: ${i}`);throw Error(e)}if(!(0,a.nf)(r)){let{message:e}=(0,a.Z7)("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(r)}`);throw Error(e)}if(!(0,a.sI)(n,i,r.name)){let{message:e}=(0,a.Z7)("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(r)}`);throw Error(e)}},this.isValidDisconnect=async e=>{if(!(0,a.EJ)(e)){let{message:t}=(0,a.Z7)("MISSING_OR_INVALID",`disconnect() params: ${e}`);throw Error(t)}let{topic:t}=e;await this.isValidSessionOrPairingTopic(t)},this.getVerifyContext=async(e,t)=>{let r={verified:{verifyUrl:t.verifyUrl||iV,validation:"UNKNOWN",origin:t.url||""}};try{let i=await this.client.core.verify.resolve({attestationId:e,verifyUrl:t.verifyUrl});i&&(r.verified.origin=i.origin,r.verified.isScam=i.isScam,r.verified.validation=i.origin===new URL(t.url).origin?"VALID":"INVALID")}catch(e){this.client.logger.info(e)}return this.client.logger.info(`Verify context: ${JSON.stringify(r)}`),r},this.validateSessionProps=(e,t)=>{Object.values(e).forEach(e=>{if(!(0,a.M_)(e,!1)){let{message:r}=(0,a.Z7)("MISSING_OR_INVALID",`${t} must be in Record<string, string> format. Received: ${JSON.stringify(e)}`);throw Error(r)}})}}async isInitialized(){if(!this.initialized){let{message:e}=(0,a.Z7)("NOT_INITIALIZED",this.name);throw Error(e)}await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(iT.message,async e=>{let{topic:t,message:r}=e;if(this.ignoredPayloadTypes.includes(this.client.core.crypto.getPayloadType(r)))return;let i=await this.client.core.crypto.decode(t,r);try{(0,rP.isJsonRpcRequest)(i)?(this.client.core.history.set(t,i),this.onRelayEventRequest({topic:t,payload:i})):(0,rP.isJsonRpcResponse)(i)?(await this.client.core.history.resolve(i),await this.onRelayEventResponse({topic:t,payload:i}),this.client.core.history.delete(t,i.id)):this.onRelayEventUnknownPayload({topic:t,payload:i})}catch(e){this.client.logger.error(e)}})}registerExpirerEvents(){this.client.core.expirer.on(iB.expired,async e=>
1{let{topic:t,id:r}=(0,a.iP)(e.target);if(r&&this.client.pendingRequest.keys.includes(r))return await this.deletePendingSessionRequest(r,(0,a.Z7)("EXPIRED"),!0);t?this.client.session.keys.includes(t)&&(await this.deleteSession(t,!0),this.client.events.emit("session_expire",{topic:t})):r&&(await this.deleteProposal(r,!0),this.client.events.emit("proposal_expire",{id:r}))})}registerPairingEvents(){this.client.core.pairing.events.on(iU.create,e=>this.onPairingCreated(e))}isValidPairingTopic(e){if(!(0,a.M_)(e,!1)){let{message:t}=(0,a.Z7)("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw Error(t)}if(!this.client.core.pairing.pairings.keys.includes(e)){let{message:t}=(0,a.Z7)("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw Error(t)}if((0,a.Bw)(this.client.core.pairing.pairings.get(e).expiry)){let{message:t}=(0,a.Z7)("EXPIRED",`pairing topic: ${e}`);throw Error(t)}}async isValidSessionTopic(e){if(!(0,a.M_)(e,!1)){let{message:t}=(0,a.Z7)("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw Error(t)}if(!this.client.session.keys.includes(e)){let{message:t}=(0,a.Z7)("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw Error(t)}if((0,a.Bw)(this.client.session.get(e).expiry)){await this.deleteSession(e);let{message:t}=(0,a.Z7)("EXPIRED",`session topic: ${e}`);throw Error(t)}}async isValidSessionOrPairingTopic(e){if(this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if((0,a.M_)(e,!1)){let{message:t}=(0,a.Z7)("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw Error(t)}else{let{message:t}=(0,a.Z7)("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw Error(t)}}async isValidProposalId(e){if(!(0,a.Q0)(e)){let{message:t}=(0,a.Z7)("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw Error(t)}if(!this.client.proposal.keys.includes(e)){let{message:t}=(0,a.Z7)("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw Error(t)}if((0,a.Bw)(this.client.proposal.get(e).expiry)){await this.deleteProposal(e);let{message:t}=(0,a.Z7)("EXPIRED",`proposal id: ${e}`);throw Error(t)}}}class nV extends nu{constructor(e,t){super(e,t,"proposal",nP),this.core=e,this.logger=t}}class nK extends nu{constructor(e,t){super(e,t,"session",nP),this.core=e,this.logger=t}}class nF extends nu{constructor(e,t){super(e,t,"request",nP,e=>e.id),this.core=e,this.logger=t}}class nZ extends ef{constructor(e){super(e),this.protocol="wc",this.version=2,this.name=nS.name,this.events=new s.EventEmitter,this.on=(e,t)=>this.events.on(e,t),this.once=(e,t)=>this.events.once(e,t),this.off=(e,t)=>this.events.off(e,t),this.removeListener=(e,t)=>this.events.removeListener(e,t),this.removeAllListeners=e=>this.events.removeAllListeners(e),this.connect=async e=>{try{return await this.engine.connect(e)}catch(e){throw this.logger.error(e.message),e}},this.pair=async e=>{try{return await this.engine.pair(e)}catch(e){throw this.logger.error(e.message),e}},this.approve=async e=>{try{return await this.engine.approve(e)}catch(e){throw this.logger.error(e.message),e}},this.reject=async e=>{try{return await this.engine.reject(e)}catch(e){throw this.logger.error(e.message),e}},this.update=async e=>{try{return await this.engine.update(e)}catch(e){throw this.logger.error(e.message),e}},this.extend=async e=>{try{return await this.engine.extend(e)}catch(e){throw this.logger.error(e.message),e}},this.request=async e=>{try{return await this.engine.request(e)}catch(e){throw this.logger.error(e.message),e}},this.respond=async e=>{try{return await this.engine.respond(e)}catch(e){throw this.logger.error(e.message),e}},this.ping=async e=>{try{return await this.engine.ping(e)}catch(e){throw this.logger.error(e.message),e}},this.emit=async e=>{try{return await this.engine.emit(e)}catch(e){throw this.logger.error(e.message),e}},this.disconnect=async e=>{try{return await this.engine.disconnect(e)}catch(e){throw this.logger.error(e.message),e}},this.find=e=>{try{return this.engine.find(e)}catch(e){throw this.logger.error(e.message),e}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(e){throw this.logger.error(e.message),e}},this.name=e?.name||nS.name,this.metadata=e?.metadata||(0,a.D)();let t="u">typeof e?.logger&&"string"!=typeof e?.logger?e.logger:et(Y({level:e?.logger||nS.logger}));this.core=e?.core||new nI(e),this.logger=ee(t,this.name),this.session=new nK(this.core,this.logger),this.proposal=new nV(this.core,this.logger),this.pendingRequest=new nF(this.core,this.logger),this.engine=new nH(this)}static async init(e){let t=new nZ(e);return await t.initialize(),t}get context(){return X(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.engine.init(),this.core.verify.init({verifyUrl:this.metadata.verifyUrl}),this.logger.info("SignClient Initialization Success")}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}var nW=r(5071);
1class nJ extends rP.IJsonRpcProvider{constructor(e){super(e),this.events=new s.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async request(e,t){return this.requestStrict((0,rP.formatJsonRpcRequest)(e.method,e.params||[],e.id||(0,rP.getBigIntRpcId)().toString()),t)}async requestStrict(e,t){return new Promise(async(r,i)=>{if(!this.connection.connected)try{await this.open()}catch(e){i(e)}this.events.on(`${e.id}`,e=>{(0,rP.isJsonRpcError)(e)?i(e.error):r(e.result)});try{await this.connection.send(e,t)}catch(e){i(e)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),(0,rP.isJsonRpcResponse)(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&3e3===e.code&&this.events.emit("error",Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),"string"==typeof e&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}}let nG="error",nQ="wc@2:universal_provider:",nY="default_chain_changed";var nX="u">typeof globalThis?globalThis:"u">typeof window?window:"u">typeof r.g?r.g:"u">typeof self?self:{},n0={exports:{}};!function(e,t){(function(){var r,i="Expected a function",n="__lodash_hash_undefined__",s="__lodash_placeholder__",o=1/0,a=0/0,c=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],l="[object Arguments]",h="[object Array]",u="[object Boolean]",p="[object Date]",f="[object Error]",d="[object Function]",g="[object GeneratorFunction]",y="[object Map]",v="[object Number]",m="[object Object]",b="[object Promise]",w="[object RegExp]",_="[object Set]",E="[object String]",I="[object Symbol]",x="[object WeakMap]",P="[object ArrayBuffer]",S="[object DataView]",R="[object Float32Array]",O="[object Float64Array]",A="[object Int8Array]",C="[object Int16Array]",N="[object Int32Array]",q="[object Uint8Array]",j="[object Uint8ClampedArray]",T="[object Uint16Array]",z="[object Uint32Array]",D=/\b__p \+= '';/g,k=/\b(__p \+=) '' \+/g,L=/(__e\(.*?\)|\b__t\)) \+\n'';/g,$=/&(?:amp|lt|gt|quot|#39);/g,U=/[&<>"']/g,M=RegExp($.source),B=RegExp(U.source),H=/<%-([\s\S]+?)%>/g,V=/<%([\s\S]+?)%>/g,K=/<%=([\s\S]+?)%>/g,F=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Z=/^\w*$/,W=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,J=/[\\^$.*+?()[\]{}|]/g,G=RegExp(J.source),Q=/^\s+/,Y=/\s/,X=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ee=/\{\n\/\* \[wrapped with (.+)\] \*/,et=/,? & /,er=
1/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ei=/[()=,{}\[\]\/\s]/,en=/\\(\\)?/g,es=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,eo=/\w*$/,ea=/^[-+]0x[0-9a-f]+$/i,ec=/^0b[01]+$/i,el=/^\[object .+?Constructor\]$/,eh=/^0o[0-7]+$/i,eu=/^(?:0|[1-9]\d*)$/,ep=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ef=/($^)/,ed=/['\n\r\u2028\u2029\\]/g,eg="\ud800-\udfff",ey="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",ev="\\u2700-\\u27bf",em="a-z\\xdf-\\xf6\\xf8-\\xff",eb="A-Z\\xc0-\\xd6\\xd8-\\xde",ew="\\ufe0e\\ufe0f",e_="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",eE="['’]",eI="["+e_+"]",ex="["+ey+"]",eP="["+em+"]",eS="[^"+eg+e_+"\\d+"+ev+em+eb+"]",eR="\ud83c[\udffb-\udfff]",eO="[^"+eg+"]",eA="(?:\ud83c[\udde6-\uddff]){2}",eC="[\ud800-\udbff][\udc00-\udfff]",eN="["+eb+"]",eq="\\u200d",ej="(?:"+eP+"|"+eS+")",eT="(?:"+eE+"(?:d|ll|m|re|s|t|ve))?",ez="(?:"+eE+"(?:D|LL|M|RE|S|T|VE))?",eD="(?:"+ex+"|"+eR+")?",ek="["+ew+"]?",eL="(?:"+eq+"(?:"+[eO,eA,eC].join("|")+")"+ek+eD+")*",e$=ek+eD+eL,eU="(?:"+["["+ev+"]",eA,eC].join("|")+")"+e$,eM="(?:"+[eO+ex+"?",ex,eA,eC,"["+eg+"]"].join("|")+")",eB=RegExp(eE,"g"),eH=RegExp(ex,"g"),eV=RegExp(eR+"(?="+eR+")|"+eM+e$,"g"),eK=RegExp([eN+"?"+eP+"+"+eT+"(?="+[eI,eN,"$"].join("|")+")","(?:"+eN+"|"+eS+")+"+ez+"(?="+[eI,eN+ej,"$"].join("|")+")",eN+"?"+ej+"+"+eT,eN+"+"+ez,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])","\\d+",eU].join("|"),"g"),eF=RegExp("["+eq+eg+ey+ew+"]"),eZ=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,eW=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],eJ=-1,eG={};eG[R]=eG[O]=eG[A]=eG[C]=eG[N]=eG[q]=eG[j]=eG[T]=eG[z]=!0,eG[l]=eG[h]=eG[P]=eG[u]=eG[S]=eG[p]=eG[f]=eG[d]=eG[y]=eG[v]=eG[m]=eG[w]=eG[_]=eG[E]=eG[x]=!1;var eQ={};eQ[l]=eQ[h]=eQ[P]=eQ[S]=eQ[u]=eQ[p]=eQ[R]=eQ[O]=eQ[A]=eQ[C]=eQ[N]=eQ[y]=eQ[v]=eQ[m]=eQ[w]=eQ[_]=eQ[E]=eQ[I]=eQ[q]=eQ[j]=eQ[T]=eQ[z]=!0,eQ[f]=eQ[d]=eQ[x]=!1;var eY={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},eX=parseFloat,e0=parseInt,e1="object"==typeof nX&&nX&&nX.Object===Object&&nX,e2="object"==typeof self&&self&&self.Object===Object&&self,e3=e1||e2||Function("return this")(),e5=t&&!t.nodeType&&t,e8=e5&&e&&!e.nodeType&&e,e4=e8&&e8.exports===e5,e6=e4&&e1.process,e7=function(){try{return e8&&e8.require&&e8.require("util").types||e6&&e6.binding&&e6.binding("util")}catch{}}(),e9=e7&&e7.isArrayBuffer,te=e7&&e7.isDate,tt=e7&&e7.isMap,tr=e7&&e7.isRegExp,ti=e7&&e7.isSet,tn=e7&&e7.isTypedArray;function ts(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function to(e,t,r,i){for(var n=-1,s=null==e?0:e.length;++n<s;){var o=e[n];t(i,o,r(o),e)}return i}function ta(e,t){for(var r=-1,i=null==e?0:e.length;++r<i&&!1!==t(e[r],r,e););return e}function tc(e,t){for(var r=-1,i=null==e?0:e.length;++r<i;)if(!t(e[r],r,e))return!1;return!0}function tl(e,t){for(var r=-1,i=null==e?0:e.length,n=0,s=[];++r<i;){var o=e[r];t(o,r,e)&&(s[n++]=o)}return s}function th(e,t){return!!(null==e?0:e.length)&&tw(e,t,0)>-1}function tu(e,t,r){for(var i=-1,n=null==e?0:e.length;++i<n;)if(r(t,e[i]))return!0;return!1}function tp(e,t){for(var r=-1,i=null==e?0:e.length,n=Array(i);++r<i;)n[r]=t(e[r],r,e);return n}function tf(e,t){for(var r=-1,i=t.length,n=e.length;++r<i;)e[n+r]=t[r];return e}function td(e,t,r,i){var n=-1,s=null==e?0:e.length;for(i&&s&&(r=e[++n]);++n<s;)r=t(r,e[n],n,e);return r}function tg(e,t,r,i){var n=null==e?0:e.length;for(i&&n&&(r=e[--n]);n--;)r=t(r,e[n],n,e);return r}function ty(e,t){for(var r=-1,i=null==e?0:e.length;++r<i;)if(t(e[r],r,e))return!0;return!1}var tv=tx("length");function tm(e,t,r){var i;return r(e,function(e,r,n){if(t(e,r,n))return i=r,!1}),i}
vendor: 5,767 bytes, line 1
1function tb(e,t,r,i){for(var n=e.length,s=r+(i?1:-1);i?s--:++s<n;)if(t(e[s],s,e))return s;return -1}function tw(e,t,r){return t==t?function(e,t,r){for(var i=r-1,n=e.length;++i<n;)if(e[i]===t)return i;return -1}(e,t,r):tb(e,tE,r)}function t_(e,t,r,i){for(var n=r-1,s=e.length;++n<s;)if(i(e[n],t))return n;return -1}function tE(e){return e!=e}function tI(e,t){var r=null==e?0:e.length;return r?tR(e,t)/r:a}function tx(e){return function(t){return null==t?r:t[e]}}function tP(e){return function(t){return null==e?r:e[t]}}function tS(e,t,r,i,n){return n(e,function(e,n,s){r=i?(i=!1,e):t(r,e,n,s)}),r}function tR(e,t){for(var i,n=-1,s=e.length;++n<s;){var o=t(e[n]);o!==r&&(i=i===r?o:i+o)}return i}function tO(e,t){for(var r=-1,i=Array(e);++r<e;)i[r]=t(r);return i}function tA(e){return e&&e.slice(0,tK(e)+1).replace(Q,"")}function tC(e){return function(t){return e(t)}}function tN(e,t){return tp(t,function(t){return e[t]})}function tq(e,t){return e.has(t)}function tj(e,t){for(var r=-1,i=e.length;++r<i&&tw(t,e[r],0)>-1;);return r}function tT(e,t){for(var r=e.length;r--&&tw(t,e[r],0)>-1;);return r}var tz=tP({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tD=tP({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function tk(e){return"\\"+eY[e]}function tL(e){return eF.test(e)}function t$(e){var t=-1,r=Array(e.size);return e.forEach(function(e,i){r[++t]=[i,e]}),r}function tU(e,t){return function(r){return e(t(r))}}function tM(e,t){for(var r=-1,i=e.length,n=0,o=[];++r<i;){var a=e[r];(a===t||a===s)&&(e[r]=s,o[n++]=r)}return o}function tB(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}function tH(e){return tL(e)?function(e){for(var t=eV.lastIndex=0;eV.test(e);)++t;return t}(e):tv(e)}function tV(e){return tL(e)?e.match(eV)||[]:e.split("")}function tK(e){for(var t=e.length;t--&&Y.test(e.charAt(t)););return t}var tF=tP({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),tZ=function e(t){var Y,eg,ey,ev,em=(t=null==t?e3:tZ.defaults(e3.Object(),t,tZ.pick(e3,eW))).Array,eb=t.Date,ew=t.Error,e_=t.Function,eE=t.Math,eI=t.Object,ex=t.RegExp,eP=t.String,eS=t.TypeError,eR=em.prototype,eO=e_.prototype,eA=eI.prototype,eC=t["__core-js_shared__"],eN=eO.toString,eq=eA.hasOwnProperty,ej=0,eT=(Y=/[^.]+$/.exec(eC&&eC.keys&&eC.keys.IE_PROTO||""))?"Symbol(src)_1."+Y:"",ez=eA.toString,eD=eN.call(eI),ek=e3._,eL=ex("^"+eN.call(eq).replace(J,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),e$=e4?t.Buffer:r,eU=t.Symbol,eM=t.Uint8Array,eV=e$?e$.allocUnsafe:r,eF=tU(eI.getPrototypeOf,eI),eY=eI.create,e1=eA.propertyIsEnumerable,e2=eR.splice,e5=eU?eU.isConcatSpreadable:r,e8=eU?eU.iterator:r,e6=eU?eU.toStringTag:r,e7=function(){try{var e=nd(eI,"defineProperty");return e({},"",{}),e}catch{}}(),tv=t.clearTimeout!==e3.clearTimeout&&t.clearTimeout,tP=eb&&eb.now!==e3.Date.now&&eb.now,tW=t.setTimeout!==e3.setTimeout&&t.setTimeout,tJ=eE.ceil,tG=eE.floor,tQ=eI.getOwnPropertySymbols,tY=e$?e$.isBuffer:r,tX=t.isFinite,t0=eR.join,t1=tU(eI.keys,eI),t2=eE.max,t3=eE.min,t5=eb.now,t8=t.parseInt,t4=eE.random,t6=eR.reverse,t7=nd(t,"DataView"),t9=nd(t,"Map"),re=nd(t,"Promise"),rt=nd(t,"Set"),rr=nd(t,"WeakMap"),ri=nd(eI,"create"),rn=rr&&new rr,rs={},ro=n$(t7),ra=n$(t9),rc=n$(re),rl=n$(rt),rh=n$(rr),ru=eU?eU.prototype:r,rp=ru?ru.valueOf:r,rf=ru?ru.toString:r;function rd(e){if(sF(e)&&!sz(e)&&!(e instanceof rm)){if(e instanceof rv)return e;if(eq.call(e,"__wrapped__"))return nU(e)}return new rv(e)}var rg=function(){function e(){}return function(t){if(!sK(t))return{};if(eY)return eY(t);e.prototype=t;var i=new e;return e.prototype=r,i}}();function ry(){}function rv(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=r}function rm(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function rb(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}function rw(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}function r_(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}function rE(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new r_;++t<r;)this.add(e[t])}function rI(e){var t=this.__data__=new rw(e);this.size=t.size}function rx(e,t){var r=sz(e),i=!r&&sT(e),n=!r&&!i&&s$(e),s=!r&&!i&&!n&&s0(e),o=r||i||n||s,a=o?tO(e.length,eP):[],c=a.length;
1for(var l in e)(t||eq.call(e,l))&&!(o&&("length"==l||n&&("offset"==l||"parent"==l)||s&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||n_(l,c)))&&a.push(l);return a}function rP(e){var t=e.length;return t?e[ih(0,t-1)]:r}function rS(e,t,i){(i===r||sN(e[t],i))&&(i!==r||t in e)||rN(e,t,i)}function rR(e,t,i){var n=e[t];eq.call(e,t)&&sN(n,i)&&(i!==r||t in e)||rN(e,t,i)}function rO(e,t){for(var r=e.length;r--;)if(sN(e[r][0],t))return r;return -1}function rA(e,t,r,i){return rL(e,function(e,n,s){t(i,e,r(e),s)}),i}function rC(e,t){return e&&iH(t,op(t),e)}function rN(e,t,r){"__proto__"==t&&e7?e7(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function rq(e,t){for(var i=-1,n=t.length,s=em(n),o=null==e;++i<n;)s[i]=o?r:oa(e,t[i]);return s}function rj(e,t,i){return e==e&&(i!==r&&(e=e<=i?e:i),t!==r&&(e=e>=t?e:t)),e}function rT(e,t,i,n,s,o){var a,c=1&t,h=2&t,f=4&t;if(i&&(a=s?i(e,n,s,o):i(e)),a!==r)return a;if(!sK(e))return e;var b=sz(e);if(b){if(x=e.length,D=new e.constructor(x),x&&"string"==typeof e[0]&&eq.call(e,"index")&&(D.index=e.index,D.input=e.input),a=D,!c)return iB(e,a)}else{var x,D,k,L,$,U=nv(e),M=U==d||U==g;if(s$(e))return iD(e,c);if(U==m||U==l||M&&!s){if(a=h||M?{}:nb(e),!c)return h?(k=($=a)&&iH(e,of(e),$),iH(e,ny(e),k)):(L=rC(a,e),iH(e,ng(e),L))}else{if(!eQ[U])return s?e:{};a=function(e,t,r){var i,n,s=e.constructor;switch(t){case P:return ik(e);case u:case p:return new s(+e);case S:return i=r?ik(e.buffer):e.buffer,new e.constructor(i,e.byteOffset,e.byteLength);case R:case O:case A:case C:case N:case q:case j:case T:case z:return iL(e,r);case y:return new s;case v:case E:return new s(e);case w:return(n=new e.constructor(e.source,eo.exec(e))).lastIndex=e.lastIndex,n;case _:return new s;case I:return rp?eI(rp.call(e)):{}}}(e,U,c)}}o||(o=new rI);var B=o.get(e);if(B)return B;o.set(e,a),sQ(e)?e.forEach(function(r){a.add(rT(r,t,i,r,e,o))}):sZ(e)&&e.forEach(function(r,n){a.set(n,rT(r,t,i,n,e,o))});var H=f?h?na:no:h?of:op,V=b?r:H(e);return ta(V||e,function(r,n){V&&(r=e[n=r]),rR(a,n,rT(r,t,i,n,e,o))}),a}function rz(e,t,i){var n=i.length;if(null==e)return!n;for(e=eI(e);n--;){var s=i[n],o=t[s],a=e[s];if(a===r&&!(s in e)||!o(a))return!1}return!0}function rD(e,t,n){if("function"!=typeof e)throw new eS(i);return nq(function(){e.apply(r,n)},t)}function rk(e,t,r,i){var n=-1,s=th,o=!0,a=e.length,c=[],l=t.length;if(!a)return c;r&&(t=tp(t,tC(r))),i?(s=tu,o=!1):t.length>=200&&(s=tq,o=!1,t=new rE(t));e:for(;++n<a;){var h=e[n],u=null==r?h:r(h);if(h=i||0!==h?h:0,o&&u==u){for(var p=l;p--;)if(t[p]===u)continue e;c.push(h)}else s(t,u,i)||c.push(h)}return c}rd.templateSettings={escape:H,evaluate:V,interpolate:K,variable:"",imports:{_:rd}},rd.prototype=ry.prototype,rd.prototype.constructor=rd,rv.prototype=rg(ry.prototype),rv.prototype.constructor=rv,rm.prototype=rg(ry.prototype),rm.prototype.constructor=rm,rb.prototype.clear=function(){this.__data__=ri?ri(null):{},this.size=0},rb.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},rb.prototype.get=function(e){var t=this.__data__;if(ri){var i=t[e];return i===n?r:i}return eq.call(t,e)?t[e]:r},rb.prototype.has=function(e){var t=this.__data__;return ri?t[e]!==r:eq.call(t,e)},rb.prototype.set=function(e,t){var i=this.__data__;return this.size+=this.has(e)?0:1,i[e]=ri&&t===r?n:t,this},rw.prototype.clear=function(){this.__data__=[],this.size=0},rw.prototype.delete=function(e){var t=this.__data__,r=rO(t,e);return!(r<0)&&(r==t.length-1?t.pop():e2.call(t,r,1),--this.size,!0)},rw.prototype.get=function(e){var t=this.__data__,i=rO(t,e);return i<0?r:t[i][1]},rw.prototype.has=function(e){return rO(this.__data__,e)>-1},rw.prototype.set=function(e,t){var r=this.__data__,i=rO(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this},r_.prototype.clear=function(){this.size=0,this.__data__={hash:new rb,map:new(t9||rw),string:new rb}},r_.prototype.delete=function(e){var t=np(this,e).delete(e);return this.size-=t?1:0,t},r_.prototype.get=function(e){return np(this,e).get(e)},r_.prototype.has=function(e){return np(this,e).has(e)},r_.prototype.set=function(e,t){var r=np(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this},rE.prototype.add=rE.prototype.push=function(e){return this.__data__.set(e,n),this},rE.prototype.has=function(e){return this.__data__.has(e)},rI.prototype.clear=function(){this.__data__=new rw,this.size=0},rI.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},rI.prototype.get=function(e){return this.__data__.get(e)},rI.prototype.has=function(e){return this.__data__.has(e)},rI.prototype.set=function(e,t){var r=this.__data__;if(r instanceof rw){var i=r.__data__;if(!t9||i.length<199)return i.push([e,t]),this.size=++r.size,this;r=this.__data__=new r_(i)}return r.set(e,t),this.size=r.size,this};var rL=iF(rF),r$=iF(rZ,!0);function rU(e,t){var r=!0;return rL(e,function(e,i,n){return r=!!t(e,i,n)}),r}function rM(e,t,i){for(var n=-1,s=e.length;++n<s;){var o=e[n],a=t(o);if(null!=a&&(c===r?a==a&&!sX(a):i(a,c)))var c=a,l=o}return l}function rB(e,t){var r=[];return rL(e,function(e,i,n){t(e,i,n)&&r.push(e)}),r}function rH(e,t,r,i,n){var s=-1,o=e.length;for(r||(r=nw),n||(n=[]);++s<o;){var a=e[s];t>0&&r(a)?t>1?rH(a,t-1,r,i,n):tf(n,a):i||(n[n.length]=a)}return n}var rV=iZ(),rK=iZ(!0);function rF(e,t){return e&&rV(e,t,op)}function rZ(e,t){return e&&rK(e,t,op)}function rW(e,t){return tl(t,function(t){return sB(e[t])})}function rJ(e,t){t=ij(t,e);for(var i=0,n=t.length;null!=e&&i<n;)e=e[nL(t[i++])];return i&&i==n?e:r}function rG(e,t,r){var i=t(e);return sz(e)?i:tf(i,r(e))}
1function rQ(e){return null==e?e===r?"[object Undefined]":"[object Null]":e6&&e6 in eI(e)?function(e){var t=eq.call(e,e6),i=e[e6];try{e[e6]=r;var n=!0}catch{}var s=ez.call(e);return n&&(t?e[e6]=i:delete e[e6]),s}(e):ez.call(e)}function rY(e,t){return e>t}function rX(e,t){return null!=e&&eq.call(e,t)}function r0(e,t){return null!=e&&t in eI(e)}function r1(e,t,i){for(var n=i?tu:th,s=e[0].length,o=e.length,a=o,c=em(o),l=1/0,h=[];a--;){var u=e[a];a&&t&&(u=tp(u,tC(t))),l=t3(u.length,l),c[a]=!i&&(t||s>=120&&u.length>=120)?new rE(a&&u):r}u=e[0];var p=-1,f=c[0];e:for(;++p<s&&h.length<l;){var d=u[p],g=t?t(d):d;if(d=i||0!==d?d:0,!(f?tq(f,g):n(h,g,i))){for(a=o;--a;){var y=c[a];if(!(y?tq(y,g):n(e[a],g,i)))continue e}f&&f.push(g),h.push(d)}}return h}function r2(e,t,i){t=ij(t,e);var n=null==(e=nA(e,t))?e:e[nL(nQ(t))];return null==n?r:ts(n,e,i)}function r3(e){return sF(e)&&rQ(e)==l}function r5(e,t,i,n,s){return e===t||(null!=e&&null!=t&&(sF(e)||sF(t))?function(e,t,i,n,s,o){var a=sz(e),c=sz(t),d=a?h:nv(e),g=c?h:nv(t);d=d==l?m:d,g=g==l?m:g;var b=d==m,x=g==m,R=d==g;if(R&&s$(e)){if(!s$(t))return!1;a=!0,b=!1}if(R&&!b)return o||(o=new rI),a||s0(e)?nn(e,t,i,n,s,o):function(e,t,r,i,n,s,o){switch(r){case S:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)break;e=e.buffer,t=t.buffer;case P:return!(e.byteLength!=t.byteLength||!s(new eM(e),new eM(t)));case u:case p:case v:return sN(+e,+t);case f:return e.name==t.name&&e.message==t.message;case w:case E:return e==t+"";case y:var a=t$;case _:var c=1&i;if(a||(a=tB),e.size!=t.size&&!c)break;var l=o.get(e);if(l)return l==t;i|=2,o.set(e,t);var h=nn(a(e),a(t),i,n,s,o);return o.delete(e),h;case I:if(rp)return rp.call(e)==rp.call(t)}return!1}(e,t,d,i,n,s,o);if(!(1&i)){var O=b&&eq.call(e,"__wrapped__"),A=x&&eq.call(t,"__wrapped__");
vendor: 11,523 bytes, line 1
1if(O||A){var C=O?e.value():e,N=A?t.value():t;return o||(o=new rI),s(C,N,i,n,o)}}return!!R&&(o||(o=new rI),function(e,t,i,n,s,o){var a=1&i,c=no(e),l=c.length;if(l!=no(t).length&&!a)return!1;for(var h=l;h--;){var u=c[h];if(!(a?u in t:eq.call(t,u)))return!1}var p=o.get(e),f=o.get(t);if(p&&f)return p==t&&f==e;var d=!0;o.set(e,t),o.set(t,e);for(var g=a;++h<l;){var y=e[u=c[h]],v=t[u];if(n)var m=a?n(v,y,u,t,e,o):n(y,v,u,e,t,o);if(!(m===r?y===v||s(y,v,i,n,o):m)){d=!1;break}g||(g="constructor"==u)}if(d&&!g){var b=e.constructor,w=t.constructor;b!=w&&"constructor"in e&&"constructor"in t&&!("function"==typeof b&&b instanceof b&&"function"==typeof w&&w instanceof w)&&(d=!1)}return o.delete(e),o.delete(t),d}(e,t,i,n,s,o))}(e,t,i,n,r5,s):e!=e&&t!=t)}function r8(e,t,i,n){var s=i.length,o=s,a=!n;if(null==e)return!o;for(e=eI(e);s--;){var c=i[s];if(a&&c[2]?c[1]!==e[c[0]]:!(c[0]in e))return!1}for(;++s<o;){var l=(c=i[s])[0],h=e[l],u=c[1];if(a&&c[2]){if(h===r&&!(l in e))return!1}else{var p=new rI;if(n)var f=n(h,u,l,e,t,p);if(!(f===r?r5(u,h,3,n,p):f))return!1}}return!0}function r4(e){return!(!sK(e)||eT&&eT in e)&&(sB(e)?eL:el).test(n$(e))}function r6(e){return"function"==typeof e?e:null==e?oL:"object"==typeof e?sz(e)?ir(e[0],e[1]):it(e):oZ(e)}function r7(e){if(!nS(e))return t1(e);var t=[];for(var r in eI(e))eq.call(e,r)&&"constructor"!=r&&t.push(r);return t}function r9(e,t){return e<t}function ie(e,t){var r=-1,i=sk(e)?em(e.length):[];return rL(e,function(e,n,s){i[++r]=t(e,n,s)}),i}function it(e){var t=nf(e);return 1==t.length&&t[0][2]?nR(t[0][0],t[0][1]):function(r){return r===e||r8(r,e,t)}}function ir(e,t){var i;return nI(e)&&(i=t)==i&&!sK(i)?nR(nL(e),t):function(i){var n=oa(i,e);return n===r&&n===t?oc(i,e):r5(t,n,3)}}function ii(e,t,i,n,s){e!==t&&rV(t,function(o,a){if(s||(s=new rI),sK(o))!function(e,t,i,n,s,o,a){var c=nC(e,i),l=nC(t,i),h=a.get(l);if(h){rS(e,i,h);return}var u=o?o(c,l,i+"",e,t,a):r,p=u===r;if(p){var f=sz(l),d=!f&&s$(l),g=!f&&!d&&s0(l);u=l,f||d||g?sz(c)?u=c:sL(c)?u=iB(c):d?(p=!1,u=iD(l,!0)):g?(p=!1,u=iL(l,!0)):u=[]:sJ(l)||sT(l)?(u=c,sT(c)?u=s7(c):(!sK(c)||sB(c))&&(u=nb(l))):p=!1}p&&(a.set(l,u),s(u,l,n,o,a),a.delete(l)),rS(e,i,u)}(e,t,a,i,ii,n,s);else{var c=n?n(nC(e,a),o,a+"",e,t,s):r;c===r&&(c=o),rS(e,a,c)}},of)}function is(e,t){var i=e.length;if(i)return n_(t+=t<0?i:0,i)?e[t]:r}function io(e,t,r){t=t.length?tp(t,function(e){return sz(e)?function(t){return rJ(t,1===e.length?e[0]:e)}:e}):[oL];var i=-1;return t=tp(t,tC(nu())),function(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}(ie(e,function(e,r,n){return{criteria:tp(t,function(t){return t(e)}),index:++i,value:e}}),function(e,t){return function(e,t,r){for(var i=-1,n=e.criteria,s=t.criteria,o=n.length,a=r.length;++i<o;){var c=i$(n[i],s[i]);if(c){if(i>=a)return c;return c*("desc"==r[i]?-1:1)}}return e.index-t.index}(e,t,r)})}function ia(e,t,r){for(var i=-1,n=t.length,s={};++i<n;){var o=t[i],a=rJ(e,o);r(a,o)&&id(s,ij(o,e),a)}return s}function ic(e,t,r,i){var n=i?t_:tw,s=-1,o=t.length,a=e;for(e===t&&(t=iB(t)),r&&(a=tp(e,tC(r)));++s<o;)for(var c=0,l=t[s],h=r?r(l):l;(c=n(a,h,c,i))>-1;)a!==e&&e2.call(a,c,1),e2.call(e,c,1);return e}function il(e,t){for(var r=e?t.length:0,i=r-1;r--;){var n=t[r];if(r==i||n!==s){var s=n;n_(n)?e2.call(e,n,1):iP(e,n)}}return e}function ih(e,t){return e+tG(t4()*(t-e+1))}function iu(e,t){var r="";if(!e||t<1||t>9007199254740991)return r;do t%2&&(r+=e),(t=tG(t/2))&&(e+=e);while(t);return r}function ip(e,t){return nj(nO(e,t,oL),e+"")}function id(e,t,i,n){if(!sK(e))return e;t=ij(t,e);for(var s=-1,o=t.length,a=o-1,c=e;null!=c&&++s<o;){var l=nL(t[s]),h=i;if("__proto__"===l||"constructor"===l||"prototype"===l)break;if(s!=a){var u=c[l];(h=n?n(u,l,c):r)===r&&(h=sK(u)?u:n_(t[s+1])?[]:{})}rR(c,l,h),c=c[l]}return e}var ig=rn?function(e,t){return rn.set(e,t),e}:oL,iy=e7?function(e,t){return e7(e,"toString",{configurable:!0,enumerable:!1,value:oz(t),writable:!0})}:oL;function iv(e,t,r){var i=-1,n=e.length;t<0&&(t=-t>n?0:n+t),(r=r>n?n:r)<0&&(r+=n),n=t>r?0:r-t>>>0,t>>>=0;for(var s=em(n);++i<n;)s[i]=e[i+t];return s}function im(e,t){var r;return rL(e,function(e,i,n){return!(r=t(e,i,n))}),!!r}function ib(e,t,r){var i=0,n=null==e?i:e.length;if("number"==typeof t&&t==t&&n<=2147483647){for(;i<n;){var s=i+n>>>1,o=e[s];null!==o&&!sX(o)&&(r?o<=t:o<t)?i=s+1:n=s}return n}return iw(e,t,oL,r)}function iw(e,t,i,n){var s=0,o=null==e?0:e.length;if(0===o)return 0;t=i(t);for(var a=t!=t,c=null===t,l=sX(t),h=t===r;s<o;){var u=tG((s+o)/2),p=i(e[u]),f=p!==r,d=null===p,g=p==p,y=sX(p);if(a)var v=n||g;else v=h?g&&(n||f):c?g&&f&&(n||!d):l?g&&f&&!d&&(n||!y):!d&&!y&&(n?p<=t:p<t);v?s=u+1:o=u}return t3(o,4294967294)}function i_(e,t){for(var r=-1,i=e.length,n=0,s=[];++r<i;){var o=e[r],a=t?t(o):o;if(!r||!sN(a,c)){var c=a;s[n++]=0===o?0:o}}return s}function iE(e){return"number"==typeof e?e:sX(e)?a:+e}function iI(e){if("string"==typeof e)return e;if(sz(e))return tp(e,iI)+"";if(sX(e))return rf?rf.call(e):"";var t=e+"";return"0"==t&&1/e==-o?"-0":t}function ix(e,t,r){var i=-1,n=th,s=e.length,o=!0,a=[],c=a;if(r)o=!1,n=tu;else if(s>=200){var l=t?null:i7(e);if(l)return tB(l);o=!1,n=tq,c=new rE}else c=t?[]:a;e:for(;++i<s;){var h=e[i],u=t?t(h):h;if(h=r||0!==h?h:0,o&&u==u){for(var p=c.length;p--;)if(c[p]===u)continue e;t&&c.push(u),a.push(h)}else n(c,u,r)||(c!==a&&c.push(u),a.push(h))}return a}function iP(e,t){return t=ij(t,e),null==(e=nA(e,t))||delete e[nL(nQ(t))]}function iS(e,t,r,i){return id(e,t,r(rJ(e,t)),i)}function iR(e,t,r,i){for(var n=e.length,s=i?n:-1;(i?s--:++s<n)&&t(e[s],s,e););return r?iv(e,i?0:s,i?s+1:n):iv(e,i?s+1:0,i?n:s)}function iO(e,t){var r=e;return r instanceof rm&&(r=r.value()),td(t,function(e,t){return t.func.apply(t.thisArg,tf([e],t.args))},r)}function iA(e,t,r){var i=e.length;if(i<2)return i?ix(e[0]):[];for(var n=-1,s=em(i);++n<i;)for(var o=e[n],a=-1;++a<i;)a!=n&&(s[n]=rk(s[n]||o,e[a],t,r));return ix(rH(s,1),t,r)}function iC(e,t,i){for(var n=-1,s=e.length,o=t.length,a={};++n<s;){var c=n<o?t[n]:r;i(a,e[n],c)}return a}function iN(e){return sL(e)?e:[]}function iq(e){return"function"==typeof e?e:oL}function ij(e,t){return sz(e)?e:nI(e,t)?[e]:nk(s9(e))}function iT(e,t,i){var n=e.length;return i=i===r?n:i,!t&&i>=n?e:iv(e,t,i)}var iz=tv||function(e){return e3.clearTimeout(e)};function iD(e,t){if(t)return e.slice();var r=e.length,i=eV?eV(r):new e.constructor(r);return e.copy(i),i}function ik(e){var t=new e.constructor(e.byteLength);return new eM(t).set(new eM(e)),t}function iL(e,t){var r=t?ik(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function i$(e,t){if(e!==t){var i=e!==r,n=null===e,s=e==e,o=sX(e),a=t!==r,c=null===t,l=t==t,h=sX(t);if(!c&&!h&&!o&&e>t||o&&a&&l&&!c&&!h||n&&a&&l||!i&&l||!s)return 1;if(!n&&!o&&!h&&e<t||h&&i&&s&&!n&&!o||c&&i&&s||!a&&s||!l)return -1}return 0}function iU(e,t,r,i){for(var n=-1,s=e.length,o=r.length,a=-1,c=t.length,l=t2(s-o,0),h=em(c+l),u=!i;++a<c;)h[a]=t[a];for(;++n<o;)(u||n<s)&&(h[r[n]]=e[n]);for(;l--;)h[a++]=e[n++];return h}function iM(e,t,r,i){for(var n=-1,s=e.length,o=-1,a=r.length,c=-1,l=t.length,h=t2(s-a,0),u=em(h+l),p=!i;++n<h;)u[n]=e[n];for(var f=n;++c<l;)u[f+c]=t[c];for(;++o<a;)(p||n<s)&&(u[f+r[o]]=e[n++]);return u}function iB(e,t){var r=-1,i=e.length;for(t||(t=em(i));++r<i;)t[r]=e[r];return t}function iH(e,t,i,n){var s=!i;i||(i={});for(var o=-1,a=t.length;++o<a;){var c=t[o],l=n?n(i[c],e[c],c,i,e):r;l===r&&(l=e[c]),s?rN(i,c,l):rR(i,c,l)}return i}function iV(e,t){return function(r,i){var n=sz(r)?to:rA,s=t?t():{};return n(r,e,nu(i,2),s)}}function iK(e){return ip(function(t,i){var n=-1,s=i.length,o=s>1?i[s-1]:r,a=s>2?i[2]:r;for(o=e.length>3&&"function"==typeof o?(s--,o):r,a&&nE(i[0],i[1],a)&&(o=s<3?r:o,s=1),t=eI(t);++n<s;){var c=i[n];c&&e(t,c,n,o)}return t})}function iF(e,t){return function(r,i){if(null==r)return r;if(!sk(r))return e(r,i);for(var n=r.length,s=t?n:-1,o=eI(r);(t?s--:++s<n)&&!1!==i(o[s],s,o););return r}}function iZ(e){return function(t,r,i){for(var n=-1,s=eI(t),o=i(t),a=o.length;a--;){var c=o[e?a:++n];if(!1===r(s[c],c,s))break}return t}}function iW(e){return function(t){var i=tL(t=s9(t))?tV(t):r,n=i?i[0]:t.charAt(0),s=i?iT(i,1).join(""):t.slice(1);return n[e]()+s}}function iJ(e){return function(t){return td(oq(ox(t).replace(eB,"")),e,"")}}function iG(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var r=rg(e.prototype),i=e.apply(r,t);return sK(i)?i:r}}function iQ(e){return function(t,i,n){var s=eI(t);if(!sk(t)){var o=nu(i,3);t=op(t),i=function(e){return o(s[e],e,s)}}var a=e(t,i,n);return a>-1?s[o?t[a]:a]:r}}function iY(e){return ns(function(t){var n=t.length,s=n,o=rv.prototype.thru;for(e&&t.reverse();s--;){var a=t[s];if("function"!=typeof a)throw new eS(i);if(o&&!c&&"wrapper"==nl(a))var c=new rv([],!0)}for(s=c?s:n;++s<n;){var l=nl(a=t[s]),h="wrapper"==l?nc(a):r;c=h&&nx(h[0])&&424==h[1]&&!h[4].length&&1==h[9]?c[nl(h[0])].apply(c,h[3]):1==a.length&&nx(a)?c[l]():c.thru(a)}return function(){var e=arguments,r=e[0];if(c&&1==e.length&&sz(r))return c.plant(r).value();for(var i=0,s=n?t[i].apply(this,e):r;++i<n;)s=t[i].call(this,s);return s}})}function iX(e,t,i,n,s,o,a,c,l,h){var u=128&t,p=1&t,f=2&t,d=24&t,g=512&t,y=f?r:iG(e);return function v(){for(var m=arguments.length,b=em(m),w=m;w--;)b[w]=arguments[w];if(d)var _=nh(v),E=function(e,t){for(var r=e.length,i=0;r--;)e[r]===t&&++i;return i}(b,_);if(n&&(b=iU(b,n,s,d)),o&&(b=iM(b,o,a,d)),m-=E,d&&m<h){var I=tM(b,_);return i4(e,t,iX,v.placeholder,i,b,I,c,l,h-m)}var x=p?i:this,P=f?x[e]:e;return m=b.length,c?b=function(e,t){for(var i=e.length,n=t3(t.length,i),s=iB(e);n--;){var o=t[n];e[n]=n_(o,i)?s[o]:r}return e}(b,c):g&&m>1&&b.reverse(),u&&l<m&&(b.length=l),this&&this!==e3&&this instanceof v&&(P=y||iG(P)),P.apply(x,b)}}function i0(e,t){return function(r,i){var n,s;return n=t(i),s={},rF(r,function(t,r,i){e(s,n(t),r,i)}),s}}function i1(e,t){return function(i,n){var s;if(i===r&&n===r)return t;if(i!==r&&(s=i),n!==r){if(s===r)return n;"string"==typeof i||"string"==typeof n?(i=iI(i),n=iI(n)):(i=iE(i),n=iE(n)),s=e(i,n)}return s}}function i2(e){return ns(function(t){return t=tp(t,tC(nu())),ip(function(r){var i=this;return e(t,function(e){return ts(e,i,r)})})})}function i3(e,t){var i=(t=t===r?" ":iI(t)).length;if(i<2)return i?iu(t,e):t;var n=iu(t,tJ(e/tH(t)));return tL(t)?iT(tV(n),0,e).join(""):n.slice(0,e)}function i5(e){return function(t,i,n){return n&&"number"!=typeof n&&nE(t,i,n)&&(i=n=r),t=s5(t),i===r?(i=t,t=0):i=s5(i),n=n===r?t<i?1:-1:s5(n),function(e,t,r,i){for(var n=-1,s=t2(tJ((t-e)/(r||1)),0),o=em(s);s--;)o[i?s:++n]=e,e+=r;return o}(t,i,n,e)}}function i8(e){return function(t,r){return"string"==typeof t&&"string"==typeof r||(t=s6(t),r=s6(r)),e(t,r)}}function i4(e,t,i,n,s,o,a,c,l,h){var u=8&t,p=u?a:r,f=u?r:a,d=u?o:r,g=u?r:o;t|=u?32:64,4&(t&=~(u?64:32))||(t&=-4);var y=[e,t,s,d,p,g,f,c,l,h],v=i.apply(r,y);return nx(e)&&nN(v,y),v.placeholder=n,nT(v,e,t)}function i6(e){var t=eE[e];return function(e,r){if(e=s6(e),(r=null==r?0:t3(s8(r),292))&&tX(e)){var i=(s9(e)+"e").split("e");return+((i=(s9(t(i[0]+"e"+(+i[1]+r)))+"e").split("e"))[0]+"e"+(+i[1]-r))}return t(e)}}var i7=rt&&1/tB(new rt([,-0]))[1]==o?function(e){return new rt(e)}:oH;function i9(e){return function(t){var r,i,n=nv(t);return n==y?t$(t):n==_?(r=-1,i=Array(t.size),t.forEach(function(e){i[++r]=[e,e]}
1),i):tp(e(t),function(e){return[e,t[e]]})}}function ne(e,t,n,o,a,c,l,h){var u=2&t;if(!u&&"function"!=typeof e)throw new eS(i);var p=o?o.length:0;if(p||(t&=-97,o=a=r),l=l===r?l:t2(s8(l),0),h=h===r?h:s8(h),p-=a?a.length:0,64&t){var f=o,d=a;o=a=r}var g=u?r:nc(e),y=[e,t,n,o,a,f,d,c,l,h];if(g&&function(e,t){var r=e[1],i=t[1],n=r|i,o=n<131,a=128==i&&8==r||128==i&&256==r&&e[7].length<=t[8]||384==i&&t[7].length<=t[8]&&8==r;if(o||a){1&i&&(e[2]=t[2],n|=1&r?0:4);var c=t[3];if(c){var l=e[3];e[3]=l?iU(l,c,t[4]):c,e[4]=l?tM(e[3],s):t[4]}(c=t[5])&&(l=e[5],e[5]=l?iM(l,c,t[6]):c,e[6]=l?tM(e[5],s):t[6]),(c=t[7])&&(e[7]=c),128&i&&(e[8]=null==e[8]?t[8]:t3(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=n}}(y,g),e=y[0],t=y[1],n=y[2],o=y[3],a=y[4],(h=y[9]=y[9]===r?u?0:e.length:t2(y[9]-p,0))||!(24&t)||(t&=-25),t&&1!=t)8==t||16==t?(v=e,m=t,b=h,w=iG(v),q=function e(){for(var t=arguments.length,i=em(t),n=t,s=nh(e);n--;)i[n]=arguments[n];var o=t<3&&i[0]!==s&&i[t-1]!==s?[]:tM(i,s);return(t-=o.length)<b?i4(v,m,iX,e.placeholder,r,i,o,r,r,b-t):ts(this&&this!==e3&&this instanceof e?w:v,this,i)}):32!=t&&33!=t||a.length?q=iX.apply(r,y):(_=e,E=t,I=n,x=o,P=1&E,S=iG(_),q=function e(){for(var t=-1,r=arguments.length,i=-1,n=x.length,s=em(n+r),o=this&&this!==e3&&this instanceof e?S:_;++i<n;)s[i]=x[i];for(;r--;)s[i++]=arguments[++t];return ts(o,P?I:this,s)});else var v,m,b,w,_,E,I,x,P,S,R,O,A,C,N,q=(R=e,O=t,A=n,C=1&O,N=iG(R),function e(){return(this&&this!==e3&&this instanceof e?N:R).apply(C?A:this,arguments)});return nT((g?ig:nN)(q,y),e,t)}function nt(e,t,i,n){return e===r||sN(e,eA[i])&&!eq.call(n,i)?t:e}function nr(e,t,i,n,s,o){return sK(e)&&sK(t)&&(o.set(t,e),ii(e,t,r,nr,o),o.delete(t)),e}function ni(e){return sJ(e)?r:e}function nn(e,t,i,n,s,o){var a=1&i,c=e.length,l=t.length;if(c!=l&&!(a&&l>c))return!1;var h=o.get(e),u=o.get(t);if(h&&u)return h==t&&u==e;var p=-1,f=!0,d=2&i?new rE:r;for(o.set(e,t),o.set(t,e);++p<c;){var g=e[p],y=t[p];if(n)var v=a?n(y,g,p,t,e,o):n(g,y,p,e,t,o);if(v!==r){if(v)continue;f=!1;break}if(d){if(!ty(t,function(e,t){if(!tq(d,t)&&(g===e||s(g,e,i,n,o)))return d.push(t)})){f=!1;break}}else if(!(g===y||s(g,y,i,n,o))){f=!1;break}}return o.delete(e),o.delete(t),f}function ns(e){return nj(nO(e,r,nF),e+"")}function no(e){return rG(e,op,ng)}function na(e){return rG(e,of,ny)}var nc=rn?function(e){return rn.get(e)}:oH;function nl(e){for(var t=e.name+"",r=rs[t],i=eq.call(rs,t)?r.length:0;i--;){var n=r[i],s=n.func;if(null==s||s==e)return n.name}return t}function nh(e){return(eq.call(rd,"placeholder")?rd:e).placeholder}function nu(){var e=rd.iteratee||o$;return e=e===o$?r6:e,arguments.length?e(arguments[0],arguments[1]):e}function np(e,t){var r,i=e.__data__;return("string"==(r=typeof t)||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==t:null===t)?i["string"==typeof t?"string":"hash"]:i.map}function nf(e){for(var t=op(e),r=t.length;r--;){var i=t[r],n=e[i];t[r]=[i,n,n==n&&!sK(n)]}return t}function nd(e,t){var i=null==e?r:e[t];return r4(i)?i:r}var ng=tQ?function(e){return null==e?[]:tl(tQ(e=eI(e)),function(t){return e1.call(e,t)})}:oG,ny=tQ?function(e){for(var t=[];e;)tf(t,ng(e)),e=eF(e);return t}:oG,nv=rQ;function nm(e,t,r){t=ij(t,e);for(var i=-1,n=t.length,s=!1;++i<n;){var o=nL(t[i]);if(!(s=null!=e&&r(e,o)))break;e=e[o]}return s||++i!=n?s:!!(n=null==e?0:e.length)&&sV(n)&&n_(o,n)&&(sz(e)||sT(e))}function nb(e){return"function"!=typeof e.constructor||nS(e)?{}:rg(eF(e))}function nw(e){return sz(e)||sT(e)||!!(e5&&e&&e[e5])}function n_(e,t){var r=typeof e;return!!(t=t??9007199254740991)&&("number"==r||"symbol"!=r&&eu.test(e))&&e>-1&&e%1==0&&e<t}function nE(e,t,r){if(!sK(r))return!1;var i=typeof t;return("number"==i?!!(sk(r)&&n_(t,r.length)):"string"==i&&t in r)&&sN(r[t],e)}function nI(e,t){if(sz(e))return!1;var r=typeof e;return!!("number"==r||"symbol"==r||"boolean"==r||null==e||sX(e))||Z.test(e)||!F.test(e)||null!=t&&e in eI(t)}function nx(e){var t=nl(e),r=rd[t];if("function"!=typeof r||!(t in rm.prototype))return!1;if(e===r)return!0;var i=nc(r);return!!i&&e===i[0]}(t7&&nv(new t7(new ArrayBuffer(1)))!=S||t9&&nv(new t9)!=y||re&&nv(re.resolve())!=b||rt&&nv(new rt)!=_||rr&&nv(new rr)!=x)&&(nv=function(e){var t=rQ(e),i=t==m?e.constructor:r,n=i?n$(i):"";if(n)switch(n){case ro:return S;case ra:return y;case rc:return b;case rl:return _;case rh:return x}return t});var nP=eC?sB:oQ;function nS(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||eA)}function nR(e,t){return function(i){return null!=i&&i[e]===t&&(t!==r||e in eI(i))}}function nO(e,t,i){return t=t2(t===r?e.length-1:t,0),function(){for(var r=arguments,n=-1,s=t2(r.length-t,0),o=em(s);++n<s;)o[n]=r[t+n];n=-1;for(var a=em(t+1);++n<t;)a[n]=r[n];return a[t]=i(o),ts(e,this,a)}}function nA(e,t){return t.length<2?e:rJ(e,iv(t,0,-1))}function nC(e,t){if(!("constructor"===t&&"function"==typeof e[t])&&"__proto__"!=t)return e[t]}var nN=nz(ig),nq=tW||function(e,t){return e3.setTimeout(e,t)},nj=nz(iy);function nT(e,t,r){var i,n,s=t+"";return nj(e,function(e,t){var r=t.length;if(!r)return e;var i=r-1;return t[i]=(r>1?"& ":"")+t[i],t=t.join(r>2?", ":" "),e.replace(X,`{
2/* [wrapped with `+t+`] */
3`)}(s,(i=(n=s.match(ee))?n[1].split(et):[],ta(c,function(e){var t="_."+e[0];r&e[1]&&!th(i,t)&&i.push(t)}),i.sort())))}function nz(e){var t=0,i=0;return function(){var n=t5(),s=16-(n-i);if(i=n,s>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(r,arguments)}}function nD(e,t){var i=-1,n=e.length,s=n-1;for(t=t===r?n:t;++i<t;){var o=ih(i,s),a=e[o];e[o]=e[i],e[i]=a}return e.length=t,e}var nk=(ey=(eg=sP(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(W,function(e,r,i,n){t.push(i?n.replace(en,"$1"):r||e)}),t},function(e){return 500===ey.size&&ey.clear(),e})).cache,eg);function nL(e){if("string"==typeof e||sX(e))return e;var t=e+"";return"0"==t&&1/e==-o?"-0":t}function n$(e){if(null!=e){try{return eN.call(e)}catch{}try{return e+""}catch{}}return""}function nU(e){if(e instanceof rm)return e.clone();var t=new rv(e.__wrapped__,e.__chain__);return t.__actions__=iB(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}
vendor: 7,421 bytes, line 3
3var nM=ip(function(e,t){return sL(e)?rk(e,rH(t,1,sL,!0)):[]}),nB=ip(function(e,t){var i=nQ(t);return sL(i)&&(i=r),sL(e)?rk(e,rH(t,1,sL,!0),nu(i,2)):[]}),nH=ip(function(e,t){var i=nQ(t);return sL(i)&&(i=r),sL(e)?rk(e,rH(t,1,sL,!0),r,i):[]});function nV(e,t,r){var i=null==e?0:e.length;if(!i)return -1;var n=null==r?0:s8(r);return n<0&&(n=t2(i+n,0)),tb(e,nu(t,3),n)}function nK(e,t,i){var n=null==e?0:e.length;if(!n)return -1;var s=n-1;return i!==r&&(s=s8(i),s=i<0?t2(n+s,0):t3(s,n-1)),tb(e,nu(t,3),s,!0)}function nF(e){return(null==e?0:e.length)?rH(e,1):[]}function nZ(e){return e&&e.length?e[0]:r}var nW=ip(function(e){var t=tp(e,iN);return t.length&&t[0]===e[0]?r1(t):[]}),nJ=ip(function(e){var t=nQ(e),i=tp(e,iN);return t===nQ(i)?t=r:i.pop(),i.length&&i[0]===e[0]?r1(i,nu(t,2)):[]}),nG=ip(function(e){var t=nQ(e),i=tp(e,iN);return(t="function"==typeof t?t:r)&&i.pop(),i.length&&i[0]===e[0]?r1(i,r,t):[]});function nQ(e){var t=null==e?0:e.length;return t?e[t-1]:r}var nY=ip(nX);function nX(e,t){return e&&e.length&&t&&t.length?ic(e,t):e}var n0=ns(function(e,t){var r=null==e?0:e.length,i=rq(e,t);return il(e,tp(t,function(e){return n_(e,r)?+e:e}).sort(i$)),i});function n1(e){return null==e?e:t6.call(e)}var n2=ip(function(e){return ix(rH(e,1,sL,!0))}),n3=ip(function(e){var t=nQ(e);return sL(t)&&(t=r),ix(rH(e,1,sL,!0),nu(t,2))}),n5=ip(function(e){var t=nQ(e);return t="function"==typeof t?t:r,ix(rH(e,1,sL,!0),r,t)});function n8(e){if(!(e&&e.length))return[];var t=0;return e=tl(e,function(e){if(sL(e))return t=t2(e.length,t),!0}),tO(t,function(t){return tp(e,tx(t))})}function n4(e,t){if(!(e&&e.length))return[];var i=n8(e);return null==t?i:tp(i,function(e){return ts(t,r,e)})}var n6=ip(function(e,t){return sL(e)?rk(e,t):[]}),n7=ip(function(e){return iA(tl(e,sL))}),n9=ip(function(e){var t=nQ(e);return sL(t)&&(t=r),iA(tl(e,sL),nu(t,2))}),se=ip(function(e){var t=nQ(e);return t="function"==typeof t?t:r,iA(tl(e,sL),r,t)}),st=ip(n8),sr=ip(function(e){var t=e.length,i=t>1?e[t-1]:r;return i="function"==typeof i?(e.pop(),i):r,n4(e,i)});function si(e){var t=rd(e);return t.__chain__=!0,t}function sn(e,t){return t(e)}var ss=ns(function(e){var t=e.length,i=t?e[0]:0,n=this.__wrapped__,s=function(t){return rq(t,e)};return!(t>1)&&!this.__actions__.length&&n instanceof rm&&n_(i)?((n=n.slice(i,+i+(t?1:0))).__actions__.push({func:sn,args:[s],thisArg:r}),new rv(n,this.__chain__).thru(function(e){return t&&!e.length&&e.push(r),e})):this.thru(s)}),so=iV(function(e,t,r){eq.call(e,r)?++e[r]:rN(e,r,1)}),sa=iQ(nV),sc=iQ(nK);function sl(e,t){return(sz(e)?ta:rL)(e,nu(t,3))}function sh(e,t){return(sz(e)?function(e,t){for(var r=null==e?0:e.length;r--&&!1!==t(e[r],r,e););return e}:r$)(e,nu(t,3))}var su=iV(function(e,t,r){eq.call(e,r)?e[r].push(t):rN(e,r,[t])}),sp=ip(function(e,t,r){var i=-1,n="function"==typeof t,s=sk(e)?em(e.length):[];return rL(e,function(e){s[++i]=n?ts(t,e,r):r2(e,t,r)}),s}),sf=iV(function(e,t,r){rN(e,r,t)});function sd(e,t){return(sz(e)?tp:ie)(e,nu(t,3))}var sg=iV(function(e,t,r){e[r?0:1].push(t)},function(){return[[],[]]}),sy=ip(function(e,t){if(null==e)return[];var r=t.length;return r>1&&nE(e,t[0],t[1])?t=[]:r>2&&nE(t[0],t[1],t[2])&&(t=[t[0]]),io(e,rH(t,1),[])}),sv=tP||function(){return e3.Date.now()};function sm(e,t,i){return t=i?r:t,t=e&&null==t?e.length:t,ne(e,128,r,r,r,r,t)}function sb(e,t){var n;if("function"!=typeof t)throw new eS(i);return e=s8(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=r),n}}var sw=ip(function(e,t,r){var i=1;if(r.length){var n=tM(r,nh(sw));i|=32}return ne(e,i,t,r,n)}),s_=ip(function(e,t,r){var i=3;if(r.length){var n=tM(r,nh(s_));i|=32}return ne(t,i,e,r,n)});function sE(e,t,n){var s,o,a,c,l,h,u=0,p=!1,f=!1,d=!0;if("function"!=typeof e)throw new eS(i);function g(t){var i=s,n=o;return s=o=r,u=t,c=e.apply(n,i)}function y(e){var i=e-h,n=e-u;return h===r||i>=t||i<0||f&&n>=a}function v(){var e,r,i,n=sv();if(y(n))return m(n);l=nq(v,(e=n-h,r=n-u,i=t-e,f?t3(i,a-r):i))}function m(e){return l=r,d&&s?g(e):(s=o=r,c)}function b(){var e,i=sv(),n=y(i);if(s=arguments,o=this,h=i,n){if(l===r)return u=e=h,l=nq(v,t),p?g(e):c;if(f)return iz(l),l=nq(v,t),g(h)}return l===r&&(l=nq(v,t)),c}return t=s6(t)||0,sK(n)&&(p=!!n.leading,a=(f="maxWait"in n)?t2(s6(n.maxWait)||0,t):a,d="trailing"in n?!!n.trailing:d),b.cancel=function(){l!==r&&iz(l),u=0,s=h=o=l=r},b.flush=function(){return l===r?c:m(sv())},b}var sI=ip(function(e,t){return rD(e,1,t)}),sx=ip(function(e,t,r){return rD(e,s6(t)||0,r)});function sP(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new eS(i);var r=function(){var i=arguments,n=t?t.apply(this,i):i[0],s=r.cache;if(s.has(n))return s.get(n);var o=e.apply(this,i);return r.cache=s.set(n,o)||s,o};return r.cache=new(sP.Cache||r_),r}function sS(e){if("function"!=typeof e)throw new eS(i);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}sP.Cache=r_;var sR=ip(function(e,t){var r=(t=1==t.length&&sz(t[0])?tp(t[0],tC(nu())):tp(rH(t,1),tC(nu()))).length;return ip(function(i){for(var n=-1,s=t3(i.length,r);++n<s;)i[n]=t[n].call(this,i[n]);return ts(e,this,i)})}),sO=ip(function(e,t){var i=tM(t,nh(sO));return ne(e,32,r,t,i)}),sA=ip(function(e,t){var i=tM(t,nh(sA));return ne(e,64,r,t,i)}),sC=ns(function(e,t){return ne(e,256,r,r,r,t)});function sN(e,t){return e===t||e!=e&&t!=t}var sq=i8(rY),sj=i8(function(e,t){return e>=t}),sT=r3(function(){return arguments}())?r3:function(e){return sF(e)&&eq.call(e,"callee")&&!e1.call(e,"callee")},sz=em.isArray,sD=e9?tC(e9):function(e){return sF(e)&&rQ(e)==P};function sk(e){return null!=e&&sV(e.length)&&!sB(e)}function sL(e){return sF(e)&&sk(e)}var s$=tY||oQ,sU=te?tC(te):function(e){return sF(e)&&rQ(e)==p};function sM(e){if(!sF(e))return!1;var t=rQ(e);return t==f||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!sJ(e)}function sB(e){if(!sK(e))return!1;var t=rQ(e);return t==d||t==g||"[object AsyncFunction]"==t||"[object Proxy]"==t}function sH(e){return"number"==typeof e&&e==s8(e)}function sV(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function sK(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function sF(e){return null!=e&&"object"==typeof e}var sZ=tt?tC(tt):function(e){return sF(e)&&nv(e)==y};function sW(e){return"number"==typeof e||sF(e)&&rQ(e)==v}function sJ(e){if(!sF(e)||rQ(e)!=m)return!1;var t=eF(e);if(null===t)return!0;var r=eq.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&eN.call(r)==eD}var sG=tr?tC(tr):function(e){return sF(e)&&rQ(e)==w},sQ=ti?tC(ti):function(e){return sF(e)&&nv(e)==_};function sY(e){return"string"==typeof e||!sz(e)&&sF(e)&&rQ(e)==E}function sX(e){return"symbol"==typeof e||sF(e)&&rQ(e)==I}var s0=tn?tC(tn):function(e){return sF(e)&&sV(e.length)&&!!eG[rQ(e)]},s1=i8(r9),s2=i8(function(e,t){return e<=t});function s3(e){if(!e)return[];if(sk(e))return sY(e)?tV(e):iB(e);if(e8&&e[e8])return function(e){for(var t,r=[];!(t=e.next()).done;)r.push(t.value);return r}(e[e8]());var t=nv(e);return(t==y?t$:t==_?tB:o_)(e)}function s5(e){return e?(e=s6(e))===o||e===-o?(e<0?-1:1)*17976931348623157e292:e==e?e:0:0===e?e:0}function s8(e){var t=s5(e),r=t%1;return t==t?r?t-r:t:0}function s4(e){return e?rj(s8(e),0,4294967295):0}function s6(e){if("number"==typeof e)return e;if(sX(e))return a;
3if(sK(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=sK(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=tA(e);var r=ec.test(e);return r||eh.test(e)?e0(e.slice(2),r?2:8):ea.test(e)?a:+e}function s7(e){return iH(e,of(e))}function s9(e){return null==e?"":iI(e)}var oe=iK(function(e,t){if(nS(t)||sk(t)){iH(t,op(t),e);return}for(var r in t)eq.call(t,r)&&rR(e,r,t[r])}),ot=iK(function(e,t){iH(t,of(t),e)}),or=iK(function(e,t,r,i){iH(t,of(t),e,i)}),oi=iK(function(e,t,r,i){iH(t,op(t),e,i)}),on=ns(rq),os=ip(function(e,t){e=eI(e);var i=-1,n=t.length,s=n>2?t[2]:r;for(s&&nE(t[0],t[1],s)&&(n=1);++i<n;)for(var o=t[i],a=of(o),c=-1,l=a.length;++c<l;){var h=a[c],u=e[h];(u===r||sN(u,eA[h])&&!eq.call(e,h))&&(e[h]=o[h])}return e}),oo=ip(function(e){return e.push(r,nr),ts(og,r,e)});function oa(e,t,i){var n=null==e?r:rJ(e,t);return n===r?i:n}function oc(e,t){return null!=e&&nm(e,t,r0)}var ol=i0(function(e,t,r){null!=t&&"function"!=typeof t.toString&&(t=ez.call(t)),e[t]=r},oz(oL)),oh=i0(function(e,t,r){null!=t&&"function"!=typeof t.toString&&(t=ez.call(t)),eq.call(e,t)?e[t].push(r):e[t]=[r]},nu),ou=ip(r2);function op(e){return sk(e)?rx(e):r7(e)}function of(e){return sk(e)?rx(e,!0):function(e){if(!sK(e))return function(e){var t=[];if(null!=e)for(var r in eI(e))t.push(r);return t}(e);var t=nS(e),r=[];for(var i in e)"constructor"==i&&(t||!eq.call(e,i))||r.push(i);return r}(e)}var od=iK(function(e,t,r){ii(e,t,r)}),og=iK(function(e,t,r,i){ii(e,t,r,i)}),oy=ns(function(e,t){var r={};if(null==e)return r;var i=!1;t=tp(t,function(t){return t=ij(t,e),i||(i=t.length>1),t}),iH(e,na(e),r),i&&(r=rT(r,7,ni));for(var n=t.length;n--;)iP(r,t[n]);return r}),ov=ns(function(e,t){return null==e?{}:ia(e,t,function(t,r){return oc(e,r)})});function om(e,t){if(null==e)return{};var r=tp(na(e),function(e){return[e]});return t=nu(t),ia(e,r,function(e,r){return t(e,r[0])})}var ob=i9(op),ow=i9(of);function o_(e){return null==e?[]:tN(e,op(e))}var oE=iJ(function(e,t,r){return t=t.toLowerCase(),e+(r?oI(t):t)});function oI(e){return oN(s9(e).toLowerCase())}function ox(e){return(e=s9(e))&&e.replace(ep,tz).replace(eH,"")}var oP=iJ(function(e,t,r){return e+(r?"-":"")+t.toLowerCase()}),oS=iJ(function(e,t,r){return e+(r?" ":"")+t.toLowerCase()}),oR=iW("toLowerCase"),oO=iJ(function(e,t,r){return e+(r?"_":"")+t.toLowerCase()}),oA=iJ(function(e,t,r){return e+(r?" ":"")+oN(t)}),oC=iJ(function(e,t,r){return e+(r?" ":"")+t.toUpperCase()}),oN=iW("toUpperCase");function oq(e,t,i){var n;return e=s9(e),(t=i?r:t)===r?(n=e,eZ.test(n))?e.match(eK)||[]:e.match(er)||[]:e.match(t)||[]}var oj=ip(function(e,t){try{return ts(e,r,t)}catch(e){return sM(e)?e:new ew(e)}}),oT=ns(function(e,t){return ta(t,function(t){rN(e,t=nL(t),sw(e[t],e))}),e});function oz(e){return function(){return e}}var oD=iY(),ok=iY(!0);function oL(e){return e}function o$(e){return r6("function"==typeof e?e:rT(e,1))}var oU=ip(function(e,t){return function(r){return r2(r,e,t)}}),oM=ip(function(e,t){return function(r){return r2(e,r,t)}});function oB(e,t,r){var i=op(t),n=rW(t,i);null!=r||sK(t)&&(n.length||!i.length)||(r=t,t=e,e=this,n=rW(t,op(t)));var s=!(sK(r)&&"chain"in r)||!!r.chain,o=sB(e);return ta(n,function(r){var i=t[r];e[r]=i,o&&(e.prototype[r]=function(){var t=this.__chain__;if(s||t){var r=e(this.__wrapped__);return(r.__actions__=iB(this.__actions__)).push({func:i,args:arguments,thisArg:e}),r.__chain__=t,r}return i.apply(e,tf([this.value()],arguments))})}),e}function oH(){}var oV=i2(tp),oK=i2(tc),oF=i2(ty);function oZ(e){return nI(e)?tx(nL(e)):function(t){return rJ(t,e)}}var oW=i5(),oJ=i5(!0);function oG(){return[]}function oQ(){return!1}var oY=i1(function(e,t){return e+t},0),oX=i6("ceil"),o0=i1(function(e,t){return e/t},1),o1=i6("floor"),o2=i1(function(e,t){return e*t},1),o3=i6("round"),o5=i1(function(e,t){return e-t},0);return rd.after=function(e,t){if("function"!=typeof t)throw new eS(i);return e=s8(e),function(){if(--e<1)return t.apply(this,arguments)}},rd.ary=sm,rd.assign=oe,rd.assignIn=ot,rd.assignInWith=or,rd.assignWith=oi,rd.at=on,rd.before=sb,rd.bind=sw,rd.bindAll=oT,rd.bindKey=s_,rd.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return sz(e)?e:[e]},rd.chain=si,rd.chunk=function(e,t,i){t=(i?nE(e,t,i):t===r)?1:t2(s8(t),
30);var n=null==e?0:e.length;if(!n||t<1)return[];for(var s=0,o=0,a=em(tJ(n/t));s<n;)a[o++]=iv(e,s,s+=t);return a},rd.compact=function(e){for(var t=-1,r=null==e?0:e.length,i=0,n=[];++t<r;){var s=e[t];s&&(n[i++]=s)}return n},rd.concat=function(){var e=arguments.length;if(!e)return[];for(var t=em(e-1),r=arguments[0],i=e;i--;)t[i-1]=arguments[i];return tf(sz(r)?iB(r):[r],rH(t,1))},rd.cond=function(e){var t=null==e?0:e.length,r=nu();return e=t?tp(e,function(e){if("function"!=typeof e[1])throw new eS(i);return[r(e[0]),e[1]]}):[],ip(function(r){for(var i=-1;++i<t;){var n=e[i];if(ts(n[0],this,r))return ts(n[1],this,r)}})},rd.conforms=function(e){var t,r;return r=op(t=rT(e,1)),function(e){return rz(e,t,r)}},rd.constant=oz,rd.countBy=so,rd.create=function(e,t){var r=rg(e);return null==t?r:rC(r,t)},rd.curry=function e(t,i,n){i=n?r:i;var s=ne(t,8,r,r,r,r,r,i);return s.placeholder=e.placeholder,s},rd.curryRight=function e(t,i,n){i=n?r:i;var s=ne(t,16,r,r,r,r,r,i);return s.placeholder=e.placeholder,s},rd.debounce=sE,rd.defaults=os,rd.defaultsDeep=oo,rd.defer=sI,rd.delay=sx,rd.difference=nM,rd.differenceBy=nB,rd.differenceWith=nH,rd.drop=function(e,t,i){var n=null==e?0:e.length;return n?iv(e,(t=i||t===r?1:s8(t))<0?0:t,n):[]},rd.dropRight=function(e,t,i){var n=null==e?0:e.length;return n?iv(e,0,(t=n-(t=i||t===r?1:s8(t)))<0?0:t):[]},rd.dropRightWhile=function(e,t){return e&&e.length?iR(e,nu(t,3),!0,!0):[]},rd.dropWhile=function(e,t){return e&&e.length?iR(e,nu(t,3),!0):[]},rd.fill=function(e,t,i,n){var s=null==e?0:e.length;return s?(i&&"number"!=typeof i&&nE(e,t,i)&&(i=0,n=s),function(e,t,i,n){var s=e.length;for((i=s8(i))<0&&(i=-i>s?0:s+i),(n=n===r||n>s?s:s8(n))<0&&(n+=s),n=i>n?0:s4(n);i<n;)e[i++]=t;return e}(e,t,i,n)):[]},rd.filter=function(e,t){return(sz(e)?tl:rB)(e,nu(t,3))},rd.flatMap=function(e,t){return rH(sd(e,t),1)},rd.flatMapDeep=function(e,t){return rH(sd(e,t),o)},rd.flatMapDepth=function(e,t,i){return i=i===r?1:s8(i),rH(sd(e,t),i)},rd.flatten=nF,rd.flattenDeep=function(e){return(null==e?0:e.length)?rH(e,o):[]},rd.flattenDepth=function(e,t){return(null==e?0:e.length)?rH(e,t=t===r?1:s8(t)):[]},rd.flip=function(e){return ne(e,512)},rd.flow=oD,rd.flowRight=ok,rd.fromPairs=function(e){for(var t=-1,r=null==e?0:e.length,i={};++t<r;){var n=e[t];i[n[0]]=n[1]}return i},rd.functions=function(e){return null==e?[]:rW(e,op(e))},rd.functionsIn=function(e){return null==e?[]:rW(e,of(e))},rd.groupBy=su,rd.initial=function(e){return(null==e?0:e.length)?iv(e,0,-1):[]},rd.intersection=nW,rd.intersectionBy=nJ,rd.intersectionWith=nG,rd.invert=ol,rd.invertBy=oh,rd.invokeMap=sp,rd.iteratee=o$,rd.keyBy=sf,rd.keys=op,rd.keysIn=of,rd.map=sd,rd.mapKeys=function(e,t){var r={};return t=nu(t,3),rF(e,function(e,i,n){rN(r,t(e,i,n),e)}),r},rd.mapValues=function(e,t){var r={};return t=nu(t,3),rF(e,function(e,i,n){rN(r,i,t(e,i,n))}),r},rd.matches=function(e){return it(rT(e,1))},rd.matchesProperty=function(e,t){return ir(e,rT(t,1))},rd.memoize=sP,rd.merge=od,rd.mergeWith=og,rd.method=oU,rd.methodOf=oM,rd.mixin=oB,rd.negate=sS,rd.nthArg=function(e){return e=s8(e),ip(function(t){return is(t,e)})},rd.omit=oy,rd.omitBy=function(e,t){return om(e,sS(nu(t)))},rd.once=function(e){return sb(2,e)},rd.orderBy=function(e,t,i,n){return null==e?[]:(sz(t)||(t=null==t?[]:[t]),sz(i=n?r:i)||(i=null==i?[]:[i]),io(e,t,i))},rd.over=oV,rd.overArgs=sR,rd.overEvery=oK,rd.overSome=oF,rd.partial=sO,rd.partialRight=sA,rd.partition=sg,rd.pick=ov,rd.pickBy=om,rd.property=oZ,rd.propertyOf=function(e){return function(t){return null==e?r:rJ(e,t)}},rd.pull=nY,rd.pullAll=nX,rd.pullAllBy=function(e,t,r){return e&&e.length&&t&&t.length?ic(e,t,nu(r,2)):e},rd.pullAllWith=function(e,t,i){return e&&e.length&&t&&t.length?ic(e,t,r,i):e},rd.pullAt=n0,rd.range=oW,rd.rangeRight=oJ,rd.rearg=sC,rd.reject=function(e,t){return(sz(e)?tl:rB)(e,sS(nu(t,3)))},rd.remove=function(e,t){var r=[];if(!(e&&e.length))return r;var i=-1,n=[],s=e.length;for(t=nu(t,3);++i<s;){var o=e[i];t(o,i,e)&&(r.push(o),n.push(i))}return il(e,n),r},rd.rest=function(e,t){if("function"!=typeof e)throw new eS(i);return ip(e,t=t===r?t:s8(t))},rd.reverse=n1,rd.sampleSize=function(e,t,i){return t=(i?nE(e,t,i):t===r)?1:s8(t),(sz(e)?function(e,t){return nD(iB(e),rj(t,0,e.length))}:function(e,t){var r=o_(e);return nD(r,rj(t,0,r.length))})(e,t)},rd.set=function(e,t,r){return null==e?e:id(e,t,r)},rd.setWith=function(e,t,i,n){return n="function"==typeof n?n:r,null==e?e:id(e,t,i,n)},rd.shuffle=function(e){return(sz(e)?function(e){return nD(iB(e))}:function(e){return nD(o_(e))})(e)},rd.slice=function(e,t,i){var n=null==e?0:e.length;return n?(i&&"number"!=typeof i&&nE(e,t,i)?(t=0,i=n):(t=null==t?0:s8(t),i=i===r?n:s8(i)),iv(e,t,i)):[]}
vendor: 4,525 bytes, line 3
3,rd.sortBy=sy,rd.sortedUniq=function(e){return e&&e.length?i_(e):[]},rd.sortedUniqBy=function(e,t){return e&&e.length?i_(e,nu(t,2)):[]},rd.split=function(e,t,i){return i&&"number"!=typeof i&&nE(e,t,i)&&(t=i=r),(i=i===r?4294967295:i>>>0)?(e=s9(e))&&("string"==typeof t||null!=t&&!sG(t))&&!(t=iI(t))&&tL(e)?iT(tV(e),0,i):e.split(t,i):[]},rd.spread=function(e,t){if("function"!=typeof e)throw new eS(i);return t=null==t?0:t2(s8(t),0),ip(function(r){var i=r[t],n=iT(r,0,t);return i&&tf(n,i),ts(e,this,n)})},rd.tail=function(e){var t=null==e?0:e.length;return t?iv(e,1,t):[]},rd.take=function(e,t,i){return e&&e.length?iv(e,0,(t=i||t===r?1:s8(t))<0?0:t):[]},rd.takeRight=function(e,t,i){var n=null==e?0:e.length;return n?iv(e,(t=n-(t=i||t===r?1:s8(t)))<0?0:t,n):[]},rd.takeRightWhile=function(e,t){return e&&e.length?iR(e,nu(t,3),!1,!0):[]},rd.takeWhile=function(e,t){return e&&e.length?iR(e,nu(t,3)):[]},rd.tap=function(e,t){return t(e),e},rd.throttle=function(e,t,r){var n=!0,s=!0;if("function"!=typeof e)throw new eS(i);return sK(r)&&(n="leading"in r?!!r.leading:n,s="trailing"in r?!!r.trailing:s),sE(e,t,{leading:n,maxWait:t,trailing:s})},rd.thru=sn,rd.toArray=s3,rd.toPairs=ob,rd.toPairsIn=ow,rd.toPath=function(e){return sz(e)?tp(e,nL):sX(e)?[e]:iB(nk(s9(e)))},rd.toPlainObject=s7,rd.transform=function(e,t,r){var i=sz(e),n=i||s$(e)||s0(e);if(t=nu(t,4),null==r){var s=e&&e.constructor;r=n?i?new s:[]:sK(e)&&sB(s)?rg(eF(e)):{}}return(n?ta:rF)(e,function(e,i,n){return t(r,e,i,n)}),r},rd.unary=function(e){return sm(e,1)},rd.union=n2,rd.unionBy=n3,rd.unionWith=n5,rd.uniq=function(e){return e&&e.length?ix(e):[]},rd.uniqBy=function(e,t){return e&&e.length?ix(e,nu(t,2)):[]},rd.uniqWith=function(e,t){return t="function"==typeof t?t:r,e&&e.length?ix(e,r,t):[]},rd.unset=function(e,t){return null==e||iP(e,t)},rd.unzip=n8,rd.unzipWith=n4,rd.update=function(e,t,r){return null==e?e:iS(e,t,iq(r))},rd.updateWith=function(e,t,i,n){return n="function"==typeof n?n:r,null==e?e:iS(e,t,iq(i),n)},rd.values=o_,rd.valuesIn=function(e){return null==e?[]:tN(e,of(e))},rd.without=n6,rd.words=oq,rd.wrap=function(e,t){return sO(iq(t),e)},rd.xor=n7,rd.xorBy=n9,rd.xorWith=se,rd.zip=st,rd.zipObject=function(e,t){return iC(e||[],t||[],rR)},rd.zipObjectDeep=function(e,t){return iC(e||[],t||[],id)},rd.zipWith=sr,rd.entries=ob,rd.entriesIn=ow,rd.extend=ot,rd.extendWith=or,oB(rd,rd),rd.add=oY,rd.attempt=oj,rd.camelCase=oE,rd.capitalize=oI,rd.ceil=oX,rd.clamp=function(e,t,i){return i===r&&(i=t,t=r),i!==r&&(i=(i=s6(i))==i?i:0),t!==r&&(t=(t=s6(t))==t?t:0),rj(s6(e),t,i)},rd.clone=function(e){return rT(e,4)},rd.cloneDeep=function(e){return rT(e,5)},rd.cloneDeepWith=function(e,t){return rT(e,5,t="function"==typeof t?t:r)},rd.cloneWith=function(e,t){return rT(e,4,t="function"==typeof t?t:r)},rd.conformsTo=function(e,t){return null==t||rz(e,t,op(t))},rd.deburr=ox,rd.defaultTo=function(e,t){return null==e||e!=e?t:e},rd.divide=o0,rd.endsWith=function(e,t,i){e=s9(e),t=iI(t);var n=e.length,s=i=i===r?n:rj(s8(i),0,n);return(i-=t.length)>=0&&e.slice(i,s)==t},rd.eq=sN,rd.escape=function(e){return(e=s9(e))&&B.test(e)?e.replace(U,tD):e},rd.escapeRegExp=function(e){return(e=s9(e))&&G.test(e)?e.replace(J,"\\$&"):e},rd.every=function(e,t,i){var n=sz(e)?tc:rU;return i&&nE(e,t,i)&&(t=r),n(e,nu(t,3))},rd.find=sa,rd.findIndex=nV,rd.findKey=function(e,t){return tm(e,nu(t,3),rF)},rd.findLast=sc,rd.findLastIndex=nK,rd.findLastKey=function(e,t){return tm(e,nu(t,3),rZ)},rd.floor=o1,rd.forEach=sl,rd.forEachRight=sh,rd.forIn=function(e,t){return null==e?e:rV(e,nu(t,3),of)},rd.forInRight=function(e,t){return null==e?e:rK(e,nu(t,3),of)},rd.forOwn=function(e,t){return e&&rF(e,nu(t,3))},rd.forOwnRight=function(e,t){return e&&rZ(e,nu(t,3))},rd.get=oa,rd.gt=sq,rd.gte=sj,rd.has=function(e,t){return null!=e&&nm(e,t,rX)},rd.hasIn=oc,rd.head=nZ,rd.identity=oL,rd.includes=function(e,t,r,i){e=sk(e)?e:o_(e),r=r&&!i?s8(r):0;var n=e.length;return r<0&&(r=t2(n+r,0)),sY(e)?r<=n&&e.indexOf(t,r)>-1:!!n&&tw(e,t,r)>-1},rd.indexOf=function(e,t,r){var i=null==e?0:e.length;if(!i)return -1;var n=null==r?0:s8(r);return n<0&&(n=t2(i+n,0)),tw(e,t,n)},rd.inRange=function(e,t,i){var n,s,o;return t=s5(t),i===r?(i=t,t=0):i=s5(i),(n=e=s6(e))>=t3(s=t,o=i)&&n<t2(s,o)},rd.invoke=ou,rd.isArguments=sT,rd.isArray=sz,rd.isArrayBuffer=sD,rd.isArrayLike=sk,rd.isArrayLikeObject=sL,rd.isBoolean=function(e){return!0===e||!1===e||sF(e)&&rQ(e)==u},rd.isBuffer=s$,rd.isDate=sU,rd.isElement=function(e){return sF(e)&&1===e.nodeType&&!sJ(e)},rd.isEmpty=function(e){if(null==e)return!0;
vendor: 2,851 bytes, line 3
3if(sk(e)&&(sz(e)||"string"==typeof e||"function"==typeof e.splice||s$(e)||s0(e)||sT(e)))return!e.length;var t=nv(e);if(t==y||t==_)return!e.size;if(nS(e))return!r7(e).length;for(var r in e)if(eq.call(e,r))return!1;return!0},rd.isEqual=function(e,t){return r5(e,t)},rd.isEqualWith=function(e,t,i){var n=(i="function"==typeof i?i:r)?i(e,t):r;return n===r?r5(e,t,r,i):!!n},rd.isError=sM,rd.isFinite=function(e){return"number"==typeof e&&tX(e)},rd.isFunction=sB,rd.isInteger=sH,rd.isLength=sV,rd.isMap=sZ,rd.isMatch=function(e,t){return e===t||r8(e,t,nf(t))},rd.isMatchWith=function(e,t,i){return i="function"==typeof i?i:r,r8(e,t,nf(t),i)},rd.isNaN=function(e){return sW(e)&&e!=+e},rd.isNative=function(e){if(nP(e))throw new ew("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return r4(e)},rd.isNil=function(e){return null==e},rd.isNull=function(e){return null===e},rd.isNumber=sW,rd.isObject=sK,rd.isObjectLike=sF,rd.isPlainObject=sJ,rd.isRegExp=sG,rd.isSafeInteger=function(e){return sH(e)&&e>=-9007199254740991&&e<=9007199254740991},rd.isSet=sQ,rd.isString=sY,rd.isSymbol=sX,rd.isTypedArray=s0,rd.isUndefined=function(e){return e===r},rd.isWeakMap=function(e){return sF(e)&&nv(e)==x},rd.isWeakSet=function(e){return sF(e)&&"[object WeakSet]"==rQ(e)},rd.join=function(e,t){return null==e?"":t0.call(e,t)},rd.kebabCase=oP,rd.last=nQ,rd.lastIndexOf=function(e,t,i){var n=null==e?0:e.length;if(!n)return -1;var s=n;return i!==r&&(s=(s=s8(i))<0?t2(n+s,0):t3(s,n-1)),t==t?function(e,t,r){for(var i=r+1;i--&&e[i]!==t;);return i}(e,t,s):tb(e,tE,s,!0)},rd.lowerCase=oS,rd.lowerFirst=oR,rd.lt=s1,rd.lte=s2,rd.max=function(e){return e&&e.length?rM(e,oL,rY):r},rd.maxBy=function(e,t){return e&&e.length?rM(e,nu(t,2),rY):r},rd.mean=function(e){return tI(e,oL)},rd.meanBy=function(e,t){return tI(e,nu(t,2))},rd.min=function(e){return e&&e.length?rM(e,oL,r9):r},rd.minBy=function(e,t){return e&&e.length?rM(e,nu(t,2),r9):r},rd.stubArray=oG,rd.stubFalse=oQ,rd.stubObject=function(){return{}},rd.stubString=function(){return""},rd.stubTrue=function(){return!0},rd.multiply=o2,rd.nth=function(e,t){return e&&e.length?is(e,s8(t)):r},rd.noConflict=function(){return e3._===this&&(e3._=ek),this},rd.noop=oH,rd.now=sv,rd.pad=function(e,t,r){e=s9(e);var i=(t=s8(t))?tH(e):0;if(!t||i>=t)return e;var n=(t-i)/2;return i3(tG(n),r)+e+i3(tJ(n),r)},rd.padEnd=function(e,t,r){e=s9(e);var i=(t=s8(t))?tH(e):0;return t&&i<t?e+i3(t-i,r):e},rd.padStart=function(e,t,r){e=s9(e);var i=(t=s8(t))?tH(e):0;return t&&i<t?i3(t-i,r)+e:e},rd.parseInt=function(e,t,r){return r||null==t?t=0:t&&(t=+t),t8(s9(e).replace(Q,""),t||0)},rd.random=function(e,t,i){if(i&&"boolean"!=typeof i&&nE(e,t,i)&&(t=i=r),i===r&&("boolean"==typeof t?(i=t,t=r):"boolean"==typeof e&&(i=e,e=r)),e===r&&t===r?(e=0,t=1):(e=s5(e),t===r?(t=e,e=0):t=s5(t)),e>t){var n=e;e=t,t=n}if(i||e%1||t%1){var s=t4();
vendor: 5,302 bytes, lines 3-20
3return t3(e+s*(t-e+eX("1e-"+((s+"").length-1))),t)}return ih(e,t)},rd.reduce=function(e,t,r){var i=sz(e)?td:tS,n=arguments.length<3;return i(e,nu(t,4),r,n,rL)},rd.reduceRight=function(e,t,r){var i=sz(e)?tg:tS,n=arguments.length<3;return i(e,nu(t,4),r,n,r$)},rd.repeat=function(e,t,i){return t=(i?nE(e,t,i):t===r)?1:s8(t),iu(s9(e),t)},rd.replace=function(){var e=arguments,t=s9(e[0]);return e.length<3?t:t.replace(e[1],e[2])},rd.result=function(e,t,i){t=ij(t,e);var n=-1,s=t.length;for(s||(s=1,e=r);++n<s;){var o=null==e?r:e[nL(t[n])];o===r&&(n=s,o=i),e=sB(o)?o.call(e):o}return e},rd.round=o3,rd.runInContext=e,rd.sample=function(e){return(sz(e)?rP:function(e){return rP(o_(e))})(e)},rd.size=function(e){if(null==e)return 0;if(sk(e))return sY(e)?tH(e):e.length;var t=nv(e);return t==y||t==_?e.size:r7(e).length},rd.snakeCase=oO,rd.some=function(e,t,i){var n=sz(e)?ty:im;return i&&nE(e,t,i)&&(t=r),n(e,nu(t,3))},rd.sortedIndex=function(e,t){return ib(e,t)},rd.sortedIndexBy=function(e,t,r){return iw(e,t,nu(r,2))},rd.sortedIndexOf=function(e,t){var r=null==e?0:e.length;if(r){var i=ib(e,t);if(i<r&&sN(e[i],t))return i}return -1},rd.sortedLastIndex=function(e,t){return ib(e,t,!0)},rd.sortedLastIndexBy=function(e,t,r){return iw(e,t,nu(r,2),!0)},rd.sortedLastIndexOf=function(e,t){if(null==e?0:e.length){var r=ib(e,t,!0)-1;if(sN(e[r],t))return r}return -1},rd.startCase=oA,rd.startsWith=function(e,t,r){return e=s9(e),r=null==r?0:rj(s8(r),0,e.length),t=iI(t),e.slice(r,r+t.length)==t},rd.subtract=o5,rd.sum=function(e){return e&&e.length?tR(e,oL):0},rd.sumBy=function(e,t){return e&&e.length?tR(e,nu(t,2)):0},rd.template=function(e,t,i){var n=rd.templateSettings;i&&nE(e,t,i)&&(t=r),e=s9(e),t=or({},t,n,nt);var s,o,a=or({},t.imports,n.imports,nt),c=op(a),l=tN(a,c),h=0,u=t.interpolate||ef,p="__p += '",f=ex((t.escape||ef).source+"|"+u.source+"|"+(u===K?es:ef).source+"|"+(t.evaluate||ef).source+"|$","g"),d="//# sourceURL="+(eq.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++eJ+"]")+`
4`;e.replace(f,function(t,r,i,n,a,c){return i||(i=n),p+=e.slice(h,c).replace(ed,tk),r&&(s=!0,p+=`' +
5__e(`+r+`) +
6'`),a&&(o=!0,p+=`';
7`+a+`;
8__p += '`),i&&(p+=`' +
9((__t = (`+i+`)) == null ? '' : __t) +
10'`),h=c+t.length,t}),p+=`';
11`;var g=eq.call(t,"variable")&&t.variable;if(g){if(ei.test(g))throw new ew("Invalid `variable` option passed into `_.template`")}else p=`with (obj) {
12`+p+`
13}
14`;p=(o?p.replace(D,""):p).replace(k,"$1").replace(L,"$1;"),p="function("+(g||"obj")+`) {
15`+(g?"":`obj || (obj = {});
16`)+"var __t, __p = ''"+(s?", __e = _.escape":"")+(o?`, __j = Array.prototype.join;
17function print() { __p += __j.call(arguments, '') }
18`:`;
19`)+p+`return __p
20}`;var y=oj(function(){return e_(c,d+"return "+p).apply(r,l)});if(y.source=p,sM(y))throw y;return y},rd.times=function(e,t){if((e=s8(e))<1||e>9007199254740991)return[];var r=4294967295,i=t3(e,4294967295);t=nu(t),e-=4294967295;for(var n=tO(i,t);++r<e;)t(r);return n},rd.toFinite=s5,rd.toInteger=s8,rd.toLength=s4,rd.toLower=function(e){return s9(e).toLowerCase()},rd.toNumber=s6,rd.toSafeInteger=function(e){return e?rj(s8(e),-9007199254740991,9007199254740991):0===e?e:0},rd.toString=s9,rd.toUpper=function(e){return s9(e).toUpperCase()},rd.trim=function(e,t,i){if((e=s9(e))&&(i||t===r))return tA(e);if(!e||!(t=iI(t)))return e;var n=tV(e),s=tV(t),o=tj(n,s),a=tT(n,s)+1;return iT(n,o,a).join("")},rd.trimEnd=function(e,t,i){if((e=s9(e))&&(i||t===r))return e.slice(0,tK(e)+1);if(!e||!(t=iI(t)))return e;var n=tV(e),s=tT(n,tV(t))+1;return iT(n,0,s).join("")},rd.trimStart=function(e,t,i){if((e=s9(e))&&(i||t===r))return e.replace(Q,"");if(!e||!(t=iI(t)))return e;var n=tV(e),s=tj(n,tV(t));return iT(n,s).join("")},rd.truncate=function(e,t){var i=30,n="...";if(sK(t)){var s="separator"in t?t.separator:s;i="length"in t?s8(t.length):i,n="omission"in t?iI(t.omission):n}var o=(e=s9(e)).length;if(tL(e)){var a=tV(e);o=a.length}if(i>=o)return e;var c=i-tH(n);if(c<1)return n;var l=a?iT(a,0,c).join(""):e.slice(0,c);if(s===r)return l+n;if(a&&(c+=l.length-c),sG(s)){if(e.slice(c).search(s)){var h,u=l;for(s.global||(s=ex(s.source,s9(eo.exec(s))+"g")),s.lastIndex=0;h=s.exec(u);)var p=h.index;l=l.slice(0,p===r?c:p)}}else if(e.indexOf(iI(s),c)!=c){var f=l.lastIndexOf(s);f>-1&&(l=l.slice(0,f))}return l+n},rd.unescape=function(e){return(e=s9(e))&&M.test(e)?e.replace($,tF):e},rd.uniqueId=function(e){var t=++ej;return s9(e)+t},rd.upperCase=oC,rd.upperFirst=oN,rd.each=sl,rd.eachRight=sh,rd.first=nZ,oB(rd,(ev={},rF(rd,function(e,t){eq.call(rd.prototype,t)||(ev[t]=e)}),ev),{chain:!1}),rd.VERSION="4.17.21",ta(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){rd[e].placeholder=rd}),ta(["drop","take"],function(e,t){rm.prototype[e]=function(i){i=i===r?1:t2(s8(i),0);var n=this.__filtered__&&!t?new rm(this):this.clone();return n.__filtered__?n.__takeCount__=t3(i,n.__takeCount__):n.__views__.push({size:t3(i,4294967295),type:e+(n.__dir__<0?"Right":"")}),n},rm.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}}),ta(["filter","map","takeWhile"],function(e,t){var r=t+1,i=1==r||3==r;rm.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:nu(e,3),type:r}),t.__filtered__=t.__filtered__||i,t}}),ta(["head","last"],function(e,t){var r="take"+(t?"Right":"");
vendor: 4,140 bytes, line 20
20rm.prototype[e]=function(){return this[r](1).value()[0]}}),ta(["initial","tail"],function(e,t){var r="drop"+(t?"":"Right");rm.prototype[e]=function(){return this.__filtered__?new rm(this):this[r](1)}}),rm.prototype.compact=function(){return this.filter(oL)},rm.prototype.find=function(e){return this.filter(e).head()},rm.prototype.findLast=function(e){return this.reverse().find(e)},rm.prototype.invokeMap=ip(function(e,t){return"function"==typeof e?new rm(this):this.map(function(r){return r2(r,e,t)})}),rm.prototype.reject=function(e){return this.filter(sS(nu(e)))},rm.prototype.slice=function(e,t){e=s8(e);var i=this;return i.__filtered__&&(e>0||t<0)?new rm(i):(e<0?i=i.takeRight(-e):e&&(i=i.drop(e)),t!==r&&(i=(t=s8(t))<0?i.dropRight(-t):i.take(t-e)),i)},rm.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},rm.prototype.toArray=function(){return this.take(4294967295)},rF(rm.prototype,function(e,t){var i=/^(?:filter|find|map|reject)|While$/.test(t),n=/^(?:head|last)$/.test(t),s=rd[n?"take"+("last"==t?"Right":""):t],o=n||/^find/.test(t);s&&(rd.prototype[t]=function(){var t=this.__wrapped__,a=n?[1]:arguments,c=t instanceof rm,l=a[0],h=c||sz(t),u=function(e){var t=s.apply(rd,tf([e],a));return n&&p?t[0]:t};h&&i&&"function"==typeof l&&1!=l.length&&(c=h=!1);var p=this.__chain__,f=!!this.__actions__.length,d=o&&!p,g=c&&!f;if(!o&&h){t=g?t:new rm(this);var y=e.apply(t,a);return y.__actions__.push({func:sn,args:[u],thisArg:r}),new rv(y,p)}return d&&g?e.apply(this,a):(y=this.thru(u),d?n?y.value()[0]:y.value():y)})}),ta(["pop","push","shift","sort","splice","unshift"],function(e){var t=eR[e],r=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",i=/^(?:pop|shift)$/.test(e);rd.prototype[e]=function(){var e=arguments;if(i&&!this.__chain__){var n=this.value();return t.apply(sz(n)?n:[],e)}return this[r](function(r){return t.apply(sz(r)?r:[],e)})}}),rF(rm.prototype,function(e,t){var r=rd[t];if(r){var i=r.name+"";eq.call(rs,i)||(rs[i]=[]),rs[i].push({name:t,func:r})}}),rs[iX(r,2).name]=[{name:"wrapper",func:r}],rm.prototype.clone=function(){var e=new rm(this.__wrapped__);return e.__actions__=iB(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=iB(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=iB(this.__views__),e},rm.prototype.reverse=function(){if(this.__filtered__){var e=new rm(this);e.__dir__=-1,e.__filtered__=!0}else e=this.clone(),e.__dir__*=-1;return e},rm.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,r=sz(e),i=t<0,n=r?e.length:0,s=function(e,t,r){for(var i=-1,n=r.length;++i<n;){var s=r[i],o=s.size;switch(s.type){case"drop":e+=o;break;case"dropRight":t-=o;break;case"take":t=t3(t,e+o);break;case"takeRight":e=t2(e,t-o)}}return{start:e,end:t}}(0,n,this.__views__),o=s.start,a=s.end,c=a-o,l=i?a:o-1,h=this.__iteratees__,u=h.length,p=0,f=t3(c,this.__takeCount__);if(!r||!i&&n==c&&f==c)return iO(e,this.__actions__);var d=[];e:for(;c--&&p<f;){l+=t;for(var g=-1,y=e[l];++g<u;){var v=h[g],m=v.iteratee,b=v.type,w=m(y);if(2==b)y=w;else if(!w){if(1==b)continue e;break e}}d[p++]=y}return d},rd.prototype.at=ss,rd.prototype.chain=function(){return si(this)},rd.prototype.commit=function(){return new rv(this.value(),this.__chain__)},rd.prototype.next=function(){this.__values__===r&&(this.__values__=s3(this.value()));var e=this.__index__>=this.__values__.length,t=e?r:this.__values__[this.__index__++];return{done:e,value:t}},rd.prototype.plant=function(e){for(var t,i=this;i instanceof ry;){var n=nU(i);n.__index__=0,n.__values__=r,t?s.__wrapped__=n:t=n;var s=n;i=i.__wrapped__}return s.__wrapped__=e,t},rd.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof rm){var t=e;return this.__actions__.length&&(t=new rm(this)),(t=t.reverse()).__actions__.push({func:sn,args:[n1],thisArg:r}),new rv(t,this.__chain__)}return this.thru(n1)},rd.prototype.toJSON=rd.prototype.valueOf=rd.prototype.value=function(){return iO(this.__wrapped__,this.__actions__)},rd.prototype.first=rd.prototype.head,e8&&(rd.prototype[e8]=function(){return this}),rd}();e8?((e8.exports=tZ)._=tZ,e5._=tZ):e3._=tZ}).call(nX)}
20(n0,n0.exports);var n1=Object.defineProperty,n2=Object.defineProperties,n3=Object.getOwnPropertyDescriptors,n5=Object.getOwnPropertySymbols,n8=Object.prototype.hasOwnProperty,n4=Object.prototype.propertyIsEnumerable,n6=(e,t,r)=>t in e?n1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,n7=(e,t)=>{for(var r in t||(t={}))n8.call(t,r)&&n6(e,r,t[r]);if(n5)for(var r of n5(t))n4.call(t,r)&&n6(e,r,t[r]);return e},n9=(e,t)=>n2(e,n3(t));function se(e,t,r){var i;let n=(0,a.DQ)(e);return(null==(i=t.rpcMap)?void 0:i[n.reference])||`https://rpc.walletconnect.com/v1/?chainId=${n.namespace}:${n.reference}&projectId=${r}`}function st(e){return e.includes(":")?e.split(":")[1]:e}function sr(e){return e.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function si(e){var t,r,i,n;let s={};if(!(0,a.L5)(e))return s;for(let[o,c]of Object.entries(e)){let e=(0,a.gp)(o)?[o]:c.chains,l=c.methods||[],h=c.events||[],u=c.rpcMap||{},p=(0,a.M)(o);s[p]=n9(n7(n7({},s[p]),c),{chains:(0,a.eG)(e,null==(t=s[p])?void 0:t.chains),methods:(0,a.eG)(l,null==(r=s[p])?void 0:r.methods),events:(0,a.eG)(h,null==(i=s[p])?void 0:i.events),rpcMap:n7(n7({},u),null==(n=s[p])?void 0:n.rpcMap)})}return s}function sn(e){return e.includes(":")?e.split(":")[2]:e}function ss(e){return"number"==typeof e?e:e.includes("0x")?parseInt(e,16):e.includes(":")?Number(e.split(":")[1]):Number(e)}let so={},sa=e=>so[e],sc=(e,t)=>{so[e]=t};class sl{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=sa("events"),this.client=sa("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(nY,`${this.name}:${e}`)}getAccounts(){let e=this.namespace.accounts;return e&&e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2])||[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{var r;let i=st(t);e[i]=this.createHttpProvider(i,null==(r=this.namespace.rpcMap)?void 0:r[t])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||se(e,this.namespace,this.client.core.projectId);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);return new nJ(new nW.Z(r,sa("disableProviderPing")))}}class sh{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=sa("events"),this.client=sa("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain())}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(parseInt(e),t),this.chainId=parseInt(e),this.events.emit(nY,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,t){let r=t||se(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);return new nJ(new nW.k(r,sa("disableProviderPing")))}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{var r;let i=parseInt(st(t));e[i]=this.createHttpProvider(i,null==(r=this.namespace.rpcMap)?void 0:r[t])}),e}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}getHttpProvider(){let e=this.chainId,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}async handleSwitchChain(e){var t,r;let i=e.request.params?null==(t=e.request.params[0])?void 0:t.chainId:"0x0",n=parseInt(i=i.startsWith("0x")?i:`0x${i}`,16);if(this.isChainApproved(n))this.setDefaultChain(`${n}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:i}]},chainId:null==(r=this.namespace.chains)?void 0:r[0]}),this.setDefaultChain(`${n}`);else throw Error(`Failed to switch to chain 'eip155:${n}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}}class su{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=sa("events"),this.client=sa("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(nY,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return e.split(":")[1]}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{var r;let i=st(t);e[i]=this.createHttpProvider(i,null==(r=this.namespace.rpcMap)?void 0:r[t])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||se(e,this.namespace,this.client.core.projectId);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);return new nJ(new nW.Z(r,sa("disableProviderPing")))}}class sp{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=sa("events"),this.client=sa("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(nY,`${this.name}:${this.chainId}`)}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{var r;let i=st(t);e[i]=this.createHttpProvider(i,null==(r=this.namespace.rpcMap)?void 0:r[t])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||se(e,this.namespace,this.client.core.projectId);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);return new nJ(new nW.Z(r,sa("disableProviderPing")))}}class sf{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=sa("events"),this.client=sa("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(nY,`${this.name}:${this.chainId}`)}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{let r=this.getCardanoRPCUrl(t),i=st(t);e[i]=this.createHttpProvider(i,r)}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}getCardanoRPCUrl(e){let t=this.namespace.rpcMap;if(t)return t[e]}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||this.getCardanoRPCUrl(e);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);return new nJ(new nW.Z(r,sa("disableProviderPing")))}}class sd{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=sa("events"),this.client=sa("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(nY,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return e.split(":")[1]}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{var r;let i=st(t);e[i]=this.createHttpProvider(i,null==(r=this.namespace.rpcMap)?void 0:r[t])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||se(e,this.namespace,this.client.core.projectId);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);return new nJ(new nW.Z(r,sa("disableProviderPing")))}}class sg{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=sa("events"),this.client=sa("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(nY,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return e.split(":")[1]}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{var r;let i=st(t);e[i]=this.createHttpProvider(i,null==(r=this.namespace.rpcMap)?void 0:r[t])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||se(e,this.namespace,this.client.core.projectId);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);return new nJ(new nW.Z(r,sa("disableProviderPing")))}}class sy{constructor(e){this.name="near",this.namespace=e.namespace,this.events=sa("events"),this.client=sa("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(this.chainId=e,!this.httpProviders[e]){let r=t||se(`${this.name}:${e}`,this.namespace);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,r)}this.events.emit(nY,`${this.name}:${this.chainId}`)}getAccounts(){let e=this.namespace.accounts;return e&&e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2])||[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{var r;e[t]=this.createHttpProvider(t,null==(r=this.namespace.rpcMap)?void 0:r[t])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||se(e,this.namespace);return typeof r>"u"?void 0:new nJ(new nW.Z(r,sa("disableProviderPing")))}}var sv=Object.defineProperty,sm=Object.defineProperties,sb=Object.getOwnPropertyDescriptors,sw=Object.getOwnPropertySymbols,s_=Object.prototype.hasOwnProperty,sE=Object.prototype.propertyIsEnumerable,sI=(e,t,r)=>t in e?sv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,sx=(e,t)=>{for(var r in t||(t={}))s_.call(t,r)&&sI(e,r,t[r]);
20if(sw)for(var r of sw(t))sE.call(t,r)&&sI(e,r,t[r]);return e},sP=(e,t)=>sm(e,sb(t));class sS{constructor(e){this.events=new(o()),this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger="u">typeof e?.logger&&"string"!=typeof e?.logger?e.logger:et(Y({level:e?.logger||nG})),this.disableProviderPing=e?.disableProviderPing||!1}static async init(e){let t=new sS(e);return await t.initialize(),t}async request(e,t){let[r,i]=this.validateChain(t);if(!this.session)throw Error("Please call connect() before request()");return await this.getProvider(r).request({request:sx({},e),chainId:`${r}:${i}`,topic:this.session.topic})}sendAsync(e,t,r){let i=new Date().getTime();this.request(e,r).then(e=>t(null,(0,rP.formatJsonRpcResult)(i,e))).catch(e=>t(e,void 0))}async enable(){if(!this.client)throw Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw Error("Please call connect() before enable()");await this.client.disconnect({topic:null==(e=this.session)?void 0:e.topic,reason:(0,a.D6)("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}removeListener(e,t){this.events.removeListener(e,t)}off(e,t){this.events.off(e,t)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let t=0;do{if(this.shouldAbortPairingAttempt)throw Error("Pairing aborted");if(t>=this.maxPairingAttempts)throw Error("Max auto pairing attempts reached");let{uri:r,approval:i}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});r&&(this.uri=r,this.events.emit("display_uri",r)),await i().then(e=>{this.session=e,this.namespaces||(this.namespaces=function(e){let t={};for(let[r,i]of Object.entries(e)){let e=i.methods||[],n=i.events||[],s=i.accounts||[],o=(0,a.gp)(r)?[r]:i.chains?i.chains:sr(i.accounts);t[r]={chains:o,methods:e,events:n,accounts:s}}return t}(e.namespaces),this.persist("namespaces",this.namespaces))}).catch(e=>{if(e.message!==nO)throw e;t++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,t){try{if(!this.session)return;let[r,i]=this.validateChain(e);this.getProvider(r).setDefaultChain(i,t)}catch(e){if(!/Please call connect/.test(e.message))throw e}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");let t=this.client.pairing.getAll();if((0,a.qt)(t)){for(let r of t)e.deletePairings?this.client.core.expirer.set(r.topic,0):await this.client.core.relayer.subscriber.unsubscribe(r.topic);this.logger.info(`Inactive pairings cleared: ${t.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){let e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await nZ.init({logger:this.providerOpts.logger||nG,relayUrl:this.providerOpts.relayUrl||"wss://relay.walletconnect.com",projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw Error("Sign Client not initialized");if(!this.session)throw Error("Session not initialized. Please call connect() before enable()");let e=[...new Set(Object.keys(this.session.namespaces).map(e=>(0,a.M)(e)))];sc("client",this.client),sc("events",this.events),sc("disableProviderPing",this.disableProviderPing),e.forEach(e
20=>{if(!this.session)return;let t=function(e,t){let r=Object.keys(t.namespaces).filter(t=>t.includes(e));if(!r.length)return[];let i=[];return r.forEach(e=>{let r=t.namespaces[e].accounts;i.push(...r)}),i}(e,this.session),r=sr(t),i=sP(sx({},function(e={},t={}){let r=si(e),i=si(t);return n0.exports.merge(r,i)}(this.namespaces,this.optionalNamespaces)[e]),{accounts:t,chains:r});switch(e){case"eip155":this.rpcProviders[e]=new sh({namespace:i});break;case"solana":this.rpcProviders[e]=new su({namespace:i});break;case"cosmos":this.rpcProviders[e]=new sp({namespace:i});break;case"polkadot":this.rpcProviders[e]=new sl({namespace:i});break;case"cip34":this.rpcProviders[e]=new sf({namespace:i});break;case"elrond":this.rpcProviders[e]=new sd({namespace:i});break;case"multiversx":this.rpcProviders[e]=new sg({namespace:i});break;case"near":this.rpcProviders[e]=new sy({namespace:i})}})}registerEventListeners(){if(typeof this.client>"u")throw Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{let{params:t}=e,{event:r}=t;if("accountsChanged"===r.name){let e=r.data;e&&(0,a.qt)(e)&&this.events.emit("accountsChanged",e.map(sn))}else if("chainChanged"===r.name){let e=t.chainId,r=t.event.data,i=(0,a.M)(e),n=ss(e)!==ss(r)?`${i}:${ss(r)}`:e;this.onChainChanged(n)}else this.events.emit(r.name,r.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:t})=>{var r;let{namespaces:i}=t,n=null==(r=this.client)?void 0:r.session.get(e);this.session=sP(sx({},n),{namespaces:i}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:t})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",sP(sx({},(0,a.D6)("USER_DISCONNECTED")),{data:e.topic}))}),this.on(nY,e=>{this.onChainChanged(e,!0)})}getProvider(e){if(!this.rpcProviders[e])throw Error(`Provider not found: ${e}`);return this.rpcProviders[e]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var t;this.getProvider(e).updateNamespace(null==(t=this.session)?void 0:t.namespaces[e])})}setNamespaces(e){let{namespaces:t,optionalNamespaces:r,sessionProperties:i}=e;t&&Object.keys(t).length&&(this.namespaces=t),r&&Object.keys(r).length&&(this.optionalNamespaces=r),this.sessionProperties=i,this.persist("namespaces",t),this.persist("optionalNamespaces",r)}validateChain(e){let[t,r]=e?.split(":")||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[t,r];if(t&&!Object.keys(this.namespaces||{}).map(e=>(0,a.M)(e)).includes(t))throw Error(`Namespace '${t}' is not configured. Please call connect() first with namespace config.`);if(t&&r)return[t,r];let i=(0,a.M)(Object.keys(this.namespaces)[0]),n=this.rpcProviders[i].getDefaultChain();return[i,n]}async requestAccounts(){let[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,t=!1){var r;if(!this.namespaces)return;let[i,n]=this.validateChain(e);t||this.getProvider(i).setDefaultChain(n),(null!=(r=this.namespaces[i])?r:this.namespaces[`${i}:${n}`]).defaultChain=n,this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",n)}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,t){this.client.core.storage.setItem(`${nQ}/${e}`,t)}async getFromStore(e){return await this.client.core.storage.getItem(`${nQ}/${e}`)}}let sR=["eth_sendTransaction","personal_sign"],sO=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode"],sA=["chainChanged","accountsChanged"],sC=["chainChanged","accountsChanged","message","disconnect","connect"];var sN=Object.defineProperty,sq=Object.defineProperties,sj=Object.getOwnPropertyDescriptors,sT=Object.getOwnPropertySymbols,sz=Object.prototype.hasOwnProperty,sD=Object.prototype.propertyIsEnumerable,sk=(e,t,r)=>t in e?sN(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,sL=(e,t)=>{for(var r in t||(t={}))sz.call(t,r)&&sk(e,r,t[r]);if(sT)for(var r of sT(t))sD.call(t,r)&&sk(e,r,t[r]);return e},s$=(e,t)=>
20sq(e,sj(t));function sU(e){return Number(e[0].split(":")[1])}function sM(e){return`0x${e.toString(16)}`}class sB{constructor(){this.events=new s.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY="wc@2:ethereum_provider:",this.on=(e,t)=>(this.events.on(e,t),this),this.once=(e,t)=>(this.events.once(e,t),this),this.removeListener=(e,t)=>(this.events.removeListener(e,t),this),this.off=(e,t)=>(this.events.off(e,t),this),this.parseAccount=e=>this.isCompatibleChainId(e)?this.parseAccountId(e).address:e,this.signer={},this.rpc={}}static async init(e){let t=new sB;return await t.initialize(e),t}async request(e){return await this.signer.request(e,this.formatChainId(this.chainId))}sendAsync(e,t){this.signer.sendAsync(e,t,this.formatChainId(this.chainId))}get connected(){return!!this.signer.client&&this.signer.client.core.relayer.connected}get connecting(){return!!this.signer.client&&this.signer.client.core.relayer.connecting}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(e){if(!this.signer.client)throw Error("Provider not initialized. Call init() first");this.loadConnectOpts(e);let{required:t,optional:r}=function(e){let{chains:t,optionalChains:r,methods:i,optionalMethods:n,events:s,optionalEvents:o,rpcMap:c}=e;if(!(0,a.qt)(t))throw Error("Invalid chains");let l={chains:t,methods:i||sR,events:s||sA,rpcMap:sL({},t.length?{[sU(t)]:c[sU(t)]}:{})},h=s?.filter(e=>!sA.includes(e)),u=i?.filter(e=>!sR.includes(e));if(!r&&!o&&!n&&!(null!=h&&h.length)&&!(null!=u&&u.length))return{required:t.length?l:void 0};let p={chains:[...new Set(h?.length&&u?.length||!r?l.chains.concat(r||[]):r)],methods:[...new Set(l.methods.concat(null!=n&&n.length?n:sO))],events:[...new Set(l.events.concat(null!=o&&o.length?o:sC))],rpcMap:c};return{required:t.length?l:void 0,optional:r.length?p:void 0}}(this.rpc);try{let i=await new Promise(async(i,n)=>{var s;this.rpc.showQrModal&&(null==(s=this.modal)||s.subscribeModal(e=>{e.open||this.signer.session||(this.signer.abortPairingAttempt(),n(Error("Connection request reset. Please try again.")))})),await this.signer.connect(s$(sL({namespaces:sL({},t&&{[this.namespace]:t})},r&&{optionalNamespaces:{[this.namespace]:r}}),{pairingTopic:e?.pairingTopic})).then(e=>{i(e)}).catch(e=>{n(Error(e.message))})});if(!i)return;let n=(0,a.gu)(i.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:n),this.setAccounts(n),this.events.emit("connect",{chainId:sM(this.chainId)})}catch(e){throw this.signer.logger.error(e),e}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",e=>{let{params:t}=e,{event:r}=t;"accountsChanged"===r.name?(this.accounts=this.parseAccounts(r.data),this.events.emit("accountsChanged",this.accounts)):"chainChanged"===r.name?this.setChainId(this.formatChainId(r.data)):this.events.emit(r.name,r.data),this.events.emit("session_event",e)}),this.signer.on("chainChanged",e=>{let t=parseInt(e);this.chainId=t,this.events.emit("chainChanged",sM(this.chainId)),this.persist()}),this.signer.on("session_update",e=>{this.events.emit("session_update",e)}),this.signer.on("session_delete",e=>{this.reset(),this.events.emit("session_delete",e),this.events.emit("disconnect",s$(sL({},(0,a.D6)("USER_DISCONNECTED")),{data:e.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",e=>{var t,r;this.rpc.showQrModal&&(null==(t=this.modal)||t.closeModal(),null==(r=this.modal)||r.openModal({uri:e})),this.events.emit("display_uri",e)})}switchEthereumChain(e){this.request({method:"wallet_switchEthereumChain",params:[{chainId:e.toString(16)}]})}isCompatibleChainId(e){return"string"==typeof e&&e.startsWith(`${this.namespace}:`)}formatChainId(e){return`${this.namespace}:${e}`}parseChainId(e){return Number(e.split(":")[1])}setChainIds(e){let t=e.filter(e=>this.isCompatibleChainId(e)).map(e=>this.parseChainId(e));t.length&&(this.chainId=t[0],this.events.emit("chainChanged",sM(this.chainId)),this.persist())}setChainId(e){if(this.isCompatibleChainId(e)){let t=this.parseChainId(e);this.chainId=t,this.switchEthereumChain(t)}}parseAccountId(e){let[t,r,i]=e.split(":");return{chainId:`${t}:${r}`,address:i}}setAccounts(e){this.accounts=e.filter(e=>this.parseChainId(this.parseAccountId(e).chainId)===this.chainId).map(e=>this.parseAccountId(e).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(e){var t,r;let i=null!=(t=e?.chains)?t:[],n=null!=(r=e?.optionalChains)?r:[],s=i.concat(n);if(!s.length)throw Error("No chains specified in either `chains` or `optionalChains`");let o=i.length?e?.methods||sR:[],a=i.length?e?.events||sA:[],c=e?.optionalMethods||[],l=e?.optionalEvents||[],h=e?.rpcMap||this.buildRpcMap(s,e.projectId),u=e?.qrModalOptions||void 0;return{chains:i?.map(e=>this.formatChainId(e)),optionalChains:n.map(e=>this.formatChainId(e)),methods:o,events:a,optionalMethods:c,optionalEvents:l,rpcMap:h,showQrModal:!!(null!=e&&e.showQrModal),qrModalOptions:u,projectId:e.projectId,metadata:e.metadata}}buildRpcMap(e,t){let r={};
20return e.forEach(e=>{r[e]=this.getRpcUrl(e,t)}),r}async initialize(e){if(this.rpc=this.getRpcConfig(e),this.chainId=this.rpc.chains.length?sU(this.rpc.chains):sU(this.rpc.optionalChains),this.signer=await sS.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:e.disableProviderPing,relayUrl:e.relayUrl,storageOptions:e.storageOptions}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let e;try{let{WalletConnectModal:t}=await r.e(4978).then(r.bind(r,44978));e=t}catch{throw Error("To use QR modal, please install @walletconnect/modal package")}if(e)try{this.modal=new e(sL({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(e){throw this.signer.logger.error(e),Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(e){if(!e)return;let{chains:t,optionalChains:r,rpcMap:i}=e;t&&(0,a.qt)(t)&&(this.rpc.chains=t.map(e=>this.formatChainId(e)),t.forEach(e=>{this.rpc.rpcMap[e]=i?.[e]||this.getRpcUrl(e)})),r&&(0,a.qt)(r)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=r?.map(e=>this.formatChainId(e)),r.forEach(e=>{this.rpc.rpcMap[e]=i?.[e]||this.getRpcUrl(e)}))}getRpcUrl(e,t){var r;return(null==(r=this.rpc.rpcMap)?void 0:r[e])||`https://rpc.walletconnect.com/v1/?chainId=eip155:${e}&projectId=${t||this.rpc.projectId}`}async loadPersistedSession(){if(!this.session)return;let e=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),t=this.session.namespaces[`${this.namespace}:${e}`]?this.session.namespaces[`${this.namespace}:${e}`]:this.session.namespaces[this.namespace];this.setChainIds(e?[this.formatChainId(e)]:t?.accounts),this.setAccounts(t?.accounts)}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(e){return"string"==typeof e||e instanceof String?[this.parseAccount(e)]:e.map(e=>this.parseAccount(e))}}let sH=sB},93514:function(e,t,r){"use strict";r.d(t,{q:function(){return i}});class i{}},70761:function(e,t,r){"use strict";r.r(t),r.d(t,{IEvents:function(){return i.q}});var i=r(93514)},72948:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HEARTBEAT_EVENTS=t.HEARTBEAT_INTERVAL=void 0;let i=r(40537);t.HEARTBEAT_INTERVAL=i.FIVE_SECONDS,t.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"}},46359:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(23033).__exportStar(r(72948),t)},70726:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HeartBeat=void 0;let i=r(23033),n=r(55445),s=r(40537),o=r(49983),a=r(46359);class c extends o.IHeartBeat{constructor(e){super(e),this.events=new n.EventEmitter,this.interval=a.HEARTBEAT_INTERVAL,this.interval=(null==e?void 0:e.interval)||a.HEARTBEAT_INTERVAL}static init(e){return i.__awaiter(this,void 0,void 0,function*(){let t=new c(e);return yield t.init(),t})}init(){return i.__awaiter(this,void 0,void 0,function*(){yield this.initialize()})}stop(){clearInterval(this.intervalRef)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}initialize(){return i.__awaiter(this,void 0,void 0,function*(){this.intervalRef=setInterval(()=>this.pulse(),s.toMiliseconds(this.interval))})}pulse(){this.events.emit(a.HEARTBEAT_EVENTS.pulse)}}t.HeartBeat=c},40632:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let i=r(23033);i.__exportStar(r(70726),t),i.__exportStar(r(49983),t),i.__exportStar(r(46359),t)},58664:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IHeartBeat=void 0;let i=r(70761);class n extends i.IEvents{constructor(e){super()}}t.IHeartBeat=n},49983:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(23033).__exportStar(r(58664),t)},23033:function(e,t,r){"use strict";r.r(t),r.d(t,{__assign:function(){return s},__asyncDelegator:function(){return w},__asyncGenerator:function(){return b},__asyncValues:function(){return _},__await:function(){return m},__awaiter:function(){return h},__classPrivateFieldGet:function(){return P},__classPrivateFieldSet:function(){return S},__createBinding:function(){return p},__decorate:function(){return a},__exportStar:function(){return f},__extends:function(){return n},__generator:function(){return u},__importDefault:function(){return x},__importStar:function(){return I}
vendor: 5,306 bytes, line 20
20,__makeTemplateObject:function(){return E},__metadata:function(){return l},__param:function(){return c},__read:function(){return g},__rest:function(){return o},__spread:function(){return y},__spreadArrays:function(){return v},__values:function(){return d}});var i=function(e,t){return(i=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function n(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var s=function(){return(s=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)};function o(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&0>t.indexOf(i)&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,i=Object.getOwnPropertySymbols(e);n<i.length;n++)0>t.indexOf(i[n])&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]]);return r}function a(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o}function c(e,t){return function(r,i){t(r,i,e)}}function l(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function h(e,t,r,i){return new(r||(r=Promise))(function(n,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,a)}c((i=i.apply(e,t||[])).next())})}function u(e,t){var r,i,n,s,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(r)throw TypeError("Generator is already executing.");for(;o;)try{if(r=1,i&&(n=2&s[0]?i.return:s[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,s[1])).done)return n;switch(i=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(n=(n=o.trys).length>0&&n[n.length-1])&&(6===s[0]||2===s[0])){o=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){o.label=s[1];break}if(6===s[0]&&o.label<n[1]){o.label=n[1],n=s;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(s);break}n[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],i=0}finally{r=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}}function p(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}function f(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||(t[r]=e[r])}function d(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function g(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var i,n,s=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(i=s.next()).done;)o.push(i.value)}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return o}function y(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(g(arguments[t]));return e}function v(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;for(var i=Array(e),n=0,t=0;t<r;t++)for(var s=arguments[t],o=0,a=s.length;o<a;o++,n++)i[n]=s[o];return i}function m(e){return this instanceof m?(this.v=e,this):new m(e)}function b(e,t,r){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var i,n=r.apply(e,t||[]),s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(e){n[e]&&(i[e]=function(t){return new Promise(function(r,i){s.push([e,t,r,i])>1||a(e,t)})})}function a(e,t){try{var r;(r=n[e](t)).value instanceof m?Promise.resolve(r.value.v).then(c,l):h(s[0][2],r)}catch(e){h(s[0][3],e)}}function c(e){a("next",e)}function l(e){a("throw",e)}function h(e,t){e(t),s.shift(),s.length&&a(s[0][0],s[0][1])}}function w(e){var t,r;return t={},i("next"),i("throw",function(e){throw e}),i("return"),t[Symbol.iterator]=function(){return this},t;function i(i,n){t[i]=e[i]?function(t){return(r=!r)?{value:m(e[i](t)),done:"return"===i}:n?n(t):t}:n}}function _(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=d(e),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(r){t[r]=e[r]&&function(t){return new Promise(function(i,n){!function(e,t,r,i){Promise.resolve(i).then(function(t){e({value:t,done:r})},t)}(i,n,(t=e[r](t)).done,t.value)})}}}function E(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}
20function I(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function x(e){return e&&e.__esModule?e:{default:e}}function P(e,t){if(!t.has(e))throw TypeError("attempted to get private field on non-instance");return t.get(e)}function S(e,t,r){if(!t.has(e))throw TypeError("attempted to set private field on non-instance");return t.set(e,r),r}},16854:function(e){"use strict";e.exports=function(){throw Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},15586:function(e,t,r){e=r.nmd(e);var i,n,s,o="__lodash_hash_undefined__",a="[object Arguments]",c="[object Array]",l="[object Boolean]",h="[object Date]",u="[object Error]",p="[object Function]",f="[object Map]",d="[object Number]",g="[object Object]",y="[object Promise]",v="[object RegExp]",m="[object Set]",b="[object String]",w="[object WeakMap]",_="[object ArrayBuffer]",E="[object DataView]",I=/^\[object .+?Constructor\]$/,x=/^(?:0|[1-9]\d*)$/,P={};P["[object Float32Array]"]=P["[object Float64Array]"]=P["[object Int8Array]"]=P["[object Int16Array]"]=P["[object Int32Array]"]=P["[object Uint8Array]"]=P["[object Uint8ClampedArray]"]=P["[object Uint16Array]"]=P["[object Uint32Array]"]=!0,P[a]=P[c]=P[_]=P[l]=P[E]=P[h]=P[u]=P[p]=P[f]=P[d]=P[g]=P[v]=P[m]=P[b]=P[w]=!1;var S="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g,R="object"==typeof self&&self&&self.Object===Object&&self,O=S||R||Function("return this")(),A=t&&!t.nodeType&&t,C=A&&e&&!e.nodeType&&e,N=C&&C.exports===A,q=N&&S.process,j=function(){try{return q&&q.binding&&q.binding("util")}catch(e){}}(),T=j&&j.isTypedArray;function z(e){var t=-1,r=Array(e.size);return e.forEach(function(e,i){r[++t]=[i,e]}),r}function D(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}var k=Array.prototype,L=Function.prototype,$=Object.prototype,U=O["__core-js_shared__"],M=L.toString,B=$.hasOwnProperty,H=(i=/[^.]+$/.exec(U&&U.keys&&U.keys.IE_PROTO||""))?"Symbol(src)_1."+i:"",V=$.toString,K=RegExp("^"+M.call(B).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),F=N?O.Buffer:void 0,Z=O.Symbol,W=O.Uint8Array,J=$.propertyIsEnumerable,G=k.splice,Q=Z?Z.toStringTag:void 0,Y=Object.getOwnPropertySymbols,X=F?F.isBuffer:void 0,ee=(n=Object.keys,s=Object,function(e){return n(s(e))}),et=eP(O,"DataView"),er=eP(O,"Map"),ei=eP(O,"Promise"),en=eP(O,"Set"),es=eP(O,"WeakMap"),eo=eP(Object,"create"),ea=eO(et),ec=eO(er),el=eO(ei),eh=eO(en),eu=eO(es),ep=Z?Z.prototype:void 0,ef=ep?ep.valueOf:void 0;function ed(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}function eg(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}function ey(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}function ev(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new ey;++t<r;)this.add(e[t])}function em(e){var t=this.__data__=new eg(e);this.size=t.size}function eb(e,t){for(var r=e.length;r--;)if(eA(e[r][0],t))return r;return -1}function ew(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Q&&Q in Object(e)?function(e){var t=B.call(e,Q),r=e[Q];try{e[Q]=void 0;var i=!0}catch(e){}var n=V.call(e);return i&&(t?e[Q]=r:delete e[Q]),n}(e):V.call(e)}function e_(e){return eD(e)&&ew(e)==a}function eE(e,t,r,i,n,s){var o=1&r,a=e.length,c=t.length;if(a!=c&&!(o&&c>a))return!1;var l=s.get(e);if(l&&s.get(t))return l==t;var h=-1,u=!0,p=2&r?new ev:void 0;for(s.set(e,t),s.set(t,e);++h<a;){var f=e[h],d=t[h];if(i)var g=o?i(d,f,h,t,e,s):i(f,d,h,e,t,s);if(void 0!==g){if(g)continue;u=!1;break}if(p){if(!function(e,t){for(var r=-1,i=null==e?0:e.length;++r<i;)if(t(e[r],r,e))return!0;return!1}(t,function(e,t){if(!p.has(t)&&(f===e||n(f,e,r,i,s)))return p.push(t)})){u=!1;break}}else if(!(f===d||n(f,d,r,i,s))){u=!1;break}}return s.delete(e),s.delete(t),u}function eI(e){var t;return t=function(e){return null!=e&&eT(e.length)&&!ej(e)?function(e,t){var r,i=eN(e),n=!i&&eC(e),s=!i&&!n&&eq(e),o=!i&&!n&&!s&&ek(e),a=i||n||s||o,c=a?function(e,t){for(var r=-1,i=Array(e);++r<e;)i[r]=t(r);return i}(e.length,String):[],l=c.length;for(var h in e)B.call(e,h)&&!(a&&("length"==h||s&&("offset"==h||"parent"==h)||o&&("buffer"==h||"byteLength"==h||"byteOffset"==h)||(r=null==(r=l)?9007199254740991:r)&&("number"==typeof h||x.test(h))&&h>-1&&h%1==0&&h<r))&&c.push(h);return c}(e):function(e){if(t=e&&e.constructor,e!==("function"==typeof t&&t.prototype||$))return ee(e);var t,r=[];for(var i in Object(e))B.call(e,i)&&"constructor"!=i&&r.push(i);return r}(e)}(e),eN(e)?t:function(e,t){for(var r=-1,i=t.length,n=e.length;++r<i;)e[n+r]=t[r];return e}(t,eS(e))}function ex(e,t){var r,i=e.__data__;return("string"==(r=typeof t)||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==t:null===t)?i["string"==typeof t?"string":"hash"]:i.map}function eP(e,t){var r=null==e?void 0:e[t];return!(!ez(r)||H&&H in r)&&(ej(r)?K:I).test(eO(r))?r:void 0}ed.prototype.clear=function(){this.__data__=eo?eo(null):{},this.size=0},ed.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},ed.prototype.get=function(e){var t=this.__data__;if(eo){var r=t[e];return r===o?void 0:r}return B.call(t,e)?t[e]:void 0},ed.prototype.has=function(e){var t=this.__data__;return eo?void 0!==t[e]:B.call(t,e)},ed.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=eo&&void 0===t?o:t,this},eg.prototype.clear=function(){this.__data__=[],this.size=0},eg.prototype.delete=function(e){var t=this.__data__,r=eb(t,e);return!(r<0)&&(r==t.length-1?t.pop():G.call(t,r,1),--this.size,!0)},eg.prototype.get=function(e){var t=this.__data__,r=eb(t,e);return r<0?void 0:t[r][1]},eg.prototype.has=function(e){return eb(this.__data__,e)>-1},eg.prototype.set=function(e,t){var r=this.__data__,i=eb(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this},ey.prototype.clear=function(){this.size=0,this.__data__={hash:new ed,map:new(er||eg),string:new ed}},ey.prototype.delete=function(e){var t=ex(this,e).delete(e);return this.size-=t?1:0,t},ey.prototype.get=function(e){return ex(this,e).get(e)},ey.prototype.has=function(e){return ex(this,e).has(e)},ey.prototype.set=function(e,t){var r=ex(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this},ev.prototype.add=ev.prototype.push=function(e){return this.__data__.set(e,o),this},ev.prototype.has=function(e){return this.__data__.has(e)},em.prototype.clear=function(){this.__data__=new eg,this.size=0},em.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},em.prototype.get=function(e){return this.__data__.get(e)},em.prototype.has=function(e){return this.__data__.has(e)},em.prototype.set=function(e,t){var r=this.__data__;if(r instanceof eg){var i=r.__data__;if(!er||i.length<199)return i.push([e,t]),this.size=++r.size,this;r=this.__data__=new ey(i)}return r.set(e,t),this.size=r.size,this};var eS=Y?function(e){return null==e?[]:function(e,t){for(var r=-1,i=null==e?0:e.length,n=0,s=[];++r<i;){var o=e[r];t(o,r,e)&&(s[n++]=o)}return s}(Y(e=Object(e)),function(t){return J.call(e,t)})}:function(){return[]},eR=ew;function eO(e){if(null!=e){try{return M.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function eA(e,t){return e===t||e!=e&&t!=t}(et&&eR(new et(new ArrayBuffer(1)))!=E||er&&eR(new er)!=f||ei&&eR(ei.resolve())!=y||en&&eR(new en)!=m||es&&eR(new es)!=w)&&(eR=function(e){var t=ew(e),r=t==g?e.constructor:void 0,i=r?eO(r):"";if(i)switch(i){case ea:return E;case ec:return f;case el:return y;case eh:return m;case eu:return w}return t});var eC=e_(function(){return arguments}())?e_:function(e){return eD(e)&&B.call(e,"callee")&&!J.call(e,"callee")},eN=Array.isArray,eq=X||function(){return!1};function ej(e){if(!ez(e))return!1;var t=ew(e);return t==p||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}function eT(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function ez(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eD(e){return null!=e&&"object"==typeof e}var ek=T?function(e){return T(e)}:function(e){return eD(e)&&eT(e.length)&&!!P[ew(e)]};e.exports=function(e,t){return function e(t,r,i,n,s){return t===r||(null!=t&&null!=r&&(eD(t)||eD(r))?function(e,t,r,i,n,s){var o=eN(e),p=eN(t),y=o?c:eR(e),w=p?c:eR(t);y=y==a?g:y,w=w==a?g:w;var I=y==g,x=w==g,P=y==w;if(P&&eq(e)){if(!eq(t))return!1;o=!0,I=!1}if(P&&!I)return s||(s=new em),o||ek(e)?eE(e,t,r,i,n,s):function(e,t,r,i,n,s,o){switch(r){case E:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)break;e=e.buffer,t=t.buffer;case _:if(e.byteLength!=t.byteLength||!s(new W(e),new W(t)))break;return!0;case l:case h:case d:return eA(+e,+t);case u:return e.name==t.name&&e.message==t.message;case v:case b:return e==t+"";case f:var a=z;
20case m:var c=1&i;if(a||(a=D),e.size!=t.size&&!c)break;var p=o.get(e);if(p)return p==t;i|=2,o.set(e,t);var g=eE(a(e),a(t),i,n,s,o);return o.delete(e),g;case"[object Symbol]":if(ef)return ef.call(e)==ef.call(t)}return!1}(e,t,y,r,i,n,s);if(!(1&r)){var S=I&&B.call(e,"__wrapped__"),R=x&&B.call(t,"__wrapped__");if(S||R){var O=S?e.value():e,A=R?t.value():t;return s||(s=new em),n(O,A,r,i,s)}}return!!P&&(s||(s=new em),function(e,t,r,i,n,s){var o=1&r,a=eI(e),c=a.length;if(c!=eI(t).length&&!o)return!1;for(var l=c;l--;){var h=a[l];if(!(o?h in t:B.call(t,h)))return!1}var u=s.get(e);if(u&&s.get(t))return u==t;var p=!0;s.set(e,t),s.set(t,e);for(var f=o;++l<c;){var d=e[h=a[l]],g=t[h];if(i)var y=o?i(g,d,h,t,e,s):i(d,g,h,e,t,s);if(!(void 0===y?d===g||n(d,g,r,i,s):y)){p=!1;break}f||(f="constructor"==h)}if(p&&!f){var v=e.constructor,m=t.constructor;v!=m&&"constructor"in e&&"constructor"in t&&!("function"==typeof v&&v instanceof v&&"function"==typeof m&&m instanceof m)&&(p=!1)}return s.delete(e),s.delete(t),p}(e,t,r,i,n,s))}(t,r,i,n,e,s):t!=t&&r!=r)}(e,t)}},52423:function(e){"use strict";let t=self.fetch.bind(self);e.exports=t,e.exports.default=e.exports},95172:function(e){"use strict";function t(e){try{return JSON.stringify(e)}catch(e){return'"[Circular]"'}}e.exports=function(e,r,i){var n=i&&i.stringify||t;if("object"==typeof e&&null!==e){var s=r.length+1;if(1===s)return e;var o=Array(s);o[0]=n(e);for(var a=1;a<s;a++)o[a]=n(r[a]);return o.join(" ")}if("string"!=typeof e)return e;var c=r.length;if(0===c)return e;for(var l="",h=0,u=-1,p=e&&e.length||0,f=0;f<p;){if(37===e.charCodeAt(f)&&f+1<p){switch(u=u>-1?u:0,e.charCodeAt(f+1)){case 100:case 102:if(h>=c||null==r[h])break;u<f&&(l+=e.slice(u,f)),l+=Number(r[h]),u=f+2,f++;break;case 105:if(h>=c||null==r[h])break;u<f&&(l+=e.slice(u,f)),l+=Math.floor(Number(r[h])),u=f+2,f++;break;case 79:case 111:case 106:if(h>=c||void 0===r[h])break;u<f&&(l+=e.slice(u,f));var d=typeof r[h];if("string"===d){l+="'"+r[h]+"'",u=f+2,f++;break}if("function"===d){l+=r[h].name||"<anonymous>",u=f+2,f++;break}l+=n(r[h]),u=f+2,f++;break;case 115:if(h>=c)break;u<f&&(l+=e.slice(u,f)),l+=String(r[h]),u=f+2,f++;break;case 37:u<f&&(l+=e.slice(u,f)),l+="%",u=f+2,f++,h--}++h}++f}return -1===u?e:(u<p&&(l+=e.slice(u)),l)}},97435:function(e,t,r){"use strict";let i=r(95172);e.exports=s;let n=function(){function e(e){return void 0!==e&&e}try{if("undefined"!=typeof globalThis)return globalThis;return Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch(t){return e(self)||e(window)||e(this)||{}}}().console||{};function s(e){var t,r;(e=e||{}).browser=e.browser||{};let i=e.browser.transmit;if(i&&"function"!=typeof i.send)throw Error("pino: transmit option must have a send function");let h=e.browser.write||n;e.browser.write&&(e.browser.asObject=!0);let u=e.serializers||{},g=Array.isArray(t=e.browser.serialize)?t.filter(function(e){return"!stdSerializers.err"!==e}):!0===t&&Object.keys(u),y=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(y=!1),"function"==typeof h&&(h.error=h.fatal=h.warn=h.info=h.debug=h.trace=h),!1===e.enabled&&(e.level="silent");let v=e.level||"info",m=Object.create(h);m.log||(m.log=p),Object.defineProperty(m,"levelVal",{get:function(){return"silent"===this.level?1/0:this.levels.values[this.level]}}),Object.defineProperty(m,"level",{get:function(){return this._level},set:function(e){if("silent"!==e&&!this.levels.values[e])throw Error("unknown level "+e);this._level=e,o(b,m,"error","log"),o(b,m,"fatal","error"),o(b,m,"warn","error"),o(b,m,"info","log"),o(b,m,"debug","log"),o(b,m,"trace","log")}});let b={transmit:i,serialize:g,asObject:e.browser.asObject,levels:["error","fatal","warn","info","debug","trace"],timestamp:"function"==typeof(r=e).timestamp?r.timestamp:!1===r.timestamp?f:d};return m.levels=s.levels,m.level=v,m.setMaxListeners=m.getMaxListeners=m.emit=m.addListener=m.on=m.prependListener=m.once=m.prependOnceListener=m.removeListener=m.removeAllListeners=m.listeners=m.listenerCount=m.eventNames=m.write=m.flush=p,m.serializers=u,m._seri
20alize=g,m._stdErrSerialize=y,m.child=function(t,r){if(!t)throw Error("missing bindings for child Pino");r=r||{},g&&t.serializers&&(r.serializers=t.serializers);let n=r.serializers;if(g&&n){var s=Object.assign({},u,n),o=!0===e.browser.serialize?Object.keys(s):g;delete t.serializers,a([t],o,s,this._stdErrSerialize)}function h(e){this._childLevel=(0|e._childLevel)+1,this.error=c(e,t,"error"),this.fatal=c(e,t,"fatal"),this.warn=c(e,t,"warn"),this.info=c(e,t,"info"),this.debug=c(e,t,"debug"),this.trace=c(e,t,"trace"),s&&(this.serializers=s,this._serialize=o),i&&(this._logEvent=l([].concat(e._logEvent.bindings,t)))}return h.prototype=this,new h(this)},i&&(m._logEvent=l()),m}function o(e,t,r,o){let c=Object.getPrototypeOf(t);t[r]=t.levelVal>t.levels.values[r]?p:c[r]?c[r]:n[r]||n[o]||p,function(e,t,r){if(e.transmit||t[r]!==p){var o;t[r]=(o=t[r],function(){let c=e.timestamp(),h=Array(arguments.length),u=Object.getPrototypeOf&&Object.getPrototypeOf(this)===n?n:this;for(var p=0;p<h.length;p++)h[p]=arguments[p];if(e.serialize&&!e.asObject&&a(h,this._serialize,this.serializers,this._stdErrSerialize),e.asObject?o.call(u,function(e,t,r,n){e._serialize&&a(r,e._serialize,e.serializers,e._stdErrSerialize);let o=r.slice(),c=o[0],l={};n&&(l.time=n),l.level=s.levels.values[t];let h=(0|e._childLevel)+1;if(h<1&&(h=1),null!==c&&"object"==typeof c){for(;h--&&"object"==typeof o[0];)Object.assign(l,o.shift());c=o.length?i(o.shift(),o):void 0}else"string"==typeof c&&(c=i(o.shift(),o));return void 0!==c&&(l.msg=c),l}(this,r,h,c)):o.apply(u,h),e.transmit){let i=e.transmit.level||t.level,n=s.levels.values[i],o=s.levels.values[r];if(o<n)return;(function(e,t,r){let i=t.send,n=t.ts,s=t.methodLevel,o=t.methodValue,c=t.val,h=e._logEvent.bindings;a(r,e._serialize||Object.keys(e.serializers),e.serializers,void 0===e._stdErrSerialize||e._stdErrSerialize),e._logEvent.ts=n,e._logEvent.messages=r.filter(function(e){return -1===h.indexOf(e)}),e._logEvent.level.label=s,e._logEvent.level.value=o,i(s,e._logEvent,c),e._logEvent=l(h)})(this,{ts:c,methodLevel:r,methodValue:o,transmitLevel:i,transmitValue:s.levels.values[e.transmit.level||t.level],send:e.transmit.send,val:t.levelVal},h)}})}}(e,t,r)}function a(e,t,r,i){for(let n in e)if(i&&e[n]instanceof Error)e[n]=s.stdSerializers.err(e[n]);else if("object"==typeof e[n]&&!Array.isArray(e[n]))for(let i in e[n])t&&t.indexOf(i)>-1&&i in r&&(e[n][i]=r[i](e[n][i]))}function c(e,t,r){return function(){let i=Array(1+arguments.length);i[0]=t;for(var n=1;n<i.length;n++)i[n]=arguments[n-1];return e[r].apply(this,i)}}function l(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function h(){return{}}function u(e){return e}function p(){}function f(){return!1}function d(){return Date.now()}s.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},s.stdSerializers={mapHttpRequest:h,mapHttpResponse:h,wrapRequestSerializer:u,wrapResponseSerializer:u,wrapErrorSerializer:u,req:h,res:h,err:function(e){let t={type:e.constructor.name,msg:e.message,stack:e.stack};for(let r in e)void 0===t[r]&&(t[r]=e[r]);return t}},s.stdTimeFunctions=Object.assign({},{nullTime:f,epochTime:d,unixTime:function(){return Math.round(Date.now()/1e3)},isoTime:function(){return new Date(Date.now()).toISOString()}})}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.