1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5400],{40926:function(e,t,r){"use strict";function i(){return(null===r.g||void 0===r.g?void 0:r.g.crypto)||(null===r.g||void 0===r.g?void 0:r.g.msCrypto)||{}}function n(){let e=i();return e.subtle||e.webkitSubtle}Object.defineProperty(t,"__esModule",{value:!0}),t.isBrowserCryptoAvailable=t.getSubtleCrypto=t.getBrowerCrypto=void 0,t.getBrowerCrypto=i,t.getSubtleCrypto=n,t.isBrowserCryptoAvailable=function(){return!!i()&&!!n()}},88618:function(e,t,r){"use strict";var i=r(83454);function n(){return"undefined"==typeof document&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product}function s(){return void 0!==i&&void 0!==i.versions&&void 0!==i.versions.node}Object.defineProperty(t,"__esModule",{value:!0}),t.isBrowser=t.isNode=t.isReactNative=void 0,t.isReactNative=n,t.isNode=s,t.isBrowser=function(){return!n()&&!s()}},1468:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let i=r(34308);i.__exportStar(r(40926),t),i.__exportStar(r(88618),t)},34308: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 u},__classPrivateFieldGet:function(){return x},__classPrivateFieldSet:function(){return S},__createBinding:function(){return f},__decorate:function(){return a},__exportStar:function(){return p},__extends:function(){return n},__generator:function(){return h},__importDefault:function(){return P},__importStar:function(){return I}
1,__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)}
1function u(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 h(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 f(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}function p(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):u(s[0][2],r)}catch(e){u(s[0][3],e)}}function c(e){a("next",e)}function l(e){a("throw",e)}function u(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}function 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 P(e){return e&&e.__esModule?e:{default:e}}function x(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}},85400:function(e,t,r){"use strict";let i;r.d(t,{EthereumProvider:function(){return oh}});var n=r(17187),s=r.n(n),o=r(88338);let a=/"(?:_|\\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*:/,c=/"(?: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*:/,l=/^\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 h(e,t={}){if("string"!=typeof e)return e;let r=e.trim();if('"'===e[0]&&e.endsWith('"')&&!e.includes("\\"))return r.slice(1,-1);if(r.length<=9){let e=r.toLowerCase();if("true"===e)return!0;
1if("false"===e)return!1;if("undefined"===e)return;if("null"===e)return null;if("nan"===e)return Number.NaN;if("infinity"===e)return Number.POSITIVE_INFINITY;if("-infinity"===e)return Number.NEGATIVE_INFINITY}if(!l.test(e)){if(t.strict)throw SyntaxError("[destr] Invalid JSON");return e}try{if(a.test(e)||c.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(48764).Buffer;function p(e,...t){try{var r;return(r=e(...t))&&"function"==typeof r.then?r:Promise.resolve(r)}catch(e){return Promise.reject(e)}}function d(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 d(e.toJSON());throw Error("[unstorage] Cannot stringify value!")}let g="base64:";function y(e){return e&&e.split("?")[0]?.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,"")||""}function v(e){return(e=y(e))?e+":":""}let m=()=>{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 b(e,t,r){return e.watch?e.watch((e,i)=>t(e,r+i)):()=>{}}async function w(e){"function"==typeof e.dispose&&await p(e.dispose)}function _(e){return new Promise((t,r)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>r(e.error)})}function E(e,t){let r=indexedDB.open(e);r.onupgradeneeded=()=>r.result.createObjectStore(t);let i=_(r);return(e,r)=>i.then(i=>r(i.transaction(t,e).objectStore(t)))}function I(){return i||(i=E("keyval-store","keyval")),i}function P(e,t=I()){return t("readonly",t=>_(t.get(e)))}let x=e=>JSON.stringify(e,(e,t)=>"bigint"==typeof t?t.toString()+"n":t),S=e=>JSON.parse(e.replace(/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,'$1"$2n"$3'),(e,t)=>"string"==typeof t&&t.match(/^\d+n$/)?BigInt(t.substring(0,t.length-1)):t);function O(e){if("string"!=typeof e)throw Error(`Cannot safe json parse value of type ${typeof e}`);try{return S(e)}catch(t){return e}}function A(e){return"string"==typeof e?e:x(e)||""}var R=(e={})=>{let t;let r=e.base&&e.base.length>0?`${e.base}:`:"",i=e=>r+e;return e.dbName&&e.storeName&&(t=E(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=I()){return r("readwrite",r=>(r.put(t,e),_(r.transaction)))})(i(e),r,t),removeItem:e=>(function(e,t=I()){return t("readwrite",t=>(t.delete(e),_(t.transaction)))})(i(e),t),getKeys:()=>(function(e=I()){return e("readonly",e=>{var t;if(e.getAllKeys)return _(e.getAllKeys());let r=[];return(t=e=>r.push(e.key),e.openCursor().onsuccess=function(){this.result&&(t(this.result),this.result.continue())},_(e.transaction)).then(()=>r)})})(t),clear:()=>(function(e=I()){return e("readwrite",e=>(e.clear(),_(e.transaction)))})(t)}};class C{constructor(){this.indexedDb=function(e={}){let t={mounts:{"":e.driver||m()},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=y(r),t.watchListeners))i(e,r)},s=async()=>{if(!t.watching)for(let e in t.watching=!0,t.mounts)t.unwatch[e]=await b(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=y(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=y(e));return p(n.hasItem,i,t)},getItem(e,t={}){let{relativeKey:i,driver:n}=r(e=y(e));return p(n.getItem,i,t).then(e=>h(e))},getItems:(e,t={})=>a(e,t,e=>e.driver.getItems?p(e.driver.getItems,e.items.map(e=>({key:e.relativeKey,options:e.options})),t).then(t=>t.map(t=>({key:function(...e){return y(e.join(":"))}(e.base,t.key),value:h(t.value)}))):Promise.all(e.items.map(t=>p(e.driver.getItem,t.relativeKey,t.options).then(e=>({key:t.key,value:h(e)}))))),getItemRaw(e,t={}){let{relativeKey:i,driver:n}=r(e=y(e));return n.getItemRaw?p(n.getItemRaw,i,t):p(n.getItem,i,t).then(e=>{var t;return"string"==typeof e&&e.startsWith(g)?(t=e.slice(g.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=y(e));
1o.setItem&&(await p(o.setItem,s,d(t),i),o.watch||n("update",e))},async setItems(e,t){await a(e,t,async e=>{if(e.driver.setItems)return p(e.driver.setItems,e.items.map(e=>({key:e.relativeKey,value:d(e.value),options:e.options})),t);e.driver.setItem&&await Promise.all(e.items.map(t=>p(e.driver.setItem,t.relativeKey,d(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=y(e));if(o.setItemRaw)await p(o.setItemRaw,s,t,i);else{if(!o.setItem)return;await p(o.setItem,s,"string"==typeof t?t:g+(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=y(e));s.removeItem&&(await p(s.removeItem,i,t),(t.removeMeta||t.removeMata)&&await p(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=y(e)),s=Object.create(null);if(n.getMeta&&Object.assign(s,await p(n.getMeta,i,t)),!t.nativeOnly){let e=await p(n.getItem,i+"$",t).then(e=>h(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=v(e),!0),n=[],s=[];for(let e of r){for(let r of(await p(e.driver.getKeys,e.relativeBase,t))){let t=e.mountpoint+y(r);n.some(e=>t.startsWith(e))||s.push(t)}n=[e.mountpoint,...n.filter(t=>!t.startsWith(e.mountpoint))]}return e?s.filter(t=>t.startsWith(e)&&"$"!==t[t.length-1]):s.filter(e=>"$"!==e[e.length-1])},async clear(e,t={}){e=v(e),await Promise.all(i(e,!1).map(async e=>e.driver.clear?p(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=>w(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=v(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(b(r,n,e)).then(r=>{t.unwatch[e]=r}).catch(console.error),c},async unmount(e,r=!0){(e=v(e))&&t.mounts[e]&&(t.watching&&e in t.unwatch&&(t.unwatch[e]?.(),delete t.unwatch[e]),r&&await w(t.mounts[e]),t.mountpoints=t.mountpoints.filter(t=>t!==e),delete t.mounts[e])},getMount(e=""){let t=r(e=y(e)+":");return{driver:t.driver,base:t.base}},getMounts:(e="",t={})=>i(e=y(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,A(t))}async removeItem(e){await this.indexedDb.removeItem(e)}}var N="u">typeof globalThis?globalThis:"u">typeof window?window:"u">typeof r.g?r.g:"u">typeof self?self:{},j={exports:{}};function T(e){var t;return[e[0],O(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 N&&N.localStorage?j.exports=N.localStorage:"u">typeof window&&window.localStorage?j.exports=window.localStorage:j.exports=new e}();class q{constructor(){this.localStorage=j.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(T)}async getItem(e){let t=this.localStorage.getItem(e);if(null!==t)return O(t)}async setItem(e,t){this.localStorage.setItem(e,A(t))}async removeItem(e){this.localStorage.removeItem(e)}}let D=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),z(e,o)},z=async(e,t)=>{t.length&&t.forEach(async t=>{await e.removeItem(t)})};class k{constructor(){this.initialized=!1,this.setInitialized=e=>{this.storage=e,this.initialized=!0};let e=new q;this.storage=e;try{let t=new C;D(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)})}}var U=r(90772),L=r(36559),B=r.n(L);let M={level:"info"},$="custom_context";var H=Object.defineProperty,V=Object.defineProperties,K=Object.getOwnPropertyDescriptors,F=Object.getOwnPropertySymbols,Z=Object.prototype.hasOwnProperty,W=Object.prototype.propertyIsEnumerable,G=(e,t,r)=>t in e?H(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,J=(e,t)=>
1{for(var r in t||(t={}))Z.call(t,r)&&G(e,r,t[r]);if(F)for(var r of F(t))W.call(t,r)&&G(e,r,t[r]);return e},Q=(e,t)=>V(e,K(t));function Y(e){return Q(J({},e),{level:e?.level||M.level})}function X(e,t=$){return typeof e.bindings>"u"?function(e,t=$){return e[t]||""}(e,t):e.bindings().context||""}function ee(e,t,r=$){let i=function(e,t,r=$){let i=X(e,r);return i.trim()?`${i}/${t}`:t}(e,t,r);return function(e,t,r=$){return e[r]=t,e}(e.child({context:i}),i,r)}var et=r(38200);class er extends et.q{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}}class ei extends et.q{constructor(e,t){super(),this.core=e,this.logger=t,this.records=new Map}}class en{constructor(e,t){this.logger=e,this.core=t}}class es extends et.q{constructor(e,t){super(),this.relayer=e,this.logger=t}}class eo extends et.q{constructor(e){super()}}class ea{constructor(e,t,r,i){this.core=e,this.logger=t,this.name=r}}class ec extends et.q{constructor(e,t){super(),this.relayer=e,this.logger=t}}class el extends et.q{constructor(e,t){super(),this.core=e,this.logger=t}}class eu{constructor(e,t){this.projectId=e,this.logger=t}}class eh{constructor(e,t){this.projectId=e,this.logger=t}}class ef{constructor(e){this.opts=e,this.protocol="wc",this.version=2}}class ep{constructor(e){this.client=e}}var ed=r(66736);function eg(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 ey(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 ev="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,em=e=>new DataView(e.buffer,e.byteOffset,e.byteLength);function eb(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)),eg(e),e}class ew{clone(){return this._cloneInto()}}function e_(e=32){if(ev&&"function"==typeof ev.getRandomValues)return ev.getRandomValues(new Uint8Array(e));if(ev&&"function"==typeof ev.randomBytes)return ev.randomBytes(e);throw Error("crypto.getRandomValues must be defined")}
1class eE extends ew{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=em(this.buffer)}update(e){ey(this);let{view:t,buffer:r,blockLen:i}=this,n=(e=eb(e)).length;for(let s=0;s<n;){let o=Math.min(i-this.pos,n-s);if(o===i){let t=em(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){ey(this),function(e,t){eg(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=em(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 eI=BigInt(4294967296-1),eP=BigInt(32),ex={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&eI),l:Number(e>>eP&eI)}:{h:0|Number(e>>eP&eI),l:0|Number(e&eI)}}(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)},[eS,eO]=ex.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),eR=new Uint32Array(80);class eC extends eE{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:u,Fl:h,Gh:f,Gl:p,Hh:d,Hl:g}=this;return[e,t,r,i,n,s,o,a,c,l,u,h,f,p,d,g]}set(e,t,r,i,n,s,o,a,c,l,u,h,f,p,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|u,this.Fl=0|h,this.Gh=0|f,this.Gl=0|p,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),eR[r]=e.getUint32(t+=4);for(let e=16;e<80;e++){let t=0|eA[e-15],r=0|eR[e-15],i=ex.rotrSH(t,r,1)^ex.rotrSH(t,r,8)^ex.shrSH(t,r,7),n=ex.rotrSL(t,r,1)^ex.rotrSL(t,r,8)^ex.shrSL(t,r,7),s=0|eA[e-2],o=0|eR[e-2],a=ex.rotrSH(s,o,19)^ex.rotrBH(s,o,61)^ex.shrSH(s,o,6),c=ex.rotrSL(s,o,19)^ex.rotrBL(s,o,61)^ex.shrSL(s,o,6),l=ex.add4L(n,c,eR[e-7],eR[e-16]),u=ex.add4H(l,i,a,eA[e-7],eA[e-16]);eA[e]=0|u,eR[e]=0|l}let{Ah:r,Al:i,Bh:n,Bl:s,Ch:o,Cl:a,Dh:c,Dl:l,Eh:u,El:h,Fh:f,Fl:p,Gh:d,Gl:g,Hh:y,Hl:v}=this;for(let e=0;e<80;e++){let t=ex.rotrSH(u,h,14)^ex.rotrSH(u,h,18)^ex.rotrBH(u,h,41),m=ex.rotrSL(u,h,14)^ex.rotrSL(u,h,18)^ex.rotrBL(u,h,41),b=u&f^~u&d,w=h&p^~h&g,_=ex.add5L(v,m,w,eO[e],eR[e]),E=ex.add5H(_,y,t,b,eS[e],eA[e]),I=0|_,P=ex.rotrSH(r,i,28)^ex.rotrBH(r,i,34)^ex.rotrBH(r,i,39),x=ex.rotrSL(r,i,28)^ex.rotrBL(r,i,34)^ex.rotrBL(r,i,39),S=r&n^r&o^n&o,O=i&s^i&a^s&a;y=0|d,v=0|g,d=0|f,g=0|p,f=0|u,p=0|h,({h:u,l:h}=ex.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 A=ex.add3L(I,x,O);r=ex.add3H(A,E,P,S),i=0|A}({h:r,l:i}=ex.add(0|this.Ah,0|this.Al,0|r,0|i)),({h:n,l:s}=ex.add(0|this.Bh,0|this.Bl,0|n,0|s)),({h:o,l:a}=ex.add(0|this.Ch,0|this.Cl,0|o,0|a)),({h:c,l:l}=ex.add(0|this.Dh,0|this.Dl,0|c,0|l)),({h:u,l:h}=ex.add(0|this.Eh,0|this.El,0|u,0|h)),({h:f,l:p}=ex.add(0|this.Fh,0|this.Fl,0|f,0|p)),({h:d,l:g}=ex.add(0|this.Gh,0|this.Gl,0|d,0|g)),({h:y,l:v}=ex.add(0|this.Hh,0|this.Hl,0|y,0|v)),this.set(r,i,n,s,o,a,c,l,u,h,f,p,d,g,y,v)}roundClean(){eA.fill(0),eR.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 eN=function(e){let t=t=>e().update(eb(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}(()=>new eC),ej=BigInt(0),eT=BigInt(1),eq=BigInt(2);function eD(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function ez(e){if(!eD(e))throw Error("Uint8Array expected")}function ek(e,t){if("boolean"!=typeof t)throw Error(e+" boolean expected, got "+t)}let eU=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function eL(e){ez(e);let t="";for(let r=0;r<e.length;r++)t+=eU[e[r]];return t}function eB(e){if("string"!=typeof e)throw Error("hex string expected, got "+typeof e);return""===e?ej:BigInt("0x"+e)}let eM={_0:48,_9:57,A:65,F:70,a:97,f:102};function e$(e){return e>=eM._0&&e<=eM._9?e-eM._0:e>=eM.A&&e<=eM.F?e-(eM.A-10):e>=eM.a&&e<=eM.f?e-(eM.a-10):void 0}function eH(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=e$(e.charCodeAt(n)),s=e$(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 eV(e){return ez(e),eB(eL(Uint8Array.from(e).reverse()))}function eK(e,t){return eH(e.toString(16).padStart(2*t,"0"))}function eF(e,t){return eK(e,t).reverse()}function eZ(e,t,r){let i;if("string"==typeof t)try{i=eH(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 eW(...e){let t=0;for(let r=0;r<e.length;r++){let i=e[r];ez(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;
1function eJ(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 eQ=e=>(eq<<BigInt(e-1))-eT,eY={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 eX(e,t,r={}){let i=(t,r,i)=>{let n=eY[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 invalid. 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 e0(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 e1=BigInt(0),e2=BigInt(1),e3=BigInt(2),e8=BigInt(3),e5=BigInt(4),e6=BigInt(5),e4=BigInt(8);function e9(e,t){let r=e%t;return r>=e1?r:t+r}function e7(e,t,r){let i=e;for(;t-- >e1;)i*=i,i%=r;return i}function te(e,t){if(e===e1)throw Error("invert: expected non-zero number");if(t<=e1)throw Error("invert: expected positive modulus, got "+t);let r=e9(e,t),i=t,n=e1,s=e2;for(;r!==e1;){let e=i/r,t=i%r,o=n-s*e;i=r,r=t,n=s,s=o}if(i!==e2)throw Error("invert: does not exist");return e9(n,t)}let tt=(e,t)=>(e9(e,t)&e2)===e2,tr=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function ti(e,t){let r=void 0!==t?t:e.toString(2).length;return{nBitLength:r,nByteLength:Math.ceil(r/8)}}function tn(e,t,r=!1,i={}){let n;if(e<=e1)throw Error("invalid field: expected ORDER > 0, got "+e);let{nBitLength:s,nByteLength:o}=ti(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:eQ(s),ZERO:e1,ONE:e2,create:t=>e9(t,e),isValid:t=>{if("bigint"!=typeof t)throw Error("invalid field element: expected bigint, got "+typeof t);return e1<=t&&t<e},is0:e=>e===e1,isOdd:e=>(e&e2)===e2,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<e1)throw Error("invalid exponent, negatives unsupported");if(r===e1)return e.ONE;if(r===e2)return t;let i=e.ONE,n=t;for(;r>e1;)r&e2&&(i=e.mul(i,n)),n=e.sqr(n),r>>=e2;return i})(a,e,t),div:(t,r)=>e9(t*te(r,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>te(t,e),sqrt:i.sqrt||(t=>(n||(n=function(e){if(e%e5===e8){let t=(e+e2)/e5;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%e4===e6){let t=(e-e6)/e4;return function(e,r){let i=e.mul(r,e3),n=e.pow(i,t),s=e.mul(r,n),o=e.mul(e.mul(s,e3),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-e2)/e3;for(t=e-e2,r=0;t%e3===e1;t/=e3,r++);for(i=e3;i<e&&function(e,t,r){if(t<e1)throw Error("invalid exponent, negatives unsupported");if(r<=e1)throw Error("invalid modulus");if(r===e2)return e1;let i=e2;for(;t>e1;)t&e2&&(i=i*e%r),e=e*e%r,t>>=e2;return i}(i,n,e)!==e-e2;i++)if(i>1e3)throw Error("Cannot find square root: likely non-prime P");if(1===r){let t=(e+e2)/e5;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+e2)/e3;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),u=e.pow(o,t);for(;!e.eql(u,e.ONE);){if(e.eql(u,e.ZERO))return e.ZERO;let t=1;for(let r=e.sqr(u);t<a&&!e.eql(r,e.ONE);t++)r=e.sqr(r);let r=e.pow(c,e2<<BigInt(a-t-1));c=e.sqr(r),l=e.mul(l,r),u=e.mul(u,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?eF(e,o):eK(e,o),fromBytes:e=>{if(e.length!==o)throw Error("Field.fromBytes: expected "+o+" bytes, got "+e.length);return r?eV(e):eB(eL(e))}});return Object.freeze(a)}let ts=BigInt(0),to=BigInt(1);function ta(e,t){let r=t.negate();return e?r:t}function tc(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw Error("invalid window size, expected [1.."+t+"], got W="+e)}function tl(e,t){return tc(e,t),{windows:Math.ceil(t/e)+1,windowSize:2**(e-1)}}let tu=new WeakMap,th=new WeakMap;function tf(e){return th.get(e)||1}let tp=BigInt(0),td=BigInt(1),tg=BigInt(2),ty=BigInt(8),tv={zip215:!0};BigInt(0),BigInt(1);let tm=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),tb=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt(0);let tw=BigInt(1),t_=BigInt(2);BigInt(3);let tE=BigInt(5),tI=BigInt(8),tP=tn(tm,void 0,!0),tx=function(e){var t;let r=function(e){let t=(eX(e.Fp,tr.reduce((e,t)=>
1(e[t]="function",e),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),eX(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...ti(e.n,e.nBitLength),...e,p:e.Fp.ORDER}));return eX(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,u=tg<<BigInt(8*c)-td,h=i.create,f=tn(r.n,r.nBitLength),p=r.uvRatio||((e,t)=>{try{return{isValid:!0,value:i.sqrt(e*i.inv(t))}}catch{return{isValid:!1,value:tp}}}),d=r.adjustScalarBytes||(e=>e),g=r.domain||((e,t,r)=>{if(ek("phflag",r),t.length||r)throw Error("Contexts/pre-hash are not supported");return e});function y(e,t){eJ("coordinate "+e,t,tp,u)}function v(e){if(!(e instanceof w))throw Error("ExtendedPoint expected")}let m=e0((e,t)=>{let{ex:r,ey:n,ez:s}=e,o=e.is0();null==t&&(t=o?ty:i.inv(s));let a=h(r*t),c=h(n*t),l=h(s*t);if(o)return{x:tp,y:td};if(l!==td)throw Error("invZ was invalid");return{x:a,y:c}}),b=e0(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=h(n*n),l=h(s*s),u=h(o*o),f=h(u*u),p=h(c*t);if(h(u*h(p+l))!==h(f+h(i*h(c*l))))throw Error("bad point: equation left != right (1)");if(h(n*s)!==h(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,td,h(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,u=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(u=u.add(t),0!==e)for(let e=0;e<o;e++)u=u.double()}return u}(w,f,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=h(t*o),c=h(n*i),l=h(r*o),u=h(s*i);return a===c&&l===u}is0(){return this.equals(w.ZERO)}negate(){return new w(h(-this.ex),this.ey,this.ez,h(-this.et))}double(){let{a:e}=r,{ex:t,ey:i,ez:n}=this,s=h(t*t),o=h(i*i),a=h(tg*h(n*n)),c=h(e*s),l=t+i,u=h(h(l*l)-s-o),f=c+o,p=f-a,d=c-o,g=h(u*p),y=h(f*d),v=h(u*d);return new w(g,y,h(p*f),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:u,et:f}=e;if(t===BigInt(-1)){let e=h((s-n)*(l+c)),t=h((s+n)*(l-c)),r=h(t-e);if(r===tp)return this.double();let i=h(o*tg*f),p=h(a*tg*u),d=p+i,g=t+e,y=p-i,v=h(d*r),m=h(g*y),b=h(d*y);return new w(v,m,h(r*g),b)}let p=h(n*c),d=h(s*l),g=h(a*i*f),y=h(o*u),m=h((n+s)*(c+l)-p-d),b=y-g,_=y+g,E=h(d-t*p),I=h(m*b),P=h(_*E),x=h(m*E);return new w(I,P,h(b*_),x)}subtract(e){return this.add(e.negate())}wNAF(e){return I.wNAFCached(this,e,w.normalizeZ)}multiply(e){eJ("scalar",e,td,n);let{p:t,f:r}=this.wNAF(e);return w.normalizeZ([t,r])[0]}multiplyUnsafe(e,t=w.ZERO){return eJ("scalar",e,tp,n),e===tp?E:this.is0()||e===td?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===td?this:this.multiplyUnsafe(e)}static fromHex(e,t=!1){let{d:n,a:s}=r,o=i.BYTES;e=eZ("pointHex",e,o),ek("zip215",t);let a=e.slice(),c=e[o-1];a[o-1]=-129&c;let l=eV(a);eJ("pointHex.y",l,tp,t?u:i.ORDER);let f=h(l*l),{isValid:d,value:g}=p(h(f-td),h(n*f-s));if(!d)throw Error("Point.fromHex: invalid y coordinate");let y=(g&td)===td,v=(128&c)!=0;if(!t&&g===tp&&v)throw Error("Point.fromHex: x=0 and x_0=1");return v!==y&&(g=h(-g)),w.fromAffine({x:g,y:l})}static fromPrivateKey(e){return P(e).point}toRawBytes(){let{x:e,y:t}=this.toAffine(),r=eF(t,i.BYTES);return r[r.length-1]|=e&td?128:0,r}toHex(){return eL(this.toRawBytes())}}w.BASE=new w(r.Gx,r.Gy,td,h(r.Gx*r.Gy)),w.ZERO=new w(tp,td,td,tp);let{BASE:_,ZERO:E}=w,I=(t=8*c,{constTimeNegate:ta,hasPrecomputes:e=>1!==tf(e),unsafeLadder(e,t,r=w.ZERO){let i=e;for(;t>ts;)t&to&&(r=r.add(i)),i=i.double(),t>>=to;return r},precomputeWindow(e,r){let{windows:i,windowSize:n}=tl(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}=tl(e,t),o=w.ZERO,a=w.BASE,c=BigInt(2**e-1),l=2**e,u=BigInt(e);for(let e=0;e<n;e++){let t=e*s,n=Number(i&c);i>>=u,n>s&&(n-=l,i+=to);let h=t+Math.abs(n)-1,f=e%2!=0,p=n<0;0===n?a=a.add(ta(f,r[t])):o=o.add(ta(p,r[h]))}return{p:o,f:a}},wNAFUnsafe(e,r,i,n=w.ZERO){let{windows:s,windowSize:o}=tl(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===ts)break;let s=Number(i&a);if(i>>=l,s>o&&(s-=c,i+=to),0===s)continue;let u=r[t+Math.abs(s)-1];s<0&&(u=u.negate()),n=n.add(u)}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){tc(r,t),th.set(e,r),tu.delete(e)}});function P(e){let t=i.BYTES;e=eZ("private key",e,t);let r=eZ("hashed private key",o(e),2*t),s=d(r.slice(0,t)),a=r.slice(t,2*t),c=e9(eV(s),n),l=_.multiply(c),u=l.toRawBytes();return{head:s,prefix:a,scalar:c,point:l,pointBytes:u}}function x(e=new Uint8Array,...t){return e9(eV(o(g(eW(...t),eZ("context",e),!!s))),n)}return _._setWindowSize(8),{CURVE:r,getPublicKey:function(e){return P(e).pointBytes},sign:function(e,t,r={}){e=eZ("message",e),s&&(e=s(e));let{prefix:o,scalar:a,pointBytes:c}=P(t),l=x(r.context,o,e),u=_.multiply(l).toRawBytes(),h=e9(l+x(r.context,u,c,e)*a,n);return eJ("signature.s",h,tp,n),eZ("result",eW(u,eF(h,i.BYTES)),2*i.BYTES)},verify:function(e,t,r,n=tv){let o,a,c;let{context:l,zip215:u}=n,h=i.BYTES;e=eZ("signature",e,2*h),t=eZ("message",t),r=eZ("publicKey",r,h),void 0!==u&&ek("zip215",u),s&&(t=s(t));let f=eV(e.slice(h,2*h));try{o=w.fromHex(r,u),a=w.fromHex(e.slice(0,h),u),c=_.multiplyUnsafe(f)}catch{return!1}if(!u&&o.isSmallOrder())return!1;let p=x(l,a.toRawBytes(),o.toRawBytes(),t);return a.add(o.multiplyUnsafe(p)).subtract(c).clearCofactor().equals(w.ZERO)},ExtendedPoint:w,utils:{getExtendedPublicKey:P,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:tI,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:eN,randomBytes:e_,adjustScalarBytes:function(e){return e[0]&=248,e[31]&=127,e[31]|=64,e},uvRatio:function(e,t){let r=e9(t*t*t,tm),i=function(e){let t=BigInt(10),r=BigInt(20),i=BigInt(40),n=BigInt(80),s=e*e%tm*e%tm,o=e7(s,t_,tm)*s%tm,a=e7(o,tw,tm)*e%tm,c=e7(a,tE,tm)*a%tm,l=e7(c,t,tm)*c%tm,u=e7(l,r,tm)*l%tm,h=e7(u,i,tm)*u%tm,f=e7(h,n,tm)*h%tm,p=e7(f,n,tm)*h%tm,d=e7(p,t,tm)*c%tm;return{pow_p_5_8:e7(d,t_,tm)*e%tm,b2:s}}(e*e9(r*r*t,tm)).pow_p_5_8,n=e9(e*r*i,tm),s=e9(t*n*n,tm),o=n,a=e9(n*tb,tm),c=s===e,l=s===e9(-e,tm),u=s===e9(-e*tb,tm);return c&&(n=o),(l||u)&&(n=a),tt(n,tm)&&(n=e9(-n,tm)),{isValid:c||l,value:n}}}),tS="base64url",tO="base58btc";function tA(e){return null!=globalThis.Buffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}function tR(e=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?tA(globalThis.Buffer.allocUnsafe(e)):new Uint8Array(e)}function tC(e,t){t||(t=e.reduce((e,t)=>e+t.length,0));let r=tR(t),i=0;for(let t of e)r.set(t,i),i+=t.length;return tA(r)}var tN=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),u=Math.log(256)/Math.log(a);function h(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 u=r[e.charCodeAt(t)];if(255===u)return;for(var h=0,f=s-1;(0!==u||h<n)&&-1!==f;f--,h++)u+=a*o[f]>>>0,o[f]=u%256>>>0,u=u/256>>>0;if(0!==u)throw Error("Non-zero carry");n=h,t++}if(" "!==e[t]){for(var p=s-n;p!==s&&0===o[p];)p++;for(var d=new Uint8Array(i+(s-p)),g=i;p!==s;)d[g++]=o[p++];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)*u+1>>>0,l=new Uint8Array(o);n!==s;){for(var h=t[n],f=0,p=o-1;(0!==h||f<i)&&-1!==p;p--,f++)h+=256*l[p]>>>0,l[p]=h%a>>>0,h=h/a>>>0;if(0!==h)throw Error("Non-zero carry");i=f,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:h,decode:function(e){var r=h(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),tq=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 tz{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 tU(this,e)}}class tk{constructor(e){this.decoders=e}or(e){return tU(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 tU=(e,t)=>new tk({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class tL{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 tz(e,t,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}let tB=({name:e,prefix:t,encode:r,decode:i})=>new tL(e,t,r,i),tM=({prefix:e,name:t,alphabet:r})=>{let{encode:i,decode:n}=tN(r,t);return tB({prefix:e,name:t,encode:i,decode:e=>tj(n(e))})},t$=(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},tH=(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},tV=({name:e,prefix:t,bitsPerChar:r,alphabet:i})=>tB({prefix:t,name:e,encode:e=>tH(e,i,r),decode:t=>t$(t,i,r,e)});var tK=Object.freeze({__proto__:null,identity:tB({prefix:"\0",name:"identity",encode:e=>tq(e),decode:e=>tT(e)})}),tF=Object.freeze({__proto__:null,base2:tV({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})}),tZ=Object.freeze({__proto__:null,base8:tV({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})}),tW=Object.freeze({__proto__:null,base10:tM({prefix:"9",name:"base10",alphabet:"0123456789"})}),tG=Object.freeze({__proto__:null,base16:tV({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),base16upper:tV({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});let tJ=tV({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),tQ=tV({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),tY=tV({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),tX=tV({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),t0=tV({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),t1=tV({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5});var t2=Object.freeze({__proto__:null,base32:tJ,base32upper:tQ,base32pad:tY,base32padupper:tX,base32hex:t0,base32hexupper:t1,base32hexpad:tV({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),base32hexpadupper:tV({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),base32z:tV({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})}),t3=Object.freeze({__proto__:null,base36:tM({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),base36upper:tM({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})}),t8=Object.freeze({__proto__:null,base58btc:tM({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),base58flickr:tM({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});let t5=tV({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6});var t6=Object.freeze({__proto__:null,base64:t5,base64pad:tV({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),base64url:tV({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),base64urlpad:tV({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});let t4=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=t4.reduce((e,t,r)=>(e[r]=t,e),[]),t7=t4.reduce((e,t,r)=>(e[t.codePointAt(0)]=r,e),[]);var re=Object.freeze({__proto__:null,base256emoji:tB({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=t7[r.codePointAt(0)];if(void 0===e)throw Error(`Non-base256emoji character: ${r}`);t.push(e)}return new Uint8Array(t)}})});function rt(e,t){var r,i=0,t=t||0,n=0,s=t,o=e.length;do{if(s>=o)throw rt.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 rt.bytes=s-t,i}var rr=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 ri=(e,t,r=0)=>(rr(e,t,r),t),rn=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,rs=(e,t)=>{let r=t.byteLength,i=rn(e),n=i+rn(r),s=new Uint8Array(n+r);return ri(e,s,0),ri(r,s,i),s.set(t,n),new ro(e,r,t,s)};class ro{constructor(e,t,r,i){this.code=e,this.size=t,this.digest=r,this.bytes=i}}let ra=({name:e,code:t,encode:r})=>new rc(e,t,r);class rc{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?rs(this.code,t):t.then(e=>rs(this.code,e))}throw Error("Unknown type, must be binary type")}}let rl=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t));var ru=Object.freeze({__proto__:null,sha256:ra({name:"sha2-256",code:18,encode:rl("SHA-256")}),sha512:ra({name:"sha2-512",code:19,encode:rl("SHA-512")})}),rh=Object.freeze({__proto__:null,identity:{code:0,name:"identity",encode:tj,digest:e=>rs(0,tj(e))}});new TextEncoder,new TextDecoder;let rf={...tK,...tF,...tZ,...tW,...tG,...t2,...t3,...t8,...t6,...re};function rp(e,t,r,i){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:i}}}({...ru,...rh});let rd=rp("utf8","u",e=>"u"+new TextDecoder("utf8").decode(e),e=>new TextEncoder().encode(e.substring(1))),rg=rp("ascii","a",e=>{let t="a";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t},e=>{let t=tR((e=e.substring(1)).length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}),ry={utf8:rd,"utf-8":rd,hex:rf.base16,latin1:rg,ascii:rg,binary:rg,...rf};function rv(e,t="utf8"){let r=ry[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)}
1function rm(e,t="utf8"){let r=ry[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 rb(e){return rv(rm(A(e),"utf8"),tS)}function rw(e){return["did","key","z"+rv(tC([rm("K36",tO),e]),tO)].join(":")}function r_(e=e_(32)){let t=tx.getPublicKey(e);return{secretKey:tC([e,t]),publicKey:t}}async function rE(e,t,r,i,n=(0,ed.fromMiliseconds)(Date.now())){var s,o;let a={alg:"EdDSA",typ:"JWT"},c={iss:rw(i.publicKey),sub:e,aud:t,iat:n,exp:n+r},l=rm([rb((s={header:a,payload:c}).header),rb(s.payload)].join("."),"utf8");return[rb((o={header:a,payload:c,signature:tx.sign(l,i.secretKey.slice(0,32))}).header),rb(o.payload),rv(o.signature,tS)].join(".")}var rI=r(75384);let rP="INTERNAL_ERROR",rx="SERVER_ERROR",rS=[-32700,-32600,-32601,-32602,-32603],rO={PARSE_ERROR:{code:-32700,message:"Parse error"},INVALID_REQUEST:{code:-32600,message:"Invalid Request"},METHOD_NOT_FOUND:{code:-32601,message:"Method not found"},INVALID_PARAMS:{code:-32602,message:"Invalid params"},[rP]:{code:-32603,message:"Internal error"},[rx]:{code:-32e3,message:"Server error"}};function rA(e){return Object.keys(rO).includes(e)?rO[e]:rO[rx]}function rR(e,t,r){return e.message.includes("getaddrinfo ENOTFOUND")||e.message.includes("connect ECONNREFUSED")?Error(`Unavailable ${r} RPC url at ${t}`):e}var rC=r(1468);
1function rN(e=3){return Date.now()*Math.pow(10,e)+Math.floor(Math.random()*Math.pow(10,e))}function rj(e=6){return BigInt(rN(e))}function rT(e,t,r){return{id:r||rN(),jsonrpc:"2.0",method:e,params:t}}function rq(e,t){return{id:e,jsonrpc:"2.0",result:t}}function rD(e,t,r){var i,n,s;return{id:e,jsonrpc:"2.0",error:void 0===(i=t)?rA(rP):("string"==typeof i&&(i=Object.assign(Object.assign({},rA(rx)),{message:i})),void 0!==r&&(i.data=r),n=i.code,rS.includes(n)&&(s=i.code,i=Object.values(rO).find(e=>e.code===s)||rO[rx]),i)}}class rz{}class rk extends rz{constructor(){super()}}class rU extends rk{constructor(e){super()}}function rL(e,t){let r=function(e){let t=e.match(RegExp(/^\w+:/,"gi"));if(t&&t.length)return t[0]}(e);return void 0!==r&&new RegExp(t).test(r)}function rB(e){return rL(e,"^https?:")}function rM(e){return rL(e,"^wss?:")}function r$(e){return"object"==typeof e&&"id"in e&&"jsonrpc"in e&&"2.0"===e.jsonrpc}function rH(e){return r$(e)&&"method"in e}function rV(e){return r$(e)&&(rK(e)||rF(e))}function rK(e){return"result"in e}function rF(e){return"error"in e}class rZ extends rU{constructor(e){super(e),this.events=new n.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(rT(e.method,e.params||[],e.id||rj().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=>{rF(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),rV(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 rW=()=>"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,rG=e=>e.split("?")[0],rJ="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(57026);class rQ{constructor(e){if(this.url=e,this.events=new n.EventEmitter,this.registering=!1,!rM(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(A(e))}catch(t){this.onError(e.id,t)}}register(e=this.url){if(!rM(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,rC.isReactNative)()?{headers:{origin:i}}:{rejectUnauthorized:!RegExp("wss?://localhost(:d{2,5})?").test(e)},s=new rJ(e,[],n);rW()?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?O(e.data):e.data;this.events.emit("payload",t)}onError(e,t){let r=this.parseError(t),i=rD(e,r.message||r.toString());this.events.emit("payload",i)}parseError(e,t=this.url){return rR(e,rG(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: ${rG(this.url)}`));return this.events.emit("register_error",t),t}}var rY=r(72307),rX=r.n(rY),r0=r(63144),r1=r.n(r0),r2=r(83454),r3=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),u=Math.log(256)/Math.log(a);function h(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 u=r[e.charCodeAt(t)];if(255===u)return;for(var h=0,f=s-1;(0!==u||h<n)&&-1!==f;f--,h++)u+=a*o[f]>>>0,o[f]=u%256>>>0,u=u/256>>>0;if(0!==u)throw Error("Non-zero carry");n=h,t++}if(" "!==e[t]){for(var p=s-n;p!==s&&0===o[p];)p++;for(var d=new Uint8Array(i+(s-p)),g=i;p!==s;)d[g++]=o[p++];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)*u+1>>>0,l=new Uint8Array(o);n!==s;){for(var h=t[n],f=0,p=o-1;(0!==h||f<i)&&-1!==p;p--,f++)h+=256*l[p]>>>0,l[p]=h%a>>>0,h=h/a>>>0;if(0!==h)throw Error("Non-zero carry");i=f,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:h,decode:function(e){var r=h(e);if(r)return r;throw Error(`Non-${t} character`)}}};let r8=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")},r5=e=>new TextEncoder().encode(e),r6=e=>new TextDecoder().decode(e);class r4{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 r9{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 ie(this,e)}}class r7{constructor(e){this.decoders=e}or(e){return ie(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 ie=(e,t)=>new r7({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class it{constructor(e,t,r,i){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=i,this.encoder=new r4(e,t,r),this.decoder=new r9(e,t,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}let ir=({name:e,prefix:t,encode:r,decode:i})=>new it(e,t,r,i),ii=({prefix:e,name:t,alphabet:r})=>{let{encode:i,decode:n}=r3(r,t);return ir({prefix:e,name:t,encode:i,decode:e=>r8(n(e))})},is=(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},io=(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},ia=({name:e,prefix:t,bitsPerChar:r,alphabet:i})=>ir({prefix:t,name:e,encode:e=>io(e,i,r),decode:t=>is(t,i,r,e)});
1var ic=Object.freeze({__proto__:null,identity:ir({prefix:"\0",name:"identity",encode:e=>r6(e),decode:e=>r5(e)})}),il=Object.freeze({__proto__:null,base2:ia({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})}),iu=Object.freeze({__proto__:null,base8:ia({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})}),ih=Object.freeze({__proto__:null,base10:ii({prefix:"9",name:"base10",alphabet:"0123456789"})}),ip=Object.freeze({__proto__:null,base16:ia({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),base16upper:ia({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});let id=ia({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ig=ia({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),iy=ia({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),iv=ia({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),im=ia({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),ib=ia({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5});var iw=Object.freeze({__proto__:null,base32:id,base32upper:ig,base32pad:iy,base32padupper:iv,base32hex:im,base32hexupper:ib,base32hexpad:ia({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),base32hexpadupper:ia({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),base32z:ia({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})}),i_=Object.freeze({__proto__:null,base36:ii({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),base36upper:ii({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})}),iE=Object.freeze({__proto__:null,base58btc:ii({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),base58flickr:ii({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});let iI=ia({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6});var iP=Object.freeze({__proto__:null,base64:iI,base64pad:ia({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),base64url:ia({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),base64urlpad:ia({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});let ix=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"),iS=ix.reduce((e,t,r)=>(e[r]=t,e),[]),iO=ix.reduce((e,t,r)=>(e[t.codePointAt(0)]=r,e),[]);var iA=Object.freeze({__proto__:null,base256emoji:ir({prefix:"\uD83D\uDE80",name:"base256emoji",encode:function(e){return e.reduce((e,t)=>
1e+=iS[t],"")},decode:function(e){let t=[];for(let r of e){let e=iO[r.codePointAt(0)];if(void 0===e)throw Error(`Non-base256emoji character: ${r}`);t.push(e)}return new Uint8Array(t)}})});function iR(e,t){var r,i=0,t=t||0,n=0,s=t,o=e.length;do{if(s>=o)throw iR.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 iR.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 iN=(e,t,r=0)=>(iC(e,t,r),t),ij=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,iT=(e,t)=>{let r=t.byteLength,i=ij(e),n=i+ij(r),s=new Uint8Array(n+r);return iN(e,s,0),iN(r,s,i),s.set(t,n),new iq(e,r,t,s)};class iq{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 iz(e,t,r);class iz{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?iT(this.code,t):t.then(e=>iT(this.code,e))}throw Error("Unknown type, must be binary type")}}let ik=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t));var iU=Object.freeze({__proto__:null,sha256:iD({name:"sha2-256",code:18,encode:ik("SHA-256")}),sha512:iD({name:"sha2-512",code:19,encode:ik("SHA-512")})}),iL=Object.freeze({__proto__:null,identity:{code:0,name:"identity",encode:r8,digest:e=>iT(0,r8(e))}});new TextEncoder,new TextDecoder;let iB={...ic,...il,...iu,...ih,...ip,...iw,...i_,...iE,...iP,...iA};function iM(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}}}({...iU,...iL});let iH=i$("utf8","u",e=>"u"+new TextDecoder("utf8").decode(e),e=>new TextEncoder().encode(e.substring(1))),iV=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?iM(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}),iK={utf8:iH,"utf-8":iH,hex:iB.base16,latin1:iV,ascii:iV,binary:iV,...iB},iF="core",iZ=`wc@2:${iF}:`,iW={logger:"error"},iG={database:":memory:"},iJ="client_ed25519_seed",iQ=ed.ONE_DAY,iY=ed.SIX_HOURS,iX="wss://relay.walletconnect.com",i0="wss://relay.walletconnect.org",i1={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"},i2={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},i3=ed.ONE_SECOND,i8={created:"subscription_created",deleted:"subscription_deleted",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},i5=1e3*ed.FIVE_SECONDS,i6={wc_pairingDelete:{req:{ttl:ed.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:ed.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:ed.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:ed.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:ed.ONE_DAY,prompt:!1,tag:0},res:{ttl:ed.ONE_DAY,prompt:!1,tag:0}}},i4={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},i9={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},i7={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},ne="verify-api",nt="https://verify.walletconnect.com",nr="https://verify.walletconnect.org",ni=[nt,nr];class nn{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=iZ,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,o.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,o.KC)(e))}async getKeyChain(){let e=await this.core.storage.getItem(this.storageKey);return"u">typeof e?(0,o.IP)(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){let{message:e}=(0,o.Z7)("NOT_INITIALIZED",this.name);throw Error(e)}}}class ns{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(),rw(r_(await this.getClientSeed()).publicKey)),this.generateKeyPair=()=>{this.isInitialized();let e=(0,o.Au)();return this.setPrivateKey(e.publicKey,e.privateKey)},this.signJWT=async e=>{this.isInitialized();let t=r_(await this.getClientSeed()),r=(0,o.jd)();return await rE(r,e,iQ,t)},this.generateSharedKey=(e,t,r)=>{this.isInitialized();let i=this.getPrivateKey(e),n=(0,o.m$)(i,t);return this.setSymKey(n,r)},this.setSymKey=async(e,t)=>{this.isInitialized();let r=t||(0,o.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,o.EN)(r),n=A(t);if((0,o.Q8)(i)){let t=i.senderPublicKey,r=i.receiverPublicKey;e=await this.generateSharedKey(t,r)}let s=this.getSymKey(e),{type:a,senderPublicKey:c}=i;return(0,o.HI)({type:a,symKey:s,message:n,senderPublicKey:c})},this.decode=async(e,t,r)=>{this.isInitialized();let i=(0,o.Ll)(t,r);if((0,o.Q8)(i)){let t=i.receiverPublicKey,r=i.senderPublicKey;e=await this.generateSharedKey(t,r)}try{let r=this.getSymKey(e),i=(0,o.pe)({symKey:r,encoded:t});return O(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,o.vB)(e);return(0,o.WG)(t.type)},this.getPayloadSenderPublicKey=e=>{let t=(0,o.vB)(e);return t.senderPublicKey?(0,rI.BB)(t.senderPublicKey,o.AW):void 0},this.core=e,this.logger=ee(t,this.name),this.keychain=r||new nn(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(iJ)}catch{e=(0,o.jd)(),await this.keychain.set(iJ,e)}return function(e,t="utf8"){let r=iK[t];if(!r)throw Error(`Unsupported encoding "${t}"`);return("utf8"===t||"utf-8"===t)&&null!=globalThis.Buffer&&null!=globalThis.Buffer.from?iM(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,o.Z7)("NOT_INITIALIZED",this.name);throw Error(e)}}}class no extends en{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=iZ,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,o.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,o.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,o.KC)(e))}async getRelayerMessages(){let e=await this.core.storage.getItem(this.storageKey);return"u">typeof e?(0,o.IP)(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){let{message:e}=(0,o.Z7)("NOT_INITIALIZED",this.name);throw Error(e)}}}class na extends es{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.events=new n.EventEmitter,this.name="publisher",this.queue=new Map,this.publishTimeout=(0,ed.toMiliseconds)(ed.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||iY,s=(0,o._H)(r),a=r?.prompt||!1,c=r?.tag||0,l=r?.id||rj().toString(),u={topic:e,message:t,opts:{ttl:n,relay:s,prompt:a,tag:c,id:l}},h=setTimeout(()=>this.queue.set(l,u),this.publishTimeout);try{await await (0,o.hF)(this.rpcPublish(e,t,n,s,a,c,l),this.publishTimeout,"Failed to publish payload, please try again."),this.removeRequestFromQueue(l),this.relayer.events.emit(i1.publish,u)}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(h)}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,a){var c,l,u,h;let f={method:(0,o.cO)(i.protocol).publish,params:{topic:e,message:t,ttl:r,prompt:n,tag:s},id:a};return(0,o.o8)(null==(c=f.params)?void 0:c.prompt)&&(null==(l=f.params)||delete l.prompt),(0,o.o8)(null==(u=f.params)?void 0:u.tag)&&(null==(h=f.params)||delete h.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:f}),this.relayer.request(f)}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(U.HEARTBEAT_EVENTS.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(i1.connection_stalled);return}this.checkQueue()}),this.relayer.on(i1.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}class nc{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 nl=Object.defineProperty,nu=Object.defineProperties,nh=Object.getOwnPropertyDescriptors,nf=Object.getOwnPropertySymbols,np=Object.prototype.hasOwnProperty,nd=Object.prototype.propertyIsEnumerable,ng=(e,t,r)=>t in e?nl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ny=(e,t)=>{for(var r in t||(t={}))np.call(t,r)&&ng(e,r,t[r]);if(nf)for(var r of nf(t))nd.call(t,r)&&ng(e,r,t[r]);return e},nv=(e,t)=>nu(e,nh(t));class nm extends ec{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.subscriptions=new Map,this.topicMap=new nc,this.events=new n.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=iZ,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,o._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 ed.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)>=i5&&(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,o._H)(r);await this.rpcUnsubscribe(e,t,i);let n=(0,o.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,o.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,o.hF)(this.relayer.request(r),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(i1.connection_stalled)}return(0,o.rj)(e+this.clientId)}async rpcBatchSubscribe(e){if(!e.length)return;let t=e[0].relay,r={method:(0,o.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,o.hF)(this.relayer.request(r),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Payload stalled"),this.relayer.events.emit(i1.connection_stalled)}}rpcUnsubscribe(e,t,r){let i={method:(0,o.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,nv(ny({},t),{id:e})),this.pending.delete(t.topic)}
1onBatchSubscribe(e){e.length&&e.forEach(e=>{this.setSubscription(e.id,ny({},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,ny({},t)),this.topicMap.set(t.topic,e),this.events.emit(i8.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,o.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(i8.deleted,nv(ny({},r),{reason:t}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(i8.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(i8.resubscribed)}async restore(){try{let e=await this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size){let{message:e}=(0,o.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,o.qt)(t)&&this.onBatchSubscribe(t.map((t,r)=>nv(ny({},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(U.HEARTBEAT_EVENTS.pulse,async()=>{await this.checkPending()}),this.relayer.on(i1.connect,async()=>{await this.onConnect()}),this.relayer.on(i1.disconnect,()=>{this.onDisconnect()}),this.events.on(i8.created,async e=>{let t=i8.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()}),this.events.on(i8.deleted,async e=>{let t=i8.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,o.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 nb=Object.defineProperty,nw=Object.getOwnPropertySymbols,n_=Object.prototype.hasOwnProperty,nE=Object.prototype.propertyIsEnumerable,nI=(e,t,r)=>t in e?nb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,nP=(e,t)=>{for(var r in t||(t={}))n_.call(t,r)&&nI(e,r,t[r]);if(nw)for(var r of nw(t))nE.call(t,r)&&nI(e,r,t[r]);return e};class nx extends eo{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new n.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(i1.connect)},this.onDisconnectHandler=()=>{this.onProviderDisconnect()},this.onProviderErrorHandler=e=>{this.logger.error(e),this.events.emit(i1.error,e),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(i2.payload,this.onPayloadHandler),this.provider.on(i2.connect,this.onConnectHandler),this.provider.on(i2.disconnect,this.onDisconnectHandler),this.provider.on(i2.error,this.onProviderErrorHandler)},this.core=e.core,this.logger="u">typeof e.logger&&"string"!=typeof e.logger?ee(e.logger,this.name):B()(Y({level:e.logger||"error"})),this.messages=new no(this.logger,e.core),this.subscriber=new nm(this,this.logger),this.publisher=new na(this,this.logger),this.relayUrl=e?.relayUrl||iX,this.projectId=e.projectId,this.bundleId=(0,o.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 ${i0}...`),await this.restartTransport(i0)}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(i8.created,s),i())};return await Promise.all([new Promise(e=>{i=e,this.subscriber.on(i8.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,o.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(i8.resubscribed,()=>{e()})}),new Promise(async(e,t)=>{try{await (0,o.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(i2.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,o.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 rZ(new rQ((0,o.$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}),rH(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(nP({type:"event",event:t.id}
1,s)),this.events.emit(t.id,s),await this.acknowledgePayload(e),await this.onMessageEvent(s)}else rV(e)&&this.events.emit(i1.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(i1.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){let t=rq(e.id,!0);await this.provider.connection.send(t)}unregisterProviderListeners(){this.provider.off(i2.payload,this.onPayloadHandler),this.provider.off(i2.connect,this.onConnectHandler),this.provider.off(i2.disconnect,this.onDisconnectHandler),this.provider.off(i2.error,this.onProviderErrorHandler)}async registerEventListeners(){this.events.on(i1.connection_stalled,()=>{this.restartTransport().catch(e=>this.logger.error(e))});let e=await (0,o.Gg)();(0,o.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(i1.disconnect),this.attemptToReconnect()}attemptToReconnect(){this.transportExplicitlyClosed||(this.logger.info("attemptToReconnect called. Connecting..."),setTimeout(async()=>{await this.restartTransport().catch(e=>this.logger.error(e))},(0,ed.toMiliseconds)(i3)))}isInitialized(){if(!this.initialized){let{message:e}=(0,o.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,nR=Object.prototype.propertyIsEnumerable,nC=(e,t,r)=>t in e?nS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,nN=(e,t)=>{for(var r in t||(t={}))nA.call(t,r)&&nC(e,r,t[r]);if(nO)for(var r of nO(t))nR.call(t,r)&&nC(e,r,t[r]);return e};class nj extends ea{constructor(e,t,r,i=iZ,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=iZ,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(e=>{this.getKey&&null!==e&&!(0,o.o8)(e)?this.map.set(this.getKey(e),e):(0,o.xW)(e)?this.map.set(e.id,e):(0,o.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=>rX()(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=nN(nN({},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,o.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,o.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,o.Z7)("NOT_INITIALIZED",this.name);throw Error(e)}}}class nT{constructor(e,t){this.core=e,this.logger=t,this.name="pairing",this.version="0.3",this.events=new(s()),this.initialized=!1,this.storagePrefix=iZ,this.ignoredPayloadTypes=[o.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,o.jd)(),t=await this.core.crypto.setSymKey(e),r=(0,o.gn)(ed.FIVE_MINUTES),i={protocol:"irn"},n=(0,o.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,o.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,o.gn)(ed.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(i4.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,o.gn)(ed.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,o.H1)();this.events.once((0,o.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,o.D6)("USER_DISCONNECTED")),await this.deletePairing(t))},this.sendRequest=async(e,t,r)=>{let i=rT(t,r),n=await this.core.crypto.encode(e,i),s=i6[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=rq(e,r),n=await this.core.crypto.encode(t,i),s=i6[(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=rD(e,r),n=await this.core.crypto.encode(t,i),s=await this.core.history.get(t,e),o=i6[s.request.method]?i6[s.request.method].res:i6.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,o.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,o.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(i4.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(()=>{rK(t)?this.events.emit((0,o.E0)("pairing_ping",r),{}):rF(t)&&this.events.emit((0,o.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(i4.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,o.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,o.D6)("WC_METHOD_UNSUPPORTED",e))},this.isValidPair=e=>{var t;if(!(0,o.EJ)(e)){let{message:t}=(0,o.Z7)("MISSING_OR_INVALID",`pair() params: ${e}`);throw Error(t)}if(!(0,o.jv)(e.uri)){let{message:t}=(0,o.Z7)("MISSING_OR_INVALID",`pair() uri: ${e.uri}`);throw Error(t)}let r=(0,o.he)(e.uri);if(!(null!=(t=r?.relay)&&t.protocol)){let{message:e}=(0,o.Z7)("MISSING_OR_INVALID","pair() uri#relay-protocol");throw Error(e)}if(!(null!=r&&r.symKey)){let{message:e}=(0,o.Z7)("MISSING_OR_INVALID","pair() uri#symKey");throw Error(e)}},this.isValidPing=async e=>{if(!(0,o.EJ)(e)){let{message:t}=(0,o.Z7)("MISSING_OR_INVALID",`ping() params: ${e}`);throw Error(t)}let{topic:t}=e;await this.isValidPairingTopic(t)},this.isValidDisconnect=async e=>{if(!(0,o.EJ)(e)){let{message:t}=(0,o.Z7)("MISSING_OR_INVALID",`disconnect() params: ${e}`);throw Error(t)}let{topic:t}=e;await this.isValidPairingTopic(t)},this.isValidPairingTopic=async e=>{if(!(0,o.M_)(e,!1)){let{message:t}=(0,o.Z7)("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw Error(t)}if(!this.pairings.keys.includes(e)){let{message:t}=(0,o.Z7)("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw Error(t)}if((0,o.Bw)(this.pairings.get(e).expiry)){await this.deletePairing(e);let{message:t}=(0,o.Z7)("EXPIRED",`pairing topic: ${e}`);throw Error(t)}},this.core=e,this.logger=ee(t,this.name),this.pairings=new nj(this.core,this.logger,this.name,this.storagePrefix)}get context(){return X(this.logger)}isInitialized(){if(!this.initialized){let{message:e}=(0,o.Z7)("NOT_INITIALIZED",this.name);throw Error(e)}}registerRelayerEvents(){this.core.relayer.on(i1.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{rH(i)?(this.core.history.set(t,i),this.onRelayEventRequest({topic:t,payload:i})):rV(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(i7.expired,async e=>{let{topic:t}=(0,o.iP)(e.target);t&&this.pairings.keys.includes(t)&&(await this.deletePairing(t,!0),this.events.emit(i4.expire,{topic:t}))})}}class nq extends ei{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.records=new Map,this.events=new n.EventEmitter,this.name="history",this.version="0.3",this.cached=[],this.initialized=!1,this.storagePrefix=iZ,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,o.gn)(ed.THIRTY_DAYS)};this.records.set(i.id,i),this.events.emit(i9.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=rF(e)?{error:e.error}:{result:e.result},this.records.set(t.id,t),this.events.emit(i9.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(i9.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:rT(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,o.Z7)("NO_MATCHING_KEY",`${this.name}: ${e}`);throw Error(t)}return t}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(i9.sync)}async restore(){try{let e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){let{message:e}=(0,o.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(i9.created,e=>{let t=i9.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e}),this.persist()}),this.events.on(i9.updated,e=>{let t=i9.updated;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e}),this.persist()}),this.events.on(i9.deleted,e=>{let t=i9.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e}),this.persist()}),this.core.heartbeat.on(U.HEARTBEAT_EVENTS.pulse,()=>{this.cleanup()})}cleanup(){try{this.records.forEach(e=>{(0,ed.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,o.Z7)("NOT_INITIALIZED",this.name);throw Error(e)}}}class nD extends el{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.expirations=new Map,this.events=new n.EventEmitter,this.name="expirer",this.version="0.3",this.cached=[],this.initialized=!1,this.storagePrefix=iZ,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(i7.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(i7.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,o.Z4)(e);if("number"==typeof e)return(0,o.Gq)(e);let{message:t}=(0,o.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(i7.sync)}async restore(){try{let e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){let{message:e}=(0,o.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,o.Z7)("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(t),Error(t)}return t}checkExpiry(e,t){let{expiry:r}=t;(0,ed.toMiliseconds)(r)-Date.now()<=0&&this.expire(e,t)}expire(e,t){this.expirations.delete(e),this.events.emit(i7.expired,{target:e,expiration:t})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,t)=>this.checkExpiry(t,e))}registerEventListeners(){this.core.heartbeat.on(U.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(i7.created,e=>{let t=i7.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(i7.expired,e=>{let t=i7.expired;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(i7.deleted,e=>{let t=i7.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,o.Z7)("NOT_INITIALIZED",this.name);throw Error(e)}}}class nz extends eu{constructor(e,t){super(e,t),this.projectId=e,this.logger=t,this.name=ne,this.initialized=!1,this.queue=[],this.verifyDisabled=!1,this.init=async e=>{if(this.verifyDisabled||(0,o.b$)()||!(0,o.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=nr;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,nr)}return t},this.fetchAttestation=async(e,t)=>{this.logger.info(`resolving attestation: ${e} from url: ${t}`);let r=this.startAbortTimer(2*ed.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(ne))return r();window.addEventListener("message",t);let i=document.createElement("iframe");i.id=ne,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,ed.toMiliseconds)(ed.FIVE_SECONDS)))])},this.removeIframe=()=>{this.iframe&&(this.iframe.remove(),this.iframe=void 0,this.initialized=!1)},this.getVerifyUrl=e=>{let t=e||nt;return ni.includes(t)||(this.logger.info(`verify url: ${t}, not included in trusted list, assigning default: ${nt}`),t=nt),t},this.logger=ee(t,this.name),this.verifyUrl=nt,this.abortController=new AbortController,this.isDevEnv=(0,o.UG)()&&r2.env.IS_VITEST}get context(){return X(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),(0,ed.toMiliseconds)(e))}}class nk extends eh{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 r1()(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 nU=Object.defineProperty,nL=Object.getOwnPropertySymbols,nB=Object.prototype.hasOwnProperty,nM=Object.prototype.propertyIsEnumerable,n$=(e,t,r)=>t in e?nU(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,nH=(e,t)=>{for(var r in t||(t={}))nB.call(t,r)&&n$(e,r,t[r]);if(nL)for(var r of nL(t))nM.call(t,r)&&n$(e,r,t[r]);return e};class nV extends er{constructor(e){super(e),this.protocol="wc",this.version=2,this.name=iF,this.events=new n.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||iX,this.customStoragePrefix=null!=e&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";let t="u">typeof e?.logger&&"string"!=typeof e?.logger?e.logger:B()(Y({level:e?.logger||iW.logger}));this.logger=ee(t,this.name),this.heartbeat=new U.HeartBeat,this.crypto=new ns(this,this.logger,e?.keychain),this.history=new nq(this,this.logger),this.expirer=new nD(this,this.logger),this.storage=null!=e&&e.storage?e.storage:new k(nH(nH({},iG),e?.storageOptions)),this.relayer=new nx({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new nT(this,this.logger),this.verify=new nz(this.projectId||"",this.logger),this.echoClient=new nk(this.projectId||"",this.logger)}static async init(e){let t=new nV(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 nK="client",nF=`wc@2:${nK}:`,nZ={name:nK,logger:"error"},nW="WALLETCONNECT_DEEPLINK_CHOICE",nG="Proposal expired",nJ=ed.SEVEN_DAYS,nQ={wc_sessionPropose:{req:{ttl:ed.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:ed.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:ed.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:ed.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:ed.ONE_DAY,prompt:!1,tag:1104},res:{ttl:ed.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:ed.ONE_DAY,prompt:!1,tag:1106},res:{ttl:ed.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:ed.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:ed.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:ed.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:ed.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:ed.ONE_DAY,prompt:!1,tag:1112},res:{ttl:ed.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:ed.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:ed.THIRTY_SECONDS,prompt:!1,tag:1115}}},nY={min:ed.FIVE_MINUTES,max:ed.SEVEN_DAYS},nX={idle:"IDLE",active:"ACTIVE"},n0=["wc_sessionPropose","wc_sessionRequest","wc_authRequest"];var n1=Object.defineProperty,n2=Object.defineProperties,n3=Object.getOwnPropertyDescriptors,n8=Object.getOwnPropertySymbols,n5=Object.prototype.hasOwnProperty,n6=Object.prototype.propertyIsEnumerable,n4=(e,t,r)=>t in e?n1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,n9=(e,t)=>{for(var r in t||(t={}))n5.call(t,r)&&n4(e,r,t[r]);if(n8)for(var r of n8(t))n6.call(t,r)&&n4(e,r,t[r]);return e},n7=(e,t)=>n2(e,n3(t));class se extends ep{constructor(e){super(e),this.name="engine",this.events=new(s()),this.initialized=!1,this.ignoredPayloadTypes=[o.rV],this.requestQueue={state:nX.idle,queue:[]},this.sessionRequestQueue={state:nX.idle,queue:[]},this.requestQueueDelay=ed.ONE_SECOND,this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),this.client.core.pairing.register({methods:Object.keys(nQ
1)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},(0,ed.toMiliseconds)(this.requestQueueDelay)))},this.connect=async e=>{await this.isInitialized();let t=n7(n9({},e),{requiredNamespaces:e.requiredNamespaces||{},optionalNamespaces:e.optionalNamespaces||{}});await this.isValidConnect(t);let{pairingTopic:r,requiredNamespaces:i,optionalNamespaces:n,sessionProperties:s,relays:a}=t,c=r,l,u=!1;if(c&&(u=this.client.core.pairing.pairings.get(c).active),!c||!u){let{topic:e,uri:t}=await this.client.core.pairing.create();c=e,l=t}let h=await this.client.core.crypto.generateKeyPair(),f=n9({requiredNamespaces:i,optionalNamespaces:n,relays:a??[{protocol:"irn"}],proposer:{publicKey:h,metadata:this.client.metadata}},s&&{sessionProperties:s}),{reject:p,resolve:d,done:g}=(0,o.H1)(ed.FIVE_MINUTES,nG);if(this.events.once((0,o.E0)("session_connect"),async({error:e,session:t})=>{if(e)p(e);else if(t){t.self.publicKey=h;let e=n7(n9({},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,o.Z7)("NO_MATCHING_KEY",`connect() pairing topic: ${c}`);throw Error(e)}let y=await this.sendRequest({topic:c,method:"wc_sessionPropose",params:f}),v=(0,o.gn)(ed.FIVE_MINUTES);return await this.setProposal(y,n9({id:y,expiry:v},f)),{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:a,requiredNamespaces:c,optionalNamespaces:l}=this.client.proposal.get(t);s=s||"",(0,o.L5)(c)||(c=(0,o.fc)(i,"approve()"));let u=await this.client.core.crypto.generateKeyPair(),h=a.publicKey,f=await this.client.core.crypto.generateSharedKey(u,h);s&&t&&(await this.client.core.pairing.updateMetadata({topic:s,metadata:a.metadata}),await this.sendResult({id:t,topic:s,result:{relay:{protocol:r??"irn"},responderPublicKey:u}}),await this.client.proposal.delete(t,(0,o.D6)("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:s}));let p=n9({relay:{protocol:r??"irn"},namespaces:i,requiredNamespaces:c,optionalNamespaces:l,pairingTopic:s,controller:{publicKey:u,metadata:this.client.metadata},expiry:(0,o.gn)(nJ)},n&&{sessionProperties:n});await this.client.core.relayer.subscribe(f),await this.sendRequest({topic:f,method:"wc_sessionSettle",params:p,throwOnFailedPublish:!0});let d=n7(n9({},p),{topic:f,pairingTopic:s,acknowledged:!1,self:p.controller,peer:{publicKey:a.publicKey,metadata:a.metadata},controller:u});return await this.client.session.set(f,d),await this.setExpiry(f,(0,o.gn)(nJ)),{topic:f,acknowledged:()=>new Promise(e=>setTimeout(()=>e(this.client.session.get(f)),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,o.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:a}=(0,o.H1)();return this.events.once((0,o.E0)("session_update",i),({error:e})=>{e?a(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,o.H1)();return this.events.once((0,o.E0)("session_extend",r),({error:e})=>{e?s(e):n()}),await this.setExpiry(t,(0,o.gn)(nJ)),{acknowledged:i}},this.request=async e=>{await this.isInitialized(),await this.isValidRequest(e);let{chainId:t,request:r,topic:i,expiry:n}=e,s=rN(),{done:a,resolve:c,reject:l}=(0,o.H1)(n,"Request expired. Please try again.");return this.events.once((0,o.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,o.bW)(this.client.core.storage,nW);(0,o.Hh)({id:s,topic:i,wcDeepLink:t}),e()}),a()]).then(e=>e[2])},this.respond=async e=>{await this.isInitialized(),await this.isValidRespond(e);let{topic:t,response:r}=e,{id:i}=r;rK(r)?await this.sendResult({id:i,topic:t,result:r.result,throwOnFailedPublish:!0}):rF(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,o.H1)();this.events.once((0,o.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,o.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,o.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,o.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(nW).catch(e=>this.client.logger.warn(e)),this.getPendingSessionRequests().forEach(t=>{t.topic===e&&this.deletePendingSessionRequest(t.id,(0,o.D6)("USER_DISCONNECTED"))})},this.deleteProposal=async(e,t)=>{await Promise.all([this.client.proposal.delete(e,(0,o.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=nX.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=nQ.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,o.gn)(t))},this.sendRequest=async e=>{let{topic:t,method:r,params:i,expiry:n,relayRpcId:s,clientRpcId:a,throwOnFailedPublish:c}=e,l=rT(r,i,a);if((0,o.jU)()&&n0.includes(r)){let e=(0,o.rj)(JSON.stringify(l));this.client.core.verify.register({attestationId:e})}let u=await this.client.core.crypto.encode(t,l),h=nQ[r].req;return n&&(h.ttl=n),s&&(h.id=s),this.client.core.history.set(t,l),c?(h.internal=n7(n9({},h.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(t,u,h)):this.client.core.relayer.publish(t,u,h).catch(e=>this.client.logger.error(e)),l.id},this.sendResult=async e=>{let{id:t,topic:r,result:i,throwOnFailedPublish:n}=e,s=rq(t,i),o=await this.client.core.crypto.encode(r,s),a=nQ[(await this.client.core.history.get(r,t)).request.method].res;n?(a.internal=n7(n9({},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=rD(e,r),n=await this.client.core.crypto.encode(t,i),s=nQ[(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,o.Bw)(t.expiry)&&e.push(t.topic)}),this.client.proposal.getAll().forEach(e=>{(0,o.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===nX.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=nX.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=nX.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,o.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(n9({},t.params));let n=(0,o.gn)(ed.FIVE_MINUTES),s=n9({id:i,pairingTopic:e,expiry:n},r);await this.setProposal(i,s);let a=(0,o.rj)(JSON.stringify(t)),c=await this.getVerifyContext(a,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(rK(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 rF(t)&&(await this.client.proposal.delete(r,(0,o.D6)("USER_DISCONNECTED")),this.events.emit((0,o.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:a,requiredNamespaces:c,optionalNamespaces:l,sessionProperties:u,pairingTopic:h}=t.params,f=n9({topic:e,relay:r,expiry:s,namespaces:a,acknowledged:!0,pairingTopic:h,requiredNamespaces:c,optionalNamespaces:l,controller:n.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:n.publicKey,metadata:n.metadata}},u&&{sessionProperties:u});await this.sendResult({id:t.id,topic:e,result:!0}),this.events.emit((0,o.E0)("session_connect"),{session:f}),this.cleanupDuplicatePairings(f)}catch(t){await this.sendError(r,e,t),this.client.logger.error(t)}},this.onSessionSettleResponse=async(e,t)=>{let{id:r}=t;rK(t)?(await this.client.session.update(e,{acknowledged:!0}),this.events.emit((0,o.E0)("session_approve",r),{})):rF(t)&&(await this.client.session.delete(e,(0,o.D6)("USER_DISCONNECTED")),this.events.emit((0,o.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=o.O6.get(t);if(n&&this.isRequestOutOfSync(n,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidUpdate(n9({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}),o.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;rK(t)?this.events.emit((0,o.E0)("session_update",r),{}):rF(t)&&this.events.emit((0,o.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,o.gn)(nJ)),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;rK(t)?this.events.emit((0,o.E0)("session_extend",r),{}):rF(t)&&this.events.emit((0,o.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(()=>{rK(t)?this.events.emit((0,o.E0)("session_ping",r),{}):rF(t)&&this.events.emit((0,o.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(i1.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(n9({topic:e},i));let t=(0,o.rj)(JSON.stringify(rT("wc_sessionRequest",i,r))),n=this.client.session.get(e),s=await this.getVerifyContext(t,n.peer.metadata),a={id:r,topic:e,params:i,verifyContext:s};await this.setPendingSessionRequest(a),this.addSessionRequestToSessionRequestQueue(a),this.processSessionRequestQueue()}catch(t){await this.sendError(r,e,t),this.client.logger.error(t)}},this.onSessionRequestResponse=(e,t)=>{let{id:r}=t;rK(t)?this.events.emit((0,o.E0)("session_request",r),{result:t.result}):rF(t)&&this.events.emit((0,o.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=o.O6.get(t);if(n&&this.isRequestOutOfSync(n,r)){this.client.logger.info(`Discarding out of sync request - ${r}`);return}this.isValidEmit(n9({topic:e},i)),this.client.events.emit("session_event",{id:r,topic:e,params:i}),o.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=nX.idle,this.processSessionRequestQueue()},(0,ed.toMiliseconds)(this.requestQueueDelay))},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===nX.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=nX.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,rT("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,o.EJ)(e)){let{message:t}=(0,o.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,o.o8)(t)||await this.isValidPairingTopic(t),!(0,o.PM)(s,!0)){let{message:e}=(0,o.Z7)("MISSING_OR_INVALID",`connect() relays: ${s}`);throw Error(e)}(0,o.o8)(r)||0===(0,o.L5)(r)||this.validateNamespaces(r,"requiredNamespaces"),(0,o.o8)(i)||0===(0,o.L5)(i)||this.validateNamespaces(i,"optionalNamespaces"),(0,o.o8)(n)||this.validateSessionProps(n,"sessionProperties")},this.validateNamespaces=(e,t)=>{let r=(0,o.n)(e,"connect()",t);if(r)throw Error(r.message)},this.isValidApprove=async e=>{if(!(0,o.EJ)(e))throw Error((0,o.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),a=(0,o.in)(r,"approve()");if(a)throw Error(a.message);let c=(0,o.rF)(s.requiredNamespaces,r,"approve()");if(c)throw Error(c.message);if(!(0,o.M_)(i,!0)){let{message:e}=(0,o.Z7)("MISSING_OR_INVALID",`approve() relayProtocol: ${i}`);throw Error(e)}(0,o.o8)(n)||this.validateSessionProps(n,"sessionProperties")},this.isValidReject=async e=>{if(!(0,o.EJ)(e)){let{message:t}=(0,o.Z7)("MISSING_OR_INVALID",`reject() params: ${e}`);throw Error(t)}let{id:t,reason:r}=e;if(await this.isValidProposalId(t),!(0,o.$t)(r)){let{message:e}=(0,o.Z7)("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(r)}`);throw Error(e)}},this.isValidSessionSettleRequest=e=>{if(!(0,o.EJ)(e)){let{message:t}=(0,o.Z7)("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${e}`);throw Error(t)}
1let{relay:t,controller:r,namespaces:i,expiry:n}=e;if(!(0,o.Z2)(t)){let{message:e}=(0,o.Z7)("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw Error(e)}let s=(0,o.Dd)(r,"onSessionSettleRequest()");if(s)throw Error(s.message);let a=(0,o.in)(i,"onSessionSettleRequest()");if(a)throw Error(a.message);if((0,o.Bw)(n)){let{message:e}=(0,o.Z7)("EXPIRED","onSessionSettleRequest()");throw Error(e)}},this.isValidUpdate=async e=>{if(!(0,o.EJ)(e)){let{message:t}=(0,o.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,o.in)(r,"update()");if(n)throw Error(n.message);let s=(0,o.rF)(i.requiredNamespaces,r,"update()");if(s)throw Error(s.message)},this.isValidExtend=async e=>{if(!(0,o.EJ)(e)){let{message:t}=(0,o.Z7)("MISSING_OR_INVALID",`extend() params: ${e}`);throw Error(t)}let{topic:t}=e;await this.isValidSessionTopic(t)},this.isValidRequest=async e=>{if(!(0,o.EJ)(e)){let{message:t}=(0,o.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,o.p8)(s,i)){let{message:e}=(0,o.Z7)("MISSING_OR_INVALID",`request() chainId: ${i}`);throw Error(e)}if(!(0,o.hH)(r)){let{message:e}=(0,o.Z7)("MISSING_OR_INVALID",`request() ${JSON.stringify(r)}`);throw Error(e)}if(!(0,o.al)(s,i,r.method)){let{message:e}=(0,o.Z7)("MISSING_OR_INVALID",`request() method: ${r.method}`);throw Error(e)}if(n&&!(0,o.ON)(n,nY)){let{message:e}=(0,o.Z7)("MISSING_OR_INVALID",`request() expiry: ${n}. Expiry must be a number (in seconds) between ${nY.min} and ${nY.max}`);throw Error(e)}},this.isValidRespond=async e=>{var t;if(!(0,o.EJ)(e)){let{message:t}=(0,o.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,o.JT)(i)){let{message:e}=(0,o.Z7)("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(i)}`);throw Error(e)}},this.isValidPing=async e=>{if(!(0,o.EJ)(e)){let{message:t}=(0,o.Z7)("MISSING_OR_INVALID",`ping() params: ${e}`);throw Error(t)}let{topic:t}=e;await this.isValidSessionOrPairingTopic(t)},this.isValidEmit=async e=>{if(!(0,o.EJ)(e)){let{message:t}=(0,o.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,o.p8)(n,i)){let{message:e}=(0,o.Z7)("MISSING_OR_INVALID",`emit() chainId: ${i}`);throw Error(e)}if(!(0,o.nf)(r)){let{message:e}=(0,o.Z7)("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(r)}`);throw Error(e)}if(!(0,o.sI)(n,i,r.name)){let{message:e}=(0,o.Z7)("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(r)}`);throw Error(e)}},this.isValidDisconnect=async e=>{if(!(0,o.EJ)(e)){let{message:t}=(0,o.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||nt,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,o.M_)(e,!1)){let{message:r}=(0,o.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,o.Z7)("NOT_INITIALIZED",this.name);throw Error(e)}await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(i1.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{rH(i)?(this.client.core.history.set(t,i),this.onRelayEventRequest({topic:t,payload:i})):rV(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(i7.expired,async e=>
1{let{topic:t,id:r}=(0,o.iP)(e.target);if(r&&this.client.pendingRequest.keys.includes(r))return await this.deletePendingSessionRequest(r,(0,o.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(i4.create,e=>this.onPairingCreated(e))}isValidPairingTopic(e){if(!(0,o.M_)(e,!1)){let{message:t}=(0,o.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,o.Z7)("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw Error(t)}if((0,o.Bw)(this.client.core.pairing.pairings.get(e).expiry)){let{message:t}=(0,o.Z7)("EXPIRED",`pairing topic: ${e}`);throw Error(t)}}async isValidSessionTopic(e){if(!(0,o.M_)(e,!1)){let{message:t}=(0,o.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,o.Z7)("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw Error(t)}if((0,o.Bw)(this.client.session.get(e).expiry)){await this.deleteSession(e);let{message:t}=(0,o.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,o.M_)(e,!1)){let{message:t}=(0,o.Z7)("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw Error(t)}else{let{message:t}=(0,o.Z7)("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw Error(t)}}async isValidProposalId(e){if(!(0,o.Q0)(e)){let{message:t}=(0,o.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,o.Z7)("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw Error(t)}if((0,o.Bw)(this.client.proposal.get(e).expiry)){await this.deleteProposal(e);let{message:t}=(0,o.Z7)("EXPIRED",`proposal id: ${e}`);throw Error(t)}}}class st extends nj{constructor(e,t){super(e,t,"proposal",nF),this.core=e,this.logger=t}}class sr extends nj{constructor(e,t){super(e,t,"session",nF),this.core=e,this.logger=t}}class si extends nj{constructor(e,t){super(e,t,"request",nF,e=>e.id),this.core=e,this.logger=t}}class sn extends ef{constructor(e){super(e),this.protocol="wc",this.version=2,this.name=nZ.name,this.events=new n.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||nZ.name,this.metadata=e?.metadata||(0,o.D)();let t="u">typeof e?.logger&&"string"!=typeof e?.logger?e.logger:B()(Y({level:e?.logger||nZ.logger}));this.core=e?.core||new nV(e),this.logger=ee(t,this.name),this.session=new sr(this.core,this.logger),this.proposal=new st(this.core,this.logger),this.pendingRequest=new si(this.core,this.logger),this.engine=new se(this)}static async init(e){let t=new sn(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 ss=r(54098),so=r.n(ss),sa=Object.defineProperty,sc=Object.defineProperties,sl=Object.getOwnPropertyDescriptors,su=Object.getOwnPropertySymbols,sh=Object.prototype.hasOwnProperty,sf=Object.prototype.propertyIsEnumerable,sp=(e,t,r)=>t in e?sa(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,sd=(e,t)=>{for(var r in t||(t={}))sh.call(t,r)&&sp(e,r,t[r]);if(su)for(var r of su(t))sf.call(t,r)&&sp(e,r,t[r]);return e},sg=(e,t)=>
1sc(e,sl(t));let sy={headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"};class sv{constructor(e,t=!1){if(this.url=e,this.disableProviderPing=t,this.events=new n.EventEmitter,this.isAvailable=!1,this.registering=!1,!rB(e))throw Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=t}get connected(){return this.isAvailable}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(){if(!this.isAvailable)throw Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{let t=A(e),r=await (await so()(this.url,sg(sd({},sy),{body:t}))).json();this.onPayload({data:r})}catch(t){this.onError(e.id,t)}}async register(e=this.url){if(!rB(e))throw Error(`Provided URL is not compatible with HTTP 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)=>{this.events.once("register_error",e=>{this.resetMaxListeners(),t(e)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return t(Error("HTTP connection is missing or invalid"));e()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){let t=A({id:1,jsonrpc:"2.0",method:"test",params:[]});await so()(e,sg(sd({},sy),{body:t}))}this.onOpen()}catch(t){let e=this.parseError(t);throw this.events.emit("register_error",e),this.onClose(),e}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;let t="string"==typeof e.data?O(e.data):e.data;this.events.emit("payload",t)}onError(e,t){let r=this.parseError(t),i=rD(e,r.message||r.toString());this.events.emit("payload",i)}parseError(e,t=this.url){return rR(e,t,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>10&&this.events.setMaxListeners(10)}}let sm="error",sb="wc@2:universal_provider:",sw="default_chain_changed";var s_="u">typeof globalThis?globalThis:"u">typeof window?window:"u">typeof r.g?r.g:"u">typeof self?self:{},sE={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]",u="[object Array]",h="[object Boolean]",f="[object Date]",p="[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]",P="[object WeakMap]",x="[object ArrayBuffer]",S="[object DataView]",O="[object Float32Array]",A="[object Float64Array]",R="[object Int8Array]",C="[object Int16Array]",N="[object Int32Array]",j="[object Uint8Array]",T="[object Uint8ClampedArray]",q="[object Uint16Array]",D="[object Uint32Array]",z=/\b__p \+= '';/g,k=/\b(__p \+=) '' \+/g,U=/(__e\(.*?\)|\b__t\)) \+\n'';/g,L=/&(?:amp|lt|gt|quot|#39);/g,B=/[&<>"']/g,M=RegExp(L.source),$=RegExp(B.source),H=/<%-([\s\S]+?)%>/g,V=/<%([\s\S]+?)%>/g,K=/<%=([\s\S]+?)%>/g,F=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Z=/^\w*$/,W=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,G=/[\\^$.*+?()[\]{}|]/g,J=RegExp(G.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\]$/,eu=/^0o[0-7]+$/i,eh=/^(?:0|[1-9]\d*)$/,ef=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ep=/($^)/,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_+"]",eP="["+ey+"]",ex="["+em+"]",eS="[^"+eg+e_+"\\d+"+ev+em+eb+"]",eO="\ud83c[\udffb-\udfff]",eA="[^"+eg+"]",eR="(?:\ud83c[\udde6-\uddff]){2}",eC="[\ud800-\udbff][\udc00-\udfff]",eN="["+eb+"]",ej="\\u200d",eT="(?:"+ex+"|"+eS+")",eq="(?:"+eE+"(?:d|ll|m|re|s|t|ve))?",eD="(?:"+eE+"(?:D|LL|M|RE|S|T|VE))?",ez="(?:"+eP+"|"+eO+")?",ek="["+ew+"]?",eU="(?:"+ej+"(?:"+[eA,eR,eC].join("|")+")"+ek+ez+")*",eL=ek+ez+eU,eB="(?:"+["["+ev+"]",eR,eC].join("|")+")"+eL,eM="(?:"+[eA+eP+"?",eP,eR,eC,"["+eg+"]"].join("|")+")",e$=RegExp(eE,"g"),eH=RegExp(eP,"g"),eV=RegExp(eO+"(?="+eO+")|"+eM+eL,"g"),eK=RegExp([eN+"?"+ex+"+"+eq+"(?="+[eI,eN,"$"].join("|")+")","(?:"+eN+"|"+eS+")+"+eD+"(?="+[eI,eN+eT,"$"].join("|")+")",eN+"?"+eT+"+"+eq,eN+"+"+eD,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])","\\d+",eB].join("|"),"g"),eF=RegExp("["+ej+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"],eG=-1,eJ={};eJ[O]=eJ[A]=eJ[R]=eJ[C]=eJ[N]=eJ[j]=eJ[T]=eJ[q]=eJ[D]=!0,eJ[l]=eJ[u]=eJ[x]=eJ[h]=eJ[S]=eJ[f]=eJ[p]=eJ[d]=eJ[y]=eJ[v]=eJ[m]=eJ[w]=eJ[_]=eJ[E]=eJ[P]=!1;var eQ={};eQ[l]=eQ[u]=eQ[x]=eQ[S]=eQ[h]=eQ[f]=eQ[O]=eQ[A]=eQ[R]=eQ[C]=eQ[N]=eQ[y]=eQ[v]=eQ[m]=eQ[w]=eQ[_]=eQ[E]=eQ[I]=eQ[j]=eQ[T]=eQ[q]=eQ[D]=!0,eQ[p]=eQ[d]=eQ[P]=!1;var eY={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},eX=parseFloat,e0=parseInt,e1="object"==typeof s_&&s_&&s_.Object===Object&&s_,e2="object"==typeof self&&self&&self.Object===Object&&self,e3=e1||e2||Function("return this")(),e8=t&&!t.nodeType&&t,e5=e8&&e&&!e.nodeType&&e,e6=e5&&e5.exports===e8,e4=e6&&e1.process,e9=function(){try{return e5&&e5.require&&e5.require("util").types||e4&&e4.binding&&e4.binding("util")}catch{}}(),e7=e9&&e9.isArrayBuffer,te=e9&&e9.isDate,tt=e9&&e9.isMap,tr=e9&&e9.isRegExp,ti=e9&&e9.isSet,tn=e9&&e9.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 tu(e,t){return!!(null==e?0:e.length)&&tw(e,t,0)>-1}function th(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 tf(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 tp(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=tP("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: 4,594 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?tO(e,t)/r:a}function tP(e){return function(t){return null==t?r:t[e]}}function tx(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 tO(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 tA(e,t){for(var r=-1,i=Array(e);++r<e;)i[r]=t(r);return i}function tR(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 tf(t,function(t){return e[t]})}function tj(e,t){return e.has(t)}function tT(e,t){for(var r=-1,i=e.length;++r<i&&tw(t,e[r],0)>-1;);return r}function tq(e,t){for(var r=e.length;r--&&tw(t,e[r],0)>-1;);return r}var tD=tx({Ã:"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",Å¿:"s"}),tz=tx({"&":"&","<":"<",">":">",'"':""","'":"'"});function tk(e){return"\\"+eY[e]}function tU(e){return eF.test(e)}function tL(e){var t=-1,r=Array(e.size);return e.forEach(function(e,i){r[++t]=[i,e]}),r}function tB(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 t$(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}function tH(e){return tU(e)?function(e){for(var t=eV.lastIndex=0;eV.test(e);)++t;return t}(e):tv(e)}function tV(e){return tU(e)?e.match(eV)||[]:e.split("")}function tK(e){for(var t=e.length;t--&&Y.test(e.charAt(t)););return t}var tF=tx({"&":"&","<":"<",">":">",""":'"',"'":"'"}),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,eP=t.RegExp,ex=t.String,eS=t.TypeError,eO=em.prototype,eA=e_.prototype,eR=eI.prototype,eC=t["__core-js_shared__"],eN=eA.toString,ej=eR.hasOwnProperty,eT=0,eq=(Y=/[^.]+$/.exec(eC&&eC.keys&&eC.keys.IE_PROTO||""))?"Symbol(src)_1."+Y:"",eD=eR.toString,ez=eN.call(eI),ek=e3._,eU=eP("^"+eN.call(ej).replace(G,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),eL=e6?t.Buffer:r,eB=t.Symbol,eM=t.Uint8Array,eV=eL?eL.allocUnsafe:r,eF=tB(eI.getPrototypeOf,eI),eY=eI.create,e1=eR.propertyIsEnumerable,e2=eO.splice,e8=eB?eB.isConcatSpreadable:r,e5=eB?eB.iterator:r,e4=eB?eB.toStringTag:r,e9=function(){try{var e=nd(eI,"defineProperty");return e({},"",{}),e}catch{}}(),tv=t.clearTimeout!==e3.clearTimeout&&t.clearTimeout,tx=eb&&eb.now!==e3.Date.now&&eb.now,tW=t.setTimeout!==e3.setTimeout&&t.setTimeout,tG=eE.ceil,tJ=eE.floor,tQ=eI.getOwnPropertySymbols,tY=eL?eL.isBuffer:r,tX=t.isFinite,t0=eO.join,t1=tB(eI.keys,eI),t2=eE.max,t3=eE.min,t8=eb.now,t5=t.parseInt,t6=eE.random,t4=eO.reverse,t9=nd(t,"DataView"),t7=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=nL(t9),ra=nL(t7),rc=nL(re),rl=nL(rt),ru=nL(rr),rh=eB?eB.prototype:r,rf=rh?rh.valueOf
1:r,rp=rh?rh.toString:r;function rd(e){if(sF(e)&&!sD(e)&&!(e instanceof rm)){if(e instanceof rv)return e;if(ej.call(e,"__wrapped__"))return nB(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 rP(e,t){var r=sD(e),i=!r&&sq(e),n=!r&&!i&&sL(e),s=!r&&!i&&!n&&s0(e),o=r||i||n||s,a=o?tA(e.length,ex):[],c=a.length;for(var l in e)(t||ej.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 rx(e){var t=e.length;return t?e[iu(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 rO(e,t,i){var n=e[t];ej.call(e,t)&&sN(n,i)&&(i!==r||t in e)||rN(e,t,i)}function rA(e,t){for(var r=e.length;r--;)if(sN(e[r][0],t))return r;return -1}function rR(e,t,r,i){return rU(e,function(e,n,s){t(i,e,r(e),s)}),i}function rC(e,t){return e&&iH(t,of(t),e)}function rN(e,t,r){"__proto__"==t&&e9?e9(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function rj(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 rT(e,t,i){return e==e&&(i!==r&&(e=e<=i?e:i),t!==r&&(e=e>=t?e:t)),e}function rq(e,t,i,n,s,o){var a,c=1&t,u=2&t,p=4&t;if(i&&(a=s?i(e,n,s,o):i(e)),a!==r)return a;
1if(!sK(e))return e;var b=sD(e);if(b){if(P=e.length,z=new e.constructor(P),P&&"string"==typeof e[0]&&ej.call(e,"index")&&(z.index=e.index,z.input=e.input),a=z,!c)return i$(e,a)}else{var P,z,k,U,L,B=nv(e),M=B==d||B==g;if(sL(e))return iz(e,c);if(B==m||B==l||M&&!s){if(a=u||M?{}:nb(e),!c)return u?(k=(L=a)&&iH(e,op(e),L),iH(e,ny(e),k)):(U=rC(a,e),iH(e,ng(e),U))}else{if(!eQ[B])return s?e:{};a=function(e,t,r){var i,n,s=e.constructor;switch(t){case x:return ik(e);case h:case f:return new s(+e);case S:return i=r?ik(e.buffer):e.buffer,new e.constructor(i,e.byteOffset,e.byteLength);case O:case A:case R:case C:case N:case j:case T:case q:case D:return iU(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 rf?eI(rf.call(e)):{}}}(e,B,c)}}o||(o=new rI);var $=o.get(e);if($)return $;o.set(e,a),sQ(e)?e.forEach(function(r){a.add(rq(r,t,i,r,e,o))}):sZ(e)&&e.forEach(function(r,n){a.set(n,rq(r,t,i,n,e,o))});var H=p?u?na:no:u?op:of,V=b?r:H(e);return ta(V||e,function(r,n){V&&(r=e[n=r]),rO(a,n,rq(r,t,i,n,e,o))}),a}function rD(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 rz(e,t,n){if("function"!=typeof e)throw new eS(i);return nj(function(){e.apply(r,n)},t)}function rk(e,t,r,i){var n=-1,s=tu,o=!0,a=e.length,c=[],l=t.length;if(!a)return c;r&&(t=tf(t,tC(r))),i?(s=th,o=!1):t.length>=200&&(s=tj,o=!1,t=new rE(t));e:for(;++n<a;){var u=e[n],h=null==r?u:r(u);if(u=i||0!==u?u:0,o&&h==h){for(var f=l;f--;)if(t[f]===h)continue e;c.push(u)}else s(t,h,i)||c.push(u)}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 ej.call(t,e)?t[e]:r},rb.prototype.has=function(e){var t=this.__data__;return ri?t[e]!==r:ej.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=rA(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=rA(t,e);return i<0?r:t[i][1]},rw.prototype.has=function(e){return rA(this.__data__,e)>-1},rw.prototype.set=function(e,t){var r=this.__data__,i=rA(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(t7||rw),string:new rb}},r_.prototype.delete=function(e){var t=nf(this,e).delete(e);return this.size-=t?1:0,t},r_.prototype.get=function(e){return nf(this,e).get(e)},r_.prototype.has=function(e){return nf(this,e).has(e)},r_.prototype.set=function(e,t){var r=nf(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(!t7||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 rU=iF(rF),rL=iF(rZ,!0);function rB(e,t){var r=!0;return rU(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 r$(e,t){var r=[];return rU(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):tp(n,a):i||(n[n.length]=a)}return n}var rV=iZ(),rK=iZ(!0);function rF(e,t){return e&&rV(e,t,of)}function rZ(e,t){return e&&rK(e,t,of)}function rW(e,t){return tl(t,function(t){return s$(e[t])})}function rG(e,t){t=iT(t,e);for(var i=0,n=t.length;null!=e&&i<n;)e=e[nU(t[i++])];return i&&i==n?e:r}function rJ(e,t,r){var i=t(e);return sD(e)?i:tp(i,r(e))}
1function rQ(e){return null==e?e===r?"[object Undefined]":"[object Null]":e4&&e4 in eI(e)?function(e){var t=ej.call(e,e4),i=e[e4];try{e[e4]=r;var n=!0}catch{}var s=eD.call(e);return n&&(t?e[e4]=i:delete e[e4]),s}(e):eD.call(e)}function rY(e,t){return e>t}function rX(e,t){return null!=e&&ej.call(e,t)}function r0(e,t){return null!=e&&t in eI(e)}function r1(e,t,i){for(var n=i?th:tu,s=e[0].length,o=e.length,a=o,c=em(o),l=1/0,u=[];a--;){var h=e[a];a&&t&&(h=tf(h,tC(t))),l=t3(h.length,l),c[a]=!i&&(t||s>=120&&h.length>=120)?new rE(a&&h):r}h=e[0];var f=-1,p=c[0];e:for(;++f<s&&u.length<l;){var d=h[f],g=t?t(d):d;if(d=i||0!==d?d:0,!(p?tj(p,g):n(u,g,i))){for(a=o;--a;){var y=c[a];if(!(y?tj(y,g):n(e[a],g,i)))continue e}p&&p.push(g),u.push(d)}}return u}function r2(e,t,i){t=iT(t,e);var n=null==(e=nR(e,t))?e:e[nU(nQ(t))];return null==n?r:ts(n,e,i)}function r3(e){return sF(e)&&rQ(e)==l}function r8(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=sD(e),c=sD(t),d=a?u:nv(e),g=c?u:nv(t);d=d==l?m:d,g=g==l?m:g;var b=d==m,P=g==m,O=d==g;if(O&&sL(e)){if(!sL(t))return!1;a=!0,b=!1}if(O&&!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 x:return!(e.byteLength!=t.byteLength||!s(new eM(e),new eM(t)));case h:case f:case v:return sN(+e,+t);case p:return e.name==t.name&&e.message==t.message;case w:case E:return e==t+"";case y:var a=tL;case _:var c=1&i;if(a||(a=t$),e.size!=t.size&&!c)break;var l=o.get(e);if(l)return l==t;i|=2,o.set(e,t);var u=nn(a(e),a(t),i,n,s,o);return o.delete(e),u;case I:if(rf)return rf.call(e)==rf.call(t)}return!1}(e,t,d,i,n,s,o);if(!(1&i)){var A=b&&ej.call(e,"__wrapped__"),R=P&&ej.call(t,"__wrapped__");
vendor: 5,438 bytes, line 1
1if(A||R){var C=A?e.value():e,N=R?t.value():t;return o||(o=new rI),s(C,N,i,n,o)}}return!!O&&(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 u=l;u--;){var h=c[u];if(!(a?h in t:ej.call(t,h)))return!1}var f=o.get(e),p=o.get(t);if(f&&p)return f==t&&p==e;var d=!0;o.set(e,t),o.set(t,e);for(var g=a;++u<l;){var y=e[h=c[u]],v=t[h];if(n)var m=a?n(v,y,h,t,e,o):n(y,v,h,e,t,o);if(!(m===r?y===v||s(y,v,i,n,o):m)){d=!1;break}g||(g="constructor"==h)}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,r8,s):e!=e&&t!=t)}function r5(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],u=e[l],h=c[1];if(a&&c[2]){if(u===r&&!(l in e))return!1}else{var f=new rI;if(n)var p=n(u,h,l,e,t,f);if(!(p===r?r8(h,u,3,n,f):p))return!1}}return!0}function r6(e){return!(!sK(e)||eq&&eq in e)&&(s$(e)?eU:el).test(nL(e))}function r4(e){return"function"==typeof e?e:null==e?oU:"object"==typeof e?sD(e)?ir(e[0],e[1]):it(e):oZ(e)}function r9(e){if(!nS(e))return t1(e);var t=[];for(var r in eI(e))ej.call(e,r)&&"constructor"!=r&&t.push(r);return t}function r7(e,t){return e<t}function ie(e,t){var r=-1,i=sk(e)?em(e.length):[];return rU(e,function(e,n,s){i[++r]=t(e,n,s)}),i}function it(e){var t=np(e);return 1==t.length&&t[0][2]?nO(t[0][0],t[0][1]):function(r){return r===e||r5(r,e,t)}}function ir(e,t){var i;return nI(e)&&(i=t)==i&&!sK(i)?nO(nU(e),t):function(i){var n=oa(i,e);return n===r&&n===t?oc(i,e):r8(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),u=a.get(l);if(u){rS(e,i,u);return}var h=o?o(c,l,i+"",e,t,a):r,f=h===r;if(f){var p=sD(l),d=!p&&sL(l),g=!p&&!d&&s0(l);h=l,p||d||g?sD(c)?h=c:sU(c)?h=i$(c):d?(f=!1,h=iz(l,!0)):g?(f=!1,h=iU(l,!0)):h=[]:sG(l)||sq(l)?(h=c,sq(c)?h=s9(c):(!sK(c)||s$(c))&&(h=nb(l))):f=!1}f&&(a.set(l,h),s(h,l,n,o,a),a.delete(l)),rS(e,i,h)}(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)}},op)}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?tf(t,function(e){return sD(e)?function(t){return rG(t,1===e.length?e[0]:e)}:e}):[oU];var i=-1;return t=tf(t,tC(nh())),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:tf(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=iL(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=rG(e,o);r(a,o)&&id(s,iT(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=i$(t)),r&&(a=tf(e,tC(r)));++s<o;)for(var c=0,l=t[s],u=r?r(l):l;(c=n(a,u,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):ix(e,n)}}return e}function iu(e,t){return e+tJ(t6()*(t-e+1))}function ih(e,t){var r="";if(!e||t<1||t>9007199254740991)return r;do t%2&&(r+=e),(t=tJ(t/2))&&(e+=e);while(t);return r}function ip(e,t){return nT(nA(e,t,oU),e+"")}function id(e,t,i,n){if(!sK(e))return e;t=iT(t,e);for(var s=-1,o=t.length,a=o-1,c=e;null!=c&&++s<o;){var l=nU(t[s]),u=i;if("__proto__"===l||"constructor"===l||"prototype"===l)break;if(s!=a){var h=c[l];(u=n?n(h,l,c):r)===r&&(u=sK(h)?h:n_(t[s+1])?[]:{})}rO(c,l,u),c=c[l]}return e}var ig=rn?function(e,t){return rn.set(e,t),e}:oU,iy=e9?function(e,t){return e9(e,"toString",{configurable:!0,enumerable:!1,value:oD(t),writable:!0})}:oU;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 rU(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,oU,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),u=t===r;s<o;){var h=tJ((s+o)/2),f=i(e[h]),p=f!==r,d=null===f,g=f==f,y=sX(f);if(a)var v=n||g;else v=u?g&&(n||p):c?g&&p&&(n||!d):l?g&&p&&!d&&(n||!y):!d&&!y&&(n?f<=t:f<t);v?s=h+1:o=h}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(sD(e))return tf(e,iI)+"";if(sX(e))return rp?rp.call(e):"";var t=e+"";return"0"==t&&1/e==-o?"-0":t}function iP(e,t,r){var i=-1,n=tu,s=e.length,o=!0,a=[],c=a;if(r)o=!1,n=th;else if(s>=200){var l=t?null:i9(e);if(l)return t$(l);o=!1,n=tj,c=new rE}else c=t?[]:a;e:for(;++i<s;){var u=e[i],h=t?t(u):u;if(u=r||0!==u?u:0,o&&h==h){for(var f=c.length;f--;)if(c[f]===h)continue e;t&&c.push(h),a.push(u)}else n(c,h,r)||(c!==a&&c.push(h),a.push(u))}return a}function ix(e,t){return t=iT(t,e),null==(e=nR(e,t))||delete e[nU(nQ(t))]}function iS(e,t,r,i){return id(e,t,r(rG(e,t)),i)}
vendor: 5,885 bytes, line 1
1function iO(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 iA(e,t){var r=e;return r instanceof rm&&(r=r.value()),td(t,function(e,t){return t.func.apply(t.thisArg,tp([e],t.args))},r)}function iR(e,t,r){var i=e.length;if(i<2)return i?iP(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 iP(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 sU(e)?e:[]}function ij(e){return"function"==typeof e?e:oU}function iT(e,t){return sD(e)?e:nI(e,t)?[e]:nk(s7(e))}function iq(e,t,i){var n=e.length;return i=i===r?n:i,!t&&i>=n?e:iv(e,t,i)}var iD=tv||function(e){return e3.clearTimeout(e)};function iz(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 iU(e,t){var r=t?ik(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function iL(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,u=sX(t);if(!c&&!u&&!o&&e>t||o&&a&&l&&!c&&!u||n&&a&&l||!i&&l||!s)return 1;if(!n&&!o&&!u&&e<t||u&&i&&s&&!n&&!o||c&&i&&s||!a&&s||!l)return -1}return 0}function iB(e,t,r,i){for(var n=-1,s=e.length,o=r.length,a=-1,c=t.length,l=t2(s-o,0),u=em(c+l),h=!i;++a<c;)u[a]=t[a];for(;++n<o;)(h||n<s)&&(u[r[n]]=e[n]);for(;l--;)u[a++]=e[n++];return u}function iM(e,t,r,i){for(var n=-1,s=e.length,o=-1,a=r.length,c=-1,l=t.length,u=t2(s-a,0),h=em(u+l),f=!i;++n<u;)h[n]=e[n];for(var p=n;++c<l;)h[p+c]=t[c];for(;++o<a;)(f||n<s)&&(h[p+r[o]]=e[n++]);return h}function i$(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):rO(i,c,l)}return i}function iV(e,t){return function(r,i){var n=sD(r)?to:rR,s=t?t():{};return n(r,e,nh(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=tU(t=s7(t))?tV(t):r,n=i?i[0]:t.charAt(0),s=i?iq(i,1).join(""):t.slice(1);return n[e]()+s}}function iG(e){return function(t){return td(oj(oP(t).replace(e$,"")),e,"")}}function iJ(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=nh(i,3);t=of(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]),u="wrapper"==l?nc(a):r;c=u&&nP(u[0])&&424==u[1]&&!u[4].length&&1==u[9]?c[nl(u[0])].apply(c,u[3]):1==a.length&&nP(a)?c[l]():c.thru(a)}return function(){var e=arguments,r=e[0];if(c&&1==e.length&&sD(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,u){var h=128&t,f=1&t,p=2&t,d=24&t,g=512&t,y=p?r:iJ(e);return function v(){for(var m=arguments.length,b=em(m),w=m;w--;)b[w]=arguments[w];if(d)var _=nu(v),E=function(e,t){for(var r=e.length,i=0;r--;)e[r]===t&&++i;return i}(b,_);if(n&&(b=iB(b,n,s,d)),o&&(b=iM(b,o,a,d)),m-=E,d&&m<u){var I=tM(b,_);return i6(e,t,iX,v.placeholder,i,b,I,c,l,u-m)}var P=f?i:this,x=p?P[e]:e;return m=b.length,c?b=function(e,t){for(var i=e.length,n=t3(t.length,i),s=i$(e);n--;){var o=t[n];e[n]=n_(o,i)?s[o]:r}return e}(b,c):g&&m>1&&b.reverse(),h&&l<m&&(b.length=l),this&&this!==e3&&this instanceof v&&(x=y||iJ(x)),x.apply(P,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=tf(t,tC(nh())),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?ih(t,e):t;var n=ih(t,tG(e/tH(t)));return tU(t)?iq(tV(n),0,e).join(""):n.slice(0,e)}function i8(e){return function(t,i,n){return n&&"number"!=typeof n&&nE(t,i,n)&&(i=n=r),t=s8(t),i===r?(i=t,t=0):i=s8(i),n=n===r?t<i?1:-1:s8(n),function(e,t,r,i){for(var n=-1,s=t2(tG((t-e)/(r||1)),0),o=em(s);s--;)o[i?s:++n]=e,e+=r;return o}(t,i,n,e)}}function i5(e){return function(t,r){return"string"==typeof t&&"string"==typeof r||(t=s4(t),r=s4(r)),e(t,r)}}function i6(e,t,i,n,s,o,a,c,l,u){var h=8&t,f=h?a:r,p=h?r:a,d=h?o:r,g=h?r:o;t|=h?32:64,4&(t&=~(h?64:32))||(t&=-4);var y=[e,t,s,d,f,g,p,c,l,u],v=i.apply(r,y);return nP(e)&&nN(v,y),v.placeholder=n,nq(v,e,t)}function i4(e){var t=eE[e];return function(e,r){if(e=s4(e),(r=null==r?0:t3(s5(r),292))&&tX(e)){var i=(s7(e)+"e").split("e");return+((i=(s7(t(i[0]+"e"+(+i[1]+r)))+"e").split("e"))[0]+"e"+(+i[1]-r))}return t(e)}}
1var i9=rt&&1/t$(new rt([,-0]))[1]==o?function(e){return new rt(e)}:oH;function i7(e){return function(t){var r,i,n=nv(t);return n==y?tL(t):n==_?(r=-1,i=Array(t.size),t.forEach(function(e){i[++r]=[e,e]}),i):tf(e(t),function(e){return[e,t[e]]})}}function ne(e,t,n,o,a,c,l,u){var h=2&t;if(!h&&"function"!=typeof e)throw new eS(i);var f=o?o.length:0;if(f||(t&=-97,o=a=r),l=l===r?l:t2(s5(l),0),u=u===r?u:s5(u),f-=a?a.length:0,64&t){var p=o,d=a;o=a=r}var g=h?r:nc(e),y=[e,t,n,o,a,p,d,c,l,u];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?iB(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],(u=y[9]=y[9]===r?h?0:e.length:t2(y[9]-f,0))||!(24&t)||(t&=-25),t&&1!=t)8==t||16==t?(v=e,m=t,b=u,w=iJ(v),j=function e(){for(var t=arguments.length,i=em(t),n=t,s=nu(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?i6(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?j=iX.apply(r,y):(_=e,E=t,I=n,P=o,x=1&E,S=iJ(_),j=function e(){for(var t=-1,r=arguments.length,i=-1,n=P.length,s=em(n+r),o=this&&this!==e3&&this instanceof e?S:_;++i<n;)s[i]=P[i];for(;r--;)s[i++]=arguments[++t];return ts(o,x?I:this,s)});else var v,m,b,w,_,E,I,P,x,S,O,A,R,C,N,j=(O=e,A=t,R=n,C=1&A,N=iJ(O),function e(){return(this&&this!==e3&&this instanceof e?N:O).apply(C?R:this,arguments)});return nq((g?ig:nN)(j,y),e,t)}function nt(e,t,i,n){return e===r||sN(e,eR[i])&&!ej.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 sG(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 u=o.get(e),h=o.get(t);if(u&&h)return u==t&&h==e;var f=-1,p=!0,d=2&i?new rE:r;for(o.set(e,t),o.set(t,e);++f<c;){var g=e[f],y=t[f];if(n)var v=a?n(y,g,f,t,e,o):n(g,y,f,e,t,o);if(v!==r){if(v)continue;p=!1;break}if(d){if(!ty(t,function(e,t){if(!tj(d,t)&&(g===e||s(g,e,i,n,o)))return d.push(t)})){p=!1;break}}else if(!(g===y||s(g,y,i,n,o))){p=!1;break}}return o.delete(e),o.delete(t),p}function ns(e){return nT(nA(e,r,nF),e+"")}function no(e){return rJ(e,of,ng)}function na(e){return rJ(e,op,ny)}var nc=rn?function(e){return rn.get(e)}:oH;function nl(e){for(var t=e.name+"",r=rs[t],i=ej.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 nu(e){return(ej.call(rd,"placeholder")?rd:e).placeholder}function nh(){var e=rd.iteratee||oL;return e=e===oL?r4:e,arguments.length?e(arguments[0],arguments[1]):e}function nf(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 np(e){for(var t=of(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 r6(i)?i:r}var ng=tQ?function(e){return null==e?[]:tl(tQ(e=eI(e)),function(t){return e1.call(e,t)})}:oJ,ny=tQ?function(e){for(var t=[];e;)tp(t,ng(e)),e=eF(e);return t}:oJ,nv=rQ;function nm(e,t,r){t=iT(t,e);for(var i=-1,n=t.length,s=!1;++i<n;){var o=nU(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)&&(sD(e)||sq(e))}function nb(e){return"function"!=typeof e.constructor||nS(e)?{}:rg(eF(e))}function nw(e){return sD(e)||sq(e)||!!(e8&&e&&e[e8])}function n_(e,t){var r=typeof e;return!!(t=t??9007199254740991)&&("number"==r||"symbol"!=r&&eh.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(sD(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 nP(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]}(t9&&nv(new t9(new ArrayBuffer(1)))!=S||t7&&nv(new t7)!=y||re&&nv(re.resolve())!=b||rt&&nv(new rt)!=_||rr&&nv(new rr)!=P)&&(nv=function(e){var t=rQ(e),i=t==m?e.constructor:r,n=i?nL(i):"";if(n)switch(n){case ro:return S;case ra:return y;case rc:return b;case rl:return _;case ru:return P}return t});var nx=eC?s$:oQ;function nS(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||eR)}function nO(e,t){return function(i){return null!=i&&i[e]===t&&(t!==r||e in eI(i))}}function nA(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 nR(e,t){return t.length<2?e:rG(e,iv(t,0,-1))}function nC(e,t){if(!("constructor"===t&&"function"==typeof e[t])&&"__proto__"!=t)return e[t]}var nN=nD(ig),nj=tW||function(e,t){return e3.setTimeout(e,t)},nT=nD(iy);function nq(e,t,r){var i,n,s=t+"";return nT(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]&&!tu(i,t)&&i.push(t)}),i.sort())))}function nD(e){var t=0,i=0;return function(){var n=t8(),s=16-(n-i);if(i=n,s>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(r,arguments)}}function nz(e,t){var i=-1,n=e.length,s=n-1;for(t=t===r?n:t;++i<t;){var o=iu(i,s),a=e[o];e[o]=e[i],e[i]=a}return e.length=t,e}var nk=(ey=(eg=sx(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 nU(e){if("string"==typeof e||sX(e))return e;var t=e+"";return"0"==t&&1/e==-o?"-0":t}function nL(e){if(null!=e){try{return eN.call(e)}catch{}try{return e+""}catch{}}return""}function nB(e){if(e instanceof rm)return e.clone();var t=new rv(e.__wrapped__,e.__chain__);return t.__actions__=i$(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}
vendor: 7,421 bytes, line 3
3var nM=ip(function(e,t){return sU(e)?rk(e,rH(t,1,sU,!0)):[]}),n$=ip(function(e,t){var i=nQ(t);return sU(i)&&(i=r),sU(e)?rk(e,rH(t,1,sU,!0),nh(i,2)):[]}),nH=ip(function(e,t){var i=nQ(t);return sU(i)&&(i=r),sU(e)?rk(e,rH(t,1,sU,!0),r,i):[]});function nV(e,t,r){var i=null==e?0:e.length;if(!i)return -1;var n=null==r?0:s5(r);return n<0&&(n=t2(i+n,0)),tb(e,nh(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=s5(i),s=i<0?t2(n+s,0):t3(s,n-1)),tb(e,nh(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=tf(e,iN);return t.length&&t[0]===e[0]?r1(t):[]}),nG=ip(function(e){var t=nQ(e),i=tf(e,iN);return t===nQ(i)?t=r:i.pop(),i.length&&i[0]===e[0]?r1(i,nh(t,2)):[]}),nJ=ip(function(e){var t=nQ(e),i=tf(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=rj(e,t);return il(e,tf(t,function(e){return n_(e,r)?+e:e}).sort(iL)),i});function n1(e){return null==e?e:t4.call(e)}var n2=ip(function(e){return iP(rH(e,1,sU,!0))}),n3=ip(function(e){var t=nQ(e);return sU(t)&&(t=r),iP(rH(e,1,sU,!0),nh(t,2))}),n8=ip(function(e){var t=nQ(e);return t="function"==typeof t?t:r,iP(rH(e,1,sU,!0),r,t)});function n5(e){if(!(e&&e.length))return[];var t=0;return e=tl(e,function(e){if(sU(e))return t=t2(e.length,t),!0}),tA(t,function(t){return tf(e,tP(t))})}function n6(e,t){if(!(e&&e.length))return[];var i=n5(e);return null==t?i:tf(i,function(e){return ts(t,r,e)})}var n4=ip(function(e,t){return sU(e)?rk(e,t):[]}),n9=ip(function(e){return iR(tl(e,sU))}),n7=ip(function(e){var t=nQ(e);return sU(t)&&(t=r),iR(tl(e,sU),nh(t,2))}),se=ip(function(e){var t=nQ(e);return t="function"==typeof t?t:r,iR(tl(e,sU),r,t)}),st=ip(n5),sr=ip(function(e){var t=e.length,i=t>1?e[t-1]:r;return i="function"==typeof i?(e.pop(),i):r,n6(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 rj(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){ej.call(e,r)?++e[r]:rN(e,r,1)}),sa=iQ(nV),sc=iQ(nK);function sl(e,t){return(sD(e)?ta:rU)(e,nh(t,3))}function su(e,t){return(sD(e)?function(e,t){for(var r=null==e?0:e.length;r--&&!1!==t(e[r],r,e););return e}:rL)(e,nh(t,3))}var sh=iV(function(e,t,r){ej.call(e,r)?e[r].push(t):rN(e,r,[t])}),sf=ip(function(e,t,r){var i=-1,n="function"==typeof t,s=sk(e)?em(e.length):[];return rU(e,function(e){s[++i]=n?ts(t,e,r):r2(e,t,r)}),s}),sp=iV(function(e,t,r){rN(e,r,t)});function sd(e,t){return(sD(e)?tf:ie)(e,nh(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=tx||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=s5(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,nu(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,nu(s_));i|=32}return ne(t,i,e,r,n)});function sE(e,t,n){var s,o,a,c,l,u,h=0,f=!1,p=!1,d=!0;if("function"!=typeof e)throw new eS(i);function g(t){var i=s,n=o;return s=o=r,h=t,c=e.apply(n,i)}function y(e){var i=e-u,n=e-h;return u===r||i>=t||i<0||p&&n>=a}function v(){var e,r,i,n=sv();if(y(n))return m(n);l=nj(v,(e=n-u,r=n-h,i=t-e,p?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,u=i,n){if(l===r)return h=e=u,l=nj(v,t),f?g(e):c;if(p)return iD(l),l=nj(v,t),g(u)}return l===r&&(l=nj(v,t)),c}return t=s4(t)||0,sK(n)&&(f=!!n.leading,a=(p="maxWait"in n)?t2(s4(n.maxWait)||0,t):a,d="trailing"in n?!!n.trailing:d),b.cancel=function(){l!==r&&iD(l),h=0,s=u=o=l=r},b.flush=function(){return l===r?c:m(sv())},b}var sI=ip(function(e,t){return rz(e,1,t)}),sP=ip(function(e,t,r){return rz(e,s4(t)||0,r)});function sx(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(sx.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)}}sx.Cache=r_;var sO=ip(function(e,t){var r=(t=1==t.length&&sD(t[0])?tf(t[0],tC(nh())):tf(rH(t,1),tC(nh()))).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)})}),sA=ip(function(e,t){var i=tM(t,nu(sA));return ne(e,32,r,t,i)}),sR=ip(function(e,t){var i=tM(t,nu(sR));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 sj=i5(rY),sT=i5(function(e,t){return e>=t}),sq=r3(function(){return arguments}())?r3:function(e){return sF(e)&&ej.call(e,"callee")&&!e1.call(e,"callee")},sD=em.isArray,sz=e7?tC(e7):function(e){return sF(e)&&rQ(e)==x};function sk(e){return null!=e&&sV(e.length)&&!s$(e)}function sU(e){return sF(e)&&sk(e)}var sL=tY||oQ,sB=te?tC(te):function(e){return sF(e)&&rQ(e)==f};function sM(e){if(!sF(e))return!1;var t=rQ(e);return t==p||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!sG(e)}function s$(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==s5(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 sG(e){if(!sF(e)||rQ(e)!=m)return!1;var t=eF(e);if(null===t)return!0;var r=ej.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&eN.call(r)==ez}var sJ=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||!sD(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)&&!!eJ[rQ(e)]},s1=i5(r7),s2=i5(function(e,t){return e<=t});function s3(e){if(!e)return[];if(sk(e))return sY(e)?tV(e):i$(e);if(e5&&e[e5])return function(e){for(var t,r=[];!(t=e.next()).done;)r.push(t.value);return r}(e[e5]());var t=nv(e);return(t==y?tL:t==_?t$:o_)(e)}function s8(e){return e?(e=s4(e))===o||e===-o?(e<0?-1:1)*17976931348623157e292:e==e?e:0:0===e?e:0}function s5(e){var t=s8(e),r=t%1;return t==t?r?t-r:t:0}function s6(e){return e?rT(s5(e),0,4294967295):0}function s4(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=tR(e);var r=ec.test(e);return r||eu.test(e)?e0(e.slice(2),r?2:8):ea.test(e)?a:+e}function s9(e){return iH(e,op(e))}function s7(e){return null==e?"":iI(e)}var oe=iK(function(e,t){if(nS(t)||sk(t)){iH(t,of(t),e);return}for(var r in t)ej.call(t,r)&&rO(e,r,t[r])}),ot=iK(function(e,t){iH(t,op(t),e)}),or=iK(function(e,t,r,i){iH(t,op(t),e,i)}),oi=iK(function(e,t,r,i){iH(t,of(t),e,i)}),on=ns(rj),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=op(o),c=-1,l=a.length;++c<l;){var u=a[c],h=e[u];(h===r||sN(h,eR[u])&&!ej.call(e,u))&&(e[u]=o[u])}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:rG(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=eD.call(t)),e[t]=r},oD(oU)),ou=i0(function(e,t,r){null!=t&&"function"!=typeof t.toString&&(t=eD.call(t)),ej.call(e,t)?e[t].push(r):e[t]=[r]},nh),oh=ip(r2);function of(e){return sk(e)?rP(e):r9(e)}function op(e){return sk(e)?rP(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||!ej.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=tf(t,function(t){return t=iT(t,e),i||(i=t.length>1),t}),iH(e,na(e),r),i&&(r=rq(r,7,ni));for(var n=t.length;n--;)ix(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=tf(na(e),function(e){return[e]});return t=nh(t),ia(e,r,function(e,r){return t(e,r[0])})}var ob=i7(of),ow=i7(op);function o_(e){return null==e?[]:tN(e,of(e))}var oE=iG(function(e,t,r){return t=t.toLowerCase(),e+(r?oI(t):t)});function oI(e){return oN(s7(e).toLowerCase())}function oP(e){return(e=s7(e))&&e.replace(ef,tD).replace(eH,"")}var ox=iG(function(e,t,r){return e+(r?"-":"")+t.toLowerCase()}),oS=iG(function(e,t,r){return e+(r?" ":"")+t.toLowerCase()}),oO=iW("toLowerCase"),oA=iG(function(e,t,r){return e+(r?"_":"")+t.toLowerCase()}),oR=iG(function(e,t,r){return e+(r?" ":"")+oN(t)}),oC=iG(function(e,t,r){return e+(r?" ":"")+t.toUpperCase()}),oN=iW("toUpperCase");function oj(e,t,i){var n;return e=s7(e),(t=i?r:t)===r?(n=e,eZ.test(n))?e.match(eK)||[]:e.match(er)||[]:e.match(t)||[]}var oT=ip(function(e,t){try{return ts(e,r,t)}catch(e){return sM(e)?e:new ew(e)}}),oq=ns(function(e,t){return ta(t,function(t){rN(e,t=nU(t),sw(e[t],e))}),e});function oD(e){return function(){return e}}var oz=iY(),ok=iY(!0);function oU(e){return e}function oL(e){return r4("function"==typeof e?e:rq(e,1))}var oB=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 o$(e,t,r){var i=of(t),n=rW(t,i);null!=r||sK(t)&&(n.length||!i.length)||(r=t,t=e,e=this,n=rW(t,of(t)));var s=!(sK(r)&&"chain"in r)||!!r.chain,o=s$(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__=i$(this.__actions__)).push({func:i,args:arguments,thisArg:e}),r.__chain__=t,r}return i.apply(e,tp([this.value()],arguments))})}),e}function oH(){}var oV=i2(tf),oK=i2(tc),oF=i2(ty);function oZ(e){return nI(e)?tP(nU(e)):function(t){return rG(t,e)}}var oW=i8(),oG=i8(!0);function oJ(){return[]}function oQ(){return!1}var oY=i1(function(e,t){return e+t},0),oX=i4("ceil"),o0=i1(function(e,t){return e/t},1),o1=i4("floor"),o2=i1(function(e,t){return e*t},1),o3=i4("round"),o8=i1(function(e,t){return e-t},0);return rd.after=function(e,t){if("function"!=typeof t)throw new eS(i);return e=s5(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=oq,rd.bindKey=s_,rd.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return sD(e)?e:[e]},rd.chain=si,rd.chunk=function(e,t,i){t=(i?nE(e,t,i):t===r)?1:t2(s5(t),0);var n=null==e?0:e.length;if(!n||t<1)return[];for(var s=0,o=0,a=em(tG(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[];
3for(var t=em(e-1),r=arguments[0],i=e;i--;)t[i-1]=arguments[i];return tp(sD(r)?i$(r):[r],rH(t,1))},rd.cond=function(e){var t=null==e?0:e.length,r=nh();return e=t?tf(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=of(t=rq(e,1)),function(e){return rD(e,t,r)}},rd.constant=oD,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=sP,rd.difference=nM,rd.differenceBy=n$,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:s5(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:s5(t)))<0?0:t):[]},rd.dropRightWhile=function(e,t){return e&&e.length?iO(e,nh(t,3),!0,!0):[]},rd.dropWhile=function(e,t){return e&&e.length?iO(e,nh(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=s5(i))<0&&(i=-i>s?0:s+i),(n=n===r||n>s?s:s5(n))<0&&(n+=s),n=i>n?0:s6(n);i<n;)e[i++]=t;return e}(e,t,i,n)):[]},rd.filter=function(e,t){return(sD(e)?tl:r$)(e,nh(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:s5(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:s5(t)):[]},rd.flip=function(e){return ne(e,512)},rd.flow=oz,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,of(e))},rd.functionsIn=function(e){return null==e?[]:rW(e,op(e))},rd.groupBy=sh,rd.initial=function(e){return(null==e?0:e.length)?iv(e,0,-1):[]},rd.intersection=nW,rd.intersectionBy=nG,rd.intersectionWith=nJ,rd.invert=ol,rd.invertBy=ou,rd.invokeMap=sf,rd.iteratee=oL,rd.keyBy=sp,rd.keys=of,rd.keysIn=op,rd.map=sd,rd.mapKeys=function(e,t){var r={};return t=nh(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=nh(t,3),rF(e,function(e,i,n){rN(r,i,t(e,i,n))}),r},rd.matches=function(e){return it(rq(e,1))},rd.matchesProperty=function(e,t){return ir(e,rq(t,1))},rd.memoize=sx,rd.merge=od,rd.mergeWith=og,rd.method=oB,rd.methodOf=oM,rd.mixin=o$,rd.negate=sS,rd.nthArg=function(e){return e=s5(e),ip(function(t){return is(t,e)})},rd.omit=oy,rd.omitBy=function(e,t){return om(e,sS(nh(t)))},rd.once=function(e){return sb(2,e)},rd.orderBy=function(e,t,i,n){return null==e?[]:(sD(t)||(t=null==t?[]:[t]),sD(i=n?r:i)||(i=null==i?[]:[i]),io(e,t,i))},rd.over=oV,rd.overArgs=sO,rd.overEvery=oK,rd.overSome=oF,rd.partial=sA,rd.partialRight=sR,rd.partition=sg,rd.pick=ov,rd.pickBy=om,rd.property=oZ,rd.propertyOf=function(e){return function(t){return null==e?r:rG(e,t)}},rd.pull=nY,rd.pullAll=nX,rd.pullAllBy=function(e,t,r){return e&&e.length&&t&&t.length?ic(e,t,nh(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=oG,rd.rearg=sC,rd.reject=function(e,t){return(sD(e)?tl:r$)(e,sS(nh(t,3)))},rd.remove=function(e,t){var r=[];if(!(e&&e.length))return r;var i=-1,n=[],s=e.length;for(t=nh(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:s5(t))},rd.reverse=n1,rd.sampleSize=function(e,t,i){return t=(i?nE(e,t,i):t===r)?1:s5(t),(sD(e)?function(e,t){return nz(i$(e),rT(t,0,e.length))}:function(e,t){var r=o_(e);return nz(r,rT(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(sD(e)?function(e){return nz(i$(e))}:function(e){return nz(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:s5(t),i=i===r?n:s5(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,nh(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=s7(e))&&("string"==typeof t||null!=t&&!sJ(t))&&!(t=iI(t))&&tU(e)?iq(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(s5(t),0),ip(function(r){var i=r[t],n=iq(r,0,t);return i&&tp(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:s5(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:s5(t)))<0?0:t,n):[]},rd.takeRightWhile=function(e,t){return e&&e.length?iO(e,nh(t,3),!1,!0):[]},rd.takeWhile=function(e,t){return e&&e.length?iO(e,nh(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 sD(e)?tf(e,nU):sX(e)?[e]:i$(nk(s7(e)))},rd.toPlainObject=s9,rd.transform=function(e,t,r){var i=sD(e),n=i||sL(e)||s0(e);if(t=nh(t,4),null==r){var s=e&&e.constructor;r=n?i?new s:[]:sK(e)&&s$(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=n8,rd.uniq=function(e){return e&&e.length?iP(e):[]},rd.uniqBy=function(e,t){return e&&e.length?iP(e,nh(t,2)):[]},rd.uniqWith=function(e,t){return t="function"==typeof t?t:r,e&&e.length?iP(e,r,t):[]},rd.unset=function(e,t){return null==e||ix(e,t)},rd.unzip=n5,rd.unzipWith=n6,rd.update=function(e,t,r){return null==e?e:iS(e,t,ij(r))},rd.updateWith=function(e,t,i,n){return n="function"==typeof n?n:r,null==e?e:iS(e,t,ij(i),n)},rd.values=o_,rd.valuesIn=function(e){return null==e?[]:tN(e,op(e))},rd.without=n4,rd.words=oj,rd.wrap=function(e,t){return sA(ij(t),e)},rd.xor=n9,rd.xorBy=n7,rd.xorWith=se,rd.zip=st,rd.zipObject=function(e,t){return iC(e||[],t||[],rO)},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,o$(rd,rd),rd.add=oY,rd.attempt=oT,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=s4(i))==i?i:0),t!==r&&(t=(t=s4(t))==t?t:0),rT(s4(e),t,i)},rd.clone=function(e){return rq(e,4)},rd.cloneDeep=function(e){return rq(e,5)},rd.cloneDeepWith=function(e,t){return rq(e,5,t="function"==typeof t?t:r)},rd.cloneWith=function(e,t){return rq(e,4,t="function"==typeof t?t:r)},rd.conformsTo=function(e,t){return null==t||rD(e,t,of(t))},rd.deburr=oP,rd.defaultTo=function(e,t){return null==e||e!=e?t:e},rd.divide=o0,rd.endsWith=function(e,t,i){e=s7(e),t=iI(t);var n=e.length,s=i=i===r?n:rT(s5(i),0,n);return(i-=t.length)>=0&&e.slice(i,s)==t},rd.eq=sN,rd.escape=function(e){return(e=s7(e))&&$.test(e)?e.replace(B,tz):e},rd.escapeRegExp=function(e){return(e=s7(e))&&J.test(e)?e.replace(G,"\\$&"):e},rd.every=function(e,t,i){var n=sD(e)?tc:rB;return i&&nE(e,t,i)&&(t=r),n(e,nh(t,3))},rd.find=sa,rd.findIndex=nV,rd.findKey=function(e,t){return tm(e,nh(t,3),rF)},rd.findLast=sc,rd.findLastIndex=nK,rd.findLastKey=function(e,t){return tm(e,nh(t,3),rZ)},rd.floor=o1,rd.forEach=sl,rd.forEachRight=su,rd.forIn=function(e,t){return null==e?e:rV(e,nh(t,3),op)},rd.forInRight=function(e,t){return null==e?e:rK(e,nh(t,3),op)},rd.forOwn=function(e,t){return e&&rF(e,nh(t,3))},rd.forOwnRight=function(e,t){return e&&rZ(e,nh(t,3))},rd.get=oa,rd.gt=sj,rd.gte=sT,rd.has=function(e,t){return null!=e&&nm(e,t,rX)},rd.hasIn=oc,rd.head=nZ,rd.identity=oU,rd.includes=function(e,t,r,i){e=sk(e)?e:o_(e),r=r&&!i?s5(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:s5(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=s8(t),i===r?(i=t,t=0):i=s8(i),(n=e=s4(e))>=t3(s=t,o=i)&&n<t2(s,o)},rd.invoke=oh,rd.isArguments=sq,rd.isArray=sD,rd.isArrayBuffer=sz,rd.isArrayLike=sk,rd.isArrayLikeObject=sU,rd.isBoolean=function(e){return!0===e||!1===e||sF(e)&&rQ(e)==h},rd.isBuffer=sL,rd.isDate=sB,rd.isElement=function(e){return sF(e)&&1===e.nodeType&&!sG(e)},rd.isEmpty=function(e){if(null==e)return!0;
vendor: 2,851 bytes, line 3
3if(sk(e)&&(sD(e)||"string"==typeof e||"function"==typeof e.splice||sL(e)||s0(e)||sq(e)))return!e.length;var t=nv(e);if(t==y||t==_)return!e.size;if(nS(e))return!r9(e).length;for(var r in e)if(ej.call(e,r))return!1;return!0},rd.isEqual=function(e,t){return r8(e,t)},rd.isEqualWith=function(e,t,i){var n=(i="function"==typeof i?i:r)?i(e,t):r;return n===r?r8(e,t,r,i):!!n},rd.isError=sM,rd.isFinite=function(e){return"number"==typeof e&&tX(e)},rd.isFunction=s$,rd.isInteger=sH,rd.isLength=sV,rd.isMap=sZ,rd.isMatch=function(e,t){return e===t||r5(e,t,np(t))},rd.isMatchWith=function(e,t,i){return i="function"==typeof i?i:r,r5(e,t,np(t),i)},rd.isNaN=function(e){return sW(e)&&e!=+e},rd.isNative=function(e){if(nx(e))throw new ew("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return r6(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=sG,rd.isRegExp=sJ,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)==P},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=ox,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=s5(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=oO,rd.lt=s1,rd.lte=s2,rd.max=function(e){return e&&e.length?rM(e,oU,rY):r},rd.maxBy=function(e,t){return e&&e.length?rM(e,nh(t,2),rY):r},rd.mean=function(e){return tI(e,oU)},rd.meanBy=function(e,t){return tI(e,nh(t,2))},rd.min=function(e){return e&&e.length?rM(e,oU,r7):r},rd.minBy=function(e,t){return e&&e.length?rM(e,nh(t,2),r7):r},rd.stubArray=oJ,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,s5(t)):r},rd.noConflict=function(){return e3._===this&&(e3._=ek),this},rd.noop=oH,rd.now=sv,rd.pad=function(e,t,r){e=s7(e);var i=(t=s5(t))?tH(e):0;if(!t||i>=t)return e;var n=(t-i)/2;return i3(tJ(n),r)+e+i3(tG(n),r)},rd.padEnd=function(e,t,r){e=s7(e);var i=(t=s5(t))?tH(e):0;return t&&i<t?e+i3(t-i,r):e},rd.padStart=function(e,t,r){e=s7(e);var i=(t=s5(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),t5(s7(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=s8(e),t===r?(t=e,e=0):t=s8(t)),e>t){var n=e;e=t,t=n}if(i||e%1||t%1){var s=t6();
vendor: 5,302 bytes, lines 3-20
3return t3(e+s*(t-e+eX("1e-"+((s+"").length-1))),t)}return iu(e,t)},rd.reduce=function(e,t,r){var i=sD(e)?td:tS,n=arguments.length<3;return i(e,nh(t,4),r,n,rU)},rd.reduceRight=function(e,t,r){var i=sD(e)?tg:tS,n=arguments.length<3;return i(e,nh(t,4),r,n,rL)},rd.repeat=function(e,t,i){return t=(i?nE(e,t,i):t===r)?1:s5(t),ih(s7(e),t)},rd.replace=function(){var e=arguments,t=s7(e[0]);return e.length<3?t:t.replace(e[1],e[2])},rd.result=function(e,t,i){t=iT(t,e);var n=-1,s=t.length;for(s||(s=1,e=r);++n<s;){var o=null==e?r:e[nU(t[n])];o===r&&(n=s,o=i),e=s$(o)?o.call(e):o}return e},rd.round=o3,rd.runInContext=e,rd.sample=function(e){return(sD(e)?rx:function(e){return rx(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:r9(e).length},rd.snakeCase=oA,rd.some=function(e,t,i){var n=sD(e)?ty:im;return i&&nE(e,t,i)&&(t=r),n(e,nh(t,3))},rd.sortedIndex=function(e,t){return ib(e,t)},rd.sortedIndexBy=function(e,t,r){return iw(e,t,nh(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,nh(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=oR,rd.startsWith=function(e,t,r){return e=s7(e),r=null==r?0:rT(s5(r),0,e.length),t=iI(t),e.slice(r,r+t.length)==t},rd.subtract=o8,rd.sum=function(e){return e&&e.length?tO(e,oU):0},rd.sumBy=function(e,t){return e&&e.length?tO(e,nh(t,2)):0},rd.template=function(e,t,i){var n=rd.templateSettings;i&&nE(e,t,i)&&(t=r),e=s7(e),t=or({},t,n,nt);var s,o,a=or({},t.imports,n.imports,nt),c=of(a),l=tN(a,c),u=0,h=t.interpolate||ep,f="__p += '",p=eP((t.escape||ep).source+"|"+h.source+"|"+(h===K?es:ep).source+"|"+(t.evaluate||ep).source+"|$","g"),d="//# sourceURL="+(ej.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++eG+"]")+` 4`;e.replace(p,function(t,r,i,n,a,c){return i||(i=n),f+=e.slice(u,c).replace(ed,tk),r&&(s=!0,f+=`' + 5__e(`+r+`) + 6'`),a&&(o=!0,f+=`'; 7`+a+`; 8__p += '`),i&&(f+=`' + 9((__t = (`+i+`)) == null ? '' : __t) + 10'`),u=c+t.length,t}),f+=`'; 11`;var g=ej.call(t,"variable")&&t.variable;if(g){if(ei.test(g))throw new ew("Invalid `variable` option passed into `_.template`")}else f=`with (obj) { 12`+f+` 13} 14`;f=(o?f.replace(z,""):f).replace(k,"$1").replace(U,"$1;"),f="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`)+f+`return __p 20}`;var y=oT(function(){return e_(c,d+"return "+f).apply(r,l)});if(y.source=f,sM(y))throw y;return y},rd.times=function(e,t){if((e=s5(e))<1||e>9007199254740991)return[];var r=4294967295,i=t3(e,4294967295);t=nh(t),e-=4294967295;for(var n=tA(i,t);++r<e;)t(r);return n},rd.toFinite=s8,rd.toInteger=s5,rd.toLength=s6,rd.toLower=function(e){return s7(e).toLowerCase()},rd.toNumber=s4,rd.toSafeInteger=function(e){return e?rT(s5(e),-9007199254740991,9007199254740991):0===e?e:0},rd.toString=s7,rd.toUpper=function(e){return s7(e).toUpperCase()},rd.trim=function(e,t,i){if((e=s7(e))&&(i||t===r))return tR(e);if(!e||!(t=iI(t)))return e;var n=tV(e),s=tV(t),o=tT(n,s),a=tq(n,s)+1;return iq(n,o,a).join("")},rd.trimEnd=function(e,t,i){if((e=s7(e))&&(i||t===r))return e.slice(0,tK(e)+1);if(!e||!(t=iI(t)))return e;var n=tV(e),s=tq(n,tV(t))+1;return iq(n,0,s).join("")},rd.trimStart=function(e,t,i){if((e=s7(e))&&(i||t===r))return e.replace(Q,"");if(!e||!(t=iI(t)))return e;var n=tV(e),s=tT(n,tV(t));return iq(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?s5(t.length):i,n="omission"in t?iI(t.omission):n}var o=(e=s7(e)).length;if(tU(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?iq(a,0,c).join(""):e.slice(0,c);if(s===r)return l+n;if(a&&(c+=l.length-c),sJ(s)){if(e.slice(c).search(s)){var u,h=l;for(s.global||(s=eP(s.source,s7(eo.exec(s))+"g")),s.lastIndex=0;u=s.exec(h);)var f=u.index;l=l.slice(0,f===r?c:f)}}else if(e.indexOf(iI(s),c)!=c){var p=l.lastIndexOf(s);p>-1&&(l=l.slice(0,p))}return l+n},rd.unescape=function(e){return(e=s7(e))&&M.test(e)?e.replace(L,tF):e},rd.uniqueId=function(e){var t=++eT;return s7(e)+t},rd.upperCase=oC,rd.upperFirst=oN,rd.each=sl,rd.eachRight=su,rd.first=nZ,o$(rd,(ev={},rF(rd,function(e,t){ej.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(s5(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:nh(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(oU)},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(nh(e)))},rm.prototype.slice=function(e,t){e=s5(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=s5(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],u=c||sD(t),h=function(e){var t=s.apply(rd,tp([e],a));return n&&f?t[0]:t};u&&i&&"function"==typeof l&&1!=l.length&&(c=u=!1);var f=this.__chain__,p=!!this.__actions__.length,d=o&&!f,g=c&&!p;if(!o&&u){t=g?t:new rm(this);var y=e.apply(t,a);return y.__actions__.push({func:sn,args:[h],thisArg:r}),new rv(y,f)}return d&&g?e.apply(this,a):(y=this.thru(h),d?n?y.value()[0]:y.value():y)})}),ta(["pop","push","shift","sort","splice","unshift"],function(e){var t=eO[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(sD(n)?n:[],e)}return this[r](function(r){return t.apply(sD(r)?r:[],e)})}}),rF(rm.prototype,function(e,t){var r=rd[t];if(r){var i=r.name+"";ej.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__=i$(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=i$(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=i$(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=sD(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,u=this.__iteratees__,h=u.length,f=0,p=t3(c,this.__takeCount__);if(!r||!i&&n==c&&p==c)return iA(e,this.__actions__);var d=[];e:for(;c--&&f<p;){l+=t;for(var g=-1,y=e[l];++g<h;){var v=u[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[f++]=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=nB(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 iA(this.__wrapped__,this.__actions__)},rd.prototype.first=rd.prototype.head,e5&&(rd.prototype[e5]=function(){return this}),rd}();e5?((e5.exports=tZ)._=tZ,e8._=tZ):e3._=tZ}).call(s_)}
20(sE,sE.exports);var sI=Object.defineProperty,sP=Object.defineProperties,sx=Object.getOwnPropertyDescriptors,sS=Object.getOwnPropertySymbols,sO=Object.prototype.hasOwnProperty,sA=Object.prototype.propertyIsEnumerable,sR=(e,t,r)=>t in e?sI(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,sC=(e,t)=>{for(var r in t||(t={}))sO.call(t,r)&&sR(e,r,t[r]);if(sS)for(var r of sS(t))sA.call(t,r)&&sR(e,r,t[r]);return e},sN=(e,t)=>sP(e,sx(t));function sj(e,t,r){var i;let n=(0,o.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 sq(e){return e.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function sD(e){var t,r,i,n;let s={};if(!(0,o.L5)(e))return s;for(let[a,c]of Object.entries(e)){let e=(0,o.gp)(a)?[a]:c.chains,l=c.methods||[],u=c.events||[],h=c.rpcMap||{},f=(0,o.M)(a);s[f]=sN(sC(sC({},s[f]),c),{chains:(0,o.eG)(e,null==(t=s[f])?void 0:t.chains),methods:(0,o.eG)(l,null==(r=s[f])?void 0:r.methods),events:(0,o.eG)(u,null==(i=s[f])?void 0:i.events),rpcMap:sC(sC({},h),null==(n=s[f])?void 0:n.rpcMap)})}return s}function sz(e){return e.includes(":")?e.split(":")[2]:e}function sk(e){return"number"==typeof e?e:e.includes("0x")?parseInt(e,16):e.includes(":")?Number(e.split(":")[1]):Number(e)}let sU={},sL=e=>sU[e],sB=(e,t)=>{sU[e]=t};class sM{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=sL("events"),this.client=sL("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(sw,`${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||sj(e,this.namespace,this.client.core.projectId);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);return new rZ(new sv(r,sL("disableProviderPing")))}}class s${constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=sL("events"),this.client=sL("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(sw,`${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||sj(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);return new rZ(new sv(r,sL("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 sH{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=sL("events"),this.client=sL("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(sw,`${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||sj(e,this.namespace,this.client.core.projectId);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);return new rZ(new sv(r,sL("disableProviderPing")))}}class sV{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=sL("events"),this.client=sL("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(sw,`${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||sj(e,this.namespace,this.client.core.projectId);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);return new rZ(new sv(r,sL("disableProviderPing")))}}class sK{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=sL("events"),this.client=sL("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(sw,`${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 rZ(new sv(r,sL("disableProviderPing")))}}class sF{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=sL("events"),this.client=sL("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(sw,`${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||sj(e,this.namespace,this.client.core.projectId);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);return new rZ(new sv(r,sL("disableProviderPing")))}}class sZ{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=sL("events"),this.client=sL("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(sw,`${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||sj(e,this.namespace,this.client.core.projectId);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);return new rZ(new sv(r,sL("disableProviderPing")))}}class sW{constructor(e){this.name="near",this.namespace=e.namespace,this.events=sL("events"),this.client=sL("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||sj(`${this.name}:${e}`,this.namespace);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,r)}this.events.emit(sw,`${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||sj(e,this.namespace);return typeof r>"u"?void 0:new rZ(new sv(r,sL("disableProviderPing")))}}var sG=Object.defineProperty,sJ=Object.defineProperties,sQ=Object.getOwnPropertyDescriptors,sY=Object.getOwnPropertySymbols,sX=Object.prototype.hasOwnProperty,s0=Object.prototype.propertyIsEnumerable,s1=(e,t,r)=>t in e?sG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,s2=(e,t)=>
20{for(var r in t||(t={}))sX.call(t,r)&&s1(e,r,t[r]);if(sY)for(var r of sY(t))s0.call(t,r)&&s1(e,r,t[r]);return e},s3=(e,t)=>sJ(e,sQ(t));class s8{constructor(e){this.events=new(s()),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:B()(Y({level:e?.logger||sm})),this.disableProviderPing=e?.disableProviderPing||!1}static async init(e){let t=new s8(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:s2({},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,rq(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,o.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||[],a=(0,o.gp)(r)?[r]:i.chains?i.chains:sq(i.accounts);t[r]={chains:a,methods:e,events:n,accounts:s}}return t}(e.namespaces),this.persist("namespaces",this.namespaces))}).catch(e=>{if(e.message!==nG)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,o.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 sn.init({logger:this.providerOpts.logger||sm,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,o.M)(e)))];sB("client",this.client),sB("events",this.events),sB("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=sq(t),i=s3(s2({},function(e={},t={}){let r=sD(e),i=sD(t);return sE.exports.merge(r,i)}(this.namespaces,this.optionalNamespaces)[e]),{accounts:t,chains:r});switch(e){case"eip155":this.rpcProviders[e]=new s$({namespace:i});break;case"solana":this.rpcProviders[e]=new sH({namespace:i});break;case"cosmos":this.rpcProviders[e]=new sV({namespace:i});break;case"polkadot":this.rpcProviders[e]=new sM({namespace:i});break;case"cip34":this.rpcProviders[e]=new sK({namespace:i});break;case"elrond":this.rpcProviders[e]=new sF({namespace:i});break;case"multiversx":this.rpcProviders[e]=new sZ({namespace:i});break;case"near":this.rpcProviders[e]=new sW({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,o.qt)(e)&&this.events.emit("accountsChanged",e.map(sz))}else if("chainChanged"===r.name){let e=t.chainId,r=t.event.data,i=(0,o.M)(e),n=sk(e)!==sk(r)?`${i}:${sk(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=s3(s2({},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",s3(s2({},(0,o.D6)("USER_DISCONNECTED")),{data:e.topic}))}),this.on(sw,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,o.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,o.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(`${sb}/${e}`,t)}async getFromStore(e){return await this.client.core.storage.getItem(`${sb}/${e}`)}}let s5=["eth_sendTransaction","personal_sign"],s6=["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"],s4=["chainChanged","accountsChanged"],s9=["chainChanged","accountsChanged","message","disconnect","connect"];var s7=Object.defineProperty,oe=Object.defineProperties,ot=Object.getOwnPropertyDescriptors,or=Object.getOwnPropertySymbols,oi=Object.prototype.hasOwnProperty,on=Object.prototype.propertyIsEnumerable,os=(e,t,r)=>t in e?s7(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,oo=(e,t)=>{for(var r in t||(t={}))oi.call(t,r)&&os(e,r,t[r]);if(or)for(var r of or(t))on.call(t,r)&&os(e,r,t[r]);return e},oa=(e,t)=>oe(e,ot(t));function oc(e){return Number(e[0].split(":")[1])}function ol(e){return`0x${e.toString(16)}`}class ou{constructor(){this.events=new n.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 ou;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:a,rpcMap:c}=e;if(!(0,o.qt)(t))throw Error("Invalid chains");let l={chains:t,methods:i||s5,events:s||s4,rpcMap:oo({},t.length?{[oc(t)]:c[oc(t)]}:{})},u=s?.filter(e=>!s4.includes(e)),h=i?.filter(e=>!s5.includes(e));if(!r&&!a&&!n&&!(null!=u&&u.length)&&!(null!=h&&h.length))return{required:t.length?l:void 0};let f={chains:[...new Set(u?.length&&h?.length||!r?l.chains.concat(r||[]):r)],methods:[...new Set(l.methods.concat(null!=n&&n.length?n:s6))],events:[...new Set(l.events.concat(null!=a&&a.length?a:s9))],rpcMap:c};return{required:t.length?l:void 0,optional:r.length?f: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(oa(oo({namespaces:oo({},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,o.gu)(i.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:n),this.setAccounts(n),this.events.emit("connect",{chainId:ol(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;
20"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",ol(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",oa(oo({},(0,o.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",ol(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||s5:[],a=i.length?e?.events||s4:[],c=e?.optionalMethods||[],l=e?.optionalEvents||[],u=e?.rpcMap||this.buildRpcMap(s,e.projectId),h=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:u,showQrModal:!!(null!=e&&e.showQrModal),qrModalOptions:h,projectId:e.projectId,metadata:e.metadata}}buildRpcMap(e,t){let r={};return 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?oc(this.rpc.chains):oc(this.rpc.optionalChains),this.signer=await s8.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(5535).then(r.bind(r,95535));e=t}catch{throw Error("To use QR modal, please install @walletconnect/modal package")}if(e)try{this.modal=new e(oo({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,o.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,o.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 oh=ou},38200:function(e,t,r){"use strict";r.d(t,{q:function(){return i}});class i{}},30997:function(e,t,r){"use strict";r.r(t),r.d(t,{IEvents:function(){return i.q}});var i=r(38200)},32568:function(e,t,r){"use strict";
20Object.defineProperty(t,"__esModule",{value:!0}),t.HEARTBEAT_EVENTS=t.HEARTBEAT_INTERVAL=void 0;let i=r(66736);t.HEARTBEAT_INTERVAL=i.FIVE_SECONDS,t.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"}},53401:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(39653).__exportStar(r(32568),t)},38969:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HeartBeat=void 0;let i=r(39653),n=r(17187),s=r(66736),o=r(1614),a=r(53401);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},90772:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let i=r(39653);i.__exportStar(r(38969),t),i.__exportStar(r(1614),t),i.__exportStar(r(53401),t)},44174:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IHeartBeat=void 0;let i=r(30997);class n extends i.IEvents{constructor(e){super()}}t.IHeartBeat=n},1614:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(39653).__exportStar(r(44174),t)},39653: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 u},__classPrivateFieldGet:function(){return x},__classPrivateFieldSet:function(){return S},__createBinding:function(){return f},__decorate:function(){return a},__exportStar:function(){return p},__extends:function(){return n},__generator:function(){return h},__importDefault:function(){return P},__importStar:function(){return I}
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)}
20function u(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 h(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 f(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}function p(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):u(s[0][2],r)}catch(e){u(s[0][3],e)}}function c(e){a("next",e)}function l(e){a("throw",e)}function u(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}function 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 P(e){return e&&e.__esModule?e:{default:e}}function x(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}},54098:function(e,t,r){var i="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==r.g&&r.g,n=function(){function e(){this.fetch=!1,this.DOMException=i.DOMException}return e.prototype=i,new e}();(function(e){var t=void 0!==n&&n||"undefined"!=typeof self&&self||void 0!==r.g&&r.g||{},i={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(e){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(i.arrayBuffer)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array
20]"],o=ArrayBuffer.isView||function(e){return e&&s.indexOf(Object.prototype.toString.call(e))>-1};function a(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||""===e)throw TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function c(e){return"string"!=typeof e&&(e=String(e)),e}function l(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return i.iterable&&(t[Symbol.iterator]=function(){return t}),t}function u(e){this.map={},e instanceof u?e.forEach(function(e,t){this.append(t,e)},this):Array.isArray(e)?e.forEach(function(e){if(2!=e.length)throw TypeError("Headers constructor: expected name/value pair to be length 2, found"+e.length);this.append(e[0],e[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}function h(e){if(!e._noBody){if(e.bodyUsed)return Promise.reject(TypeError("Already read"));e.bodyUsed=!0}}function f(e){return new Promise(function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}})}function p(e){var t=new FileReader,r=f(t);return t.readAsArrayBuffer(e),r}function d(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function g(){return this.bodyUsed=!1,this._initBody=function(e){if(this.bodyUsed=this.bodyUsed,this._bodyInit=e,e){if("string"==typeof e)this._bodyText=e;else if(i.blob&&Blob.prototype.isPrototypeOf(e))this._bodyBlob=e;else if(i.formData&&FormData.prototype.isPrototypeOf(e))this._bodyFormData=e;else if(i.searchParams&&URLSearchParams.prototype.isPrototypeOf(e))this._bodyText=e.toString();else{var t;i.arrayBuffer&&i.blob&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=d(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):i.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||o(e))?this._bodyArrayBuffer=d(e):this._bodyText=e=Object.prototype.toString.call(e)}}else this._noBody=!0,this._bodyText="";!this.headers.get("content-type")&&("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):i.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i.blob&&(this.blob=function(){var e=h(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(!this._bodyFormData)return Promise.resolve(new Blob([this._bodyText]));throw Error("could not read FormData body as blob")}),this.arrayBuffer=function(){if(this._bodyArrayBuffer)return h(this)||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer));if(i.blob)return this.blob().then(p);throw Error("could not read as ArrayBuffer")},this.text=function(){var e,t,r,i,n,s=h(this);if(s)return s;if(this._bodyBlob)return e=this._bodyBlob,r=f(t=new FileReader),n=(i=/charset=([A-Za-z0-9_-]+)/.exec(e.type))?i[1]:"utf-8",t.readAsText(e,n),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=Array(t.length),i=0;i<t.length;i++)r[i]=String.fromCharCode(t[i]);return r.join("")}(this._bodyArrayBuffer));if(!this._bodyFormData)return Promise.resolve(this._bodyText);throw Error("could not read FormData body as text")},i.formData&&(this.formData=function(){return this.text().then(m)}),this.json=function(){return this.text().then(JSON.parse)},this}u.prototype.append=function(e,t){e=a(e),t=c(t);var r=this.map[e];this.map[e]=r?r+", "+t:t},u.prototype.delete=function(e){delete this.map[a(e)]},u.prototype.get=function(e){return e=a(e),this.has(e)?this.map[e]:null},u.prototype.has=function(e){return this.map.hasOwnProperty(a(e))},u.prototype.set=function(e,t){this.map[a(e)]=c(t)},u.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},u.prototype.keys=function(){var e=[];return this.forEach(function(t,r){e.push(r)}),l(e)},u.prototype.values=function(){var e=[];return this.forEach(function(t){e.push(t)}),l(e)},u.prototype.entries=function(){var e=[];return this.forEach(function(t,r){e.push([r,t])}),l(e)},i.iterable&&(u.prototype[Symbol.iterator]=u.prototype.entries);var y=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function v(e,r){if(!(this instanceof v))throw TypeError('Please use the "new" operator, this DOM object c
20onstructor cannot be called as a function.');var i,n,s=(r=r||{}).body;if(e instanceof v){if(e.bodyUsed)throw TypeError("Already read");this.url=e.url,this.credentials=e.credentials,r.headers||(this.headers=new u(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,s||null==e._bodyInit||(s=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=r.credentials||this.credentials||"same-origin",(r.headers||!this.headers)&&(this.headers=new u(r.headers)),this.method=(n=(i=r.method||this.method||"GET").toUpperCase(),y.indexOf(n)>-1?n:i),this.mode=r.mode||this.mode||null,this.signal=r.signal||this.signal||function(){if("AbortController"in t)return new AbortController().signal}(),this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&s)throw TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(s),("GET"===this.method||"HEAD"===this.method)&&("no-store"===r.cache||"no-cache"===r.cache)){var o=/([?&])_=[^&]*/;o.test(this.url)?this.url=this.url.replace(o,"$1_="+new Date().getTime()):this.url+=(/\?/.test(this.url)?"&":"?")+"_="+new Date().getTime()}}function m(e){var t=new FormData;return e.trim().split("&").forEach(function(e){if(e){var r=e.split("="),i=r.shift().replace(/\+/g," "),n=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(i),decodeURIComponent(n))}}),t}function b(e,t){if(!(this instanceof b))throw TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.status<200||this.status>599)throw RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=void 0===t.statusText?"":""+t.statusText,this.headers=new u(t.headers),this.url=t.url||"",this._initBody(e)}v.prototype.clone=function(){return new v(this,{body:this._bodyInit})},g.call(v.prototype),g.call(b.prototype),b.prototype.clone=function(){return new b(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new u(this.headers),url:this.url})},b.error=function(){var e=new b(null,{status:200,statusText:""});return e.ok=!1,e.status=0,e.type="error",e};var w=[301,302,303,307,308];b.redirect=function(e,t){if(-1===w.indexOf(t))throw RangeError("Invalid status code");return new b(null,{status:t,headers:{location:e}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function _(r,n){return new Promise(function(s,o){var l=new v(r,n);if(l.signal&&l.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var h=new XMLHttpRequest;function f(){h.abort()}if(h.onload=function(){var e,t,r={statusText:h.statusText,headers:(e=h.getAllResponseHeaders()||"",t=new u,e.replace(/\r?\n[\t ]+/g," ").split("\r").map(function(e){return 0===e.indexOf("\n")?e.substr(1,e.length):e}).forEach(function(e){var r=e.split(":"),i=r.shift().trim();if(i){var n=r.join(":").trim();try{t.append(i,n)}catch(e){console.warn("Response "+e.message)}}}),t)};0===l.url.indexOf("file://")&&(h.status<200||h.status>599)?r.status=200:r.status=h.status,r.url="responseURL"in h?h.responseURL:r.headers.get("X-Request-URL");var i="response"in h?h.response:h.responseText;setTimeout(function(){s(new b(i,r))},0)},h.onerror=function(){setTimeout(function(){o(TypeError("Network request failed"))},0)},h.ontimeout=function(){setTimeout(function(){o(TypeError("Network request timed out"))},0)},h.onabort=function(){setTimeout(function(){o(new e.DOMException("Aborted","AbortError"))},0)},h.open(l.method,function(e){try{return""===e&&t.location.href?t.location.href:e}catch(t){return e}}(l.url),!0),"include"===l.credentials?h.withCredentials=!0:"omit"===l.credentials&&(h.withCredentials=!1),"responseType"in h&&(i.blob?h.responseType="blob":i.arrayBuffer&&(h.responseType="arraybuffer")),n&&"object"==typeof n.headers&&!(n.headers instanceof u||t.Headers&&n.headers instanceof t.Headers)){var p=[];
20Object.getOwnPropertyNames(n.headers).forEach(function(e){p.push(a(e)),h.setRequestHeader(e,c(n.headers[e]))}),l.headers.forEach(function(e,t){-1===p.indexOf(t)&&h.setRequestHeader(t,e)})}else l.headers.forEach(function(e,t){h.setRequestHeader(t,e)});l.signal&&(l.signal.addEventListener("abort",f),h.onreadystatechange=function(){4===h.readyState&&l.signal.removeEventListener("abort",f)}),h.send(void 0===l._bodyInit?null:l._bodyInit)})}_.polyfill=!0,t.fetch||(t.fetch=_,t.Headers=u,t.Request=v,t.Response=b),e.Headers=u,e.Request=v,e.Response=b,e.fetch=_,Object.defineProperty(e,"__esModule",{value:!0})})({}),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var s=i.fetch?i:n;(t=s.fetch).default=s.fetch,t.fetch=s.fetch,t.Headers=s.Headers,t.Request=s.Request,t.Response=s.Response,e.exports=t},72307: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]",u="[object Date]",h="[object Error]",f="[object Function]",p="[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\]$/,P=/^(?:0|[1-9]\d*)$/,x={};x["[object Float32Array]"]=x["[object Float64Array]"]=x["[object Int8Array]"]=x["[object Int16Array]"]=x["[object Int32Array]"]=x["[object Uint8Array]"]=x["[object Uint8ClampedArray]"]=x["[object Uint16Array]"]=x["[object Uint32Array]"]=!0,x[a]=x[c]=x[_]=x[l]=x[E]=x[u]=x[h]=x[f]=x[p]=x[d]=x[g]=x[v]=x[m]=x[b]=x[w]=!1;var S="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g,O="object"==typeof self&&self&&self.Object===Object&&self,A=S||O||Function("return this")(),R=t&&!t.nodeType&&t,C=R&&e&&!e.nodeType&&e,N=C&&C.exports===R,j=N&&S.process,T=function(){try{return j&&j.binding&&j.binding("util")}catch(e){}}(),q=T&&T.isTypedArray;function D(e){var t=-1,r=Array(e.size);return e.forEach(function(e,i){r[++t]=[i,e]}),r}function z(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}var k=Array.prototype,U=Function.prototype,L=Object.prototype,B=A["__core-js_shared__"],M=U.toString,$=L.hasOwnProperty,H=(i=/[^.]+$/.exec(B&&B.keys&&B.keys.IE_PROTO||""))?"Symbol(src)_1."+i:"",V=L.toString,K=RegExp("^"+M.call($).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),F=N?A.Buffer:void 0,Z=A.Symbol,W=A.Uint8Array,G=L.propertyIsEnumerable,J=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=ex(A,"DataView"),er=ex(A,"Map"),ei=ex(A,"Promise"),en=ex(A,"Set"),es=ex(A,"WeakMap"),eo=ex(Object,"create"),ea=eA(et),ec=eA(er),el=eA(ei),eu=eA(en),eh=eA(es),ef=Z?Z.prototype:void 0,ep=ef?ef.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(eR(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=$.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 ez(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 u=-1,h=!0,f=2&r?new ev:void 0;for(s.set(e,t),s.set(t,e);++u<a;){var p=e[u],d=t[u];if(i)var g=o?i(d,p,u,t,e,s):i(p,d,u,e,t,s);if(void 0!==g){if(g)continue;h=!1;break}if(f){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(!f.has(t)&&(p===e||n(p,e,r,i,s)))return f.push(t)})){h=!1;break}}else if(!(p===d||n(p,d,r,i,s))){h=!1;break}}return s.delete(e),s.delete(t),h}function eI(e){var t;return t=function(e){return null!=e&&eq(e.length)&&!eT(e)?function(e,t){var r,i=eN(e),n=!i&&eC(e),s=!i&&!n&&ej(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 u in e)$.call(e,u)&&!(a&&("length"==u||s&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||(r=null==(r=l)?9007199254740991:r)&&("number"==typeof u||P.test(u))&&u>-1&&u%1==0&&u<r))&&c.push(u);return c}(e):function(e){if(t=e&&e.constructor,e!==("function"==typeof t&&t.prototype||L))return ee(e);var t,r=[];for(var i in Object(e))$.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 eP(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 ex(e,t){var r=null==e?void 0:e[t];return!(!eD(r)||H&&H in r)&&(eT(r)?K:I).test(eA(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 $.call(t,e)?t[e]:void 0},ed.prototype.has=function(e){var t=this.__data__;return eo?void 0!==t[e]:$.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():J.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=eP(this,e).delete(e);return this.size-=t?1:0,t},ey.prototype.get=function(e){return eP(this,e).get(e)},ey.prototype.has=function(e){return eP(this,e).has(e)},ey.prototype.set=function(e,t){var r=eP(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 G.call(e,t)})}:function(){return[]},eO=ew;function eA(e){if(null!=e){try{return M.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function eR(e,t){return e===t||e!=e&&t!=t}(et&&eO(new et(new ArrayBuffer(1)))!=E||er&&eO(new er)!=p||ei&&eO(ei.resolve())!=y||en&&eO(new en)!=m||es&&eO(new es)!=w)&&(eO=function(e){var t=ew(e),r=t==g?e.constructor:void 0,i=r?eA(r):"";if(i)switch(i){case ea:return E;case ec:return p;case el:return y;case eu:return m;case eh:return w}return t});var eC=e_(function(){return arguments}())?e_:function(e){return ez(e)&&$.call(e,"callee")&&!G.call(e,"callee")},eN=Array.isArray,ej=X||function(){return!1};function eT(e){if(!eD(e))return!1;var t=ew(e);return t==f||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}function eq(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function eD(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function ez(e){return null!=e&&"object"==typeof e}var ek=q?function(e){return q(e)}:function(e){return ez(e)&&eq(e.length)&&!!x[ew(e)]};e.exports=function(e,t){return function e(t,r,i,n,s){return t===r||(null!=t&&null!=r&&(ez(t)||ez(r))?function(e,t,r,i,n,s){var o=eN(e),f=e
20N(t),y=o?c:eO(e),w=f?c:eO(t);y=y==a?g:y,w=w==a?g:w;var I=y==g,P=w==g,x=y==w;if(x&&ej(e)){if(!ej(t))return!1;o=!0,I=!1}if(x&&!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 u:case d:return eR(+e,+t);case h:return e.name==t.name&&e.message==t.message;case v:case b:return e==t+"";case p:var a=D;case m:var c=1&i;if(a||(a=z),e.size!=t.size&&!c)break;var f=o.get(e);if(f)return f==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(ep)return ep.call(e)==ep.call(t)}return!1}(e,t,y,r,i,n,s);if(!(1&r)){var S=I&&$.call(e,"__wrapped__"),O=P&&$.call(t,"__wrapped__");if(S||O){var A=S?e.value():e,R=O?t.value():t;return s||(s=new em),n(A,R,r,i,s)}}return!!x&&(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 u=a[l];if(!(o?u in t:$.call(t,u)))return!1}var h=s.get(e);if(h&&s.get(t))return h==t;var f=!0;s.set(e,t),s.set(t,e);for(var p=o;++l<c;){var d=e[u=a[l]],g=t[u];if(i)var y=o?i(g,d,u,t,e,s):i(d,g,u,e,t,s);if(!(void 0===y?d===g||n(d,g,r,i,s):y)){f=!1;break}p||(p="constructor"==u)}if(f&&!p){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)&&(f=!1)}return s.delete(e),s.delete(t),f}(e,t,r,i,n,s))}(t,r,i,n,e,s):t!=t&&r!=r)}(e,t)}},63144:function(e){"use strict";let t=self.fetch.bind(self);e.exports=t,e.exports.default=e.exports},85346: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="",u=0,h=-1,f=e&&e.length||0,p=0;p<f;){if(37===e.charCodeAt(p)&&p+1<f){switch(h=h>-1?h:0,e.charCodeAt(p+1)){case 100:case 102:if(u>=c||null==r[u])break;h<p&&(l+=e.slice(h,p)),l+=Number(r[u]),h=p+2,p++;break;case 105:if(u>=c||null==r[u])break;h<p&&(l+=e.slice(h,p)),l+=Math.floor(Number(r[u])),h=p+2,p++;break;case 79:case 111:case 106:if(u>=c||void 0===r[u])break;h<p&&(l+=e.slice(h,p));var d=typeof r[u];if("string"===d){l+="'"+r[u]+"'",h=p+2,p++;break}if("function"===d){l+=r[u].name||"<anonymous>",h=p+2,p++;break}l+=n(r[u]),h=p+2,p++;break;case 115:if(u>=c)break;h<p&&(l+=e.slice(h,p)),l+=String(r[u]),h=p+2,p++;break;case 37:h<p&&(l+=e.slice(h,p)),l+="%",h=p+2,p++,u--}++u}++p}return -1===h?e:(h<f&&(l+=e.slice(h)),l)}},57026:function(e){"use strict";e.exports=function(){throw Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},36559:function(e,t,r){"use strict";let i=r(85346);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 u=e.browser.write||n;e.browser.write&&(e.browser.asObject=!0);let h=e.serializers||{},g=Array.isArray(t=e.browser.serialize)?t.filter(function(e){return"!stdSerializers.err"!==e}):!0===t&&Object.keys(h),y=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(y=!1),"function"==typeof u&&(u.error=u.fatal=u.warn=u.info=u.debug=u.trace=u),!1===e.enabled&&(e.level="silent");let v=e.level||"info",m=Object.create(u);m.log||(m.log=f),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?p: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=f,m.serializers=h,m._serialize=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({},h,n),o=!0===e.browser.serialize?Object.keys(s):g;delete t.serializers,a([t],o,s,this._stdErrSerialize)}function u(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 u.prototype=this,new u(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]?f:c[r]?c[r]:n[r]||n[o]||f,function(e,t,r){if(e.transmit||t[r]!==f){var o;t[r]=(o=t[r],function(){let c=e.timestamp(),u=Array(arguments.length),h=Object.getPrototypeOf&&Object.getPrototypeOf(this)===n?n:this;for(var f=0;f<u.length;f++)u[f]=arguments[f];if(e.serialize&&!e.asObject&&a(u,this._serialize,this.serializers,this._stdErrSerialize),e.asObject?o.call(h,function(e,t,r,n){e._seri
20alize&&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 u=(0|e._childLevel)+1;if(u<1&&(u=1),null!==c&&"object"==typeof c){for(;u--&&"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,u,c)):o.apply(h,u),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,u=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===u.indexOf(e)}),e._logEvent.level.label=s,e._logEvent.level.value=o,i(s,e._logEvent,c),e._logEvent=l(u)})(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},u)}})}}(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 u(){return{}}function h(e){return e}function f(){}function p(){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:u,mapHttpResponse:u,wrapRequestSerializer:h,wrapResponseSerializer:h,wrapErrorSerializer:h,req:u,res:u,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:p,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.