1import{f as Ic,h as ie,i as kr,j as em,w as Ll,r as ql,l as xc,t as ya,m as tm,o as ta,p as rm,q as _i,D as im,u as nm,N as X,v as sm,x as uc,y as am,V as om,R as cm,F as Dh,K as um,z as hm,L as lm,A as Lh,$ as fm,B as pm,C as Bn,Z as qh,J as dm,X as gm,E as Sc,_ as jl,G as Fr,H as ym,I as vm,M as hn,O as $t,U as tr,P as wi,Q as hr,S as mm,T as ln,W as zl,Y as wm,a0 as _m,a1 as bm,a2 as Ml,a3 as Em,a4 as Ul,a5 as Hl,a6 as fn,a7 as hc,a8 as ca,a9 as pn,aa as Im,ab as ua,ac as xm,ad as Sm,ae as Pm,af as ra,ag as Om,ah as Cm,ai as Vo,aj as jh,ak as Am,al as Rm,am as Tm,an as zh,ao as Nm,ap as $m,aq as Fm,ar as Dm,as as Lm,at as qm,au as jm,av as Un,aw as kl,ax as Go,ay as zm,az as Mm,aA as Um}from"./index-fcdc5867.js";import{s as Wn,a as va,i as Mh,c as Hm,b as km,f as Pc,p as Km,J as si,d as Oc,e as Cc,g as Ac,h as mi,j as ni,k as Kn,l as Bm,m as Vm,H as Ii}from"./http-8ae62238.js";const Gm=/"(?:_|\\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*:/,Wm=/"(?: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*:/,Jm=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function Qm(o,i){if(o==="__proto__"||o==="constructor"&&i&&typeof i=="object"&&"prototype"in i){Ym(o);return}return i}function Ym(o){console.warn(`[destr] Dropping "${o}" key to prevent prototype pollution.`)}function ia(o,i={}){if(typeof o!="string")return o;const t=o.trim();if(o[0]==='"'&&o.at(-1)==='"'&&!o.includes("\\"))return t.slice(1,-1);if(t.length<=9){const n=t.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!Jm.test(o)){if(i.strict)throw new SyntaxError("[destr] Invalid JSON");return o}try{if(Gm.test(o)||Wm.test(o)){if(i.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(o,Qm)}return JSON.parse(o)}catch(n){if(i.strict)throw n;return o}}function Xm(o){return!o||typeof o.then!="function"?Promise.resolve(o):o}function Mt(o,...i){try{return Xm(o(...i))}catch(t){return Promise.reject(t)}}function Zm(o){const i=typeof o;return o===null||i!=="object"&&i!=="function"}function e1(o){const i=Object.getPrototypeOf(o);return!i||i.isPrototypeOf(Object)}function ha(o){if(Zm(o))return String(o);if(e1(o)||Array.isArray(o))return JSON.stringify(o);if(typeof o.toJSON=="function")return ha(o.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function Kl(){if(typeof Buffer===void 0)throw new TypeError("[unstorage] Buffer is not supported!")}const lc="base64:";function t1(o){if(typeof o=="string")return o;Kl();const i=Buffer.from(o).toString("base64");return lc+i}function r1(o){return typeof o!="string"||!o.startsWith(lc)?o:(Kl(),Buffer.from(o.slice(lc.length),"base64"))}function ur(o){return o?o.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function i1(...o){return ur(o.join(":"))}function na(o){return o=ur(o),o?o+":":""}const n1="memory",s1=()=>{const o=new Map;return{name:n1,options:{},hasItem(i){return o.has(i)},getItem(i){return o.get(i)??null},getItemRaw(i){return o.get(i)??null},setItem(i,t){o.set(i,t)},setItemRaw(i,t){o.set(i,t)},removeItem(i){o.delete(i)},getKeys(){return Array.from(o.keys())},clear(){o.clear()},dispose(){o.clear()}}};function a1(o={}){const i={mounts:{"":o.driver||s1()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},t=d=>{for(const _ of i.mountpoints)if(d.startsWith(_))return{base:_,relativeKey:d.slice(_.length),driver:i.mounts[_]};return{base:"",relativeKey:d,driver:i.mounts[""]}},n=(d,_)=>i.mountpoints.filter(O=>O.startsWith(d)||_&&d.startsWith(O)).map(O=>({relativeBase:d.length>O.length?d.slice(O.length):void 0,mountpoint:O,driver:i.mounts[O]})),a=(d,_)=>{if(i.watching){_=ur(_);for(const O of i.watchListeners)O(d,_)}},u=async()=>{if(!i.watching){i.watching=!0;for(const d in i.mounts)i.unwatch[d]=await Uh(i.mounts[d],a,d)}},f=async()=>
1{if(i.watching){for(const d in i.unwatch)await i.unwatch[d]();i.unwatch={},i.watching=!1}},y=(d,_,O)=>{const P=new Map,L=N=>{let K=P.get(N.base);return K||(K={driver:N.driver,base:N.base,items:[]},P.set(N.base,K)),K};for(const N of d){const K=typeof N=="string",re=ur(K?N:N.key),ce=K?void 0:N.value,ue=K||!N.options?_:{..._,...N.options},he=t(re);L(he).items.push({key:re,value:ce,relativeKey:he.relativeKey,options:ue})}return Promise.all([...P.values()].map(N=>O(N))).then(N=>N.flat())},w={hasItem(d,_={}){d=ur(d);const{relativeKey:O,driver:P}=t(d);return Mt(P.hasItem,O,_)},getItem(d,_={}){d=ur(d);const{relativeKey:O,driver:P}=t(d);return Mt(P.getItem,O,_).then(L=>ia(L))},getItems(d,_){return y(d,_,O=>O.driver.getItems?Mt(O.driver.getItems,O.items.map(P=>({key:P.relativeKey,options:P.options})),_).then(P=>P.map(L=>({key:i1(O.base,L.key),value:ia(L.value)}))):Promise.all(O.items.map(P=>Mt(O.driver.getItem,P.relativeKey,P.options).then(L=>({key:P.key,value:ia(L)})))))},getItemRaw(d,_={}){d=ur(d);const{relativeKey:O,driver:P}=t(d);return P.getItemRaw?Mt(P.getItemRaw,O,_):Mt(P.getItem,O,_).then(L=>r1(L))},async setItem(d,_,O={}){if(_===void 0)return w.removeItem(d);d=ur(d);const{relativeKey:P,driver:L}=t(d);L.setItem&&(await Mt(L.setItem,P,ha(_),O),L.watch||a("update",d))},async setItems(d,_){await y(d,_,async O=>{O.driver.setItems&&await Mt(O.driver.setItems,O.items.map(P=>({key:P.relativeKey,value:ha(P.value),options:P.options})),_),O.driver.setItem&&await Promise.all(O.items.map(P=>Mt(O.driver.setItem,P.relativeKey,ha(P.value),P.options)))})},async setItemRaw(d,_,O={}){if(_===void 0)return w.removeItem(d,O);d=ur(d);const{relativeKey:P,driver:L}=t(d);if(L.setItemRaw)await Mt(L.setItemRaw,P,_,O);else if(L.setItem)await Mt(L.setItem,P,t1(_),O);else return;L.watch||a("update",d)},async removeItem(d,_={}){typeof _=="boolean"&&(_={removeMeta:_}),d=ur(d);const{relativeKey:O,driver:P}=t(d);P.removeItem&&(await Mt(P.removeItem,O,_),(_.removeMeta||_.removeMata)&&await Mt(P.removeItem,O+"$",_),P.watch||a("remove",d))},async getMeta(d,_={}){typeof _=="boolean"&&(_={nativeOnly:_}),d=ur(d);const{relativeKey:O,driver:P}=t(d),L=Object.create(null);if(P.getMeta&&Object.assign(L,await Mt(P.getMeta,O,_)),!_.nativeOnly){const N=await Mt(P.getItem,O+"$",_).then(K=>ia(K));N&&typeof N=="object"&&(typeof N.atime=="string"&&(N.atime=new Date(N.atime)),typeof N.mtime=="string"&&(N.mtime=new Date(N.mtime)),Object.assign(L,N))}return L},setMeta(d,_,O={}){return this.setItem(d+"$",_,O)},removeMeta(d,_={}){return this.removeItem(d+"$",_)},async getKeys(d,_={}){d=na(d);const O=n(d,!0);let P=[];const L=[];for(const N of O){const re=(await Mt(N.driver.getKeys,N.relativeBase,_)).map(ce=>N.mountpoint+ur(ce)).filter(ce=>!P.some(ue=>ce.startsWith(ue)));L.push(...re),P=[N.mountpoint,...P.filter(ce=>!ce.startsWith(N.mountpoint))]}return d?L.filter(N=>N.startsWith(d)&&!N.endsWith("$")):L.filter(N=>!N.endsWith("$"))},async clear(d,_={}){d=na(d),await Promise.all(n(d,!1).map(async O=>{if(O.driver.clear)return Mt(O.driver.clear,O.relativeBase,_);if(O.driver.removeItem){const P=await O.driver.getKeys(O.relativeBase||"",_);return Promise.all(P.map(L=>O.driver.removeItem(L,_)))}}))},async dispose(){await Promise.all(Object.values(i.mounts).map(d=>Hh(d)))},async watch(d){return await u(),i.watchListeners.push(d),async()=>{i.watchListeners=i.watchListeners.filter(_=>_!==d),i.watchListeners.length===0&&await f()}},async unwatch(){i.watchListeners=[],await f()}
vendor: 11,788 bytes, lines 1-14
1,mount(d,_){if(d=na(d),d&&i.mounts[d])throw new Error(`already mounted at ${d}`);return d&&(i.mountpoints.push(d),i.mountpoints.sort((O,P)=>P.length-O.length)),i.mounts[d]=_,i.watching&&Promise.resolve(Uh(_,a,d)).then(O=>{i.unwatch[d]=O}).catch(console.error),w},async unmount(d,_=!0){d=na(d),!(!d||!i.mounts[d])&&(i.watching&&d in i.unwatch&&(i.unwatch[d](),delete i.unwatch[d]),_&&await Hh(i.mounts[d]),i.mountpoints=i.mountpoints.filter(O=>O!==d),delete i.mounts[d])},getMount(d=""){d=ur(d)+":";const _=t(d);return{driver:_.driver,base:_.base}},getMounts(d="",_={}){return d=ur(d),n(d,_.parents).map(P=>({driver:P.driver,base:P.mountpoint}))}};return w}function Uh(o,i,t){return o.watch?o.watch((n,a)=>i(n,t+a)):()=>{}}async function Hh(o){typeof o.dispose=="function"&&await Mt(o.dispose)}function Mi(o){return new Promise((i,t)=>{o.oncomplete=o.onsuccess=()=>i(o.result),o.onabort=o.onerror=()=>t(o.error)})}function Bl(o,i){const t=indexedDB.open(o);t.onupgradeneeded=()=>t.result.createObjectStore(i);const n=Mi(t);return(a,u)=>n.then(f=>u(f.transaction(i,a).objectStore(i)))}let Wo;function Jn(){return Wo||(Wo=Bl("keyval-store","keyval")),Wo}function kh(o,i=Jn()){return i("readonly",t=>Mi(t.get(o)))}function o1(o,i,t=Jn()){return t("readwrite",n=>(n.put(i,o),Mi(n.transaction)))}function c1(o,i=Jn()){return i("readwrite",t=>(t.delete(o),Mi(t.transaction)))}function u1(o=Jn()){return o("readwrite",i=>(i.clear(),Mi(i.transaction)))}function h1(o,i){return o.openCursor().onsuccess=function(){this.result&&(i(this.result),this.result.continue())},Mi(o.transaction)}function l1(o=Jn()){return o("readonly",i=>{if(i.getAllKeys)return Mi(i.getAllKeys());const t=[];return h1(i,n=>t.push(n.key)).then(()=>t)})}const f1="idb-keyval";var p1=(o={})=>{const i=o.base&&o.base.length>0?`${o.base}:`:"",t=a=>i+a;let n;return o.dbName&&o.storeName&&(n=Bl(o.dbName,o.storeName)),{name:f1,options:o,async hasItem(a){return!(typeof await kh(t(a),n)>"u")},async getItem(a){return await kh(t(a),n)??null},setItem(a,u){return o1(t(a),u,n)},removeItem(a){return c1(t(a),n)},getKeys(){return l1(n)},clear(){return u1(n)}}};const d1="WALLET_CONNECT_V2_INDEXED_DB",g1="keyvaluestorage";let y1=class{constructor(){this.indexedDb=a1({driver:p1({dbName:d1,storeName:g1})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(i=>[i.key,i.value])}async getItem(i){const t=await this.indexedDb.getItem(i);if(t!==null)return t}async setItem(i,t){await this.indexedDb.setItem(i,Wn(t))}async removeItem(i){await this.indexedDb.removeItem(i)}};var Jo=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},la={exports:{}};(function(){let o;function i(){}o=i,o.prototype.getItem=function(t){return this.hasOwnProperty(t)?String(this[t]):null},o.prototype.setItem=function(t,n){this[t]=String(n)},o.prototype.removeItem=function(t){delete this[t]},o.prototype.clear=function(){const t=this;Object.keys(t).forEach(function(n){t[n]=void 0,delete t[n]})},o.prototype.key=function(t){return t=t||0,Object.keys(this)[t]},o.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof Jo<"u"&&Jo.localStorage?la.exports=Jo.localStorage:typeof window<"u"&&window.localStorage?la.exports=window.localStorage:la.exports=new i})();function v1(o){var i;return[o[0],va((i=o[1])!=null?i:"")]}let m1=class{constructor(){this.localStorage=la.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(v1)}async getItem(i){const t=this.localStorage.getItem(i);if(t!==null)return va(t)}async setItem(i,t){this.localStorage.setItem(i,Wn(t))}async removeItem(i){this.localStorage.removeItem(i)}};const w1="wc_storage_version",Kh=1,_1=async(o,i,t)=>{const n=w1,a=await i.getItem(n);if(a&&a>=Kh){t(i);return}const u=await o.getKeys();if(!u.length){t(i);return}const f=[];for(;u.length;){const y=u.shift();if(!y)continue;const w=y.toLowerCase();if(w.includes("wc@")||w.includes("walletconnect")||w.includes("wc_")||w.includes("wallet_connect")){const d=await o.getItem(y);await i.setItem(y,d),f.push(y)}}await i.setItem(n,Kh),t(i),b1(o,f)},b1=async(o,i)=>{i.length&&i.forEach(async t=>{await o.removeItem(t)})};let E1=class{constructor(){this.initialized=!1,this.setInitialized=t=>{this.storage=t,this.initialized=!0};const i=new m1;this.storage=i;try{const t=new y1;_1(i,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(i){return await this.initialize(),this.storage.getItem(i)}async setItem(i,t){return await this.initialize(),this.storage.setItem(i,t)}async removeItem(i){return await this.initialize(),this.storage.removeItem(i)}async initialize(){this.initialized||await new Promise(i=>{const t=setInterval(()=>{this.initialized&&(clearInterval(t),i())},20)})}};var dn={};/*! ***************************************************************************** 2Copyright (c) Microsoft Corporation. 3 4Permission to use, copy, modify, and/or distribute this software for any 5purpose with or without fee is hereby granted. 6 7THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 8REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 9AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 10INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 11LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 12OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 13PERFORMANCE OF THIS SOFTWARE. 14***************************************************************************** */var fc=function(o,i){return fc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var a in n)n.hasOwnProperty(a)&&(t[a]=n[a])},fc(o,i)};function I1(o,i){fc(o,i);function t(){this.constructor=o}o.prototype=i===null?Object.create(i):(t.prototype=i.prototype,new t)}var pc=function(){return pc=Object.assign||function(i){for(var t,n=1,a=arguments.length;n<a;n++){t=arguments[n];for(var u in t)Object.prototype.hasOwnProperty.call(t,u)&&(i[u]=t[u])}return i},pc.apply(this,arguments)};function x1(o,i){var t={};for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&i.indexOf(n)<0&&(t[n]=o[n]);if(o!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,n=Object.getOwnPropertySymbols(o);a<n.length;a++)i.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(o,n[a])&&(t[n[a]]=o[n[a]]);return t}function S1(o,i,t,n){var a=arguments.length,u=a<3?i:n===null?n=Object.getOwnPropertyDescriptor(i,t):n,f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(o,i,t,n);else for(var y=o.length-1;y>=0;y--)(f=o[y])&&(u=(a<3?f(u):a>3?f(i,t,u):f(i,t))||u);return a>3&&u&&Object.defineProperty(i,t,u),u}function P1(o,i){return function(t,n){i(t,n,o)}}function O1(o,i){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,i)}function C1(o,i,t,n){function a(u){return u instanceof t?u:new t(function(f){f(u)})}return new(t||(t=Promise))(function(u,f){function y(_){try{d(n.next(_))}catch(O){f(O)}}function w(_){try{d(n.throw(_))}catch(O){f(O)}}function d(_){_.done?u(_.value):a(_.value).then(y,w)}d((n=n.apply(o,i||[])).next())})}function A1(o,i){var t={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]},n,a,u,f;return f={next:y(0),throw:y(1),return:y(2)},typeof Symbol=="function"&&(f[Symbol.iterator]=function(){return this}),f;function y(d){return function(_){return w([d,_])}}function w(d){if(n)throw new TypeError("Generator is already executing.");for(;t;)try{if(n=1,a&&(u=d[0]&2?a.return:d[0]?a.throw||((u=a.return)&&u.call(a),0):a.next)&&!(u=u.call(a,d[1])).done)return u;switch(a=0,u&&(d=[d[0]&2,u.value]),d[0]){case 0:case 1:u=d;break;case 4:return t.label++,{value:d[1],done:!1};case 5:t.label++,a=d[1],d=[0];continue;case 7:d=t.ops.pop(),t.trys.pop();continue;default:if(u=t.trys,!(u=u.length>0&&u[u.length-1])&&(d[0]===6||d[0]===2)){t=0;continue}if(d[0]===3&&(!u||d[1]>u[0]&&d[1]<u[3])){t.label=d[1];break}if(d[0]===6&&t.label<u[1]){t.label=u[1],u=d;break}if(u&&t.label<u[2]){t.label=u[2],t.ops.push(d);break}u[2]&&t.ops.pop(),t.trys.pop();continue}d=i.call(o,t)}catch(_){d=[6,_],a=0}finally{n=u=0}if(d[0]&5)throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}}function R1(o,i,t,n){n===void 0&&(n=t),o[n]=i[t]}function T1(o,i){for(var t in o)t!=="default"&&!i.hasOwnProperty(t)&&(i[t]=o[t])}function dc(o){var i=typeof Symbol=="function"&&Symbol.iterator,t=i&&o[i],n=0;if(t)return t.call(o);if(o&&typeof o.length=="number")return{next:function(){return o&&n>=o.length&&(o=void 0),{value:o&&o[n++],done:!o}}};throw new TypeError(i?"Object is not iterable.":"Symbol.iterator is not defined.")}function Vl(o,i){var t=typeof Symbol=="function"&&o[Symbol.iterator];if(!t)return o;var n=t.call(o),a,u=[],f;try{for(;(i===void 0||i-- >0)&&!(a=n.next()).done;)u.push(a.value)}catch(y){f={error:y}}finally{try{a&&!a.done&&(t=n.return)&&t.call(n)}finally{if(f)throw f.error}}return u}function N1(){for(var o=[],i=0;i<arguments.length;i++)o=o.concat(Vl(arguments[i]));return o}function $1(){for(var o=0,i=0,t=arguments.length;i<t;i++)o+=arguments[i].length;for(var n=Array(o),a=0,i=0;i<t;i++)for(var u=arguments[i],f=0,y=u.length;f<y;f++,a++)n[a]=u[f];return n}function Vn(o){return this instanceof Vn?(this.v=o,this):new Vn(o)}function F1(o,i,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(o,i||[]),a,u=[];return a={},f("next"),f("throw"),f("return"),a[Symbol.asyncIterator]=function(){return this},a;function f(P){n[P]&&(a[P]=function(L){return new Promise(function(N,K){u.push([P,L,N,K])>1||y(P,L)})})}function y(P,L){try{w(n[P](L))}catch(N){O(u[0][3],N)}}function w(P){P.value instanceof Vn?Promise.resolve(P.value.v).then(d,_):O(u[0][2],P)}function d(P){y("next",P)}function _(P){y("throw",P)}function O(P,L){P(L),u.shift(),u.length&&y(u[0][0],u[0][1])}}function D1(o){var i,t;return i={},n("next"),n("throw",function(a){throw a}),n("return"),i[Symbol.iterator]=function(){return this},i;function n(a,u){i[a]=o[a]?function(f){return(t=!t)?{value:Vn(o[a](f)),done:a==="return"}:u?u(f):f}:u}}function L1(o){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=o[Symbol.asyncIterator],t;return i?i.call(o):(o=typeof dc=="function"?dc(o):o[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(u){t[u]=o[u]&&function(f){return new Promise(function(y,w){f=o[u](f),a(y,w,f.done,f.value)})}}function a(u,f,y,w){Promise.resolve(w).then(function(d){u({value:d,done:y})},f)}}function q1(o,i){return Object.defineProperty?Object.defineProperty(o,"raw",{value:i}):o.raw=i,o}function j1(o){if(o&&o.__esModule)return o;var i={};if(o!=null)for(var t in o)Object.hasOwnProperty.call(o,t)&&(i[t]=o[t]);return i.default=o,i}function z1(o){return o&&o.__esModule?o:{default:o}}function M1(o,i){if(!i.has(o))throw new TypeError("attempted to get private field on non-instance");return i.get(o)}function U1(o,i,t){if(!i.has(o))throw new TypeError("attempted to set private field on non-instance");return i.set(o,t),t}const H1=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return pc},__asyncDelegator:D1,__asyncGenerator:F1,__asyncValues:L1,__await:Vn,__awaiter:C1,__classPrivateFieldGet:M1,__classPrivateFieldSet:U1,__createBinding:R1,__decorate:S1,__exportStar:T1,__extends:I1,__generator:A1,__importDefault:z1,__importStar:j1,__makeTemplateOb
14ject:q1,__metadata:O1,__param:P1,__read:Vl,__rest:x1,__spread:N1,__spreadArrays:$1,__values:dc},Symbol.toStringTag,{value:"Module"})),ma=Ic(H1);var Fn={},Qo={},Dn={};class Ui{}const k1=Object.freeze(Object.defineProperty({__proto__:null,IEvents:Ui},Symbol.toStringTag,{value:"Module"})),K1=Ic(k1);var Bh;function B1(){if(Bh)return Dn;Bh=1,Object.defineProperty(Dn,"__esModule",{value:!0}),Dn.IHeartBeat=void 0;const o=K1;class i extends o.IEvents{constructor(n){super()}}return Dn.IHeartBeat=i,Dn}var Vh;function Gl(){return Vh||(Vh=1,function(o){Object.defineProperty(o,"__esModule",{value:!0}),ma.__exportStar(B1(),o)}(Qo)),Qo}var Yo={},ji={},Gh;function V1(){if(Gh)return ji;Gh=1,Object.defineProperty(ji,"__esModule",{value:!0}),ji.HEARTBEAT_EVENTS=ji.HEARTBEAT_INTERVAL=void 0;const o=ie;return ji.HEARTBEAT_INTERVAL=o.FIVE_SECONDS,ji.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"},ji}var Wh;function Wl(){return Wh||(Wh=1,function(o){Object.defineProperty(o,"__esModule",{value:!0}),ma.__exportStar(V1(),o)}(Yo)),Yo}var Jh;function G1(){if(Jh)return Fn;Jh=1,Object.defineProperty(Fn,"__esModule",{value:!0}),Fn.HeartBeat=void 0;const o=ma,i=kr,t=ie,n=Gl(),a=Wl();class u extends n.IHeartBeat{constructor(y){super(y),this.events=new i.EventEmitter,this.interval=a.HEARTBEAT_INTERVAL,this.interval=(y==null?void 0:y.interval)||a.HEARTBEAT_INTERVAL}static init(y){return o.__awaiter(this,void 0,void 0,function*(){const w=new u(y);return yield w.init(),w})}init(){return o.__awaiter(this,void 0,void 0,function*(){yield this.initialize()})}stop(){clearInterval(this.intervalRef)}on(y,w){this.events.on(y,w)}once(y,w){this.events.once(y,w)}off(y,w){this.events.off(y,w)}removeListener(y,w){this.events.removeListener(y,w)}initialize(){return o.__awaiter(this,void 0,void 0,function*(){this.intervalRef=setInterval(()=>this.pulse(),t.toMiliseconds(this.interval))})}pulse(){this.events.emit(a.HEARTBEAT_EVENTS.pulse)}}return Fn.HeartBeat=u,Fn}(function(o){Object.defineProperty(o,"__esModule",{value:!0});const i=ma;i.__exportStar(G1(),o),i.__exportStar(Gl(),o),i.__exportStar(Wl(),o)})(dn);var Ce={};/*! ***************************************************************************** 15Copyright (c) Microsoft Corporation. 16 17Permission to use, copy, modify, and/or distribute this software for any 18purpose with or without fee is hereby granted. 19 20THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 21REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 22AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 23INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 24LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 25OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 26PERFORMANCE OF THIS SOFTWARE. 27***************************************************************************** */var gc=function(o,i){return gc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var a in n)n.hasOwnProperty(a)&&(t[a]=n[a])},gc(o,i)};function W1(o,i){gc(o,i);function t(){this.constructor=o}o.prototype=i===null?Object.create(i):(t.prototype=i.prototype,new t)}var yc=function(){return yc=Object.assign||function(i){for(var t,n=1,a=arguments.length;n<a;n++){t=arguments[n];for(var u in t)Object.prototype.hasOwnProperty.call(t,u)&&(i[u]=t[u])}return i},yc.apply(this,arguments)};function J1(o,i){var t={};for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&i.indexOf(n)<0&&(t[n]=o[n]);if(o!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,n=Object.getOwnPropertySymbols(o);a<n.length;a++)i.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(o,n[a])&&(t[n[a]]=o[n[a]]);return t}function Q1(o,i,t,n){var a=arguments.length,u=a<3?i:n===null?n=Object.getOwnPropertyDescriptor(i,t):n,f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(o,i,t,n);else for(var y=o.length-1;y>=0;y--)(f=o[y])&&(u=(a<3?f(u):a>3?f(i,t,u):f(i,t))||u);return a>3&&u&&Object.defineProperty(i,t,u),u}function Y1(o,i){return function(t,n){i(t,n,o)}}function X1(o,i){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,i)}function Z1(o,i,t,n){function a(u){return u instanceof t?u:new t(function(f){f(u)})}return new(t||(t=Promise))(function(u,f){function y(_){try{d(n.next(_))}catch(O){f(O)}}function w(_){try{d(n.throw(_))}catch(O){f(O)}}function d(_){_.done?u(_.value):a(_.value).then(y,w)}d((n=n.apply(o,i||[])).next())})}function ew(o,i){var t={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]},n,a,u,f;return f={next:y(0),throw:y(1),return:y(2)},typeof Symbol=="function"&&(f[Symbol.iterator]=function(){return this}),f;function y(d){return function(_){return w([d,_])}}function w(d){if(n)throw new TypeError("Generator is already executing.");for(;t;
vendor: 3,945 bytes, line 27
27)try{if(n=1,a&&(u=d[0]&2?a.return:d[0]?a.throw||((u=a.return)&&u.call(a),0):a.next)&&!(u=u.call(a,d[1])).done)return u;switch(a=0,u&&(d=[d[0]&2,u.value]),d[0]){case 0:case 1:u=d;break;case 4:return t.label++,{value:d[1],done:!1};case 5:t.label++,a=d[1],d=[0];continue;case 7:d=t.ops.pop(),t.trys.pop();continue;default:if(u=t.trys,!(u=u.length>0&&u[u.length-1])&&(d[0]===6||d[0]===2)){t=0;continue}if(d[0]===3&&(!u||d[1]>u[0]&&d[1]<u[3])){t.label=d[1];break}if(d[0]===6&&t.label<u[1]){t.label=u[1],u=d;break}if(u&&t.label<u[2]){t.label=u[2],t.ops.push(d);break}u[2]&&t.ops.pop(),t.trys.pop();continue}d=i.call(o,t)}catch(_){d=[6,_],a=0}finally{n=u=0}if(d[0]&5)throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}}function tw(o,i,t,n){n===void 0&&(n=t),o[n]=i[t]}function rw(o,i){for(var t in o)t!=="default"&&!i.hasOwnProperty(t)&&(i[t]=o[t])}function vc(o){var i=typeof Symbol=="function"&&Symbol.iterator,t=i&&o[i],n=0;if(t)return t.call(o);if(o&&typeof o.length=="number")return{next:function(){return o&&n>=o.length&&(o=void 0),{value:o&&o[n++],done:!o}}};throw new TypeError(i?"Object is not iterable.":"Symbol.iterator is not defined.")}function Jl(o,i){var t=typeof Symbol=="function"&&o[Symbol.iterator];if(!t)return o;var n=t.call(o),a,u=[],f;try{for(;(i===void 0||i-- >0)&&!(a=n.next()).done;)u.push(a.value)}catch(y){f={error:y}}finally{try{a&&!a.done&&(t=n.return)&&t.call(n)}finally{if(f)throw f.error}}return u}function iw(){for(var o=[],i=0;i<arguments.length;i++)o=o.concat(Jl(arguments[i]));return o}function nw(){for(var o=0,i=0,t=arguments.length;i<t;i++)o+=arguments[i].length;for(var n=Array(o),a=0,i=0;i<t;i++)for(var u=arguments[i],f=0,y=u.length;f<y;f++,a++)n[a]=u[f];return n}function Gn(o){return this instanceof Gn?(this.v=o,this):new Gn(o)}function sw(o,i,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(o,i||[]),a,u=[];return a={},f("next"),f("throw"),f("return"),a[Symbol.asyncIterator]=function(){return this},a;function f(P){n[P]&&(a[P]=function(L){return new Promise(function(N,K){u.push([P,L,N,K])>1||y(P,L)})})}function y(P,L){try{w(n[P](L))}catch(N){O(u[0][3],N)}}function w(P){P.value instanceof Gn?Promise.resolve(P.value.v).then(d,_):O(u[0][2],P)}function d(P){y("next",P)}function _(P){y("throw",P)}function O(P,L){P(L),u.shift(),u.length&&y(u[0][0],u[0][1])}}function aw(o){var i,t;return i={},n("next"),n("throw",function(a){throw a}),n("return"),i[Symbol.iterator]=function(){return this},i;function n(a,u){i[a]=o[a]?function(f){return(t=!t)?{value:Gn(o[a](f)),done:a==="return"}:u?u(f):f}:u}}function ow(o){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=o[Symbol.asyncIterator],t;return i?i.call(o):(o=typeof vc=="function"?vc(o):o[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(u){t[u]=o[u]&&function(f){return new Promise(function(y,w){f=o[u](f),a(y,w,f.done,f.value)})}}function a(u,f,y,w){Promise.resolve(w).then(function(d){u({value:d,done:y})},f)}}function cw(o,i){return Object.defineProperty?Object.defineProperty(o,"raw",{value:i}):o.raw=i,o}function uw(o){if(o&&o.__esModule)return o;var i={};if(o!=null)for(var t in o)Object.hasOwnProperty.call(o,t)&&(i[t]=o[t]);return i.default=o,i}function hw(o){return o&&o.__esModule?o:{default:o}}function lw(o,i){if(!i.has(o))throw new TypeError("attempted to get private field on non-instance");return i.get(o)}function fw(o,i,t){if(!i.has(o))throw new TypeError("attempted to set private field on non-instance");return i.set(o,t),t}const pw=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return yc},__asyncDelegator:aw,__asyncGenerator:sw,__asyncValues:ow,__await:Gn,__awaiter:Z1,__classPrivateFieldGet:lw,__classPrivateFieldSet:fw,__createBinding:tw,__decorate:Q1,__exportStar:rw,__extends:W1,__generator:ew,__importDefault:hw,__importStar:uw,__makeTemplateOb
27ject:cw,__metadata:X1,__param:Y1,__read:Jl,__rest:J1,__spread:iw,__spreadArrays:nw,__values:vc},Symbol.toStringTag,{value:"Module"})),dw=Ic(pw);var Xo,Qh;function gw(){if(Qh)return Xo;Qh=1;function o(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}Xo=i;function i(t,n,a){var u=a&&a.stringify||o,f=1;if(typeof t=="object"&&t!==null){var y=n.length+f;if(y===1)return t;var w=new Array(y);w[0]=u(t);for(var d=1;d<y;d++)w[d]=u(n[d]);return w.join(" ")}if(typeof t!="string")return t;var _=n.length;if(_===0)return t;for(var O="",P=1-f,L=-1,N=t&&t.length||0,K=0;K<N;){if(t.charCodeAt(K)===37&&K+1<N){switch(L=L>-1?L:0,t.charCodeAt(K+1)){case 100:case 102:if(P>=_||n[P]==null)break;L<K&&(O+=t.slice(L,K)),O+=Number(n[P]),L=K+2,K++;break;case 105:if(P>=_||n[P]==null)break;L<K&&(O+=t.slice(L,K)),O+=Math.floor(Number(n[P])),L=K+2,K++;break;case 79:case 111:case 106:if(P>=_||n[P]===void 0)break;L<K&&(O+=t.slice(L,K));var re=typeof n[P];if(re==="string"){O+="'"+n[P]+"'",L=K+2,K++;break}if(re==="function"){O+=n[P].name||"<anonymous>",L=K+2,K++;break}O+=u(n[P]),L=K+2,K++;break;case 115:if(P>=_)break;L<K&&(O+=t.slice(L,K)),O+=String(n[P]),L=K+2,K++;break;case 37:L<K&&(O+=t.slice(L,K)),O+="%",L=K+2,K++,P--;break}++P}++K}return L===-1?t:(L<N&&(O+=t.slice(L)),O)}return Xo}var Zo,Yh;function yw(){if(Yh)return Zo;Yh=1;const o=gw();Zo=a;const i=pe().console||{},t={mapHttpRequest:N,mapHttpResponse:N,wrapRequestSerializer:K,wrapResponseSerializer:K,wrapErrorSerializer:K,req:N,res:N,err:P};function n(F,H){return Array.isArray(F)?F.filter(function(ye){return ye!=="!stdSerializers.err"}):F===!0?Object.keys(H):!1}function a(F){F=F||{},F.browser=F.browser||{};const H=F.browser.transmit;if(H&&typeof H.send!="function")throw Error("pino: transmit option must have a send function");const W=F.browser.write||i;F.browser.write&&(F.browser.asObject=!0);const ye=F.serializers||{},te=n(F.browser.serialize,ye);let Ee=F.browser.serialize;Array.isArray(F.browser.serialize)&&F.browser.serialize.indexOf("!stdSerializers.err")>-1&&(Ee=!1);const Ae=["error","fatal","warn","info","debug","trace"];typeof W=="function"&&(W.error=W.fatal=W.warn=W.info=W.debug=W.trace=W),F.enabled===!1&&(F.level="silent");const et=F.level||"info",R=Object.create(W);R.log||(R.log=re),Object.defineProperty(R,"levelVal",{get:ze}),Object.defineProperty(R,"level",{get:Re,set:J});const z={transmit:H,serialize:te,asObject:F.browser.asObject,levels:Ae,timestamp:L(F)};R.levels=a.levels,R.level=et,R.setMaxListeners=R.getMaxListeners=R.emit=R.addListener=R.on=R.prependListener=R.once=R.prependOnceListener=R.removeListener=R.removeAllListeners=R.listeners=R.listenerCount=R.eventNames=R.write=R.flush=re,R.serializers=ye,R._serialize=te,R._stdErrSerialize=Ee,R.child=B,H&&(R._logEvent=O());function ze(){return this.level==="silent"?1/0:this.levels.values[this.level]}function Re(){return this._level}function J(k){if(k!=="silent"&&!this.levels.values[k])throw Error("unknown level "+k);this._level=k,u(z,R,"error","log"),u(z,R,"fatal","error"),u(z,R,"warn","error"),u(z,R,"info","log"),u(z,R,"debug","log"),u(z,R,"trace","log")}function B(k,V){if(!k)throw new Error("missing bindings for child Pino");V=V||{},te&&k.serializers&&(V.serializers=k.serializers);const ut=V.serializers;if(te&&ut){var He=Object.assign({},ye,ut),Dr=F.browser.serialize===!0?Object.keys(He):te;delete k.serializers,w([k],Dr,He,this._stdErrSerialize)}function _e(It){this._childLevel=(It._childLevel|0)+1,this.error=d(It,k,"error"),this.fatal=d(It,k,"fatal"),this.warn=d(It,k,"warn"),this.info=d(It,k,"info"),this.debug=d(It,k,"debug"),this.trace=d(It,k,"trace"),He&&(this.serializers=He,this._serialize=Dr),H&&(this._logEvent=O([].concat(It._logEvent.bindings,k)))}return _e.prototype=this,new _e(this)}return R}a.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"}},a.stdSerializers=t,a.stdTimeFunctions=Object.assign({},{nullTime:ce,epochTime:ue,unixTime:he,isoTime:fe});function u(F,H,W,ye){const te=Object.getPrototypeOf(H);H[W]=H.levelVal>H.levels.values[W]?re:te[W]?te[W]:i[W]||i[ye]||re,f(F,H,W)}function f(F,H,W){!F.transmit&&H[W]===re||(H[W]=function(ye){return function(){const Ee=F.timestamp(),Ae=new Array(arguments.length),et=Object.getPrototypeOf&&Object.getPrototypeOf(this)===i?i:this;for(var R=0;R<Ae.length;R++)Ae[R]=arguments[R];if(F.serialize&&!F.asObject&&w(Ae,this._serialize,this.serializers,this._stdErrSerialize),F.asObject?ye.call(et,y(this,W,Ae,Ee)):ye.apply(et,Ae),F.transmit){const z=F.transmit.level||H.level,ze=a.levels.values[z],Re=a.levels.values[W];if(Re<ze)return;_(this,{ts:Ee,methodLevel:W,methodValue:Re,transmitLevel:z,transmitValue:a.levels.values[F.transmit.level||H.level],send:
27F.transmit.send,val:H.levelVal},Ae)}}}(H[W]))}function y(F,H,W,ye){F._serialize&&w(W,F._serialize,F.serializers,F._stdErrSerialize);const te=W.slice();let Ee=te[0];const Ae={};ye&&(Ae.time=ye),Ae.level=a.levels.values[H];let et=(F._childLevel|0)+1;if(et<1&&(et=1),Ee!==null&&typeof Ee=="object"){for(;et--&&typeof te[0]=="object";)Object.assign(Ae,te.shift());Ee=te.length?o(te.shift(),te):void 0}else typeof Ee=="string"&&(Ee=o(te.shift(),te));return Ee!==void 0&&(Ae.msg=Ee),Ae}function w(F,H,W,ye){for(const te in F)if(ye&&F[te]instanceof Error)F[te]=a.stdSerializers.err(F[te]);else if(typeof F[te]=="object"&&!Array.isArray(F[te]))for(const Ee in F[te])H&&H.indexOf(Ee)>-1&&Ee in W&&(F[te][Ee]=W[Ee](F[te][Ee]))}function d(F,H,W){return function(){const ye=new Array(1+arguments.length);ye[0]=H;for(var te=1;te<ye.length;te++)ye[te]=arguments[te-1];return F[W].apply(this,ye)}}function _(F,H,W){const ye=H.send,te=H.ts,Ee=H.methodLevel,Ae=H.methodValue,et=H.val,R=F._logEvent.bindings;w(W,F._serialize||Object.keys(F.serializers),F.serializers,F._stdErrSerialize===void 0?!0:F._stdErrSerialize),F._logEvent.ts=te,F._logEvent.messages=W.filter(function(z){return R.indexOf(z)===-1}),F._logEvent.level.label=Ee,F._logEvent.level.value=Ae,ye(Ee,F._logEvent,et),F._logEvent=O(R)}function O(F){return{ts:0,messages:[],bindings:F||[],level:{label:"",value:0}}}function P(F){const H={type:F.constructor.name,msg:F.message,stack:F.stack};for(const W in F)H[W]===void 0&&(H[W]=F[W]);return H}function L(F){return typeof F.timestamp=="function"?F.timestamp:F.timestamp===!1?ce:ue}function N(){return{}}function K(F){return F}function re(){}function ce(){return!1}function ue(){return Date.now()}function he(){return Math.round(Date.now()/1e3)}function fe(){return new Date(Date.now()).toISOString()}function pe(){function F(H){return typeof H<"u"&&H}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return F(self)||F(window)||F(this)||{}}}return Zo}var zi={},Xh;function Ql(){return Xh||(Xh=1,Object.defineProperty(zi,"__esModule",{value:!0}),zi.PINO_CUSTOM_CONTEXT_KEY=zi.PINO_LOGGER_DEFAULTS=void 0,zi.PINO_LOGGER_DEFAULTS={level:"info"},zi.PINO_CUSTOM_CONTEXT_KEY="custom_context"),zi}var er={},Zh;function vw(){if(Zh)return er;Zh=1,Object.defineProperty(er,"__esModule",{value:!0}),er.generateChildLogger=er.formatChildLoggerContext=er.getLoggerContext=er.setBrowserLoggerContext=er.getBrowserLoggerContext=er.getDefaultLoggerOptions=void 0;const o=Ql();function i(y){return Object.assign(Object.assign({},y),{level:(y==null?void 0:y.level)||o.PINO_LOGGER_DEFAULTS.level})}er.getDefaultLoggerOptions=i;function t(y,w=o.PINO_CUSTOM_CONTEXT_KEY){return y[w]||""}er.getBrowserLoggerContext=t;function n(y,w,d=o.PINO_CUSTOM_CONTEXT_KEY){return y[d]=w,y}er.setBrowserLoggerContext=n;function a(y,w=o.PINO_CUSTOM_CONTEXT_KEY){let d="";return typeof y.bindings>"u"?d=t(y,w):d=y.bindings().context||"",d}er.getLoggerContext=a;function u(y,w,d=o.PINO_CUSTOM_CONTEXT_KEY){const _=a(y,d);return _.trim()?`${_}/${w}`:w}er.formatChildLoggerContext=u;function f(y,w,d=o.PINO_CUSTOM_CONTEXT_KEY){const _=u(y,w,d),O=y.child({context:_});return n(O,_,d)}return er.generateChildLogger=f,er}(function(o){Object.defineProperty(o,"__esModule",{value:!0}),o.pino=void 0;const i=dw,t=i.__importDefault(yw());Object.defineProperty(o,"pino",{enumerable:!0,get:function(){return t.default}}),i.__exportStar(Ql(),o),i.__exportStar(vw(),o)})(Ce);class mw extends Ui{constructor(i){super(),this.opts=i,this.protocol="wc",this.version=2}}class ww extends Ui{constructor(i,t){super(),this.core=i,this.logger=t,this.records=new Map}}class _w{constructor(i,t){this.logger=i,this.core=t}}let bw=class extends Ui{constructor(i,t){super(),this.relayer=i,this.logger=t}},Ew=class extends Ui{constructor(i){super()}},Iw=class{constructor(i,t,n,a){this.core=i,this.logger=t,this.name=n}};class xw extends Ui{constructor(i,t){super(),this.relayer=i,this.logger=t}}let Sw=class extends Ui{constructor(i,t){super(),this.core=i,this.logger=t}},Pw=class{constructor(i,t){this.projectId=i,this.logger=t}},Ow=class{constructor(i){this.opts=i,this.protocol="wc",this.version=2}},Cw=class{constructor(i){this.client=i}};var Rc={},Yl={};(function(o){Object.defineProperty(o,"__esModule",{value:!0});var i=em,t=Ll;o.DIGEST_LENGTH=64,o.BLOCK_SIZE=128;var n=function(){function y(){this.digestLength=o.DIGEST_LENGTH,this.blockSize=o.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return y.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},y.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},y.prototype.clean=function(){t.wipe(this._buffer),t.wipe(this._tempHi),t.wipe(this._tempLo),this.reset()},y.prototype.update=function(w,d){if(d===void 0&&(d=w.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var _=0;if(this._bytesHashed+=d,this._bufferLength>0){for(;this._bufferLength<o.BLOCK_SIZE&&d>0;)this._buffer[this._bufferLength++]=w[_++],d--;this._bufferLength===this.blockSize&&(u(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(d>=this.blockSize&&(_=u(this._tempHi,this._tempLo,this._stateHi,this._stateLo,w,_,d),d%=this.blockSize);d>0;)this._buffer[this._bufferLength++]=w[_++],d--;return this},y.prototype.finish=function(w){if(!this._finished){var d=this._bytesHashed,_=this._bufferLength,O=d
27/536870912|0,P=d<<3,L=d%128<112?128:256;this._buffer[_]=128;for(var N=_+1;N<L-8;N++)this._buffer[N]=0;i.writeUint32BE(O,this._buffer,L-8),i.writeUint32BE(P,this._buffer,L-4),u(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,L),this._finished=!0}for(var N=0;N<this.digestLength/8;N++)i.writeUint32BE(this._stateHi[N],w,N*8),i.writeUint32BE(this._stateLo[N],w,N*8+4);return this},y.prototype.digest=function(){var w=new Uint8Array(this.digestLength);return this.finish(w),w},y.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{stateHi:new Int32Array(this._stateHi),stateLo:new Int32Array(this._stateLo),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},y.prototype.restoreState=function(w){return this._stateHi.set(w.stateHi),this._stateLo.set(w.stateLo),this._bufferLength=w.bufferLength,w.buffer&&this._buffer.set(w.buffer),this._bytesHashed=w.bytesHashed,this._finished=!1,this},y.prototype.cleanSavedState=function(w){t.wipe(w.stateHi),t.wipe(w.stateLo),w.buffer&&t.wipe(w.buffer),w.bufferLength=0,w.bytesHashed=0},y}();o.SHA512=n;var a=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,
271126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function u(y,w,d,_,O,P,L){for(var N=d[0],K=d[1],re=d[2],ce=d[3],ue=d[4],he=d[5],fe=d[6],pe=d[7],F=_[0],H=_[1],W=_[2],ye=_[3],te=_[4],Ee=_[5],Ae=_[6],et=_[7],R,z,ze,Re,J,B,k,V;L>=128;){for(var ut=0;ut<16;ut++){var He=8*ut+P;y[ut]=i.readUint32BE(O,He),w[ut]=i.readUint32BE(O,He+4)}for(var ut=0;ut<80;ut++){var Dr=N,_e=K,It=re,$=ce,T=ue,C=he,h=fe,E=pe,Z=F,oe=H,me=W,Te=ye,$e=te,xe=Ee,xt=Ae,mt=et;if(R=pe,z=et,J=z&65535,B=z>>>16,k=R&65535,V=R>>>16,R=(ue>>>14|te<<32-14)^(ue>>>18|te<<32-18)^(te>>>41-32|ue<<32-(41-32)),z=(te>>>14|ue<<32-14)^(te>>>18|ue<<32-18)^(ue>>>41-32|te<<32-(41-32)),J+=z&65535,B+=z>>>16,k+=R&65535,V+=R>>>16,R=ue&he^~ue&fe,z=te&Ee^~te&Ae,J+=z&65535,B+=z>>>16,k+=R&65535,V+=R>>>16,R=a[ut*2],z=a[ut*2+1],J+=z&65535,B+=z>>>16,k+=R&65535,V+=R>>>16,R=y[ut%16],z=w[ut%16],J+=z&65535,B+=z>>>16,k+=R&65535,V+=R>>>16,B+=J>>>16,k+=B>>>16,V+=k>>>16,ze=k&65535|V<<16,Re=J&65535|B<<16,R=ze,z=Re,J=z&65535,B=z>>>16,k=R&65535,V=R>>>16,R=(N>>>28|F<<32-28)^(F>>>34-32|N<<32-(34-32))^(F>>>39-32|N<<32-(39-32)),z=(F>>>28|N<<32-28)^(N>>>34-32|F<<32-(34-32))^(N>>>39-32|F<<32-(39-32)),J+=z&65535,B+=z>>>16,k+=R&65535,V+=R>>>16,R=N&K^N&re^K&re,z=F&H^F&W^H&W,J+=z&65535,B+=z>>>16,k+=R&65535,V+=R>>>16,B+=J>>>16,k+=B>>>16,V+=k>>>16,E=k&65535|V<<16,mt=J&65535|B<<16,R=$,z=Te,J=z&65535,B=z>>>16,k=R&65535,V=R>>>16,R=ze,z=Re,J+=z&65535,B+=z>>>16,k+=R&65535,V+=R>>>16,B+=J>>>16,k+=B>>>16,V+=k>>>16,$=k&65535|V<<16,Te=J&65535|B<<16,K=Dr,re=_e,ce=It,ue=$,he=T,fe=C,pe=h,N=E,H=Z,W=oe,ye=me,te=Te,Ee=$e,Ae=xe,et=xt,F=mt,ut%16===15)for(var He=0;He<16;He++)R=y[He],z=w[He],J=z&65535,B=z>>>16,k=R&65535,V=R>>>16,R=y[(He+9)%16],z=w[(He+9)%16],J+=z&65535,B+=z>>>16,k+=R&65535,V+=R>>>16,ze=y[(He+1)%16],Re=w[(He+1)%16],R=(ze>>>1|Re<<32-1)^(ze>>>8|Re<<32-8)^ze>>>7,z=(Re>>>1|ze<<32-1)^(Re>>>8|ze<<32-8)^(Re>>>7|ze<<32-7),J+=z&65535,B+=z>>>16,k+=R&65535,V+=R>>>16,ze=y[(He+14)%16],Re=w[(He+14)%16],R=(ze>>>19|Re<<32-19)^(Re>>>61-32|ze<<32-(61-32))^ze>>>6,z=(Re>>>19|ze<<32-19)^(ze>>>61-32|Re<<32-(61-32))^(Re>>>6|ze<<32-6),J+=z&65535,B+=z>>>16,k+=R&65535,V+=R>>>16,B+=J>>>16,k+=B>>>16,V+=k>>>16,y[He]=k&65535|V<<16,w[He]=J&65535|B<<16}R=N,z=F,J=z&65535,B=z>>>16,k=R&65535,V=R>>>16,R=d[0],z=_[0],J+=z&65535,B+=z>>>16,k+=R&65535,V+=R>>>16,B+=J>>>16,k+=B>>>16,V+=k>>>16,d[0]=N=k&65535|V<<16,_[0]=F=J&65535|B<<16,R=K,z=H,J=z&65535,B=z>>>16,k=R&65535,V=R>>>16,R=d[1],z=_[1],J+=z&65535,B+=z>>>16,k+=R&65535,V+=R>>>16,B+=J>>>16,k+=B>>>16,V+=k>>>16,d[1]=K=k&65535|V<<16,_[1]=H=J&65535|B<<16,R=re,z=W,J=z&65535,B=z>>>16,k=R&65535,V=R>>>16,R=d[2],z=_[2],J+=z&65535,B+=z>>>16,k+=R&65535,V+=R>>>16,B+=J>>>16,k+=B>>>16,V+=k>>>16,d[2]=re=k&65535|V<<16,_[2]=W=J&65535|B<<16,R=ce,z=ye,J=z&65535,B=z>>>16,k=R&65535,V=R>>>16,R=d[3],z=_[3],J+=z&65535,B+=z>>>16,k+=R&65535,V+=R>>>16,B+=J>>>16,k+=B>>>16,V+=k>>>16,d[3]=ce=k&65535|V<<16,_[3]=ye=J&65535|B<<16,R=ue,z=te,J=z&65535,B=z>>>16,k=R&65535,V=R>>>16,R=d[4],z=_[4],J+=z&65535,B+=z>>>16,k+=R&65535,V+=R>>>16,B+=J>>>16,k+=B>>>16,V+=k>>>16,d[4]=ue=k&65535|V<<16,_[4]=te=J&65535|B<<16,R=he,z=Ee,J=z&65535,B=z>>>16,k=R&65535,V=R>>>16,R=d[5],z=_[5],J+=z&65535,B+=z>>>16,k+=R&65535,V+=R>>>16,B+=J>>>16,k+=B>>>16,V+=k>>>16,d[5]=he=k&65535|V<<16,_[5]=Ee=J&65535|B<<16,R=fe,z=Ae,J=z&65535,B=z>>>16,k=R&65535,V=R>>>16,R=d[6],z=_[6],J+=z&65535,B+=z>>>16,k+=R&65535,V+=R>>>16,B+=J>>>16,k+=B>>>16,V+=k>>>16,d[6]=fe=k&65535|V<<16,_[6]=Ae=J&65535|B<<16,R=pe,z=et,J=z&65535,B=z>>>16,k=R&65535,V=R>>>16,R=d[7],z=_[7],J+=z&65535,B+=z>>>16,k+=R&65535,V+=R>>>16,B+=J>>>16,k+=B>>>16,V+=k>>>16,d[7]=pe=k&65535|V<<16,_[7]=et=J&65535|B<<16,P+=128,L-=128}return P}function f(y){var w=new n;w.update(y);var d=w.digest();return w.clean(),d}o.hash=f})(Yl);(function(o){Object.defineProperty(o,"__esModule",{value:!0}),o.convertSecretKeyToX25519=o.convertPublicKeyToX25519=o.verify=o.sign=o.extractPublicKeyFromSecretKey=o.generateKeyPair=o.generateKeyPairFromSeed=o.SEED_LENGTH=o.SECRET_KEY_LENGTH=o.PUBLIC_KEY_LENGTH=o.SIGNATURE_LENGTH=void 0;const i=ql,t=Yl,n=Ll;o.SIGNATURE_LENGTH=64,o.PUBLIC_KEY_LENGTH=32,o.SECRET_KEY_LENGTH=64,o.SEED_LENGTH=32;function a($){const T=new Float64Array(16);if($)for(let C=0;C<$.length;C++)T[C]=$[C];return T}const u=new Uint8Array(32);u[0]=9;const f=a(),y=a([1]),w=a([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),d=a([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),_=a([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),O=a([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),P=a([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function L($,T){for(let C=0;C<16;C++)$[C]=T[C]|0}function N($){let T=1;for(let C=0;C<16;C++){let h=$[C]+T+65535;T=Math.floor(h/65536),$[C]=h-T*65536}$[0]+=T-1+37*(T-1)}function K($,T,C){const h=~(C-1);for(let E=0;E<16;
27E++){const Z=h&($[E]^T[E]);$[E]^=Z,T[E]^=Z}}function re($,T){const C=a(),h=a();for(let E=0;E<16;E++)h[E]=T[E];N(h),N(h),N(h);for(let E=0;E<2;E++){C[0]=h[0]-65517;for(let oe=1;oe<15;oe++)C[oe]=h[oe]-65535-(C[oe-1]>>16&1),C[oe-1]&=65535;C[15]=h[15]-32767-(C[14]>>16&1);const Z=C[15]>>16&1;C[14]&=65535,K(h,C,1-Z)}for(let E=0;E<16;E++)$[2*E]=h[E]&255,$[2*E+1]=h[E]>>8}function ce($,T){let C=0;for(let h=0;h<32;h++)C|=$[h]^T[h];return(1&C-1>>>8)-1}function ue($,T){const C=new Uint8Array(32),h=new Uint8Array(32);return re(C,$),re(h,T),ce(C,h)}function he($){const T=new Uint8Array(32);return re(T,$),T[0]&1}function fe($,T){for(let C=0;C<16;C++)$[C]=T[2*C]+(T[2*C+1]<<8);$[15]&=32767}function pe($,T,C){for(let h=0;h<16;h++)$[h]=T[h]+C[h]}function F($,T,C){for(let h=0;h<16;h++)$[h]=T[h]-C[h]}function H($,T,C){let h,E,Z=0,oe=0,me=0,Te=0,$e=0,xe=0,xt=0,mt=0,st=0,De=0,Je=0,Qe=0,at=0,Me=0,Ye=0,Ne=0,ke=0,ht=0,qe=0,St=0,Ft=0,Ut=0,Ht=0,qt=0,Wt=0,rr=0,Lr=0,Jt=0,Kr=0,oi=0,xi=0,lt=C[0],tt=C[1],ft=C[2],pt=C[3],ot=C[4],rt=C[5],Pt=C[6],Ot=C[7],dt=C[8],Ct=C[9],gt=C[10],wt=C[11],yt=C[12],We=C[13],At=C[14],Rt=C[15];h=T[0],Z+=h*lt,oe+=h*tt,me+=h*ft,Te+=h*pt,$e+=h*ot,xe+=h*rt,xt+=h*Pt,mt+=h*Ot,st+=h*dt,De+=h*Ct,Je+=h*gt,Qe+=h*wt,at+=h*yt,Me+=h*We,Ye+=h*At,Ne+=h*Rt,h=T[1],oe+=h*lt,me+=h*tt,Te+=h*ft,$e+=h*pt,xe+=h*ot,xt+=h*rt,mt+=h*Pt,st+=h*Ot,De+=h*dt,Je+=h*Ct,Qe+=h*gt,at+=h*wt,Me+=h*yt,Ye+=h*We,Ne+=h*At,ke+=h*Rt,h=T[2],me+=h*lt,Te+=h*tt,$e+=h*ft,xe+=h*pt,xt+=h*ot,mt+=h*rt,st+=h*Pt,De+=h*Ot,Je+=h*dt,Qe+=h*Ct,at+=h*gt,Me+=h*wt,Ye+=h*yt,Ne+=h*We,ke+=h*At,ht+=h*Rt,h=T[3],Te+=h*lt,$e+=h*tt,xe+=h*ft,xt+=h*pt,mt+=h*ot,st+=h*rt,De+=h*Pt,Je+=h*Ot,Qe+=h*dt,at+=h*Ct,Me+=h*gt,Ye+=h*wt,Ne+=h*yt,ke+=h*We,ht+=h*At,qe+=h*Rt,h=T[4],$e+=h*lt,xe+=h*tt,xt+=h*ft,mt+=h*pt,st+=h*ot,De+=h*rt,Je+=h*Pt,Qe+=h*Ot,at+=h*dt,Me+=h*Ct,Ye+=h*gt,Ne+=h*wt,ke+=h*yt,ht+=h*We,qe+=h*At,St+=h*Rt,h=T[5],xe+=h*lt,xt+=h*tt,mt+=h*ft,st+=h*pt,De+=h*ot,Je+=h*rt,Qe+=h*Pt,at+=h*Ot,Me+=h*dt,Ye+=h*Ct,Ne+=h*gt,ke+=h*wt,ht+=h*yt,qe+=h*We,St+=h*At,Ft+=h*Rt,h=T[6],xt+=h*lt,mt+=h*tt,st+=h*ft,De+=h*pt,Je+=h*ot,Qe+=h*rt,at+=h*Pt,Me+=h*Ot,Ye+=h*dt,Ne+=h*Ct,ke+=h*gt,ht+=h*wt,qe+=h*yt,St+=h*We,Ft+=h*At,Ut+=h*Rt,h=T[7],mt+=h*lt,st+=h*tt,De+=h*ft,Je+=h*pt,Qe+=h*ot,at+=h*rt,Me+=h*Pt,Ye+=h*Ot,Ne+=h*dt,ke+=h*Ct,ht+=h*gt,qe+=h*wt,St+=h*yt,Ft+=h*We,Ut+=h*At,Ht+=h*Rt,h=T[8],st+=h*lt,De+=h*tt,Je+=h*ft,Qe+=h*pt,at+=h*ot,Me+=h*rt,Ye
27+=h*Pt,Ne+=h*Ot,ke+=h*dt,ht+=h*Ct,qe+=h*gt,St+=h*wt,Ft+=h*yt,Ut+=h*We,Ht+=h*At,qt+=h*Rt,h=T[9],De+=h*lt,Je+=h*tt,Qe+=h*ft,at+=h*pt,Me+=h*ot,Ye+=h*rt,Ne+=h*Pt,ke+=h*Ot,ht+=h*dt,qe+=h*Ct,St+=h*gt,Ft+=h*wt,Ut+=h*yt,Ht+=h*We,qt+=h*At,Wt+=h*Rt,h=T[10],Je+=h*lt,Qe+=h*tt,at+=h*ft,Me+=h*pt,Ye+=h*ot,Ne+=h*rt,ke+=h*Pt,ht+=h*Ot,qe+=h*dt,St+=h*Ct,Ft+=h*gt,Ut+=h*wt,Ht+=h*yt,qt+=h*We,Wt+=h*At,rr+=h*Rt,h=T[11],Qe+=h*lt,at+=h*tt,Me+=h*ft,Ye+=h*pt,Ne+=h*ot,ke+=h*rt,ht+=h*Pt,qe+=h*Ot,St+=h*dt,Ft+=h*Ct,Ut+=h*gt,Ht+=h*wt,qt+=h*yt,Wt+=h*We,rr+=h*At,Lr+=h*Rt,h=T[12],at+=h*lt,Me+=h*tt,Ye+=h*ft,Ne+=h*pt,ke+=h*ot,ht+=h*rt,qe+=h*Pt,St+=h*Ot,Ft+=h*dt,Ut+=h*Ct,Ht+=h*gt,qt+=h*wt,Wt+=h*yt,rr+=h*We,Lr+=h*At,Jt+=h*Rt,h=T[13],Me+=h*lt,Ye+=h*tt,Ne+=h*ft,ke+=h*pt,ht+=h*ot,qe+=h*rt,St+=h*Pt,Ft+=h*Ot,Ut+=h*dt,Ht+=h*Ct,qt+=h*gt,Wt+=h*wt,rr+=h*yt,Lr+=h*We,Jt+=h*At,Kr+=h*Rt,h=T[14],Ye+=h*lt,Ne+=h*tt,ke+=h*ft,ht+=h*pt,qe+=h*ot,St+=h*rt,Ft+=h*Pt,Ut+=h*Ot,Ht+=h*dt,qt+=h*Ct,Wt+=h*gt,rr+=h*wt,Lr+=h*yt,Jt+=h*We,Kr+=h*At,oi+=h*Rt,h=T[15],Ne+=h*lt,ke+=h*tt,ht+=h*ft,qe+=h*pt,St+=h*ot,Ft+=h*rt,Ut+=h*Pt,Ht+=h*Ot,qt+=h*dt,Wt+=h*Ct,rr+=h*gt,Lr+=h*wt,Jt+=h*yt,Kr+=h*We,oi+=h*At,xi+=h*Rt,Z+=38*ke,oe+=38*ht,me+=38*qe,Te+=38*St,$e+=38*Ft,xe+=38*Ut,xt+=38*Ht,mt+=38*qt,st+=38*Wt,De+=38*rr,Je+=38*Lr,Qe+=38*Jt,at+=38*Kr,Me+=38*oi,Ye+=38*xi,E=1,h=Z+E+65535,E=Math.floor(h/65536),Z=h-E*65536,h=oe+E+65535,E=Math.floor(h/65536),oe=h-E*65536,h=me+E+65535,E=Math.floor(h/65536),me=h-E*65536,h=Te+E+65535,E=Math.floor(h/65536),Te=h-E*65536,h=$e+E+65535,E=Math.floor(h/65536),$e=h-E*65536,h=xe+E+65535,E=Math.floor(h/65536),xe=h-E*65536,h=xt+E+65535,E=Math.floor(h/65536),xt=h-E*65536,h=mt+E+65535,E=Math.floor(h/65536),mt=h-E*65536,h=st+E+65535,E=Math.floor(h/65536),st=h-E*65536,h=De+E+65535,E=Math.floor(h/65536),De=h-E*65536,h=Je+E+65535,E=Math.floor(h/65536),Je=h-E*65536,h=Qe+E+65535,E=Math.floor(h/65536),Qe=h-E*65536,h=at+E+65535,E=Math.floor(h/65536),at=h-E*65536,h=Me+E+65535,E=Math.floor(h/65536),Me=h-E*65536,h=Ye+E+65535,E=Math.floor(h/65536),Ye=h-E*65536,h=Ne+E+65535,E=Math.floor(h/65536),Ne=h-E*65536,Z+=E-1+37*(E-1),E=1,h=Z+E+65535,E=Math.floor(h/65536),Z=h-E*65536,h=oe+E+65535,E=Math.floor(h/65536),oe=h-E*65536,h=me+E+65535,E=Math.floor(h/65536),me=h-E*65536,h=Te+E+65535,E=Math.floor(h/65536),Te=h-E*65536,h=$e+E+65535,E=Math.floor(h/65536),$e=h-E*65536,h=xe+E+65535,E=Math.floor(h/65536),xe=h-E*65536,h=xt+E+65535,E=Math.floor(h/65536),xt=h-E*65536,h=mt+E+65535,E=Math.floor(h/65536),mt=h-E*65536,h=st+E+65535,E=Math.floor(h/65536),st=h-E*65536,h=De+E+65535,E=Math.floor(h/65536),De=h-E*65536,h=Je+E+65535,E=Math.floor(h/65536),Je=h-E*65536,h=Qe+E+65535,E=Math.floor(h/65536),Qe=h-E*65536,h=at+E+65535,E=Math.floor(h/65536),at=h-E*65536,h=Me+E+65535,E=Math.floor(h/65536),Me=h-E*65536,h=Ye+E+65535,E=Math.floor(h/65536),Ye=h-E*65536,h=Ne+E+65535,E=Math.floor(h/65536),Ne=h-E*65536,Z+=E-1+37*(E-1),$[0]=Z,$[1]=oe,$[2]=me,$[3]=Te,$[4]=$e,$[5]=xe,$[6]=xt,$[7]=mt,$[8]=st,$[9]=De,$[10]=Je,$[11]=Qe,$[12]=at,$[13]=Me,$[14]=Ye,$[15]=Ne}function W($,T){H($,T,T)}function ye($,T){const C=a();let h;for(h=0;h<16;h++)C[h]=T[h];for(h=253;h>=0;h--)W(C,C),h!==2&&h!==4&&H(C,C,T);for(h=0;h<16;h++)$[h]=C[h]}function te($,T){const C=a();let h;for(h=0;h<16;h++)C[h]=T[h];for(h=250;h>=0;h--)W(C,C),h!==1&&H(C,C,T);for(h=0;h<16;h++)$[h]=C[h]}function Ee($,T){const C=a(),h=a(),E=a(),Z=a(),oe=a(),me=a(),Te=a(),$e=a(),xe=a();F(C,$[1],$[0]),F(xe,T[1],T[0]),H(C,C,xe),pe(h,$[0],$[1]),pe(xe,T[0],T[1]),H(h,h,xe),H(E,$[3],T[3]),H(E,E,d),H(Z,$[2],T[2]),pe(Z,Z,Z),F(oe,h,C),F(me,Z,E),pe(Te,Z,E),pe($e,h,C),H($[0],oe,me),H($[1],$e,Te),H($[2],Te,me),H($[3],oe,$e)}function Ae($,T,C){for(let h=0;h<4;h++)K($[h],T[h],C)}function et($,T){const C=a(),h=a(),E=a();ye(E,T[2]),H(C,T[0],E),H(h,T[1],E),re($,h),$[31]^=he(C)<<7}function R($,T,C){L($[0],f),L($[1],y),L($[2],y),L($[3],f);for(let h=255;h>=0;--h){const E=C[h/8|0]>>(h&7)&1;Ae($,T,E),Ee(T,$),Ee($,$),Ae($,T,E)}}function z($,T){const C=[a(),a(),a(),a()];L(C[0],_),L(C[1],O),L(C[2],y),H(C[3],_,O),R($,C,T)}function ze($){if($.length!==o.SEED_LENGTH)throw new Error(`ed25519: seed must be ${o.SEED_LENGTH} bytes`);const T=(0,t.hash)($);T[0]&=248,T[31]&=127,T[31]|=64;const C=new Uint8Array(32),h=[a(),a(),a(),a()];z(h,T),et(C,h);const E=new Uint8Array(64);return E.set($),E.set(C,32),{publicKey:C,secretKey:E}}o.generateKeyPairFromSeed=ze;function Re($){const T=(0,i.randomBytes)(32,$),C=ze(T);return(0,n.wipe)(T),C}o.generateKeyPair=Re;function J($){if($.length!==o.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${o.SECRET_KEY_LENGTH} bytes`);return new Uint8Array($.subarray(32))}o.extractPublicKeyFromSecretKey=J;const B=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function k($,T){let C,h,E,Z;for(h=63;h>=32;--h){for(C=0,E=h-32,Z=h-12;E<Z;
27++E)T[E]+=C-16*T[h]*B[E-(h-32)],C=Math.floor((T[E]+128)/256),T[E]-=C*256;T[E]+=C,T[h]=0}for(C=0,E=0;E<32;E++)T[E]+=C-(T[31]>>4)*B[E],C=T[E]>>8,T[E]&=255;for(E=0;E<32;E++)T[E]-=C*B[E];for(h=0;h<32;h++)T[h+1]+=T[h]>>8,$[h]=T[h]&255}function V($){const T=new Float64Array(64);for(let C=0;C<64;C++)T[C]=$[C];for(let C=0;C<64;C++)$[C]=0;k($,T)}function ut($,T){const C=new Float64Array(64),h=[a(),a(),a(),a()],E=(0,t.hash)($.subarray(0,32));E[0]&=248,E[31]&=127,E[31]|=64;const Z=new Uint8Array(64);Z.set(E.subarray(32),32);const oe=new t.SHA512;oe.update(Z.subarray(32)),oe.update(T);const me=oe.digest();oe.clean(),V(me),z(h,me),et(Z,h),oe.reset(),oe.update(Z.subarray(0,32)),oe.update($.subarray(32)),oe.update(T);const Te=oe.digest();V(Te);for(let $e=0;$e<32;$e++)C[$e]=me[$e];for(let $e=0;$e<32;$e++)for(let xe=0;xe<32;xe++)C[$e+xe]+=Te[$e]*E[xe];return k(Z.subarray(32),C),Z}o.sign=ut;function He($,T){const C=a(),h=a(),E=a(),Z=a(),oe=a(),me=a(),Te=a();return L($[2],y),fe($[1],T),W(E,$[1]),H(Z,E,w),F(E,E,$[2]),pe(Z,$[2],Z),W(oe,Z),W(me,oe),H(Te,me,oe),H(C,Te,E),H(C,C,Z),te(C,C),H(C,C,E),H(C,C,Z),H(C,C,Z),H($[0],C,Z),W(h,$[0]),H(h,h,Z),ue(h,E)&&H($[0],$[0],P),W(h,$[0]),H(h,h,Z),ue(h,E)?-1:(he($[0])===T[31]>>7&&F($[0],f,$[0]),H($[3],$[0],$[1]),0)}function Dr($,T,C){const h=new Uint8Array(32),E=[a(),a(),a(),a()],Z=[a(),a(),a(),a()];if(C.length!==o.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${o.SIGNATURE_LENGTH} bytes`);if(He(Z,$))return!1;const oe=new t.SHA512;oe.update(C.subarray(0,32)),oe.update($),oe.update(T);const me=oe.digest();return V(me),R(E,Z,me),z(Z,C.subarray(32)),Ee(E,Z),et(h,E),!ce(C,h)}o.verify=Dr;function _e($){let T=[a(),a(),a(),a()];if(He(T,$))throw new Error("Ed25519: invalid public key");let C=a(),h=a(),E=T[1];pe(C,y,E),F(h,y,E),ye(h,h),H(C,C,h);let Z=new Uint8Array(32);return re(Z,C),Z}o.convertPublicKeyToX25519=_e;function It($){const T=(0,t.hash)($.subarray(0,32));T[0]&=248,T[31]&=127,T[31]|=64;const C=new Uint8Array(T.subarray(0,32));return(0,n.wipe)(T),C}o.convertSecretKeyToX25519=It})(Rc);const Aw="EdDSA",Rw="JWT",Xl=".",Zl="base64url",Tw="utf8",Nw="utf8",$w=":",Fw="did",Dw="key",el="base58btc",Lw="z",qw="K36",jw=32;function pa(o){return ya(xc(Wn(o),Tw),Zl)}function ef(o){const i=xc(qw,el),t=Lw+ya(tm([i,o]),el);return[Fw,Dw,t].join($w)}function zw(o){return ya(o,Zl)}function Mw(o){return xc([pa(o.header),pa(o.payload)].join(Xl),Nw)}function Uw(o){return[pa(o.header),pa(o.payload),zw(o.signature)].join(Xl)}function tl(o=ql.randomBytes(jw)){return Rc.generateKeyPairFromSeed(o)}async function Hw(o,i,t,n,a=ie.fromMiliseconds(Date.now())){const u={alg:Aw,typ:Rw},f=ef(n.publicKey),y=a+t,w={iss:f,sub:o,aud:i,iat:a,exp:y},d=Mw({header:u,payload:w}),_=Rc.sign(n.secretKey,d);return Uw({header:u,payload:w,signature:_})}const kw=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),Kw=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",rl=o=>o.split("?")[0],il=10,Bw=kw();class Vw{constructor(i){if(this.url=i,this.events=new kr.EventEmitter,this.registering=!1,!Mh(i))throw new Error(`Provided URL is not compatible with WebSocket connection: ${i}`);this.url=i}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(i,t){this.events.on(i,t)}once(i,t){this.events.once(i,t)}off(i,t){this.events.off(i,t)}removeListener(i,t){this.events.removeListener(i,t)}async open(i=this.url){await this.register(i)}async close(){return new Promise((i,t)=>{if(typeof this.socket>"u"){t(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),i()},this.socket.close()})}async send(i,t){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(Wn(i))}catch(n){this.onError(i.id,n)}}register(i=this.url){if(!Mh(i))throw new Error(`Provided URL is not compatible with WebSocket connection: ${i}`);if(this.registering){const t=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=t||this.events.listenerCount("open")>=t)&&this.events.setMaxListeners(t+1),new Promise((n,a)=>{this.events.once("register_error",u=>{this.resetMaxListeners(),a(u)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return a(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=i,this.registering=!0,new Promise((t,n)=>{const a=Hm.isReactNative()?void 0:{rejectUnauthorized:!km(i)},u=new Bw(i,[],a);Kw()?u.onerror=f=>{const y=f;n(this.emitError(y.error))}:u.on("error",f=>{n(this.emitError(f))}),u.onopen=()=>{this.onOpen(u),t(u)}})}onOpen(i){i.onmessage=t=>
27this.onPayload(t),i.onclose=t=>this.onClose(t),this.socket=i,this.registering=!1,this.events.emit("open")}onClose(i){this.socket=void 0,this.registering=!1,this.events.emit("close",i)}onPayload(i){if(typeof i.data>"u")return;const t=typeof i.data=="string"?va(i.data):i.data;this.events.emit("payload",t)}onError(i,t){const n=this.parseError(t),a=n.message||n.toString(),u=Pc(i,a);this.events.emit("payload",u)}parseError(i,t=this.url){return Km(i,rl(t),"WS")}resetMaxListeners(){this.events.getMaxListeners()>il&&this.events.setMaxListeners(il)}emitError(i){const t=this.parseError(new Error((i==null?void 0:i.message)||`WebSocket connection failed for host: ${rl(this.url)}`));return this.events.emit("register_error",t),t}}var da={exports:{}};da.exports;(function(o,i){var t=200,n="__lodash_hash_undefined__",a=1,u=2,f=9007199254740991,y="[object Arguments]",w="[object Array]",d="[object AsyncFunction]",_="[object Boolean]",O="[object Date]",P="[object Error]",L="[object Function]",N="[object GeneratorFunction]",K="[object Map]",re="[object Number]",ce="[object Null]",ue="[object Object]",he="[object Promise]",fe="[object Proxy]",pe="[object RegExp]",F="[object Set]",H="[object String]",W="[object Symbol]",ye="[object Undefined]",te="[object WeakMap]",Ee="[object ArrayBuffer]",Ae="[object DataView]",et="[object Float32Array]",R="[object Float64Array]",z="[object Int8Array]",ze="[object Int16Array]",Re="[object Int32Array]",J="[object Uint8Array]",B="[object Uint8ClampedArray]",k="[object Uint16Array]",V="[object Uint32Array]",ut=/[\\^$.*+?()[\]{}|]/g,He=/^\[object .+?Constructor\]$/,Dr=/^(?:0|[1-9]\d*)$/,_e={};_e[et]=_e[R]=_e[z]=_e[ze]=_e[Re]=_e[J]=_e[B]=_e[k]=_e[V]=!0,_e[y]=_e[w]=_e[Ee]=_e[_]=_e[Ae]=_e[O]=_e[P]=_e[L]=_e[K]=_e[re]=_e[ue]=_e[pe]=_e[F]=_e[H]=_e[te]=!1;var It=typeof ta=="object"&&ta&&ta.Object===Object&&ta,$=typeof self=="object"&&self&&self.Object===Object&&self,T=It||$||Function("return this")(),C=i&&!i.nodeType&&i,h=C&&!0&&o&&!o.nodeType&&o,E=h&&h.exports===C,Z=E&&It.process,oe=function(){try{return Z&&Z.binding&&Z.binding("util")}catch{}}(),me=oe&&oe.isTypedArray;function Te(v,I){for(var M=-1,Q=v==null?0:v.length,Be=0,de=[];++M<Q;){var Xe=v[M];I(Xe,M,v)&&(de[Be++]=Xe)}return de}function $e(v,I){for(var M=-1,Q=I.length,Be=v.length;++M<Q;)v[Be+M]=I[M];return v}function xe(v,I){for(var M=-1,Q=v==null?0:v.length;++M<Q;)if(I(v[M],M,v))return!0;return!1}function xt(v,I){for(var M=-1,Q=Array(v);++M<v;)Q[M]=I(M);return Q}function mt(v){return function(I){return v(I)}}function st(v,I){return v.has(I)}function De(v,I){return v==null?void 0:v[I]}function Je(v){var I=-1,M=Array(v.size);return v.forEach(function(Q,Be){M[++I]=[Be,Q]}),M}function Qe(v,I){return function(M){return v(I(M))}}function at(v){var I=-1,M=Array(v.size);return v.forEach(function(Q){M[++I]=Q}),M}var Me=Array.prototype,Ye=Function.prototype,Ne=Object.prototype,ke=T["__core-js_shared__"],ht=Ye.toString,qe=Ne.hasOwnProperty,St=function(){var v=/[^.]+$/.exec(ke&&ke.keys&&ke.keys.IE_PROTO||"");return v?"Symbol(src)_1."+v:""}(),Ft=Ne.toString,Ut=RegExp("^"+ht.call(qe).replace(ut,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ht=E?T.Buffer:void 0,qt=T.Symbol,Wt=T.Uint8Array,rr=Ne.propertyIsEnumerable,Lr=Me.splice,Jt=qt?qt.toStringTag:void 0,Kr=Object.getOwnPropertySymbols,oi=Ht?Ht.isBuffer:void 0,xi=Qe(Object.keys,Object),lt=lr(T,"DataView"),tt=lr(T,"Map"),ft=lr(T,"Promise"),pt=lr(T,"Set"),ot=lr(T,"WeakMap"),rt=lr(Object,"create"),Pt=Vr(lt),Ot=Vr(tt),dt=Vr(ft),Ct=Vr(pt),gt=Vr(ot),wt=qt?qt.prototype:void 0,yt=wt?wt.valueOf:void 0;function We(v){var I=-1,M=v==null?0:v.length;for(this.clear();++I<M;){var Q=v[I];this.set(Q[0],Q[1])}}function At(){this.__data__=rt?rt(null):{},this.size=0}function Rt(v){var I=this.has(v)&&delete this.__data__[v];return this.size-=I?1:0,I}function ba(v){var I=this.__data__;if(rt){var M=I[v];return M===n?void 0:M}return qe.call(I,v)?I[v]:void 0}function Ea(v){var I=this.__data__;return rt?I[v]!==void 0:qe.call(I,v)}function Ia(v,I){var M=this.__data__;return this.size+=this.has(v)?0:1,M[v]=rt&&I===void 0?n:I,this}We.prototype.clear=At,We.prototype.delete=Rt,We.prototype.get=ba,We.prototype.has=Ea,We.prototype.set=Ia;function vr(v){var I=-1,M=v==null?0:v.length;for(this.clear();++I<M;){var Q=v[I];this.set(Q[0],Q[1])}}function xa(){this.__data__=[],this.size=0}function Sa(v){var I=this.__data__,M=Si(I,v);if(M<0)return!1;var Q=I.length-1;return M==Q?I.pop():Lr.call(I,M,1),--this.size,!0}function Pa(v){var I=this.__data__,M=Si(I,v);return M<0?void 0:I[M][1]}function Oa(v){return Si(this.__data__,v)>-1}function Ca(v,I){var M=this.__data__,Q=Si(M,v);return Q<0?(++this.size,M.push([v,I])):M[Q][1]=I,this}vr.prototype.clear=xa,vr.prototype.delete=Sa,vr.prototype.get=Pa,vr.prototype.has=Oa,vr.prototype.set=Ca;function Br(v){var I=-1,M=v==null?0:v.length;for(this.clear();++I<M;){var Q=v[I];this.set(Q[0],Q[1])}}function ki(){this.size=0,this.__data__={hash:new We,map:new(tt||vr),string:new We}}function Aa(v){var I=ci(this,v).delete(v);return this.size-=I?1:0,I}function Ki(v){return ci(this,v).get(v)}function Ra(v){return ci(this,v).has(v)}function Ta(v,I){var M=ci(this,v),Q=M.size;return M.set(v,I),this.size+=M.size==Q?0:1,this}Br.prototype.clear=ki,Br.prototype.delete=Aa,Br.prototype.get=Ki,Br.prototype.has=Ra,Br.prototype.set=Ta;function Bi(v){var I=-1,M=v==null?0:v.length;for(this.__data__=new Br;++I<M;)this.add(v[I])}function Yn(v){return this.__data__.set(v,n),this}function Xn(v){return this.__data__.has(v)}Bi.prototype.add=Bi.prototype.push=Yn,Bi.prototype.has=Xn;function Or(v){var I=this.__data__=new vr(v);this.size=I.size}function Na(){this.__data__=new vr,this.size=0}function $a(v){var I=this.__data__,M=I.delete(v);return this.size=I.size,M}function Fa(v){return this.__data__.get(v)}function Da(v){return this.__data__.has(v)}function Zn(v,I){var M=this.__data__;if(M instanceof vr){var Q=M.__data__;if(!tt||Q.length<t-1)return Q.push([v,I]),this.size=++M.size,this;M=this.__data__=new Br(Q)}return M.set(v,I),this.size=M.size,this}Or.prototype.clear=Na,Or.prototype.delete=$a,Or.prototype.get=Fa,Or.prototype.has=Da,Or.prototype.set=Zn;function es(v,I){var M=Wi(v),Q=!M&&fs(v),Be=!M&&!Q&&vn(v),de=!M&&!Q&&!Be&&gs(v),Xe=M||Q||Be||de,Tt=Xe?xt(v.length,String):[],Pe=Tt.length;for(var Ve in v)(I||qe.call(v,Ve))&&!(Xe&&(Ve=="length"||Be&&(Ve=="offset"||Ve=="parent")||de&&(Ve=="buffer"||Ve=="byteLength"||Ve=="byteOffset")||os(Ve,Pe)))&&Tt.push(Ve);return Tt}function Si(v,I){for(var M=v.length;M--;)if(ls(v[M][0],I))return M;return-1}function gn(v,I,M){var Q=I(v);return Wi(v)?Q:$e(Q,M(v))}function Pi(v){return v==null?v===void 0?ye:ce:Jt&&Jt in Object(v)?ss(v):ja(v)}function yn(v){return Ci(v)&&Pi(v)==y}function Oi(v,I,M,Q,Be){return v===I?!0:v==null||I==null||!Ci(v)&&!Ci(I)?v!==v&&I!==I:ts(v,I,M,Q,Oi,Be)}function ts(v,I,M,Q,Be,de){var Xe=Wi(v),Tt=Wi(I),Pe=Xe?w:qr(v),Ve=Tt?w:qr(I);Pe=Pe==y?ue:Pe,Ve=Ve==y?ue:Ve;var _t=Pe==ue,ir=Ve==ue,Nt=Pe==Ve;if(Nt&&vn(v)){if(!vn(I))return!1;Xe=!0,_t=!1}if(Nt&&!_t)return de||(de=new Or),Xe||gs(v)?Vi(v,I,M,Q,Be,de):qa(v,I,Pe,M,Q,Be,de);if(!(M&a)){var Ze=_t&&qe.call(v,"__wrapped__"),Qt=ir&&qe.call(I,"__wrapped__");
27if(Ze||Qt){var Cr=Ze?v.value():v,mr=Qt?I.value():I;return de||(de=new Or),Be(Cr,mr,M,Q,de)}}return Nt?(de||(de=new Or),ns(v,I,M,Q,Be,de)):!1}function La(v){if(!ds(v)||us(v))return!1;var I=Ji(v)?Ut:He;return I.test(Vr(v))}function rs(v){return Ci(v)&&ps(v.length)&&!!_e[Pi(v)]}function is(v){if(!hs(v))return xi(v);var I=[];for(var M in Object(v))qe.call(v,M)&&M!="constructor"&&I.push(M);return I}function Vi(v,I,M,Q,Be,de){var Xe=M&a,Tt=v.length,Pe=I.length;if(Tt!=Pe&&!(Xe&&Pe>Tt))return!1;var Ve=de.get(v);if(Ve&&de.get(I))return Ve==I;var _t=-1,ir=!0,Nt=M&u?new Bi:void 0;for(de.set(v,I),de.set(I,v);++_t<Tt;){var Ze=v[_t],Qt=I[_t];if(Q)var Cr=Xe?Q(Qt,Ze,_t,I,v,de):Q(Ze,Qt,_t,v,I,de);if(Cr!==void 0){if(Cr)continue;ir=!1;break}if(Nt){if(!xe(I,function(mr,jr){if(!st(Nt,jr)&&(Ze===mr||Be(Ze,mr,M,Q,de)))return Nt.push(jr)})){ir=!1;break}}else if(!(Ze===Qt||Be(Ze,Qt,M,Q,de))){ir=!1;break}}return de.delete(v),de.delete(I),ir}function qa(v,I,M,Q,Be,de,Xe){switch(M){case Ae:if(v.byteLength!=I.byteLength||v.byteOffset!=I.byteOffset)return!1;v=v.buffer,I=I.buffer;case Ee:return!(v.byteLength!=I.byteLength||!de(new Wt(v),new Wt(I)));case _:case O:case re:return ls(+v,+I);case P:return v.name==I.name&&v.message==I.message;case pe:case H:return v==I+"";case K:var Tt=Je;case F:var Pe=Q&a;if(Tt||(Tt=at),v.size!=I.size&&!Pe)return!1;var Ve=Xe.get(v);if(Ve)return Ve==I;Q|=u,Xe.set(v,I);var _t=Vi(Tt(v),Tt(I),Q,Be,de,Xe);return Xe.delete(v),_t;case W:if(yt)return yt.call(v)==yt.call(I)}return!1}function ns(v,I,M,Q,Be,de){var Xe=M&a,Tt=Gi(v),Pe=Tt.length,Ve=Gi(I),_t=Ve.length;if(Pe!=_t&&!Xe)return!1;for(var ir=Pe;ir--;){var Nt=Tt[ir];if(!(Xe?Nt in I:qe.call(I,Nt)))return!1}var Ze=de.get(v);if(Ze&&de.get(I))return Ze==I;var Qt=!0;de.set(v,I),de.set(I,v);for(var Cr=Xe;++ir<Pe;){Nt=Tt[ir];var mr=v[Nt],jr=I[Nt];if(Q)var mn=Xe?Q(jr,mr,Nt,I,v,de):Q(mr,jr,Nt,v,I,de);if(!(mn===void 0?mr===jr||Be(mr,jr,M,Q,de):mn)){Qt=!1;break}Cr||(Cr=Nt=="constructor")}if(Qt&&!Cr){var Ai=v.constructor,jt=I.constructor;Ai!=jt&&"constructor"in v&&"constructor"in I&&!(typeof Ai=="function"&&Ai instanceof Ai&&typeof jt=="function"&&jt instanceof jt)&&(Qt=!1)}return de.delete(v),de.delete(I),Qt}function Gi(v){return gn(v,Ua,as)}function ci(v,I){var M=v.__data__;return cs(I)?M[typeof I=="string"?"string":"hash"]:M.map}function lr(v,I){var M=De(v,I);return La(M)?M:void 0}function ss(v){var I=qe.call(v,Jt),M=v[Jt];try{v[Jt]=void 0;var Q=!0}catch{}var Be=Ft.call(v);return Q&&(I?v[Jt]=M:delete v[Jt]),Be}var as=Kr?function(v){return v==null?[]:(v=Object(v),Te(Kr(v),function(I){return rr.call(v,I)}))}:Ke,qr=Pi;(lt&&qr(new lt(new ArrayBuffer(1)))!=Ae||tt&&qr(new tt)!=K||ft&&qr(ft.resolve())!=he||pt&&qr(new pt)!=F||ot&&qr(new ot)!=te)&&(qr=function(v){var I=Pi(v),M=I==ue?v.constructor:void 0,Q=M?Vr(M):"";if(Q)switch(Q){case Pt:return Ae;case Ot:return K;case dt:return he;case Ct:return F;case gt:return te}return I});function os(v,I){return I=I??f,!!I&&(typeof v=="number"||Dr.test(v))&&v>-1&&v%1==0&&v<I}function cs(v){var I=typeof v;return I=="string"||I=="number"||I=="symbol"||I=="boolean"?v!=="__proto__":v===null}function us(v){return!!St&&St in v}function hs(v){var I=v&&v.constructor,M=typeof I=="function"&&I.prototype||Ne;return v===M}function ja(v){return Ft.call(v)}function Vr(v){if(v!=null){try{return ht.call(v)}catch{}try{return v+""}catch{}}return""}function ls(v,I){return v===I||v!==v&&I!==I}var fs=yn(function(){return arguments}())?yn:function(v){return Ci(v)&&qe.call(v,"callee")&&!rr.call(v,"callee")},Wi=Array.isArray;function za(v){return v!=null&&ps(v.length)&&!Ji(v)}var vn=oi||Ue;function Ma(v,I){return Oi(v,I)}function Ji(v){if(!ds(v))return!1;var I=Pi(v);return I==L||I==N||I==d||I==fe}function ps(v){return typeof v=="number"&&v>-1&&v%1==0&&v<=f}function ds(v){var I=typeof v;return v!=null&&(I=="object"||I=="function")}function Ci(v){return v!=null&&typeof v=="object"}var gs=me?mt(me):rs;function Ua(v){return za(v)?es(v):is(v)}function Ke(){return[]}function Ue(){return!1}o.exports=Ma})(da,da.exports);var Gw=da.exports;const Ww=rm(Gw);function Jw(o,i){if(o.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var a=0;a<o.length;a++){var u=o.charAt(a),f=u.charCodeAt(0);if(t[f]!==255)throw new TypeError(u+" is ambiguous");t[f]=a}var y=o.length,w=o.charAt(0),d=Math.log(y)/Math.log(256),_=Math.log(256)/Math.log(y);function O(N){if(N instanceof Uint8Array||(ArrayBuffer.isView(N)?N=new Uint8Array(N.buffer,N.byteOffset,N.byteLength):Array.isArray(N)&&(N=Uint8Array.from(N))),!(N instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(N.length===0)return"";for(var K=0,re=0,ce=0,ue=N.length;ce!==ue&&N[ce]===0;)ce++,K++;for(var he=(ue-ce)*_+1>>>0,fe=new Uint8Array(he);ce!==ue;){for(var pe=N[ce],F=0,H=he-1;(pe!==0||F<re)&&H!==-1;H--,F++)pe+=256*fe[H]>>>0,fe[H]=pe%y>>>0,pe=pe/y>>>0;if(pe!==0)throw new Error("Non-zero carry");re=F,ce++}for(var W=he-re;W!==he&&fe[W]===0;
vendor: 5,709 bytes, line 27
27)W++;for(var ye=w.repeat(K);W<he;++W)ye+=o.charAt(fe[W]);return ye}function P(N){if(typeof N!="string")throw new TypeError("Expected String");if(N.length===0)return new Uint8Array;var K=0;if(N[K]!==" "){for(var re=0,ce=0;N[K]===w;)re++,K++;for(var ue=(N.length-K)*d+1>>>0,he=new Uint8Array(ue);N[K];){var fe=t[N.charCodeAt(K)];if(fe===255)return;for(var pe=0,F=ue-1;(fe!==0||pe<ce)&&F!==-1;F--,pe++)fe+=y*he[F]>>>0,he[F]=fe%256>>>0,fe=fe/256>>>0;if(fe!==0)throw new Error("Non-zero carry");ce=pe,K++}if(N[K]!==" "){for(var H=ue-ce;H!==ue&&he[H]===0;)H++;for(var W=new Uint8Array(re+(ue-H)),ye=re;H!==ue;)W[ye++]=he[H++];return W}}}function L(N){var K=P(N);if(K)return K;throw new Error(`Non-${i} character`)}return{encode:O,decodeUnsafe:P,decode:L}}var Qw=Jw,Yw=Qw;const tf=o=>{if(o instanceof Uint8Array&&o.constructor.name==="Uint8Array")return o;if(o instanceof ArrayBuffer)return new Uint8Array(o);if(ArrayBuffer.isView(o))return new Uint8Array(o.buffer,o.byteOffset,o.byteLength);throw new Error("Unknown type, must be binary type")},Xw=o=>new TextEncoder().encode(o),Zw=o=>new TextDecoder().decode(o);class e_{constructor(i,t,n){this.name=i,this.prefix=t,this.baseEncode=n}encode(i){if(i instanceof Uint8Array)return`${this.prefix}${this.baseEncode(i)}`;throw Error("Unknown type, must be binary type")}}class t_{constructor(i,t,n){if(this.name=i,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=n}decode(i){if(typeof i=="string"){if(i.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(i)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(i.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(i){return rf(this,i)}}class r_{constructor(i){this.decoders=i}or(i){return rf(this,i)}decode(i){const t=i[0],n=this.decoders[t];if(n)return n.decode(i);throw RangeError(`Unable to decode multibase string ${JSON.stringify(i)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const rf=(o,i)=>new r_({...o.decoders||{[o.prefix]:o},...i.decoders||{[i.prefix]:i}});class i_{constructor(i,t,n,a){this.name=i,this.prefix=t,this.baseEncode=n,this.baseDecode=a,this.encoder=new e_(i,t,n),this.decoder=new t_(i,t,a)}encode(i){return this.encoder.encode(i)}decode(i){return this.decoder.decode(i)}}const wa=({name:o,prefix:i,encode:t,decode:n})=>new i_(o,i,t,n),Qn=({prefix:o,name:i,alphabet:t})=>{const{encode:n,decode:a}=Yw(t,i);return wa({prefix:o,name:i,encode:n,decode:u=>tf(a(u))})},n_=(o,i,t,n)=>{const a={};for(let _=0;_<i.length;++_)a[i[_]]=_;let u=o.length;for(;o[u-1]==="=";)--u;const f=new Uint8Array(u*t/8|0);let y=0,w=0,d=0;for(let _=0;_<u;++_){const O=a[o[_]];if(O===void 0)throw new SyntaxError(`Non-${n} character`);w=w<<t|O,y+=t,y>=8&&(y-=8,f[d++]=255&w>>y)}if(y>=t||255&w<<8-y)throw new SyntaxError("Unexpected end of data");return f},s_=(o,i,t)=>{const n=i[i.length-1]==="=",a=(1<<t)-1;let u="",f=0,y=0;for(let w=0;w<o.length;++w)for(y=y<<8|o[w],f+=8;f>t;)f-=t,u+=i[a&y>>f];if(f&&(u+=i[a&y<<t-f]),n)for(;u.length*t&7;)u+="=";return u},Kt=({name:o,prefix:i,bitsPerChar:t,alphabet:n})=>wa({prefix:i,name:o,encode(a){return s_(a,n,t)},decode(a){return n_(a,n,t,o)}}),a_=wa({prefix:"\0",name:"identity",encode:o=>Zw(o),decode:o=>Xw(o)});var o_=Object.freeze({__proto__:null,identity:a_});const c_=Kt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var u_=Object.freeze({__proto__:null,base2:c_});const h_=Kt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var l_=Object.freeze({__proto__:null,base8:h_});const f_=Qn({prefix:"9",name:"base10",alphabet:"0123456789"});var p_=Object.freeze({__proto__:null,base10:f_});const d_=Kt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),g_=Kt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var y_=Object.freeze({__proto__:null,base16:d_,base16upper:g_});const v_=Kt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),m_=Kt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),w_=Kt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),__=Kt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),b_=Kt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),E_=Kt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),I_=Kt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),x_=Kt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),S_=Kt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var P_=Object.freeze({__proto__:null,base32:v_,base32upper:m_,base32pad:w_,base32padupper:__,base32hex:b_,base32hexupper:E_,base32hexpad:I_,base32hexpadupper:x_,base32z:S_});const O_=Qn({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),C_=Qn({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var A_=Object.freeze({__proto__:null,base36:O_,base36upper:C_});const R_=Qn({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),T_=Qn({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var N_=Object.freeze({__proto__:null,base58btc:R_,base58flickr:T_});const $_=Kt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
27+/",bitsPerChar:6}),F_=Kt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),D_=Kt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),L_=Kt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var q_=Object.freeze({__proto__:null,base64:$_,base64pad:F_,base64url:D_,base64urlpad:L_});const nf=Array.from("ððªâð°ðððððððððððððâð»ð¥ð¾ð¿ðâ¤ðð¤£ððððððð
ððð¥ð¥°ðððð¢ð¤ðððªðâºðð¤ððððð¹ð¤¦ððââ¨ð¤·ð±ðð¸ððððððððð¤©ððð¤ðð¯ððð¶ðð¤â£ððððªðð¥ððð©ð¡ð¤ªðð¥³ð¥ð¤¤ððð³âððð´ðð¬ððð·ð»ðââ
ð¥ºððð¤ð¦âð£ððâ¹ððð âððºðð»ððððð¹ð£ð«ðððµð¤ðð´ð¤ð¼ð«â½ð¤âðð¤«ðð®ðð»ðð¶ðð²ð¿ð§¡ðâ¡ððââðð°ð¤¨ð¶ð¤ð¶ð°ðð¢ð¤ðð¨ð¨ð¤¬âððºð¤ððð±ðð¶ð¥´â¶â¡âðð¸â¬ð¨ðð¦ð·ðºâ ð
ððµðð¤²ð¤ ð¤§ððµð
ð§ð¾ððð¤ðð¤¯ð·âð§ð¯ððð¤ððâð´ð£ð¸ððð¥ð¤¢ð
ð¡ð©ðð¸ð»ð¤ð¤®ð¼ð¥µð©ððð¼ðð£ð¥"),j_=nf.reduce((o,i,t)=>(o[t]=i,o),[]),z_=nf.reduce((o,i,t)=>(o[i.codePointAt(0)]=t,o),[]);function M_(o){return o.reduce((i,t)=>(i+=j_[t],i),"")}function U_(o){const i=[];for(const t of o){const n=z_[t.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${t}`);i.push(n)}return new Uint8Array(i)}const H_=wa({prefix:"ð",name:"base256emoji",encode:M_,decode:U_});var k_=Object.freeze({__proto__:null,base256emoji:H_}),K_=sf,nl=128,B_=127,V_=~B_,G_=Math.pow(2,31);function sf(o,i,t){i=i||[],t=t||0;for(var n=t;o>=G_;)i[t++]=o&255|nl,o/=128;for(;o&V_;)i[t++]=o&255|nl,o>>>=7;return i[t]=o|0,sf.bytes=t-n+1,i}var W_=mc,J_=128,sl=127;function mc(o,n){var t=0,n=n||0,a=0,u=n,f,y=o.length;do{if(u>=y)throw mc.bytes=0,new RangeError("Could not decode varint");f=o[u++],t+=a<28?(f&sl)<<a:(f&sl)*Math.pow(2,a),a+=7}while(f>=J_);return mc.bytes=u-n,t}var Q_=Math.pow(2,7),Y_=Math.pow(2,14),X_=Math.pow(2,21),Z_=Math.pow(2,28),eb=Math.pow(2,35),tb=Math.pow(2,42),rb=Math.pow(2,49),ib=Math.pow(2,56),nb=Math.pow(2,63),sb=function(o){return o<Q_?1:o<Y_?2:o<X_?3:o<Z_?4:o<eb?5:o<tb?6:o<rb?7:o<ib?8:o<nb?9:10},ab={encode:K_,decode:W_,encodingLength:sb},af=ab;const al=(o,i,t=0)=>(af.encode(o,i,t),i),ol=o=>af.encodingLength(o),wc=(o,i)=>{const t=i.byteLength,n=ol(o),a=n+ol(t),u=new Uint8Array(a+t);return al(o,u,0),al(t,u,n),u.set(i,a),new ob(o,t,i,u)};class ob{constructor(i,t,n,a){this.code=i,this.size=t,this.digest=n,this.bytes=a}}const of=({name:o,code:i,encode:t})=>new cb(o,i,t);class cb{constructor(i,t,n){this.name=i,this.code=t,this.encode=n}digest(i){if(i instanceof Uint8Array){const t=this.encode(i);return t instanceof Uint8Array?wc(this.code,t):t.then(n=>wc(this.code,n))}else throw Error("Unknown type, must be binary type")}}const cf=o=>async i=>new Uint8Array(await crypto.subtle.digest(o,i)),ub=of({name:"sha2-256",code:18,encode:cf("SHA-256")}),hb=of({name:"sha2-512",code:19,encode:cf("SHA-512")});var lb=Object.freeze({__proto__:null,sha256:ub,sha512:hb});const uf=0,fb="identity",hf=tf,pb=o=>wc(uf,hf(o)),db={code:uf,name:fb,encode:hf,digest:pb};var gb=Object.freeze({__proto__:null,identity:db});new TextEncoder,new TextDecoder;const cl={...o_,...u_,...l_,...p_,...y_,...P_,...A_,...N_,...q_,...k_};({...lb,...gb});function lf(o){return globalThis.Buffer!=null?new Uint8Array(o.buffer,o.byteOffset,o.byteLength):o}function yb(o=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?lf(globalThis.Buffer.allocUnsafe(o)):new Uint8Array(o)}function ff(o,i,t,n){return{name:o,prefix:i,encoder:{name:o,prefix:i,encode:t},decoder:{decode:n}}}const ul=ff("utf8","u",o=>"u"+new TextDecoder("utf8").decode(o),o=>new TextEncoder().encode(o.substring(1))),ec=ff("ascii","a",o=>{let i="a";for(let t=0;t<o.length;t++)i+=String.fromCharCode(o[t]);return i},o=>{o=o.substring(1);const i=yb(o.length);for(let t=0;t<o.length;
vendor: 5,482 bytes, line 27
27t++)i[t]=o.charCodeAt(t);return i}),vb={utf8:ul,"utf-8":ul,hex:cl.base16,latin1:ec,ascii:ec,binary:ec,...cl};function mb(o,i="utf8"){const t=vb[i];if(!t)throw new Error(`Unsupported encoding "${i}"`);return(i==="utf8"||i==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?lf(globalThis.Buffer.from(o,"utf-8")):t.decoder.decode(`${t.prefix}${o}`)}const pf="wc",wb=2,Tc="core",bi=`${pf}@2:${Tc}:`,_b={name:Tc,logger:"error"},bb={database:":memory:"},Eb="crypto",hl="client_ed25519_seed",Ib=ie.ONE_DAY,xb="keychain",Sb="0.3",Pb="messages",Ob="0.3",Cb=ie.SIX_HOURS,Ab="publisher",df="irn",Rb="error",gf="wss://relay.walletconnect.com",ll="wss://relay.walletconnect.org",Tb="relayer",Gt={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed",publish:"relayer_publish"},Nb="_subscription",ri={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},$b=ie.ONE_SECOND,Fb="2.10.2",Db=1e4,Lb="0.3",qb="WALLETCONNECT_CLIENT_ID",$r={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},jb="subscription",zb="0.3",Mb=ie.FIVE_SECONDS*1e3,Ub="pairing",Hb="0.3",Ln={wc_pairingDelete:{req:{ttl:ie.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:ie.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:ie.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:ie.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:ie.ONE_DAY,prompt:!1,tag:0},res:{ttl:ie.ONE_DAY,prompt:!1,tag:0}}},Hn={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},Hr={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},kb="history",Kb="0.3",Bb="expirer",Pr={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},Vb="0.3",tc="verify-api",fa="https://verify.walletconnect.com",fl="https://verify.walletconnect.org";class Gb{constructor(i,t){this.core=i,this.logger=t,this.keychain=new Map,this.name=xb,this.version=Sb,this.initialized=!1,this.storagePrefix=bi,this.init=async()=>{if(!this.initialized){const n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,a)=>{this.isInitialized(),this.keychain.set(n,a),await this.persist()},this.get=n=>{this.isInitialized();const a=this.keychain.get(n);if(typeof a>"u"){const{message:u}=X("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(u)}return a},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=i,this.logger=Ce.generateChildLogger(t,this.name)}get context(){return Ce.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(i){await this.core.storage.setItem(this.storageKey,Ul(i))}async getKeyChain(){const i=await this.core.storage.getItem(this.storageKey);return typeof i<"u"?Hl(i):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:i}=X("NOT_INITIALIZED",this.name);throw new Error(i)}}}class Wb{constructor(i,t,n){this.core=i,this.logger=t,this.name=Eb,this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=a=>(this.isInitialized(),this.keychain.has(a)),this.getClientId=async()=>{this.isInitialized();const a=await this.getClientSeed(),u=tl(a);return ef(u.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const a=sm();return this.setPrivateKey(a.publicKey,a.privateKey)},this.signJWT=async a=>{this.isInitialized();const u=await this.getClientSeed(),f=tl(u),y=uc();return await Hw(y,a,Ib,f)},this.generateSharedKey=(a,u,f)=>{this.isInitialized();const y=this.getPrivateKey(a),w=am(y,u);return this.setSymKey(w,f)},this.setSymKey=async(a,u)=>{this.isInitialized();const f=u||om(a);return await this.keychain.set(f,a),f},this.deleteKeyPair=async a=>{this.isInitialized(),await this.keychain.del(a)},this.deleteSymKey=async a=>{this.isInitialized(),await this.keychain.del(a)},this.encode=async(a,u,f)=>{this.isInitialized();const y=cm(f),w=Wn(u);if(Dh(y)){const P=y.senderPublicKey,L=y.receiverPublicKey;a=await this.generateSharedKey(P,L)}const d=this.getSymKey(a),{type:_,senderPublicKey:O}=y;return um({type:_,symKey:d,message:w,senderPublicKey:O})},this.decode=async(a,u,f)=>{this.isInitialized();const y=hm(u,f);if(Dh(y)){const w=y.receiverPublicKey,d=y.senderPublicKey;a=await this.generateSharedKey(w,d)}try{const w=this.getSymKey(a),d=lm({symKey:w,encoded:u});return va(d)}catch(w){this.logger.error(`Failed to decode message from topic: '${a}', clientId: '${await this.getClientId()}'`),this.logger.error(w)}},this.getPayloadType=a=>{const u=Lh(a);return fm(u.type)},this.getPayloadSenderPublicKey=a=>{const u=Lh(a);return u.senderPublicKey?ya(u.senderPublicKey,pm):void 0},this.core=i,this.logger=Ce.generateChildLogger(t,this.name),this.keychain=n||new Gb(this.core,this.logger)}get context(){return Ce.getLoggerContext(this.logger)}async setPrivateKey(i,t){return await this.keychain.set(i,t),i}getPrivateKey(i){return this.keychain.get(i)}async getClientSeed(){let i="";try{i=this.keychain.get(hl)}
27catch{i=uc(),await this.keychain.set(hl,i)}return mb(i,"base16")}getSymKey(i){return this.keychain.get(i)}isInitialized(){if(!this.initialized){const{message:i}=X("NOT_INITIALIZED",this.name);throw new Error(i)}}}class Jb extends _w{constructor(i,t){super(i,t),this.logger=i,this.core=t,this.messages=new Map,this.name=Pb,this.version=Ob,this.initialized=!1,this.storagePrefix=bi,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,a)=>{this.isInitialized();const u=fn(a);let f=this.messages.get(n);return typeof f>"u"&&(f={}),typeof f[u]<"u"||(f[u]=a,this.messages.set(n,f),await this.persist()),u},this.get=n=>{this.isInitialized();let a=this.messages.get(n);return typeof a>"u"&&(a={}),a},this.has=(n,a)=>{this.isInitialized();const u=this.get(n),f=fn(a);return typeof u[f]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=Ce.generateChildLogger(i,this.name),this.core=t}get context(){return Ce.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(i){await this.core.storage.setItem(this.storageKey,Ul(i))}async getRelayerMessages(){const i=await this.core.storage.getItem(this.storageKey);return typeof i<"u"?Hl(i):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:i}=X("NOT_INITIALIZED",this.name);throw new Error(i)}}}class Qb extends bw{constructor(i,t){super(i,t),this.relayer=i,this.logger=t,this.events=new kr.EventEmitter,this.name=Ab,this.queue=new Map,this.publishTimeout=ie.toMiliseconds(ie.TEN_SECONDS),this.needsTransportRestart=!1,this.publish=async(n,a,u)=>{var f;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:a,opts:u}});try{const y=(u==null?void 0:u.ttl)||Cb,w=hc(u),d=(u==null?void 0:u.prompt)||!1,_=(u==null?void 0:u.tag)||0,O=(u==null?void 0:u.id)||Bm().toString(),P={topic:n,message:a,opts:{ttl:y,relay:w,prompt:d,tag:_,id:O}},L=setTimeout(()=>this.queue.set(O,P),this.publishTimeout);try{await await Bn(this.rpcPublish(n,a,y,w,d,_,O),this.publishTimeout,"Failed to publish payload, please try again."),this.removeRequestFromQueue(O),this.relayer.events.emit(Gt.publish,P)}catch(N){if(this.logger.debug("Publishing Payload stalled"),this.needsTransportRestart=!0,(f=u==null?void 0:u.internal)!=null&&f.throwOnFailedPublish)throw this.removeRequestFromQueue(O),N;return}finally{clearTimeout(L)}this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:a,opts:u}})}catch(y){throw this.logger.debug("Failed to Publish Payload"),this.logger.error(y),y}},this.on=(n,a)=>{this.events.on(n,a)},this.once=(n,a)=>{this.events.once(n,a)},this.off=(n,a)=>{this.events.off(n,a)},this.removeListener=(n,a)=>{this.events.removeListener(n,a)},this.relayer=i,this.logger=Ce.generateChildLogger(t,this.name),this.registerEventListeners()}get context(){return Ce.getLoggerContext(this.logger)}rpcPublish(i,t,n,a,u,f,y){var w,d,_,O;const P={method:ca(a.protocol).publish,params:{topic:i,message:t,ttl:n,prompt:u,tag:f},id:y};return _i((w=P.params)==null?void 0:w.prompt)&&((d=P.params)==null||delete d.prompt),_i((_=P.params)==null?void 0:_.tag)&&((O=P.params)==null||delete O.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:P}),this.relayer.request(P)}removeRequestFromQueue(i){this.queue.delete(i)}checkQueue(){this.queue.forEach(async i=>{const{topic:t,message:n,opts:a}=i;await this.publish(t,n,a)})}registerEventListeners(){this.relayer.core.heartbeat.on(dn.HEARTBEAT_EVENTS.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(Gt.connection_stalled);return}this.checkQueue()}),this.relayer.on(Gt.message_ack,i=>{this.removeRequestFromQueue(i.id.toString())})}}class Yb{constructor(){this.map=new Map,this.set=(i,t)=>{const n=this.get(i);this.exists(i,t)||this.map.set(i,[...n,t])},this.get=i=>this.map.get(i)||[],this.exists=(i,t)=>this.get(i).includes(t),this.delete=(i,t)=>{if(typeof t>"u"){this.map.delete(i);return}if(!this.map.has(i))return;const n=this.get(i);if(!this.exists(i,t))return;const a=n.filter(u=>u!==t);if(!a.length){this.map.delete(i);return}this.map.set(i,a)},this.clear=()=>{this.map.clear()}}
27get topics(){return Array.from(this.map.keys())}}var Xb=Object.defineProperty,Zb=Object.defineProperties,eE=Object.getOwnPropertyDescriptors,pl=Object.getOwnPropertySymbols,tE=Object.prototype.hasOwnProperty,rE=Object.prototype.propertyIsEnumerable,dl=(o,i,t)=>i in o?Xb(o,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[i]=t,qn=(o,i)=>{for(var t in i||(i={}))tE.call(i,t)&&dl(o,t,i[t]);if(pl)for(var t of pl(i))rE.call(i,t)&&dl(o,t,i[t]);return o},rc=(o,i)=>Zb(o,eE(i));class iE extends xw{constructor(i,t){super(i,t),this.relayer=i,this.logger=t,this.subscriptions=new Map,this.topicMap=new Yb,this.events=new kr.EventEmitter,this.name=jb,this.version=zb,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=bi,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(n,a)=>{await this.restartToComplete(),this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:a}});try{const u=hc(a),f={topic:n,relay:u};this.pending.set(n,f);const y=await this.rpcSubscribe(n,u);return this.onSubscribe(y,f),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:a}}),y}catch(u){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(u),u}},this.unsubscribe=async(n,a)=>{await this.restartToComplete(),this.isInitialized(),typeof(a==null?void 0:a.id)<"u"?await this.unsubscribeById(n,a.id,a):await this.unsubscribeByTopic(n,a)},this.isSubscribed=async n=>this.topics.includes(n)?!0:await new Promise((a,u)=>{const f=new ie.Watch;f.start(this.pendingSubscriptionWatchLabel);const y=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(y),f.stop(this.pendingSubscriptionWatchLabel),a(!0)),f.elapsed(this.pendingSubscriptionWatchLabel)>=Mb&&(clearInterval(y),f.stop(this.pendingSubscriptionWatchLabel),u(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1),this.on=(n,a)=>{this.events.on(n,a)},this.once=(n,a)=>{this.events.once(n,a)},this.off=(n,a)=>{this.events.off(n,a)},this.removeListener=(n,a)=>{this.events.removeListener(n,a)},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=i,this.logger=Ce.generateChildLogger(t,this.name),this.clientId=""}get context(){return Ce.getLoggerContext(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(i,t){let n=!1;try{n=this.getSubscription(i).topic===t}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(i,t){const n=this.topicMap.get(i);await Promise.all(n.map(async a=>await this.unsubscribeById(i,a,t)))}async unsubscribeById(i,t,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:i,id:t,opts:n}});try{const a=hc(n);await this.rpcUnsubscribe(i,t,a);const u=tr("USER_DISCONNECTED",`${this.name}, ${i}`);await this.onUnsubscribe(i,t,u),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:i,id:t,opts:n}})}catch(a){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(a),a}}async rpcSubscribe(i,t){const n={method:ca(t.protocol).subscribe,params:{topic:i}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{await await Bn(this.relayer.request(n),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(Gt.connection_stalled)}return fn(i+this.clientId)}async rpcBatchSubscribe(i){if(!i.length)return;const t=i[0].relay,n={method:ca(t.protocol).batchSubscribe,params:{topics:i.map(a=>a.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await Bn(this.relayer.request(n),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Payload stalled"),this.relayer.events.emit(Gt.connection_stalled)}}rpcUnsubscribe(i,t,n){const a={method:ca(n.protocol).unsubscribe,params:{topic:i,id:t}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:a}),this.relayer.request(a)}onSubscribe(i,t){this.setSubscription(i,rc(qn({},t),{id:i})),this.pending.delete(t.topic)}
27onBatchSubscribe(i){i.length&&i.forEach(t=>{this.setSubscription(t.id,qn({},t)),this.pending.delete(t.topic)})}async onUnsubscribe(i,t,n){this.events.removeAllListeners(t),this.hasSubscription(t,i)&&this.deleteSubscription(t,n),await this.relayer.messages.del(i)}async setRelayerSubscriptions(i){await this.relayer.core.storage.setItem(this.storageKey,i)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(i,t){this.subscriptions.has(i)||(this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:i,subscription:t}),this.addSubscription(i,t))}addSubscription(i,t){this.subscriptions.set(i,qn({},t)),this.topicMap.set(t.topic,i),this.events.emit($r.created,t)}getSubscription(i){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:i});const t=this.subscriptions.get(i);if(!t){const{message:n}=X("NO_MATCHING_KEY",`${this.name}: ${i}`);throw new Error(n)}return t}deleteSubscription(i,t){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:i,reason:t});const n=this.getSubscription(i);this.subscriptions.delete(i),this.topicMap.delete(n.topic,i),this.events.emit($r.deleted,rc(qn({},n),{reason:t}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit($r.sync)}async reset(){if(this.cached.length){const i=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let t=0;t<i;t++){const n=this.cached.splice(0,this.batchSubscribeTopicsLimit);await this.batchSubscribe(n)}}this.events.emit($r.resubscribed)}async restore(){try{const i=await this.getRelayerSubscriptions();if(typeof i>"u"||!i.length)return;if(this.subscriptions.size){const{message:t}=X("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(t)}this.cached=i,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(i){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(i)}}async batchSubscribe(i){if(!i.length)return;const t=await this.rpcBatchSubscribe(i);pn(t)&&this.onBatchSubscribe(t.map((n,a)=>rc(qn({},i[a]),{id:n})))}async onConnect(){this.restartInProgress||(await this.restart(),this.onEnable())}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||this.relayer.transportExplicitlyClosed)return;const i=[];this.pending.forEach(t=>{i.push(t)}),await this.batchSubscribe(i)}registerEventListeners(){this.relayer.core.heartbeat.on(dn.HEARTBEAT_EVENTS.pulse,async()=>{await this.checkPending()}),this.relayer.on(Gt.connect,async()=>{await this.onConnect()}),this.relayer.on(Gt.disconnect,()=>{this.onDisconnect()}),this.events.on($r.created,async i=>{const t=$r.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:i}),await this.persist()}),this.events.on($r.deleted,async i=>{const t=$r.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:i}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:i}=X("NOT_INITIALIZED",this.name);throw new Error(i)}}async restartToComplete(){this.restartInProgress&&await new Promise(i=>{const t=setInterval(()=>{this.restartInProgress||(clearInterval(t),i())},this.pollingInterval)})}}var nE=Object.defineProperty,gl=Object.getOwnPropertySymbols,sE=Object.prototype.hasOwnProperty,aE=Object.prototype.propertyIsEnumerable,yl=(o,i,t)=>i in o?nE(o,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[i]=t,oE=(o,i)=>{for(var t in i||(i={}))sE.call(i,t)&&yl(o,t,i[t]);if(gl)for(var t of gl(i))aE.call(i,t)&&yl(o,t,i[t]);return o};class cE extends Ew{constructor(i){super(i),this.protocol="wc",this.version=2,this.events=new kr.EventEmitter,this.name=Tb,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["s
27ocket hang up","socket stalled"],this.hasExperiencedNetworkDisruption=!1,this.request=async t=>{this.logger.debug("Publishing Request Payload");try{return await this.toEstablishConnection(),await this.provider.request(t)}catch(n){throw this.logger.debug("Failed to Publish Request"),this.logger.error(n),n}},this.onPayloadHandler=t=>{this.onProviderPayload(t)},this.onConnectHandler=()=>{this.events.emit(Gt.connect)},this.onDisconnectHandler=()=>{this.onProviderDisconnect()},this.onProviderErrorHandler=t=>{this.logger.error(t),this.events.emit(Gt.error,t),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(ri.payload,this.onPayloadHandler),this.provider.on(ri.connect,this.onConnectHandler),this.provider.on(ri.disconnect,this.onDisconnectHandler),this.provider.on(ri.error,this.onProviderErrorHandler)},this.core=i.core,this.logger=typeof i.logger<"u"&&typeof i.logger!="string"?Ce.generateChildLogger(i.logger,this.name):Ce.pino(Ce.getDefaultLoggerOptions({level:i.logger||Rb})),this.messages=new Jb(this.logger,i.core),this.subscriber=new iE(this,this.logger),this.publisher=new Qb(this,this.logger),this.relayUrl=(i==null?void 0:i.relayUrl)||gf,this.projectId=i.projectId,this.provider={}}
27async 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 ${ll}...`),await this.restartTransport(ll)}this.initialized=!0,setTimeout(async()=>{this.subscriber.topics.length===0&&(this.logger.info("No topics subscribed to after init, closing transport"),await this.transportClose(),this.transportExplicitlyClosed=!1)},Db)}get context(){return Ce.getLoggerContext(this.logger)}get connected(){return this.provider.connection.connected}get connecting(){return this.provider.connection.connecting}async publish(i,t,n){this.isInitialized(),await this.publisher.publish(i,t,n),await this.recordMessageEvent({topic:i,message:t,publishedAt:Date.now()})}async subscribe(i,t){var n;this.isInitialized();let a=((n=this.subscriber.topicMap.get(i))==null?void 0:n[0])||"";if(a)return a;let u;const f=y=>{y.topic===i&&(this.subscriber.off($r.created,f),u())};return await Promise.all([new Promise(y=>{u=y,this.subscriber.on($r.created,f)}),new Promise(async y=>{a=await this.subscriber.subscribe(i,t),y()})]),a}async unsubscribe(i,t){this.isInitialized(),await this.subscriber.unsubscribe(i,t)}on(i,t){this.events.on(i,t)}once(i,t){this.events.once(i,t)}off(i,t){this.events.off(i,t)}removeListener(i,t){this.events.removeListener(i,t)}async transportClose(){this.transportExplicitlyClosed=!0,this.hasExperiencedNetworkDisruption&&this.connected?await Bn(this.provider.disconnect(),1e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.connected&&await this.provider.disconnect()}async transportOpen(i){if(this.transportExplicitlyClosed=!1,await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress){i&&i!==this.relayUrl&&(this.relayUrl=i,await this.transportClose(),await this.createProvider()),this.connectionAttemptInProgress=!0;try{await Promise.all([new Promise(t=>{if(!this.initialized)return t();this.subscriber.once($r.resubscribed,()=>{t()})}),new Promise(async(t,n)=>{try{await Bn(this.provider.connect(),1e4,`Socket stalled when trying to connect to ${this.relayUrl}`)}catch(a){n(a);return}t()})])}catch(t){this.logger.error(t);const n=t;if(!this.isConnectionStalled(n.message))throw t;this.provider.events.emit(ri.disconnect)}finally{this.connectionAttemptInProgress=!1,this.hasExperiencedNetworkDisruption=!1}}}async restartTransport(i){await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress&&(this.relayUrl=i||this.relayUrl,await this.transportClose(),await this.createProvider(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await qh())throw new Error("No internet connection detected. Please restart your network and try again.")}isConnectionStalled(i){return this.staleConnectionErrors.some(t=>i.includes(t))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const i=await this.core.crypto.signJWT(this.relayUrl);this.provider=new si(new Vw(dm({sdkVersion:Fb,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:i,useOnCloseEvent:!0}))),this.registerProviderListeners()}async recordMessageEvent(i){const{topic:t,message:n}=i;await this.messages.set(t,n)}async shouldIgnoreMessageEvent(i){const{topic:t,message:n}=i;if(!n||n.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(t))return this.logger.debug(`Ignoring message for non-subscribed topic ${t}`),!0;const a=this.messages.has(t,n);return a&&this.logger.debug(`Ignoring duplicate message: ${n}`),a}async onProviderPayload(i){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:i}),Oc(i)){if(!i.method.endsWith(Nb))return;const t=i.params,{topic:n,message:a,publishedAt:u}=t.data,f={topic:n,message:a,publishedAt:u};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(oE({type:"event",event:t.id},f)),this.events.emit(t.id,f),await this.acknowledgePayload(i),await this.onMessageEvent(f)}else Cc(i)&&this.events.emit(Gt.message_ack,i)}async onMessageEvent(i){await this.shouldIgnoreMessageEvent(i)||(this.events.emit(Gt.message,i),await this.recordMessageEvent(i))}async acknowledgePayload(i){const t=Ac(i.id,!0);await this.provider.connection.send(t)}unregisterProviderListeners(){this.provider.off(ri.payload,this.onPayloadHandler),this.provider.off(ri.connect,this.onConnectHandler),this.provider.off(ri.disconnect,this.onDisconnectHandler),this.provider.off(ri.error,this.onProviderErrorHandler)}async registerEventListeners(){this.events.on(Gt.connection_stalled,()=>{this.restartTransport().catch(t=>this.logger.error(t))});let i=await qh();gm(async t=>{this.initialized&&i!==t&&(i=t,t?await this.restartTransport().catch(n=>this.logger.error(n)):(this.hasExperiencedNetworkDisruption=!0,await this.transportClose().catch(n=>this.logger.error(n))))})}onProviderDisconnect(){this.events.emit(Gt.disconnect),this.attemptToReconnect()}attemptToReconnect(){this.transportExplicitlyClosed||(this.logger.info("attemptToReconnect called. Connecting..."),setTimeout(async()=>{await this.restartTransport().catch(i=>this.logger.error(i))},ie.toMiliseconds($b)))}isInitialized(){if(!this.initialized){const{message:i}=X("NOT_INITIALIZED",this.name);throw new Error(i)}}async toEstablishConnection(){if(await this.confirmOnlineStateOrThrow(),!this.connected){if(this.connectionAttemptInProgress)return await new Promise(i=>{const t=setInterval(()=>{this.connected&&(clearInterval(t),i())},this.connectionStatusPollingInterval)});await this.restartTransport()}}}var uE=Object.defineProperty,vl=Object.getOwnPropertySymbols,hE=Object.prototype.hasOwnProperty,lE=Object.prototype.propertyIsEnumerable,ml=(o,i,t)=>i in o?uE(o,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[i]=t,wl=(o,i)=>
vendor: 8,340 bytes, line 27
27{for(var t in i||(i={}))hE.call(i,t)&&ml(o,t,i[t]);if(vl)for(var t of vl(i))lE.call(i,t)&&ml(o,t,i[t]);return o};class _a extends Iw{constructor(i,t,n,a=bi,u=void 0){super(i,t,n,a),this.core=i,this.logger=t,this.name=n,this.map=new Map,this.version=Lb,this.cached=[],this.initialized=!1,this.storagePrefix=bi,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(f=>{this.getKey&&f!==null&&!_i(f)?this.map.set(this.getKey(f),f):im(f)?this.map.set(f.id,f):nm(f)&&this.map.set(f.topic,f)}),this.cached=[],this.initialized=!0)},this.set=async(f,y)=>{this.isInitialized(),this.map.has(f)?await this.update(f,y):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:f,value:y}),this.map.set(f,y),await this.persist())},this.get=f=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:f}),this.getData(f)),this.getAll=f=>(this.isInitialized(),f?this.values.filter(y=>Object.keys(f).every(w=>Ww(y[w],f[w]))):this.values),this.update=async(f,y)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:f,update:y});const w=wl(wl({},this.getData(f)),y);this.map.set(f,w),await this.persist()},this.delete=async(f,y)=>{this.isInitialized(),this.map.has(f)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:f,reason:y}),this.map.delete(f),await this.persist())},this.logger=Ce.generateChildLogger(t,this.name),this.storagePrefix=a,this.getKey=u}get context(){return Ce.getLoggerContext(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(i){await this.core.storage.setItem(this.storageKey,i)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(i){const t=this.map.get(i);if(!t){const{message:n}=X("NO_MATCHING_KEY",`${this.name}: ${i}`);throw this.logger.error(n),new Error(n)}return t}async persist(){await this.setDataStore(this.values)}async restore(){try{const i=await this.getDataStore();if(typeof i>"u"||!i.length)return;if(this.map.size){const{message:t}=X("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=i,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(i){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(i)}}isInitialized(){if(!this.initialized){const{message:i}=X("NOT_INITIALIZED",this.name);throw new Error(i)}}}class fE{constructor(i,t){this.core=i,this.logger=t,this.name=Ub,this.version=Hb,this.events=new Sc,this.initialized=!1,this.storagePrefix=bi,this.ignoredPayloadTypes=[jl],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:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async()=>{this.isInitialized();const n=uc(),a=await this.core.crypto.setSymKey(n),u=Fr(ie.FIVE_MINUTES),f={protocol:df},y={topic:a,expiry:u,relay:f,active:!1},w=ym({protocol:this.core.protocol,version:this.core.version,topic:a,symKey:n,relay:f});return await this.pairings.set(a,y),await this.core.relayer.subscribe(a),this.core.expirer.set(a,u),{topic:a,uri:w}},this.pair=async n=>{this.isInitialized(),this.isValidPair(n);const{topic:a,symKey:u,relay:f}=vm(n.uri);let y;if(this.pairings.keys.includes(a)&&(y=this.pairings.get(a),y.active))throw new Error(`Pairing already exists: ${a}. Please try again with a new connection URI.`);this.core.crypto.keychain.has(a)||(await this.core.crypto.setSymKey(u,a),await this.core.relayer.subscribe(a,{relay:f}));const w=Fr(ie.FIVE_MINUTES),d={topic:a,relay:f,expiry:w,active:!1};return await this.pairings.set(a,d),this.core.expirer.set(a,w),n.activatePairing&&await this.activate({topic:a}),this.events.emit(Hn.create,d),d},this.activate=async({topic:n})=>{this.isInitialized();const a=Fr(ie.THIRTY_DAYS);await this.pairings.update(n,{active:!0,expiry:a}),this.core.expirer.set(n,a)},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);const{topic:a}=n;if(this.pairings.keys.includes(a)){const u=await this.sendRequest(a,"wc_pairingPing",{}),{done:f,resolve:y,reject:w}=hn();this.events.once($t("pairing_ping",u),({error:d})=>{d?w(d):y()}),await f()}},this.updateExpiry=async({topic:n,expiry:a})=>{this.isInitialized(),await this.pairings.update(n,{expiry:a})},this.updateMetadata=async({topic:n,metadata:a})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:a})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);const{topic:a}=n;this.pairings.keys.includes(a)&&(await this.sendRequest(a,"wc_pairingDelete",tr("USER_DISCONNECTED")),await this.deletePairing(a))},this.sendRequest=async(n,a,u)=>{const f=Kn(a,u),y=await this.core.crypto.encode(n,f),w=Ln[a].req;return this.core.history.set(n,f),this.core.relayer.publish(n,y,w),f.id},this.sendResult=async(n,a,u)=>{const f=Ac(n,u),y=await this.core.crypto.encode(a,f),w=await this.core.history.get(a,n),d=Ln[w.request.method].res;await this.core.relayer.publish(a,y,d),await this.core.history.resolve(f)},this.sendError=async(n,a,u)=>{const f=Pc(n,u),y=await this.core.crypto.encode(a,f),w=await this.core.history.get(a,n),d=Ln[w.request.method]?Ln[w.request.method].res:Ln.unregistered_method.res;await this.core.relayer.publish(a,y,d),await this.core.history.resolve(f)},this.deletePairing=async(n,a)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,tr("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),a?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{const n=this.pairings.getAll().filter(a=>wi(a.expiry));await Promise.all(n.map(a=>this.deletePairing(a.topic)))},this.onRelayEventRequest=n=>{const{topic:a,payload:u}=n;switch(u.method){case"wc_pairingPing":return this.onPairingPingRequest(a,u);case"wc_pairingDelete":return this.onPairingDeleteRequest(a,u);default:return this.onUnknownRpcMethodRequest(a,u)}},this.onRelayEventResponse=async n=>{const{topic:a,payload:u}=n,f=(await this.core.history.get(a,u.id)).request.method;switch(f){case"wc_pairingPing":return this.onPairingPingResponse(a,u);default:return this.onUnknownRpcMethodResponse(f)}},this.onPairingPingRequest=async(n,a)=>{const{id:u}=a;try{this.isValidPing({topic:n}),await this.sendResult(u,n,!0),this.events.emit(Hn.ping,{id:u,topic:n})}catch(f){await this.sendError(u,n,f),this.logger.error(f)}},this.onPairingPingResponse=(n,a)=>{const{id:u}=a;setTimeout(()=>{mi(a)?this.events.emit($t("pairing_ping",u),{}):ni(a)&&this.events.emit($t("pairing_ping",u),{error:a.error})},500)},this.onPairingDeleteRequest=async(n,a)=>{const{id:u}=a;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit(Hn.delete,{id:u,topic:n})}catch(f){await this.sendError(u,n,f),this.logger.error(f)}},this.onUnknownRpcMethodRequest=async(n,a)=>{const{id:u,method:f}=a;try{if(this.registeredMethods.includes(f))return;const y=tr("WC_METHOD_UNSUPPORTED",f);await this.sendError(u,n,y),this.logger.error(y)}catch(y){await this.sendError(u,n,y),this.logger.error(y)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(tr("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=n=>{if(!hr(n)){const{message:a}=X("MISSING_OR_INVALID",`pair() params: ${n}`);throw new Error(a)}if(!mm(n.uri)){const{message:a}=X("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw new Error(a)}},this.isValidPing=async n=>{if(!hr(n)){const{message:u}=X("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(u)}const{topic:a}=n;await this.isValidPairingTopic(a)},this.isValidDisconnect=async n=>{if(!hr(n)){const{message:u}=X("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(u)}const{topic:a}=n;await this.isValidPairingTopic(a)},this.isValidPairingTopic=async n=>
27{if(!ln(n,!1)){const{message:a}=X("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(a)}if(!this.pairings.keys.includes(n)){const{message:a}=X("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(a)}if(wi(this.pairings.get(n).expiry)){await this.deletePairing(n);const{message:a}=X("EXPIRED",`pairing topic: ${n}`);throw new Error(a)}},this.core=i,this.logger=Ce.generateChildLogger(t,this.name),this.pairings=new _a(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Ce.getLoggerContext(this.logger)}isInitialized(){if(!this.initialized){const{message:i}=X("NOT_INITIALIZED",this.name);throw new Error(i)}}registerRelayerEvents(){this.core.relayer.on(Gt.message,async i=>{const{topic:t,message:n}=i;if(!this.pairings.keys.includes(t)||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;const a=await this.core.crypto.decode(t,n);try{Oc(a)?(this.core.history.set(t,a),this.onRelayEventRequest({topic:t,payload:a})):Cc(a)&&(await this.core.history.resolve(a),await this.onRelayEventResponse({topic:t,payload:a}),this.core.history.delete(t,a.id))}catch(u){this.logger.error(u)}})}
vendor: 4,659 bytes, line 27
27registerExpirerEvents(){this.core.expirer.on(Pr.expired,async i=>{const{topic:t}=zl(i.target);t&&this.pairings.keys.includes(t)&&(await this.deletePairing(t,!0),this.events.emit(Hn.expire,{topic:t}))})}}class pE extends ww{constructor(i,t){super(i,t),this.core=i,this.logger=t,this.records=new Map,this.events=new kr.EventEmitter,this.name=kb,this.version=Kb,this.cached=[],this.initialized=!1,this.storagePrefix=bi,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,a,u)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:a,chainId:u}),this.records.has(a.id))return;const f={id:a.id,topic:n,request:{method:a.method,params:a.params||null},chainId:u,expiry:Fr(ie.THIRTY_DAYS)};this.records.set(f.id,f),this.events.emit(Hr.created,f)},this.resolve=async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;const a=await this.getRecord(n.id);typeof a.response>"u"&&(a.response=ni(n)?{error:n.error}:{result:n.result},this.records.set(a.id,a),this.events.emit(Hr.updated,a))},this.get=async(n,a)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:a}),await this.getRecord(a)),this.delete=(n,a)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:a}),this.values.forEach(u=>{if(u.topic===n){if(typeof a<"u"&&u.id!==a)return;this.records.delete(u.id),this.events.emit(Hr.deleted,u)}})},this.exists=async(n,a)=>(this.isInitialized(),this.records.has(a)?(await this.getRecord(a)).topic===n:!1),this.on=(n,a)=>{this.events.on(n,a)},this.once=(n,a)=>{this.events.once(n,a)},this.off=(n,a)=>{this.events.off(n,a)},this.removeListener=(n,a)=>{this.events.removeListener(n,a)},this.logger=Ce.generateChildLogger(t,this.name)}get context(){return Ce.getLoggerContext(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(){const i=[];return this.values.forEach(t=>{if(typeof t.response<"u")return;const n={topic:t.topic,request:Kn(t.request.method,t.request.params,t.id),chainId:t.chainId};return i.push(n)}),i}async setJsonRpcRecords(i){await this.core.storage.setItem(this.storageKey,i)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(i){this.isInitialized();const t=this.records.get(i);if(!t){const{message:n}=X("NO_MATCHING_KEY",`${this.name}: ${i}`);throw new Error(n)}return t}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(Hr.sync)}async restore(){try{const i=await this.getJsonRpcRecords();if(typeof i>"u"||!i.length)return;if(this.records.size){const{message:t}=X("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=i,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(i){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(i)}}registerEventListeners(){this.events.on(Hr.created,i=>{const t=Hr.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:i}),this.persist()}),this.events.on(Hr.updated,i=>{const t=Hr.updated;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:i}),this.persist()}),this.events.on(Hr.deleted,i=>{const t=Hr.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:i}),this.persist()}),this.core.heartbeat.on(dn.HEARTBEAT_EVENTS.pulse,()=>{this.cleanup()})}cleanup(){try{this.records.forEach(i=>{ie.toMiliseconds(i.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${i.id}`),this.delete(i.topic,i.id))})}catch(i){this.logger.warn(i)}}isInitialized(){if(!this.initialized){const{message:i}=X("NOT_INITIALIZED",this.name);throw new Error(i)}}}class dE extends Sw{constructor(i,t){super(i,t),this.core=i,this.logger=t,this.expirations=new Map,this.events=new kr.EventEmitter,this.name=Bb,this.version=Vb,this.cached=[],this.initialized=!1,this.storagePrefix=bi,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(
27),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=n=>{try{const a=this.formatTarget(n);return typeof this.getExpiration(a)<"u"}catch{return!1}},this.set=(n,a)=>{this.isInitialized();const u=this.formatTarget(n),f={target:u,expiry:a};this.expirations.set(u,f),this.checkExpiry(u,f),this.events.emit(Pr.created,{target:u,expiration:f})},this.get=n=>{this.isInitialized();const a=this.formatTarget(n);return this.getExpiration(a)},this.del=n=>{if(this.isInitialized(),this.has(n)){const a=this.formatTarget(n),u=this.getExpiration(a);this.expirations.delete(a),this.events.emit(Pr.deleted,{target:a,expiration:u})}},this.on=(n,a)=>{this.events.on(n,a)},this.once=(n,a)=>{this.events.once(n,a)},this.off=(n,a)=>{this.events.off(n,a)},this.removeListener=(n,a)=>{this.events.removeListener(n,a)},this.logger=Ce.generateChildLogger(t,this.name)}get context(){return Ce.getLoggerContext(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(i){if(typeof i=="string")return wm(i);if(typeof i=="number")return _m(i);const{message:t}=X("UNKNOWN_TYPE",`Target type: ${typeof i}`);throw new Error(t)}async setExpirations(i){await this.core.storage.setItem(this.storageKey,i)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Pr.sync)}async restore(){try{const i=await this.getExpirations();if(typeof i>"u"||!i.length)return;if(this.expirations.size){const{message:t}=X("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=i,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(i){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(i)}}getExpiration(i){const t=this.expirations.get(i);if(!t){const{message:n}=X("NO_MATCHING_KEY",`${this.name}: ${i}`);throw this.logger.error(n),new Error(n)}return t}checkExpiry(i,t){const{expiry:n}=t;ie.toMiliseconds(n)-Date.now()<=0&&this.expire(i,t)}expire(i,t){this.expirations.delete(i),this.events.emit(Pr.expired,{target:i,expiration:t})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((i,t)=>this.checkExpiry(t,i))}registerEventListeners(){this.core.heartbeat.on(dn.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(Pr.created,i=>{const t=Pr.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:i}),this.persist()}),this.events.on(Pr.expired,i=>{const t=Pr.expired;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:i}),this.persist()}),this.events.on(Pr.deleted,i=>{const t=Pr.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:i}),this.persist()})}isInitialized(){if(!this.initialized){const{message:i}=X("NOT_INITIALIZED",this.name);throw new Error(i)}}}class gE extends Pw{constructor(i,t){super(i,t),this.projectId=i,this.logger=t,this.name=tc,this.initialized=!1,this.queue=[],this.verifyDisabled=!1,this.init=async()=>{if(this.verifyDisabled||bm()||!Ml())return;const n=fa;this.verifyUrl!==n&&this.removeIframe(),this.verifyUrl=n;try{await this.createIframe()}catch(a){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(a)}if(!this.initialized){this.removeIframe(),this.verifyUrl=fl;try{await this.createIframe()}catch(a){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(a),this.verifyDisabled=!0}}},this.register=async n=>{this.initialized?this.sendPost(n.attestationId):(this.addToQueue(n.attestationId),await this.init())},this.resolve=async n=>{if(this.isDevEnv)return"";const a=(n==null?void 0:n.verifyUrl)||fa;let u;try{u=await this.fetchAttestation(n.attestationId,a)}catch(f){this.logger.info(`failed to resolve attestation: ${n.attestationId} from url: ${a}`),this.logger.info(f),u=await this.fetchAttestation(n.attestationId,fl)}return u},this.fetchAttestation=async(n,a)=>{this.logger.info(`resolving attestation: ${n} from url: ${a}`);const u=this.startAbortTimer(ie.ONE_SECOND*2),f=await fetch(`${a}/attestation/${n}`,{signal:this.abortController.signal});return clearTimeout(u),f.status===200?await f.json():void 0},this.addToQueue=n=>{this.queue.push(n)},this.processQueue=()=>{this.queue.length!==0&&(this.queue.forEach(n=>this.sendPost(n)),this.queue=[])},this.sendPost=n=>{var a;try{if(!this.iframe)return;(a=this.iframe.contentWindow)==null||a.postMessage(n,"*"),this.logger.info(`postMessage sent: ${n} ${this.verifyUrl}`)}catch{}},this.createIframe=async()=>{let n;const a=u=>{u.data==="verify_ready"&&(this.initialized=!0,this.processQueue(),window.removeEventListener("message",a),n())};await Promise.race([new Promise(u=>{if(document.getElementById(tc))return u();window.addEventListener("message",a);const f=document.createElement("iframe");f.id=tc,f.src=`${this.verifyUrl}/${this.projectId}`,f.style.display="none",document.body.append(f),this.iframe=f,n=u}),new Promise((u,f)=>setTimeout(()=>{window.removeEventListener("message",a),f("verify iframe load timeout")},ie.toMiliseconds(ie.FIVE_SECONDS)))])},this.removeIframe=()=>{this.iframe&&(this.iframe.remove(),this.iframe=void 0,this.initialized=!1)},this.logger=Ce.generateChildLogger(t,this.name),this.verifyUrl=fa,this.abortController=new AbortController,this.isDevEnv=Em()&&{}.IS_VITEST}get context(){return Ce.getLoggerContext(this.logger)}startAbortTimer(i){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),ie.toMiliseconds(i))}}var yE=Object.defineProperty,_l=Object.getOwnPropertySymbols,vE=Object.prototype.hasOwnProperty,mE=Object.prototype.propertyIsEnumerable,bl=(o,i,t)=>i in o?yE(o,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[i]=t,El=(o,i)=>
27{for(var t in i||(i={}))vE.call(i,t)&&bl(o,t,i[t]);if(_l)for(var t of _l(i))mE.call(i,t)&&bl(o,t,i[t]);return o};class Nc extends mw{constructor(i){super(i),this.protocol=pf,this.version=wb,this.name=Tc,this.events=new kr.EventEmitter,this.initialized=!1,this.on=(n,a)=>this.events.on(n,a),this.once=(n,a)=>this.events.once(n,a),this.off=(n,a)=>this.events.off(n,a),this.removeListener=(n,a)=>this.events.removeListener(n,a),this.projectId=i==null?void 0:i.projectId,this.relayUrl=(i==null?void 0:i.relayUrl)||gf,this.customStoragePrefix=i!=null&&i.customStoragePrefix?`:${i.customStoragePrefix}`:"";const t=typeof(i==null?void 0:i.logger)<"u"&&typeof(i==null?void 0:i.logger)!="string"?i.logger:Ce.pino(Ce.getDefaultLoggerOptions({level:(i==null?void 0:i.logger)||_b.logger}));this.logger=Ce.generateChildLogger(t,this.name),this.heartbeat=new dn.HeartBeat,this.crypto=new Wb(this,this.logger,i==null?void 0:i.keychain),this.history=new pE(this,this.logger),this.expirer=new dE(this,this.logger),this.storage=i!=null&&i.storage?i.storage:new E1(El(El({},bb),i==null?void 0:i.storageOptions)),this.relayer=new cE({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new fE(this,this.logger),this.verify=new gE(this.projectId||"",this.logger)}static async init(i){const t=new Nc(i);await t.initialize();const n=await t.crypto.getClientId();return await t.storage.setItem(qb,n),t}get context(){return Ce.getLoggerContext(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(i){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,i),this.logger.error(i.message),i}}}const wE=Nc,yf="wc",vf=2,mf="client",$c=`${yf}@${vf}:${mf}:`,ic={name:mf,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},Il="WALLETCONNECT_DEEPLINK_CHOICE",_E="proposal",wf="Proposal expired",bE="session",sa=ie.SEVEN_DAYS,EE="engine",jn={wc_sessionPropose:{req:{ttl:ie.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:ie.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:ie.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:ie.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:ie.ONE_DAY,prompt:!1,tag:1104},res:{ttl:ie.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:ie.ONE_DAY,prompt:!1,tag:1106},res:{ttl:ie.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:ie.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:ie.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:ie.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:ie.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:ie.ONE_DAY,prompt:!1,tag:1112},res:{ttl:ie.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:ie.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:ie.THIRTY_SECONDS,prompt:!1,tag:1115}}},nc={min:ie.FIVE_MINUTES,max:ie.SEVEN_DAYS},ii={idle:"IDLE",active:"ACTIVE"},IE="request",xE=["wc_sessionPropose","wc_sessionRequest","wc_authRequest"];var SE=Object.defineProperty,PE=Object.defineProperties,OE=Object.getOwnPropertyDescriptors,xl=Object.getOwnPropertySymbols,CE=Object.prototype.hasOwnProperty,AE=Object.prototype.propertyIsEnumerable,Sl=(o,i,t)=>i in o?SE(o,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[i]=t,cr=(o,i)=>{for(var t in i||(i={}))CE.call(i,t)&&Sl(o,t,i[t]);if(xl)for(var t of xl(i))AE.call(i,t)&&Sl(o,t,i[t]);return o},zn=(o,i)=>PE(o,OE(i));class RE extends Cw{constructor(i){super(i),this.name=EE,this.events=new Sc,this.initialized=!1,this.ignoredPayloadTypes=[jl],this.requestQueue={state:ii.idle,queue:[]},this.sessionRequestQueue={state:ii.idle,queue:[]},this.requestQueueDelay=ie.ONE_SECOND,this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),this.client.core.pairing.register({methods:Object.keys(jn)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},ie.toMiliseconds(this.requestQueueDelay)))},this.connect=async t=>{await this.isInitialized();const n=zn(cr({},t),{requiredNamespaces:t.requiredNamespaces||{},optionalNamespaces:t.optionalNamespaces||{}});await this.isValidConnect(n);const{pairingTopic:a,requiredNamespaces:u,optionalNamespaces:f,sessionProperties:y,relays:w}=n;let d=a,_,O=!1;
27if(d&&(O=this.client.core.pairing.pairings.get(d).active),!d||!O){const{topic:he,uri:fe}=await this.client.core.pairing.create();d=he,_=fe}const P=await this.client.core.crypto.generateKeyPair(),L=cr({requiredNamespaces:u,optionalNamespaces:f,relays:w??[{protocol:df}],proposer:{publicKey:P,metadata:this.client.metadata}},y&&{sessionProperties:y}),{reject:N,resolve:K,done:re}=hn(ie.FIVE_MINUTES,wf);if(this.events.once($t("session_connect"),async({error:he,session:fe})=>{if(he)N(he);else if(fe){fe.self.publicKey=P;const pe=zn(cr({},fe),{requiredNamespaces:fe.requiredNamespaces,optionalNamespaces:fe.optionalNamespaces});await this.client.session.set(fe.topic,pe),await this.setExpiry(fe.topic,fe.expiry),d&&await this.client.core.pairing.updateMetadata({topic:d,metadata:fe.peer.metadata}),K(pe)}}),!d){const{message:he}=X("NO_MATCHING_KEY",`connect() pairing topic: ${d}`);throw new Error(he)}const ce=await this.sendRequest({topic:d,method:"wc_sessionPropose",params:L}),ue=Fr(ie.FIVE_MINUTES);return await this.setProposal(ce,cr({id:ce,expiry:ue},L)),{uri:_,approval:re}},this.pair=async t=>(await this.isInitialized(),await this.client.core.pairing.pair(t)),this.approve=async t=>{await this.isInitialized(),await this.isValidApprove(t);const{id:n,relayProtocol:a,namespaces:u,sessionProperties:f}=t,y=this.client.proposal.get(n);let{pairingTopic:w,proposer:d,requiredNamespaces:_,optionalNamespaces:O}=y;w=w||"",ua(_)||(_=xm(u,"approve()"));const P=await this.client.core.crypto.generateKeyPair(),L=d.publicKey,N=await this.client.core.crypto.generateSharedKey(P,L);w&&n&&(await this.client.core.pairing.updateMetadata({topic:w,metadata:d.metadata}),await this.sendResult({id:n,topic:w,result:{relay:{protocol:a??"irn"},responderPublicKey:P}}),await this.client.proposal.delete(n,tr("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:w}));const K=cr({relay:{protocol:a??"irn"},namespaces:u,requiredNamespaces:_,optionalNamespaces:O,pairingTopic:w,controller:{publicKey:P,metadata:this.client.metadata},expiry:Fr(sa)},f&&{sessionProperties:f});await this.client.core.relayer.subscribe(N),await this.sendRequest({topic:N,method:"wc_sessionSettle",params:K,throwOnFailedPublish:!0});const re=zn(cr({},K),{topic:N,pairingTopic:w,acknowledged:!1,self:K.controller,peer:{publicKey:d.publicKey,metadata:d.metadata},controller:P});return await this.client.session.set(N,re),await this.setExpiry(N,Fr(sa)),{topic:N,acknowledged:()=>new Promise(ce=>setTimeout(()=>ce(this.client.session.get(N)),500))}},this.reject=async t=>{await this.isInitialized(),await this.isValidReject(t);const{id:n,reason:a}=t,{pairingTopic:u}=this.client.proposal.get(n);u&&(await this.sendError(n,u,a),await this.client.proposal.delete(n,tr("USER_DISCONNECTED")))},this.update=async t=>{await this.isInitialized(),await this.isValidUpdate(t);const{topic:n,namespaces:a}=t,u=await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:a}}),{done:f,resolve:y,reject:w}=hn();return this.events.once($t("session_update",u),({error:d})=>{d?w(d):y()}),await this.client.session.update(n,{namespaces:a}),{acknowledged:f}},this.extend=async t=>{await this.isInitialized(),await this.isValidExtend(t);const{topic:n}=t,a=await this.sendRequest({topic:n,method:"wc_sessionExtend",params:{}}),{done:u,resolve:f,reject:y}=hn();return this.events.once($t("session_extend",a),({error:w})=>{w?y(w):f()}),await this.setExpiry(n,Fr(sa)),{acknowledged:u}},this.request=async t=>{await this.isInitialized(),await this.isValidRequest(t);const{chainId:n,request:a,topic:u,expiry:f}=t,y=Vm(),{done:w,resolve:d,reject:_}=hn(f,"Request expired. Please try again.");return this.events.once($t("session_request",y),({error:O,result:P})=>{O?_(O):d(P)}),await Promise.all([new Promise(async O=>{await this.sendRequest({clientRpcId:y,topic:u,method:"wc_sessionRequest",params:{request:a,chainId:n},expiry:f,throwOnFailedPublish:!0}).catch(P=>_(P)),this.client.events.emit("session_request_sent",{topic:u,request:a,chainId:n,id:y}),O()}),new Promise(async O=>{const P=await this.client.core.storage.getItem(Il);Sm({id:y,topic:u,wcDeepLink:P}),O()}),w()]).then(O=>O[2])},this.respond=async t=>{await this.isInitialized(),await this.isValidRespond(t);const{topic:n,response:a}=t,{id:u}=a;mi(a)?await this.sendResult({id:u,topic:n,result:a.result,throwOnFailedPublish:!0}):ni(a)&&await this.sendError(u,n,a.error),this.cleanupAfterResponse(t)},this.ping=async t=>{await this.isInitialized(),await this.isValidPing(t);const{topic:n}=t;if(this.client.session.keys.includes(n)){const a=await this.sendRequest({topic:n,method:"wc_sessionPing",params:{}}),{done:u,resolve:f,reject:y}=hn();this.events.once($t("session_ping",a),({error:w})=>{w?y(w):f()}),await u()}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async t=>{await this.isInitialized(),await this.isValidEmit(t);const{topic:n,event:a,chainId:u}=t;await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:a,chainId:u}})},this.disconnect=async t=>{await this.isInitialized(),await this.isValidDisconnect(t);const{topic:n}=t;this.client.session.keys.includes(n)?(await this.sendRequest({topic:n,method:"wc_sessionDelete",params:tr("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession(n)):await this.client.core.pairing.disconnect({topic:n})},this.find=t=>(this.isInitialized(),this.client.session.getAll().filter(n=>Pm(n,t))),this.getPendingSessionRequests=()=>
27(this.isInitialized(),this.client.pendingRequest.getAll()),this.cleanupDuplicatePairings=async t=>{if(t.pairingTopic)try{const n=this.client.core.pairing.pairings.get(t.pairingTopic),a=this.client.core.pairing.pairings.getAll().filter(u=>{var f,y;return((f=u.peerMetadata)==null?void 0:f.url)&&((y=u.peerMetadata)==null?void 0:y.url)===t.peer.metadata.url&&u.topic&&u.topic!==n.topic});if(a.length===0)return;this.client.logger.info(`Cleaning up ${a.length} duplicate pairing(s)`),await Promise.all(a.map(u=>this.client.core.pairing.disconnect({topic:u.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}},this.deleteSession=async(t,n)=>{const{self:a}=this.client.session.get(t);await this.client.core.relayer.unsubscribe(t),this.client.session.delete(t,tr("USER_DISCONNECTED")),this.client.core.crypto.keychain.has(a.publicKey)&&await this.client.core.crypto.deleteKeyPair(a.publicKey),this.client.core.crypto.keychain.has(t)&&await this.client.core.crypto.deleteSymKey(t),n||this.client.core.expirer.del(t),this.client.core.storage.removeItem(Il).catch(u=>this.client.logger.warn(u))},this.deleteProposal=async(t,n)=>{await Promise.all([this.client.proposal.delete(t,tr("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(t)])},this.deletePendingSessionRequest=async(t,n,a=!1)=>{await Promise.all([this.client.pendingRequest.delete(t,n),a?Promise.resolve():this.client.core.expirer.del(t)]),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(u=>u.id!==t),a&&(this.sessionRequestQueue.state=ii.idle)},this.setExpiry=async(t,n)=>{this.client.session.keys.includes(t)&&await this.client.session.update(t,{expiry:n}),this.client.core.expirer.set(t,n)},this.setProposal=async(t,n)=>{await this.client.proposal.set(t,n),this.client.core.expirer.set(t,n.expiry)},this.setPendingSessionRequest=async t=>{const n=jn.wc_sessionRequest.req.ttl,{id:a,topic:u,params:f,verifyContext:y}=t;await this.client.pendingRequest.set(a,{id:a,topic:u,params:f,verifyContext:y}),n&&this.client.core.expirer.set(a,Fr(n))},this.sendRequest=async t=>{const{topic:n,method:a,params:u,expiry:f,relayRpcId:y,clientRpcId:w,throwOnFailedPublish:d}=t,_=Kn(a,u,w);if(Ml()&&xE.includes(a)){const L=fn(JSON.stringify(_));this.client.core.verify.register({attestationId:L})}const O=await this.client.core.crypto.encode(n,_),P=jn[a].req;return f&&(P.ttl=f),y&&(P.id=y),this.client.core.history.set(n,_),d?(P.internal=zn(cr({},P.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,O,P)):this.client.core.relayer.publish(n,O,P).catch(L=>this.client.logger.error(L)),_.id},this.sendResult=async t=>{const{id:n,topic:a,result:u,throwOnFailedPublish:f}=t,y=Ac(n,u),w=await this.client.core.crypto.encode(a,y),d=await this.client.core.history.get(a,n),_=jn[d.request.method].res;f?(_.internal=zn(cr({},_.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(a,w,_)):this.client.core.relayer.publish(a,w,_).catch(O=>this.client.logger.error(O)),await this.client.core.history.resolve(y)},this.sendError=async(t,n,a)=>{const u=Pc(t,a),f=await this.client.core.crypto.encode(n,u),y=await this.client.core.history.get(n,t),w=jn[y.request.method].res;this.client.core.relayer.publish(n,f,w),await this.client.core.history.resolve(u)},this.cleanup=async()=>{const t=[],n=[];this.client.session.getAll().forEach(a=>{wi(a.expiry)&&t.push(a.topic)}),this.client.proposal.getAll().forEach(a=>{wi(a.expiry)&&n.push(a.id)}),await Promise.all([...t.map(a=>this.deleteSession(a)),...n.map(a=>this.deleteProposal(a))])},this.onRelayEventRequest=async t=>{this.requestQueue.queue.push(t),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===ii.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=ii.active;const t=this.requestQueue.queue.shift();if(t)try{this.processRequest(t),await new Promise(n=>setTimeout(n,300))}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=ii.idle},this.processRequest=t=>{const{topic:n,payload:a}=t,u=a.method;switch(u){case"wc_sessionPropose":return this.onSessionProposeRequest
27(n,a);case"wc_sessionSettle":return this.onSessionSettleRequest(n,a);case"wc_sessionUpdate":return this.onSessionUpdateRequest(n,a);case"wc_sessionExtend":return this.onSessionExtendRequest(n,a);case"wc_sessionPing":return this.onSessionPingRequest(n,a);case"wc_sessionDelete":return this.onSessionDeleteRequest(n,a);case"wc_sessionRequest":return this.onSessionRequest(n,a);case"wc_sessionEvent":return this.onSessionEventRequest(n,a);default:return this.client.logger.info(`Unsupported request method ${u}`)}},this.onRelayEventResponse=async t=>{const{topic:n,payload:a}=t,u=(await this.client.core.history.get(n,a.id)).request.method;switch(u){case"wc_sessionPropose":return this.onSessionProposeResponse(n,a);case"wc_sessionSettle":return this.onSessionSettleResponse(n,a);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,a);case"wc_sessionExtend":return this.onSessionExtendResponse(n,a);case"wc_sessionPing":return this.onSessionPingResponse(n,a);case"wc_sessionRequest":return this.onSessionRequestResponse(n,a);default:return this.client.logger.info(`Unsupported response method ${u}`)}},this.onRelayEventUnknownPayload=t=>{const{topic:n}=t,{message:a}=X("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(a)},this.onSessionProposeRequest=async(t,n)=>{const{params:a,id:u}=n;try{this.isValidConnect(cr({},n.params));const f=Fr(ie.FIVE_MINUTES),y=cr({id:u,pairingTopic:t,expiry:f},a);await this.setProposal(u,y);const w=fn(JSON.stringify(n)),d=await this.getVerifyContext(w,y.proposer.metadata);this.client.events.emit("session_proposal",{id:u,params:y,verifyContext:d})}catch(f){await this.sendError(u,t,f),this.client.logger.error(f)}},this.onSessionProposeResponse=async(t,n)=>{const{id:a}=n;if(mi(n)){const{result:u}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:u});const f=this.client.proposal.get(a);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:f});const y=f.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:y});const w=u.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:w});const d=await this.client.core.crypto.generateSharedKey(y,w);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:d});const _=await this.client.core.relayer.subscribe(d);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:_}),await this.client.core.pairing.activate({topic:t})}else ni(n)&&(await this.client.proposal.delete(a,tr("USER_DISCONNECTED")),this.events.emit($t("session_connect"),{error:n.error}))},this.onSessionSettleRequest=async(t,n)=>{const{id:a,params:u}=n;try{this.isValidSessionSettleRequest(u);const{relay:f,controller:y,expiry:w,namespaces:d,requiredNamespaces:_,optionalNamespaces:O,sessionProperties:P,pairingTopic:L}=n.params,N=cr({topic:t,relay:f,expiry:w,namespaces:d,acknowledged:!0,pairingTopic:L,requiredNamespaces:_,optionalNamespaces:O,controller:y.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:y.publicKey,metadata:y.metadata}},P&&{sessionProperties:P});await this.sendResult({id:n.id,topic:t,result:!0}),this.events.emit($t("session_connect"),{session:N}),this.cleanupDuplicatePairings(N)}catch(f){await this.sendError(a,t,f),this.client.logger.error(f)}},this.onSessionSettleResponse=async(t,n)=>{const{id:a}=n;mi(n)?(await this.client.session.update(t,{acknowledged:!0}),this.events.emit($t("session_approve",a),{})):ni(n)&&(await this.client.session.delete(t,tr("USER_DISCONNECTED")),this.events.emit($t("session_approve",a),{error:n.error}))},this.onSessionUpdateRequest=async(t,n)=>{const{params:a,id:u}=n;try{const f=`${t}_session_update`,y=ra.get(f);if(y&&this.isRequestOutOfSync(y,u)){this.client.logger.info(`Discarding out of sync request - ${u}`);return}this.isValidUpdate(cr({topic:t},a)),await this.client.session.update(t,{namespaces:a.namespaces}),await this.sendResult({id:u,topic:t,result:!0}),this.client.events.emit("session_update",{id:u,topic:t,params:a}),ra.set(f,u)}catch(f){await this.sendError(u,t,f),this.client.logger.error(f)}},this.isRequestOutOfSync=(t,n)=>parseInt(n.toString().slice(0,-3))<=parseInt(t.toString().slice(0,-3)),this.onSessionUpdateResponse=(t,n)=>{const{id:a}=n;mi(n)?this.events.emit($t("session_update",a),{}):ni(n)&&this.events.emit($t("session_update",a),{error:n.error})},this.onSessionExtendRequest=async(t,n)=>{const{id:a}=n;try{this.isValidExtend({topic:t}),await this.setExpiry(t,Fr(sa)),await this.sendResult({id:a,topic:t,result:!0}),this.client.events.emit("session_extend",{id:a,topic:t})}catch(u){await this.sendError(a,t,u),this.client.logger.error(u)}},this.onSessionExtendResponse=(t,n)=>{const{id:a}=n;mi(n)?this.events.emit($t("session_extend",a),{}):ni(n)&&this.events.emit($t("session_extend",a),{error:n.error})},this.onSessionPingRequest=async(t,n)=>{const{id:a}=n;try{this.isValidPing({topic:t}),await this.sendResult({id:a,topic:t,result:!0}),this.client.events.emit("session_ping",{id:a,topic:t})}catch(u){await this.sendError(a,t,u),this.client.logger.error(u)}},this.onSessionPingResponse=(t,n)=>{const{id:a}=n;setTimeout(()=>{mi(n)?this.events.emit($t("session_ping",a),{}):ni(n)&&this.events.emit($t("session_ping",a),{error:n.error})},500)},this.onSessionDeleteRequest=async(t,n)=>{const{id:a}=n;try{this.isValidDisconnect({topic:t,reason:n.params}),await Promise.all([new Promise(u=>{this.client.core.relayer.once(Gt.publish,async()=>{u(await this.deleteSession(t))})}),this.sendResult({id:a,topic:t,result:!0})]),this.client.events.emit("session_delete",{id:a,topic:t})}catch(u){this.client.logger.error(u)}},this.onSessionRequest=async(t,n)=>{const{id:a,params:u}=n;try{this.isValidRequest(cr({topic:t},u));const f=fn(JSON.stringify(Kn("wc_sessionRequest",u,a))),y=this.client.session.get(t),w=await this.getVerifyContext(f,y.peer.metadata),d={id:a,topic:t,params:u,verifyContext:w};await this.setPendingSessionRequest(d),this.addSessionRequestToSessionRequestQueue(d),this.processSessionRequestQueue()}catch(f){await this.sendError(a,t,f),this.client.logger.error(f)}},this.onSessionRequestResponse=(t,n)=>{const{id:a}=n;mi(n)?this.events.emit($t("session_request",a),{result:n.result}):ni(n)&&this.events.emit($t("session_request",a),{error:n.error})},this.onSessionEventRequest=async(t,n)=>{const{id:a,params:u}=n;try{const f=`${t}_session_event_${u.event.name}`,y=ra.get(f);if(y&&this.isRequestOutOfSync(y,a)){this.client.logger.info(`Discarding out of sync request - ${a}`);return}this.isValidEmit(cr({topic:t},u)),this.client.events.emit("session_event",{id:a,topic:t,params:u}),ra.set(f,a)}catch(f){await this.sendError(a,t,f),this.client.logger.error(f)}},this.addSessionRequestToSessionRequestQueue=t=>{this.sessionRequestQueue.queue.push(t)},this.cleanupAfterResponse=t=>{this.deletePendingSessionRequest(t.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=ii.idle,this.processSessionRequestQueue()},ie.toMiliseconds(this.requestQueueDelay))},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===ii.active){this.client.logger.info("session request queue is already active.");return}const t=this.sessionRequestQueue.queue[0];if(!t){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=ii.active,this.client.events.emit("session_request",t)}catch(n){this.client.logger.error(n)}}
27,this.onPairingCreated=t=>{if(t.active)return;const n=this.client.proposal.getAll().find(a=>a.pairingTopic===t.topic);n&&this.onSessionProposeRequest(t.topic,Kn("wc_sessionPropose",{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer},n.id))},this.isValidConnect=async t=>{if(!hr(t)){const{message:w}=X("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(t)}`);throw new Error(w)}const{pairingTopic:n,requiredNamespaces:a,optionalNamespaces:u,sessionProperties:f,relays:y}=t;if(_i(n)||await this.isValidPairingTopic(n),!Om(y,!0)){const{message:w}=X("MISSING_OR_INVALID",`connect() relays: ${y}`);throw new Error(w)}!_i(a)&&ua(a)!==0&&this.validateNamespaces(a,"requiredNamespaces"),!_i(u)&&ua(u)!==0&&this.validateNamespaces(u,"optionalNamespaces"),_i(f)||this.validateSessionProps(f,"sessionProperties")},this.validateNamespaces=(t,n)=>{const a=Cm(t,"connect()",n);if(a)throw new Error(a.message)},this.isValidApprove=async t=>{if(!hr(t))throw new Error(X("MISSING_OR_INVALID",`approve() params: ${t}`).message);const{id:n,namespaces:a,relayProtocol:u,sessionProperties:f}=t;await this.isValidProposalId(n);const y=this.client.proposal.get(n),w=Vo(a,"approve()");if(w)throw new Error(w.message);const d=jh(y.requiredNamespaces,a,"approve()");if(d)throw new Error(d.message);if(!ln(u,!0)){const{message:_}=X("MISSING_OR_INVALID",`approve() relayProtocol: ${u}`);throw new Error(_)}_i(f)||this.validateSessionProps(f,"sessionProperties")},this.isValidReject=async t=>{if(!hr(t)){const{message:u}=X("MISSING_OR_INVALID",`reject() params: ${t}`);throw new Error(u)}const{id:n,reason:a}=t;if(await this.isValidProposalId(n),!Am(a)){const{message:u}=X("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(a)}`);throw new Error(u)}},this.isValidSessionSettleRequest=t=>{if(!hr(t)){const{message:d}=X("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${t}`);throw new Error(d)}const{relay:n,controller:a,namespaces:u,expiry:f}=t;if(!Rm(n)){const{message:d}=X("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(d)}const y=Tm(a,"onSessionSettleRequest()");if(y)throw new Error(y.message);const w=Vo(u,"onSessionSettleRequest()");if(w)throw new Error(w.message);if(wi(f)){const{message:d}=X("EXPIRED","onSessionSettleRequest()");throw new Error(d)}},this.isValidUpdate=async t=>{if(!hr(t)){const{message:w}=X("MISSING_OR_INVALID",`update() params: ${t}`);throw new Error(w)}const{topic:n,namespaces:a}=t;await this.isValidSessionTopic(n);const u=this.client.session.get(n),f=Vo(a,"update()");if(f)throw new Error(f.message);const y=jh(u.requiredNamespaces,a,"update()");if(y)throw new Error(y.message)},this.isValidExtend=async t=>{if(!hr(t)){const{message:a}=X("MISSING_OR_INVALID",`extend() params: ${t}`);throw new Error(a)}const{topic:n}=t;await this.isValidSessionTopic(n)},this.isValidRequest=async t=>{if(!hr(t)){const{message:w}=X("MISSING_OR_INVALID",`request() params: ${t}`);throw new Error(w)}const{topic:n,request:a,chainId:u,expiry:f}=t;await this.isValidSessionTopic(n);const{namespaces:y}=this.client.session.get(n);if(!zh(y,u)){const{message:w}=X("MISSING_OR_INVALID",`request() chainId: ${u}`);throw new Error(w)}if(!Nm(a)){const{message:w}=X("MISSING_OR_INVALID",`request() ${JSON.stringify(a)}`);throw new Error(w)}if(!$m(y,u,a.method)){const{message:w}=X("MISSING_OR_INVALID",`request() method: ${a.method}`);throw new Error(w)}if(f&&!Fm(f,nc)){const{message:w}=X("MISSING_OR_INVALID",`request() expiry: ${f}. Expiry must be a number (in seconds) between ${nc.min} and ${nc.max}`);throw new Error(w)}},this.isValidRespond=async t=>{if(!hr(t)){const{message:u}=X("MISSING_OR_INVALID",`respond() params: ${t}`);throw new Error(u)}const{topic:n,response:a}=t;if(await this.isValidSessionTopic(n),!Dm(a)){const{message:u}=X("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(a)}`);throw new Error(u)}},this.isValidPing=async t=>{if(!hr(t)){const{message:a}=X("MISSING_OR_INVALID",`ping() params: ${t}`);throw new Error(a)}const{topic:n}=t;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async t=>{if(!hr(t)){const{message:y}=X("MISSING_OR_INVALID",`emit() params: ${t}`);throw new Error(y)}const{topic:n,event:a,chainId:u}=t;await this.isValidSessionTopic(n);const{namespaces:f}=this.client.session.get(n);if(!zh(f,u)){const{message:y}=X("MISSING_OR_INVALID",`emit() chainId: ${u}`);throw new Error(y)}if(!Lm(a)){const{message:y}=X("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(a)}`);throw new Error(y)}if(!qm(f,u,a.name)){const{message:y}=X("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(a)}`);throw new Error(y)}},this.isValidDisconnect=async t=>{if(!hr(t)){const{message:a}=X("MISSING_OR_INVALID",`disconnect() params: ${t}`);throw new Error(a)}const{topic:n}=t;await this.isValidSessionOrPairingTopic(n)},this.getVerifyContext=async(t,n)=>{const a={verified:{verifyUrl:n.verifyUrl||fa,validation:"UNKNOWN",origin:n.url||""}};try{const u=await this.client.core.verify.resolve({attestationId:t,verifyUrl:n.verifyUrl});u&&(a.verified.origin=u.origin,a.verified.isScam=u.isScam,a.verified.validation=u.origin===new URL(n.url).origin?"VALID":"INVALID")}catch(u){this.client.logger.info(u)}return this.client.logger.info(`Verify context: ${JSON.stringify(a)}`),a},this.validateSessionProps=(t,n)=>{Object.values(t).forEach(a=>
27{if(!ln(a,!1)){const{message:u}=X("MISSING_OR_INVALID",`${n} must be in Record<string, string> format. Received: ${JSON.stringify(a)}`);throw new Error(u)}})}}async isInitialized(){if(!this.initialized){const{message:i}=X("NOT_INITIALIZED",this.name);throw new Error(i)}await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(Gt.message,async i=>{const{topic:t,message:n}=i;if(this.ignoredPayloadTypes.includes(this.client.core.crypto.getPayloadType(n)))return;const a=await this.client.core.crypto.decode(t,n);try{Oc(a)?(this.client.core.history.set(t,a),this.onRelayEventRequest({topic:t,payload:a})):Cc(a)?(await this.client.core.history.resolve(a),await this.onRelayEventResponse({topic:t,payload:a}),this.client.core.history.delete(t,a.id)):this.onRelayEventUnknownPayload({topic:t,payload:a})}catch(u){this.client.logger.error(u)}})}registerExpirerEvents(){this.client.core.expirer.on(Pr.expired,async i=>{const{topic:t,id:n}=zl(i.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,X("EXPIRED"),!0);t?this.client.session.keys.includes(t)&&(await this.deleteSession(t,!0),this.client.events.emit("session_expire",{topic:t})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(Hn.create,i=>this.onPairingCreated(i))}isValidPairingTopic(i){if(!ln(i,!1)){const{message:t}=X("MISSING_OR_INVALID",`pairing topic should be a string: ${i}`);throw new Error(t)}if(!this.client.core.pairing.pairings.keys.includes(i)){const{message:t}=X("NO_MATCHING_KEY",`pairing topic doesn't exist: ${i}`);throw new Error(t)}if(wi(this.client.core.pairing.pairings.get(i).expiry)){const{message:t}=X("EXPIRED",`pairing topic: ${i}`);throw new Error(t)}}async isValidSessionTopic(i){if(!ln(i,!1)){const{message:t}=X("MISSING_OR_INVALID",`session topic should be a string: ${i}`);throw new Error(t)}if(!this.client.session.keys.includes(i)){const{message:t}=X("NO_MATCHING_KEY",`session topic doesn't exist: ${i}`);throw new Error(t)}if(wi(this.client.session.get(i).expiry)){await this.deleteSession(i);const{message:t}=X("EXPIRED",`session topic: ${i}`);throw new Error(t)}}async isValidSessionOrPairingTopic(i){if(this.client.session.keys.includes(i))await this.isValidSessionTopic(i);else if(this.client.core.pairing.pairings.keys.includes(i))this.isValidPairingTopic(i);else if(ln(i,!1)){const{message:t}=X("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${i}`);throw new Error(t)}else{const{message:t}=X("MISSING_OR_INVALID",`session or pairing topic should be a string: ${i}`);throw new Error(t)}}async isValidProposalId(i){if(!jm(i)){const{message:t}=X("MISSING_OR_INVALID",`proposal id should be a number: ${i}`);throw new Error(t)}if(!this.client.proposal.keys.includes(i)){const{message:t}=X("NO_MATCHING_KEY",`proposal id doesn't exist: ${i}`);throw new Error(t)}if(wi(this.client.proposal.get(i).expiry)){await this.deleteProposal(i);const{message:t}=X("EXPIRED",`proposal id: ${i}`);throw new Error(t)}}}class TE extends _a{constructor(i,t){super(i,t,_E,$c),this.core=i,this.logger=t}}class NE extends _a{constructor(i,t){super(i,t,bE,$c),this.core=i,this.logger=t}}class $E extends _a{constructor(i,t){super(i,t,IE,$c,n=>n.id),this.core=i,this.logger=t}}let FE=class _f extends Ow{constructor(i){super(i),this.protocol=yf,this.version=vf,this.name=ic.name,this.events=new kr.EventEmitter,this.on=(n,a)=>this.events.on(n,a),this.once=(n,a)=>this.events.once(n,a),this.off=(n,a)=>this.events.off(n,a),this.removeListener=(n,a)=>this.events.removeListener(n,a),this.removeAllListeners=n=>this.events.removeAllListeners(n),this.connect=async n=>{try{return await this.engine.connect(n)}catch(a){throw this.logger.error(a.message),a}},this.pair=async n=>{try{return await this.engine.pair(n)}catch(a){throw this.logger.error(a.message),a}},this.approve=async n=>{try{return await this.engine.approve(n)}catch(a){throw this.logger.error(a.message),a}},this.reject=async n=>{try{return await this.engine.reject(n)}catch(a){throw this.logger.error(a.message),a}},this.update=async n=>{try{return await this.engine.update(n)}catch(a){throw this.logger.error(a.message),a}},this.extend=async n=>{try{return await this.engine.extend(n)}catch(a){throw this.logger.error(a.message),a}},this.request=async n=>{try{return await this.engine.request(n)}catch(a){throw this.logger.error(a.message),a}},this.respond=async n=>{try{return await this.engine.respond(n)}catch(a){throw this.logger.error(a.message),a}},this.ping=async n=>{try{return await this.engine.ping(n)}catch(a){throw this.logger.error(a.message),a}},this.emit=async n=>{try{return await this.engine.emit(n)}catch(a){throw this.logger.error(a.message),a}},this.disconnect=async n=>{try{return await this.engine.disconnect(n)}catch(a){throw this.logger.error(a.message),a}},this.find=n=>{try{return this.engine.find(n)}catch(a){throw this.logger.error(a.message),a}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}},this.name=(i==null?void 0:i.name)||ic.name,this.metadata=(i==null?void 0:i.metadata)||Im();const t=typeof(i==null?void 0:i.logger)<"u"&&typeof(i==null?void 0:i.logger)!="string"?i.logger:Ce.pino(Ce.getDefaultLoggerOptions({level:(i==null?void 0:i.logger)||ic.logger}));this.core=(i==null?void 0:i.core)||new wE(i),this.logger=Ce.generateChildLogger(t,this.name),this.session=new NE(this.core,this.logger),this.proposal=new TE(this.core,this.logger),this.pendingRequest=new $E(this.core,this.logger),this.engine=new RE(this)}static async init(i){const t=new _f(i);return await t.initialize(),t}get context(){return Ce.getLoggerContext(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(i){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(i.message),i}}};const Pl="error",DE="wss://relay.walletconnect.com",LE="wc",qE="universal_provider",Ol=`${LE}@2:${qE}:`,jE="https://rpc.walletconnect.com/v1/",ai={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var Mn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},_c={exports:{}};/** 28* @license 29* Lodash <https://lodash.com/>
30* Copyright OpenJS Foundation and other contributors <https://openjsf.org/> 31* Released under MIT license <https://lodash.com/license> 32* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> 33* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors 34*/(function(o,i){(function(){var t,n="4.17.21",a=200,u="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",f="Expected a function",y="Invalid `variable` option passed into `_.template`",w="__lodash_hash_undefined__",d=500,_="__lodash_placeholder__",O=1,P=2,L=4,N=1,K=2,re=1,ce=2,ue=4,he=8,fe=16,pe=32,F=64,H=128,W=256,ye=512,te=30,Ee="...",Ae=800,et=16,R=1,z=2,ze=3,Re=1/0,J=9007199254740991,B=17976931348623157e292,k=0/0,V=4294967295,ut=V-1,He=V>>>1,Dr=[["ary",H],["bind",re],["bindKey",ce],["curry",he],["curryRight",fe],["flip",ye],["partial",pe],["partialRight",F],["rearg",W]],_e="[object Arguments]",It="[object Array]",$="[object AsyncFunction]",T="[object Boolean]",C="[object Date]",h="[object DOMException]",E="[object Error]",Z="[object Function]",oe="[object GeneratorFunction]",me="[object Map]",Te="[object Number]",$e="[object Null]",xe="[object Object]",xt="[object Promise]",mt="[object Proxy]",st="[object RegExp]",De="[object Set]",Je="[object String]",Qe="[object Symbol]",at="[object Undefined]",Me="[object WeakMap]",Ye="[object WeakSet]",Ne="[object ArrayBuffer]",ke="[object DataView]",ht="[object Float32Array]",qe="[object Float64Array]",St="[object Int8Array]",Ft="[object Int16Array]",Ut="[object Int32Array]",Ht="[object Uint8Array]",qt="[object Uint8ClampedArray]",Wt="[object Uint16Array]",rr="[object Uint32Array]",Lr=/\b__p \+= '';/g,Jt=/\b(__p \+=) '' \+/g,Kr=/(__e\(.*?\)|\b__t\)) \+\n'';/g,oi=/&(?:amp|lt|gt|quot|#39);/g,xi=/[&<>"']/g,lt=RegExp(oi.source),tt=RegExp(xi.source),ft=/<%-([\s\S]+?)%>/g,pt=/<%([\s\S]+?)%>/g,ot=/<%=([\s\S]+?)%>/g,rt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Pt=/^\w*$/,Ot=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,dt=/[\\^$.*+?()[\]{}|]/g,Ct=RegExp(dt.source),gt=/^\s+/,wt=/\s/,yt=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,We=/\{\n\/\* \[wrapped with (.+)\] \*/,At=/,? & /,Rt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ba=/[()=,{}\[\]\/\s]/,Ea=/\\(\\)?/g,Ia=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,vr=/\w*$/,xa=/^[-+]0x[0-9a-f]+$/i,Sa=/^0b[01]+$/i,Pa=/^\[object .+?Constructor\]$/,Oa=/^0o[0-7]+$/i,Ca=/^(?:0|[1-9]\d*)$/,Br=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u01
vendor: 4,121 bytes, line 34
347f]/g,ki=/($^)/,Aa=/['\n\r\u2028\u2029\\]/g,Ki="\\ud800-\\udfff",Ra="\\u0300-\\u036f",Ta="\\ufe20-\\ufe2f",Bi="\\u20d0-\\u20ff",Yn=Ra+Ta+Bi,Xn="\\u2700-\\u27bf",Or="a-z\\xdf-\\xf6\\xf8-\\xff",Na="\\xac\\xb1\\xd7\\xf7",$a="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Fa="\\u2000-\\u206f",Da=" \\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",Zn="A-Z\\xc0-\\xd6\\xd8-\\xde",es="\\ufe0e\\ufe0f",Si=Na+$a+Fa+Da,gn="['â]",Pi="["+Ki+"]",yn="["+Si+"]",Oi="["+Yn+"]",ts="\\d+",La="["+Xn+"]",rs="["+Or+"]",is="[^"+Ki+Si+ts+Xn+Or+Zn+"]",Vi="\\ud83c[\\udffb-\\udfff]",qa="(?:"+Oi+"|"+Vi+")",ns="[^"+Ki+"]",Gi="(?:\\ud83c[\\udde6-\\uddff]){2}",ci="[\\ud800-\\udbff][\\udc00-\\udfff]",lr="["+Zn+"]",ss="\\u200d",as="(?:"+rs+"|"+is+")",qr="(?:"+lr+"|"+is+")",os="(?:"+gn+"(?:d|ll|m|re|s|t|ve))?",cs="(?:"+gn+"(?:D|LL|M|RE|S|T|VE))?",us=qa+"?",hs="["+es+"]?",ja="(?:"+ss+"(?:"+[ns,Gi,ci].join("|")+")"+hs+us+")*",Vr="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",ls="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",fs=hs+us+ja,Wi="(?:"+[La,Gi,ci].join("|")+")"+fs,za="(?:"+[ns+Oi+"?",Oi,Gi,ci,Pi].join("|")+")",vn=RegExp(gn,"g"),Ma=RegExp(Oi,"g"),Ji=RegExp(Vi+"(?="+Vi+")|"+za+fs,"g"),ps=RegExp([lr+"?"+rs+"+"+os+"(?="+[yn,lr,"$"].join("|")+")",qr+"+"+cs+"(?="+[yn,lr+as,"$"].join("|")+")",lr+"?"+as+"+"+os,lr+"+"+cs,ls,Vr,ts,Wi].join("|"),"g"),ds=RegExp("["+ss+Ki+Yn+es+"]"),Ci=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,gs=["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"],Ua=-1,Ke={};Ke[ht]=Ke[qe]=Ke[St]=Ke[Ft]=Ke[Ut]=Ke[Ht]=Ke[qt]=Ke[Wt]=Ke[rr]=!0,Ke[_e]=Ke[It]=Ke[Ne]=Ke[T]=Ke[ke]=Ke[C]=Ke[E]=Ke[Z]=Ke[me]=Ke[Te]=Ke[xe]=Ke[st]=Ke[De]=Ke[Je]=Ke[Me]=!1;var Ue={};Ue[_e]=Ue[It]=Ue[Ne]=Ue[ke]=Ue[T]=Ue[C]=Ue[ht]=Ue[qe]=Ue[St]=Ue[Ft]=Ue[Ut]=Ue[me]=Ue[Te]=Ue[xe]=Ue[st]=Ue[De]=Ue[Je]=Ue[Qe]=Ue[Ht]=Ue[qt]=Ue[Wt]=Ue[rr]=!0,Ue[E]=Ue[Z]=Ue[Me]=!1;var v={Ã:"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"},I={"&":"&","<":"<",">":">",'"':""","'":"'"},M={"&":"&","<":"<",">":">",""":'"',"'":"'"},Q={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Be=parseFloat,de=parseInt,Xe=typeof Mn=="object"&&Mn&&Mn.Object===Object&&Mn,Tt=typeof self=="object"&&self&&self.Object===Object&&self,Pe=Xe||Tt||Function("return this")(),Ve=i&&!i.nodeType&&i,_t=Ve&&!0&&o&&!o.nodeType&&o,ir=_t&&_t.exports===Ve,Nt=ir&&Xe.process,Ze=function(){try{var x=_t&&_t.require&&_t.require("util").t
vendor: 12,673 bytes, line 34
34ypes;return x||Nt&&Nt.binding&&Nt.binding("util")}catch{}}(),Qt=Ze&&Ze.isArrayBuffer,Cr=Ze&&Ze.isDate,mr=Ze&&Ze.isMap,jr=Ze&&Ze.isRegExp,mn=Ze&&Ze.isSet,Ai=Ze&&Ze.isTypedArray;function jt(x,D,A){switch(A.length){case 0:return x.call(D);case 1:return x.call(D,A[0]);case 2:return x.call(D,A[0],A[1]);case 3:return x.call(D,A[0],A[1],A[2])}return x.apply(D,A)}function If(x,D,A,Y){for(var le=-1,Fe=x==null?0:x.length;++le<Fe;){var Dt=x[le];D(Y,Dt,A(Dt),x)}return Y}function wr(x,D){for(var A=-1,Y=x==null?0:x.length;++A<Y&&D(x[A],A,x)!==!1;);return x}function xf(x,D){for(var A=x==null?0:x.length;A--&&D(x[A],A,x)!==!1;);return x}function Lc(x,D){for(var A=-1,Y=x==null?0:x.length;++A<Y;)if(!D(x[A],A,x))return!1;return!0}function ui(x,D){for(var A=-1,Y=x==null?0:x.length,le=0,Fe=[];++A<Y;){var Dt=x[A];D(Dt,A,x)&&(Fe[le++]=Dt)}return Fe}function ys(x,D){var A=x==null?0:x.length;return!!A&&Qi(x,D,0)>-1}function Ha(x,D,A){for(var Y=-1,le=x==null?0:x.length;++Y<le;)if(A(D,x[Y]))return!0;return!1}function it(x,D){for(var A=-1,Y=x==null?0:x.length,le=Array(Y);++A<Y;)le[A]=D(x[A],A,x);return le}function hi(x,D){for(var A=-1,Y=D.length,le=x.length;++A<Y;)x[le+A]=D[A];return x}function ka(x,D,A,Y){var le=-1,Fe=x==null?0:x.length;for(Y&&Fe&&(A=x[++le]);++le<Fe;)A=D(A,x[le],le,x);return A}function Sf(x,D,A,Y){var le=x==null?0:x.length;for(Y&&le&&(A=x[--le]);le--;)A=D(A,x[le],le,x);return A}function Ka(x,D){for(var A=-1,Y=x==null?0:x.length;++A<Y;)if(D(x[A],A,x))return!0;return!1}var Pf=Ba("length");function Of(x){return x.split("")}function Cf(x){return x.match(Rt)||[]}function qc(x,D,A){var Y;return A(x,function(le,Fe,Dt){if(D(le,Fe,Dt))return Y=Fe,!1}),Y}function vs(x,D,A,Y){for(var le=x.length,Fe=A+(Y?1:-1);Y?Fe--:++Fe<le;)if(D(x[Fe],Fe,x))return Fe;return-1}function Qi(x,D,A){return D===D?Mf(x,D,A):vs(x,jc,A)}function Af(x,D,A,Y){for(var le=A-1,Fe=x.length;++le<Fe;)if(Y(x[le],D))return le;return-1}function jc(x){return x!==x}function zc(x,D){var A=x==null?0:x.length;return A?Ga(x,D)/A:k}function Ba(x){return function(D){return D==null?t:D[x]}}function Va(x){return function(D){return x==null?t:x[D]}}function Mc(x,D,A,Y,le){return le(x,function(Fe,Dt,Ge){A=Y?(Y=!1,Fe):D(A,Fe,Dt,Ge)}),A}function Rf(x,D){var A=x.length;for(x.sort(D);A--;)x[A]=x[A].value;return x}function Ga(x,D){for(var A,Y=-1,le=x.length;++Y<le;){var Fe=D(x[Y]);Fe!==t&&(A=A===t?Fe:A+Fe)}return A}function Wa(x,D){for(var A=-1,Y=Array(x);++A<x;)Y[A]=D(A);return Y}function Tf(x,D){return it(D,function(A){return[A,x[A]]})}function Uc(x){return x&&x.slice(0,Bc(x)+1).replace(gt,"")}function fr(x){return function(D){return x(D)}}function Ja(x,D){return it(D,function(A){return x[A]})}function wn(x,D){return x.has(D)}function Hc(x,D){for(var A=-1,Y=x.length;++A<Y&&Qi(D,x[A],0)>-1;);return A}function kc(x,D){for(var A=x.length;A--&&Qi(D,x[A],0)>-1;);return A}function Nf(x,D){for(var A=x.length,Y=0;A--;)x[A]===D&&++Y;return Y}var $f=Va(v),Ff=Va(I);function Df(x){return"\\"+Q[x]}function Lf(x,D){return x==null?t:x[D]}function Yi(x){return ds.test(x)}function qf(x){return Ci.test(x)}function jf(x){for(var D,A=[];!(D=x.next()).done;)A.push(D.value);return A}function Qa(x){var D=-1,A=Array(x.size);return x.forEach(function(Y,le){A[++D]=[le,Y]}),A}function Kc(x,D){return function(A){return x(D(A))}}function li(x,D){for(var A=-1,Y=x.length,le=0,Fe=[];++A<Y;){var Dt=x[A];(Dt===D||Dt===_)&&(x[A]=_,Fe[le++]=A)}return Fe}function ms(x){var D=-1,A=Array(x.size);return x.forEach(function(Y){A[++D]=Y}),A}function zf(x){var D=-1,A=Array(x.size);return x.forEach(function(Y){A[++D]=[Y,Y]}),A}function Mf(x,D,A){for(var Y=A-1,le=x.length;++Y<le;)if(x[Y]===D)return Y;return-1}function Uf(x,D,A){for(var Y=A+1;Y--;)if(x[Y]===D)return Y;return Y}function Xi(x){return Yi(x)?kf(x):Pf(x)}function Ar(x){return Yi(x)?Kf(x):Of(x)}function Bc(x){for(var D=x.length;D--&&wt.test(x.charAt(D)););return D}var Hf=Va(M);function kf(x){for(var D=Ji.lastIndex=0;Ji.test(x);)++D;return D}function Kf(x){return x.match(Ji)||[]}function Bf(x){return x.match(ps)||[]}var Vf=function x(D){D=D==null?Pe:Zi.defaults(Pe.Object(),D,Zi.pick(Pe,gs));var A=D.Array,Y=D.Date,le=D.Error,Fe=D.Function,Dt=D.Math,Ge=D.Object,Ya=D.RegExp,Gf=D.String,_r=D.TypeError,ws=A.prototype,Wf=Fe.prototype,en=Ge.prototype,_s=D["__core-js_shared__"],bs=Wf.toString,je=en.hasOwnProperty,Jf=0,Vc=function(){var e=/[^.]+$/.exec(_s&&_s.keys&&_s.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Es=en.toString,Qf=bs.call(Ge),Yf=Pe._,Xf=Ya("^"+bs.call(je).replace(dt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Is=ir?D.Buffer:t,fi=D.Symbol,xs=D.Uint8Array,Gc=Is?Is.allocUnsafe:t,Ss=Kc(Ge.getPrototypeOf,Ge),Wc=Ge.create,Jc=en.propertyIsEnumerable,Ps=ws.splice,Qc=fi?fi.isConcatSpreadable:t,_n=fi?fi.iterator:t,Ri=fi?fi.toStringTag:t,Os=function(){try{var e=Di(Ge,"defineProperty");return e({},"",{}),e}catch{}}(),Zf=D.clearTimeout!==Pe.clearTimeout&&D.clearTimeout,ep=Y&&Y.now!==Pe.Date.now&&Y.now,tp=D.setTimeout!==Pe.setTimeout&&D.setTimeout,Cs=Dt.ceil,As=Dt.floor,Xa=Ge.getOwnPropertySymbols,rp=Is?Is.isBuffer:t,Yc=D.isFinite,ip=ws.join,np=Kc(Ge.keys,Ge),Lt=Dt.max,Bt=Dt.min,sp=Y.now,ap=D.parseInt,Xc=Dt.random,op=ws.reverse,Za=Di(D,"DataView"),bn=Di(D,"Map"),eo=Di(D,"Promise"),tn=Di(D,"Set"),En=Di(D,"WeakMap"),In=Di(Ge,"create"),Rs=En&&new En,rn={},cp=Li(Za),up=Li(bn),hp=Li(eo),lp=Li(tn),fp=Li(En),Ts=fi?fi.prototype:t,xn=Ts?Ts.valueOf:t,Zc=Ts?Ts.toString:t;function p(e){if(vt(e)&&!ge(e)&&!(e instanceof Se)){if(e instanceof br)return e;if(je.call(e,"__wrapped__"))return eh(e)}return new br(e)}var nn=function(){function e(){}return function(r){if(!ct(r))return{};if(Wc)return Wc(r);e.prototype=r;var s=new e;return e.prototype=t,s}}();function Ns(){}function br(e,r){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!r,this.__index__=0,this.__values__=t}p.templateSettings={escape:ft,evaluate:pt,interpolate:ot,variable:"",imports:{_:p}},p.prototype=Ns.prototype,p.prototype.constructor=p,br.prototype=nn(Ns.prototype),br.prototype.constructor=br;function Se(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=V,this.__views__=[]}function pp(){var e=new Se(this.__wrapped__);return e.__actions__=nr(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=nr(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=nr(this.__views__),e}function dp(){if(this.__filtered__){var e=new Se(this);e.__dir__=-1,e.__filtered__=!0}else e=this.clone(),e.__dir__*=-1;return e}function gp(){var e=this.__wrapped__.value(),r=this.__dir__,s=ge(e),c=r<0,l=s?e.length:0,g=Od(0,l,this.__views__),m=g.start,b=g.end,S=b-m,q=c?b:m-1,j=this.__iteratees__,U=j.length,G=0,ee=Bt(S,this.__takeCount__);if(!s||!c&&l==S&&ee==S)return Iu(e,this.__actions__);var se=[];e:for(;S--&&G<ee;){q+=r;for(var we=-1,ae=e[q];++we<U;){var Ie=j[we],Oe=Ie.iteratee,gr=Ie.type,Zt=Oe(ae);if(gr==z)ae=Zt;else if(!Zt){if(gr==R)continue e;break e}}se[G++]=ae}return se}Se.prototype=nn(Ns.prototype),Se.prototype.constructor=Se;function Ti(e){var r=-1,s=e==null?0:e.length;for(this.clear();++r<s;){var c=e[r];this.set(c[0],c[1])}}function yp(){this.__data__=In?In(null):{},this.size=0}function vp(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r}function mp(e){var r=this.__data__;if(In){var s=r[e];return s===w?t:s}return je.call(r,e)?r[e]:t}function wp(e){var r=this.__data__;return In?r[e]!==t:je.call(r,e)}function _p(e,r){var s=this.__data__;return this.size+=this.has(e)?0:1,s[e]=In&&r===t?w:r,this}Ti.prototype.clear=yp,Ti.prototype.delete=vp,Ti.prototype.get=mp,Ti.prototype.has=wp,Ti.prototype.set=_p;function Gr(e){var r=-1,s=e==null?0:e.length;for(this.clear();++r<s;){var c=e[r];this.set(c[0],c[1])}}function bp(){this.__data__=[],this.size=0}function Ep(e){var r=this.__data__,s=$s(r,e);if(s<0)return!1;var c=r.length-1;return s==c?r.pop():Ps.call(r,s,1),--this.size,!0}function Ip(e){var r=this.__data__,s=$s(r,e);return s<0?t:r[s][1]}function xp(e){return $s(this.__data__,e)>-1}function Sp(e,r){var s=this.__data__,c=$s(s,e);return c<0?(++this.size,s.push([e,r])):s[c][1]=r,this}Gr.prototype.clear=bp,Gr.prototype.delete=Ep,Gr.prototype.get=Ip,Gr.prototype.has=xp,Gr.prototype.set=Sp;function Wr(e){var r=-1,s=e==null?0:e.length;for(this.clear();++r<s;){var c=e[r];this.set(c[0],c[1])}}function Pp(){this.size=0,this.__data__={hash:new Ti,map:new(bn||Gr),string:new Ti}}function Op(e){var r=Bs(this,e).delete(e);return this.size-=r?1:0,r}function Cp(e){return Bs(this,e).get(e)}function Ap(e){return Bs(this,e).has(e)}function Rp(e,r){var s=Bs(this,e),c=s.size;return s.set(e,r),this.size+=s.size==c?0:1,this}Wr.prototype.clear=Pp,Wr.prototype.delete=Op,Wr.prototype.get=Cp,Wr.prototype.has=Ap,Wr.prototype.set=Rp;function Ni(e){var r=-1,s=e==null?0:e.length;for(this.__data__=new Wr;++r<s;)this.add(e[r])}function Tp(e){return this.__data__.set(e,w),this}function Np(e){return this.__data__.has(e)}Ni.prototype.add=Ni.prototype.push=Tp,Ni.prototype.has=Np;function Rr(e){var r=this.__data__=new Gr(e);this.size=r.size}function $p(){this.__data__=new Gr,this.size=0}function Fp(e){var r=this.__data__,s=r.delete(e);return this.size=r.size,s}function Dp(e){return this.__data__.get(e)}function Lp(e){return this.__data__.has(e)}function qp(e,r){var s=this.__data__;if(s instanceof Gr){var c=s.__data__;if(!bn||c.length<a-1)return c.push([e,r]),this.size=++s.size,this;s=this.__data__=new Wr(c)}return s.set(e,r),this.size=s.size,this}Rr.prototype.clear=$p,Rr.prototype.delete=Fp,Rr.prototype.get=Dp,Rr.prototype.has=Lp,Rr.prototype.set=qp;function eu(e,r){var s=ge(e),c=!s&&qi(e),l=!s&&!c&&vi(e),g=!s&&!c&&!l&&cn(e),m=s||c||l||g,b=m?Wa(e.length,Gf):[],S=b.length;for(var q in e)(r||je.call(e,q))&&!(m&&(q=="length"||l&&(q=="offset"||q=="parent")||g&&(q=="buffer"||q=="byteLength"||q=="byteOffset")||Xr(q,S)))&&b.push(q);return b}function tu(e){var r=e.length;return r?e[lo(0,r-1)]:t}function jp(e,r){return Vs(nr(e),$i(r,0,e.length))}function zp(e){return Vs(nr(e))}function to(e,r,s){(s!==t&&!Tr(e[r],s)||s===t&&!(r in e))&&Jr(e,r,s)}function Sn(e,r,s){var c=e[r];(!(je.call(e,r)&&Tr(c,s))||s===t&&!(r in e))&&Jr(e,r,s)}function $s(e,r){for(var s=e.length;s--;)if(Tr(e[s][0],r))return s;return-1}function Mp(e,r,s,c){return pi(e,function(l,g,m){r(c,l,s(l),m)}),c}function ru(e,r){return e&&Mr(r,zt(r),e)}function Up(e,r){return e&&Mr(r,ar(r),e)}function Jr(e,r,s){r=="__proto__"&&Os?Os(e,r,{configurable:!0,enumerable:!0,value:s,writable:!0}):e[r]=s}function ro(e,r){for(var s=-1,c=r.length,l=A(c),g=e==null;++s<c;)l[s]=g?t:qo(e,r[s]);return l}function $i(e,r,s){return e===e&&(s!==t&&(e=e<=s?e:s),r!==t&&(e=e>=r?e:r)),e}function Er(e,r,s,c,l,g){var m,b=r&O,S=r&P,q=r&L;if(s&&(m=l?s(e,c,l,g):s(e)),m!==t)return m;if(!ct(e))return e;var j=ge(e);if(j){if(m=Ad(e),!b)return nr(e,m)}else{var U=Vt(e),G=U==Z||U==oe;if(vi(e))return Pu(e,b);if(U==xe||U==_e||G&&!l){if(m=S||G?{}:Bu(e),!b)return S?md(e,Up(m,e)):vd(e,ru(m,e))}else{if(!Ue[U])return l?e:{};m=Rd(e,U,b)}}g||(g=new Rr);var ee=g.get(e);if(ee)return ee;g.set(e,m),_h(e)?e.forEach(function(ae){m.add(Er(ae,r,s,ae,e,g))}):mh(e)&&e.forEach(function(ae,Ie){m.set(Ie,Er(ae,r,s,Ie,e,g))});var se=q?S?Io:Eo:S?ar:zt,we=j?t:se(e);return wr(we||e,function(ae,Ie){we&&(Ie=ae,ae=e[Ie]),Sn(m,Ie,Er(ae,r,s,Ie,e,g))}),m}function Hp(e){var r=zt(e);return function(s){return iu(s,e,r)}}function iu(e,r,s){var c=s.length;if(e==null)return!c;for(e=Ge(e);c--;){var l=s[c],g=r[l],m=e[l];if(m===t&&!(l in e)||!g(m))return!1}return!0}function nu(e,r,s){if(typeof e!="function")throw new _r(f);return Nn(function(){e.apply(t,s)},r)}function Pn(e,r,s,c){var l=-1,g=ys,m=!0,b=e.length,S=[],q=r.length;if(!b)return S;s&&(r=it(r,fr(s))),c?(g=Ha,m=!1):r.length>=a&&(g=wn,m=!1,r=new Ni(r));e:for(;++l<b;){var j=e[l],U=s==null?j:s(j);if(j=c||j!==0?j:0,m&&U===U){for(var G=q;G--;)if(r[G]===U)continue e;S.push(j)}else g(r,U,c)||S.push(j)}return S}var pi=Tu(zr),su=Tu(no,!0);function kp(e,r){var s=!0;return pi(e,function(c,l,g){return s=!!r(c,l,g),s}),s}function Fs(e,r,s){for(var c=-1,l=e.length;++c<l;){var g=e[c],m=r(g);if(m!=null&&(b===t?m===m&&!dr(m):s(m,b)))var b=m,S=g}return S}function Kp(e,r,s,c){var l=e.length;for(s=ve(s),s<0&&(s=-s>l?0:l+s),c=c===t||c>l?l:ve(c),c<0&&(c+=l),c=s>c?0:Eh(c);s<c;)e[s++]=r;return e}function au(e,r){var s=[];return pi(e,function(c,l,g){r(c,l,g)&&s.push(c)}),s}function kt(e,r,s,c,l){var g=-1,m=e.length;for(s||(s=Nd),l||(l=[]);++g<m;){var b=e[g];r>0&&s(b)?r>1?kt(b,r-1,s,c,l):hi(l,b):c||(l[l.length]=b)}return l}var io=Nu(),ou=Nu(!0);function zr(e,r){return e&&io(e,r,zt)}function no(e,r){return e&&ou(e,r,zt)}
vendor: 1,563 bytes, line 34
34function Ds(e,r){return ui(r,function(s){return Zr(e[s])})}function Fi(e,r){r=gi(r,e);for(var s=0,c=r.length;e!=null&&s<c;)e=e[Ur(r[s++])];return s&&s==c?e:t}function cu(e,r,s){var c=r(e);return ge(e)?c:hi(c,s(e))}function Yt(e){return e==null?e===t?at:$e:Ri&&Ri in Ge(e)?Pd(e):zd(e)}function so(e,r){return e>r}function Bp(e,r){return e!=null&&je.call(e,r)}function Vp(e,r){return e!=null&&r in Ge(e)}function Gp(e,r,s){return e>=Bt(r,s)&&e<Lt(r,s)}function ao(e,r,s){for(var c=s?Ha:ys,l=e[0].length,g=e.length,m=g,b=A(g),S=1/0,q=[];m--;){var j=e[m];m&&r&&(j=it(j,fr(r))),S=Bt(j.length,S),b[m]=!s&&(r||l>=120&&j.length>=120)?new Ni(m&&j):t}j=e[0];var U=-1,G=b[0];e:for(;++U<l&&q.length<S;){var ee=j[U],se=r?r(ee):ee;if(ee=s||ee!==0?ee:0,!(G?wn(G,se):c(q,se,s))){for(m=g;--m;){var we=b[m];if(!(we?wn(we,se):c(e[m],se,s)))continue e}G&&G.push(se),q.push(ee)}}return q}function Wp(e,r,s,c){return zr(e,function(l,g,m){r(c,s(l),g,m)}),c}function On(e,r,s){r=gi(r,e),e=Ju(e,r);var c=e==null?e:e[Ur(xr(r))];return c==null?t:jt(c,e,s)}function uu(e){return vt(e)&&Yt(e)==_e}function Jp(e){return vt(e)&&Yt(e)==Ne}function Qp(e){return vt(e)&&Yt(e)==C}function Cn(e,r,s,c,l){return e===r?!0:e==null||r==null||!vt(e)&&!vt(r)?e!==e&&r!==r:Yp(e,r,s,c,Cn,l)}function Yp(e,r,s,c,l,g){var m=ge(e),b=ge(r),S=m?It:Vt(e),q=b?It:Vt(r);S=S==_e?xe:S,q=q==_e?xe:q;var j=S==xe,U=q==xe,G=S==q;if(G&&vi(e)){if(!vi(r))return!1;m=!0,j=!1}if(G&&!j)return g||(g=new Rr),m||cn(e)?Hu(e,r,s,c,l,g):xd(e,r,S,s,c,l,g);if(!(s&N)){var ee=j&&je.call(e,"__wrapped__"),se=U&&je.call(r,"__wrapped__");
vendor: 5,645 bytes, line 34
34if(ee||se){var we=ee?e.value():e,ae=se?r.value():r;return g||(g=new Rr),l(we,ae,s,c,g)}}return G?(g||(g=new Rr),Sd(e,r,s,c,l,g)):!1}function Xp(e){return vt(e)&&Vt(e)==me}function oo(e,r,s,c){var l=s.length,g=l,m=!c;if(e==null)return!g;for(e=Ge(e);l--;){var b=s[l];if(m&&b[2]?b[1]!==e[b[0]]:!(b[0]in e))return!1}for(;++l<g;){b=s[l];var S=b[0],q=e[S],j=b[1];if(m&&b[2]){if(q===t&&!(S in e))return!1}else{var U=new Rr;if(c)var G=c(q,j,S,e,r,U);if(!(G===t?Cn(j,q,N|K,c,U):G))return!1}}return!0}function hu(e){if(!ct(e)||Fd(e))return!1;var r=Zr(e)?Xf:Pa;return r.test(Li(e))}function Zp(e){return vt(e)&&Yt(e)==st}function ed(e){return vt(e)&&Vt(e)==De}function td(e){return vt(e)&&Xs(e.length)&&!!Ke[Yt(e)]}function lu(e){return typeof e=="function"?e:e==null?or:typeof e=="object"?ge(e)?du(e[0],e[1]):pu(e):$h(e)}function co(e){if(!Tn(e))return np(e);var r=[];for(var s in Ge(e))je.call(e,s)&&s!="constructor"&&r.push(s);return r}function rd(e){if(!ct(e))return jd(e);var r=Tn(e),s=[];for(var c in e)c=="constructor"&&(r||!je.call(e,c))||s.push(c);return s}function uo(e,r){return e<r}function fu(e,r){var s=-1,c=sr(e)?A(e.length):[];return pi(e,function(l,g,m){c[++s]=r(l,g,m)}),c}function pu(e){var r=So(e);return r.length==1&&r[0][2]?Gu(r[0][0],r[0][1]):function(s){return s===e||oo(s,e,r)}}function du(e,r){return Oo(e)&&Vu(r)?Gu(Ur(e),r):function(s){var c=qo(s,e);return c===t&&c===r?jo(s,e):Cn(r,c,N|K)}}function Ls(e,r,s,c,l){e!==r&&io(r,function(g,m){if(l||(l=new Rr),ct(g))id(e,r,m,s,Ls,c,l);else{var b=c?c(Ao(e,m),g,m+"",e,r,l):t;b===t&&(b=g),to(e,m,b)}},ar)}function id(e,r,s,c,l,g,m){var b=Ao(e,s),S=Ao(r,s),q=m.get(S);if(q){to(e,s,q);return}var j=g?g(b,S,s+"",e,r,m):t,U=j===t;if(U){var G=ge(S),ee=!G&&vi(S),se=!G&&!ee&&cn(S);j=S,G||ee||se?ge(b)?j=b:bt(b)?j=nr(b):ee?(U=!1,j=Pu(S,!0)):se?(U=!1,j=Ou(S,!0)):j=[]:$n(S)||qi(S)?(j=b,qi(b)?j=Ih(b):(!ct(b)||Zr(b))&&(j=Bu(S))):U=!1}U&&(m.set(S,j),l(j,S,c,g,m),m.delete(S)),to(e,s,j)}function gu(e,r){var s=e.length;if(s)return r+=r<0?s:0,Xr(r,s)?e[r]:t}function yu(e,r,s){r.length?r=it(r,function(g){return ge(g)?function(m){return Fi(m,g.length===1?g[0]:g)}:g}):r=[or];var c=-1;r=it(r,fr(ne()));var l=fu(e,function(g,m,b){var S=it(r,function(q){return q(g)});return{criteria:S,index:++c,value:g}});return Rf(l,function(g,m){return yd(g,m,s)})}function nd(e,r){return vu(e,r,function(s,c){return jo(e,c)})}function vu(e,r,s){for(var c=-1,l=r.length,g={};++c<l;){var m=r[c],b=Fi(e,m);s(b,m)&&An(g,gi(m,e),b)}return g}function sd(e){return function(r){return Fi(r,e)}}function ho(e,r,s,c){var l=c?Af:Qi,g=-1,m=r.length,b=e;for(e===r&&(r=nr(r)),s&&(b=it(e,fr(s)));++g<m;)for(var S=0,q=r[g],j=s?s(q):q;(S=l(b,j,S,c))>-1;)b!==e&&Ps.call(b,S,1),Ps.call(e,S,1);return e}function mu(e,r){for(var s=e?r.length:0,c=s-1;s--;){var l=r[s];if(s==c||l!==g){var g=l;Xr(l)?Ps.call(e,l,1):go(e,l)}}return e}function lo(e,r){return e+As(Xc()*(r-e+1))}function ad(e,r,s,c){for(var l=-1,g=Lt(Cs((r-e)/(s||1)),0),m=A(g);g--;)m[c?g:++l]=e,e+=s;return m}function fo(e,r){var s="";if(!e||r<1||r>J)return s;do r%2&&(s+=e),r=As(r/2),r&&(e+=e);while(r);return s}function be(e,r){return Ro(Wu(e,r,or),e+"")}function od(e){return tu(un(e))}function cd(e,r){var s=un(e);return Vs(s,$i(r,0,s.length))}function An(e,r,s,c){if(!ct(e))return e;r=gi(r,e);for(var l=-1,g=r.length,m=g-1,b=e;b!=null&&++l<g;){var S=Ur(r[l]),q=s;if(S==="__proto__"||S==="constructor"||S==="prototype")return e;if(l!=m){var j=b[S];q=c?c(j,S,b):t,q===t&&(q=ct(j)?j:Xr(r[l+1])?[]:{})}Sn(b,S,q),b=b[S]}return e}var wu=Rs?function(e,r){return Rs.set(e,r),e}:or,ud=Os?function(e,r){return Os(e,"toString",{configurable:!0,enumerable:!1,value:Mo(r),writable:!0})}:or;function hd(e){return Vs(un(e))}function Ir(e,r,s){var c=-1,l=e.length;r<0&&(r=-r>l?0:l+r),s=s>l?l:s,s<0&&(s+=l),l=r>s?0:s-r>>>0,r>>>=0;for(var g=A(l);++c<l;)g[c]=e[c+r];return g}function ld(e,r){var s;return pi(e,function(c,l,g){return s=r(c,l,g),!s}),!!s}function qs(e,r,s){var c=0,l=e==null?c:e.length;if(typeof r=="number"&&r===r&&l<=He){for(;c<l;){var g=c+l>>>1,m=e[g];m!==null&&!dr(m)&&(s?m<=r:m<r)?c=g+1:l=g}return l}return po(e,r,or,s)}function po(e,r,s,c){var l=0,g=e==null?0:e.length;if(g===0)return 0;r=s(r);for(var m=r!==r,b=r===null,S=dr(r),q=r===t;l<g;){var j=As((l+g)/2),U=s(e[j]),G=U!==t,ee=U===null,se=U===U,we=dr(U);if(m)var ae=c||se;else q?ae=se&&(c||G):b?ae=se&&G&&(c||!ee):S?ae=se&&G&&!ee&&(c||!we):ee||we?ae=!1:ae=c?U<=r:U<r;ae?l=j+1:g=j}return Bt(g,ut)}function _u(e,r){for(var s=-1,c=e.length,l=0,g=[];++s<c;){var m=e[s],b=r?r(m):m;if(!s||!Tr(b,S)){var S=b;g[l++]=m===0?0:m}}return g}function bu(e){return typeof e=="number"?e:dr(e)?k:+e}function pr(e){if(typeof e=="string")return e;if(ge(e))return it(e,pr)+"";if(dr(e))return Zc?Zc.call(e):"";var r=e+"";return r=="0"&&1/e==-Re?"-0":r}function di(e,r,s){var c=-1,l=ys,g=e.length,m=!0,b=[],S=b;if(s)m=!1,l=Ha;else if(g>=a){var q=r?null:Ed(e);if(q)return ms(q);m=!1,l=wn,S=new Ni}else S=r?[]:b;e:for(;++c<g;){var j=e[c],U=r?r(j):j;if(j=s||j!==0?j:0,m&&U===U){for(var G=S.length;G--;)if(S[G]===U)continue e;r&&S.push(U),b.push(j)}else l(S,U,s)||(S!==b&&S.push(U),b.push(j))}return b}function go(e,r){return r=gi(r,e),e=Ju(e,r),e==null||delete e[Ur(xr(r))]}function Eu(e,r,s,c){return An(e,r,s(Fi(e,r)),c)}function js(e,r,s,c){for(var l=e.length,g=c?l:-1;(c?g--:++g<l)&&r(e[g],g,e););return s?Ir(e,c?0:g,c?g+1:l):Ir(e,c?g+1:0,c?l:g)}function Iu(e,r){var s=e;return s instanceof Se&&(s=s.value()),ka(r,function(c,l){return l.func.apply(l.thisArg,hi([c],l.args))},s)}function yo(e,r,s){var c=e.length;if(c<2)return c?di(e[0]):[];for(var l=-1,g=A(c);++l<c;)for(var m=e[l],b=-1;++b<c;)b!=l&&(g[l]=Pn(g[l]||m,e[b],r,s));
vendor: 4,320 bytes, line 34
34return di(kt(g,1),r,s)}function xu(e,r,s){for(var c=-1,l=e.length,g=r.length,m={};++c<l;){var b=c<g?r[c]:t;s(m,e[c],b)}return m}function vo(e){return bt(e)?e:[]}function mo(e){return typeof e=="function"?e:or}function gi(e,r){return ge(e)?e:Oo(e,r)?[e]:Zu(Le(e))}var fd=be;function yi(e,r,s){var c=e.length;return s=s===t?c:s,!r&&s>=c?e:Ir(e,r,s)}var Su=Zf||function(e){return Pe.clearTimeout(e)};function Pu(e,r){if(r)return e.slice();var s=e.length,c=Gc?Gc(s):new e.constructor(s);return e.copy(c),c}function wo(e){var r=new e.constructor(e.byteLength);return new xs(r).set(new xs(e)),r}function pd(e,r){var s=r?wo(e.buffer):e.buffer;return new e.constructor(s,e.byteOffset,e.byteLength)}function dd(e){var r=new e.constructor(e.source,vr.exec(e));return r.lastIndex=e.lastIndex,r}function gd(e){return xn?Ge(xn.call(e)):{}}function Ou(e,r){var s=r?wo(e.buffer):e.buffer;return new e.constructor(s,e.byteOffset,e.length)}function Cu(e,r){if(e!==r){var s=e!==t,c=e===null,l=e===e,g=dr(e),m=r!==t,b=r===null,S=r===r,q=dr(r);if(!b&&!q&&!g&&e>r||g&&m&&S&&!b&&!q||c&&m&&S||!s&&S||!l)return 1;if(!c&&!g&&!q&&e<r||q&&s&&l&&!c&&!g||b&&s&&l||!m&&l||!S)return-1}return 0}function yd(e,r,s){for(var c=-1,l=e.criteria,g=r.criteria,m=l.length,b=s.length;++c<m;){var S=Cu(l[c],g[c]);if(S){if(c>=b)return S;var q=s[c];return S*(q=="desc"?-1:1)}}return e.index-r.index}function Au(e,r,s,c){for(var l=-1,g=e.length,m=s.length,b=-1,S=r.length,q=Lt(g-m,0),j=A(S+q),U=!c;++b<S;)j[b]=r[b];for(;++l<m;)(U||l<g)&&(j[s[l]]=e[l]);for(;q--;)j[b++]=e[l++];return j}function Ru(e,r,s,c){for(var l=-1,g=e.length,m=-1,b=s.length,S=-1,q=r.length,j=Lt(g-b,0),U=A(j+q),G=!c;++l<j;)U[l]=e[l];for(var ee=l;++S<q;)U[ee+S]=r[S];for(;++m<b;)(G||l<g)&&(U[ee+s[m]]=e[l++]);return U}function nr(e,r){var s=-1,c=e.length;for(r||(r=A(c));++s<c;)r[s]=e[s];return r}function Mr(e,r,s,c){var l=!s;s||(s={});for(var g=-1,m=r.length;++g<m;){var b=r[g],S=c?c(s[b],e[b],b,s,e):t;S===t&&(S=e[b]),l?Jr(s,b,S):Sn(s,b,S)}return s}function vd(e,r){return Mr(e,Po(e),r)}function md(e,r){return Mr(e,ku(e),r)}function zs(e,r){return function(s,c){var l=ge(s)?If:Mp,g=r?r():{};return l(s,e,ne(c,2),g)}}function sn(e){return be(function(r,s){var c=-1,l=s.length,g=l>1?s[l-1]:t,m=l>2?s[2]:t;for(g=e.length>3&&typeof g=="function"?(l--,g):t,m&&Xt(s[0],s[1],m)&&(g=l<3?t:g,l=1),r=Ge(r);++c<l;){var b=s[c];b&&e(r,b,c,g)}return r})}function Tu(e,r){return function(s,c){if(s==null)return s;if(!sr(s))return e(s,c);for(var l=s.length,g=r?l:-1,m=Ge(s);(r?g--:++g<l)&&c(m[g],g,m)!==!1;);return s}}function Nu(e){return function(r,s,c){for(var l=-1,g=Ge(r),m=c(r),b=m.length;b--;){var S=m[e?b:++l];if(s(g[S],S,g)===!1)break}return r}}function wd(e,r,s){var c=r&re,l=Rn(e);function g(){var m=this&&this!==Pe&&this instanceof g?l:e;return m.apply(c?s:this,arguments)}return g}function $u(e){return function(r){r=Le(r);var s=Yi(r)?Ar(r):t,c=s?s[0]:r.charAt(0),l=s?yi(s,1).join(""):r.slice(1);return c[e]()+l}}function an(e){return function(r){return ka(Th(Rh(r).replace(vn,"")),e,"")}}function Rn(e){return function(){var r=arguments;switch(r.length){case 0:return new e;case 1:return new e(r[0]);case 2:return new e(r[0],r[1]);case 3:return new e(r[0],r[1],r[2]);case 4:return new e(r[0],r[1],r[2],r[3]);case 5:return new e(r[0],r[1],r[2],r[3],r[4]);case 6:return new e(r[0],r[1],r[2],r[3],r[4],r[5]);case 7:return new e(r[0],r[1],r[2],r[3],r[4],r[5],r[6])}var s=nn(e.prototype),c=e.apply(s,r);return ct(c)?c:s}}function _d(e,r,s){var c=Rn(e);function l(){for(var g=arguments.length,m=A(g),b=g,S=on(l);b--;)m[b]=arguments[b];var q=g<3&&m[0]!==S&&m[g-1]!==S?[]:li(m,S);if(g-=q.length,g<s)return ju(e,r,Ms,l.placeholder,t,m,q,t,t,s-g);var j=this&&this!==Pe&&this instanceof l?c:e;return jt(j,this,m)}return l}function Fu(e){return function(r,s,c){var l=Ge(r);if(!sr(r)){var g=ne(s,3);r=zt(r),s=function(b){return g(l[b],b,l)}}var m=e(r,s,c);return m>-1?l[g?r[m]:m]:t}}function Du(e){return Yr(function(r){var s=r.length,c=s,l=br.prototype.thru;for(e&&r.reverse();c--;){var g=r[c];if(typeof g!="function")throw new _r(f);if(l&&!m&&Ks(g)=="wrapper")var m=new br([],!0)}for(c=m?c:s;++c<s;){g=r[c];var b=Ks(g),S=b=="wrapper"?xo(g):t;S&&Co(S[0])&&S[1]==(H|he|pe|W)&&!S[4].length&&S[9]==1?m=m[Ks(S[0])].apply(m,S[3]):m=g.length==1&&Co(g)?m[b]():m.thru(g)}return function(){var q=arguments,j=q[0];
vendor: 29,763 bytes, lines 34-36
34if(m&&q.length==1&&ge(j))return m.plant(j).value();for(var U=0,G=s?r[U].apply(this,q):j;++U<s;)G=r[U].call(this,G);return G}})}function Ms(e,r,s,c,l,g,m,b,S,q){var j=r&H,U=r&re,G=r&ce,ee=r&(he|fe),se=r&ye,we=G?t:Rn(e);function ae(){for(var Ie=arguments.length,Oe=A(Ie),gr=Ie;gr--;)Oe[gr]=arguments[gr];if(ee)var Zt=on(ae),yr=Nf(Oe,Zt);if(c&&(Oe=Au(Oe,c,l,ee)),g&&(Oe=Ru(Oe,g,m,ee)),Ie-=yr,ee&&Ie<q){var Et=li(Oe,Zt);return ju(e,r,Ms,ae.placeholder,s,Oe,Et,b,S,q-Ie)}var Nr=U?s:this,ti=G?Nr[e]:e;return Ie=Oe.length,b?Oe=Md(Oe,b):se&&Ie>1&&Oe.reverse(),j&&S<Ie&&(Oe.length=S),this&&this!==Pe&&this instanceof ae&&(ti=we||Rn(ti)),ti.apply(Nr,Oe)}return ae}function Lu(e,r){return function(s,c){return Wp(s,e,r(c),{})}}function Us(e,r){return function(s,c){var l;if(s===t&&c===t)return r;if(s!==t&&(l=s),c!==t){if(l===t)return c;typeof s=="string"||typeof c=="string"?(s=pr(s),c=pr(c)):(s=bu(s),c=bu(c)),l=e(s,c)}return l}}function _o(e){return Yr(function(r){return r=it(r,fr(ne())),be(function(s){var c=this;return e(r,function(l){return jt(l,c,s)})})})}function Hs(e,r){r=r===t?" ":pr(r);var s=r.length;if(s<2)return s?fo(r,e):r;var c=fo(r,Cs(e/Xi(r)));return Yi(r)?yi(Ar(c),0,e).join(""):c.slice(0,e)}function bd(e,r,s,c){var l=r&re,g=Rn(e);function m(){for(var b=-1,S=arguments.length,q=-1,j=c.length,U=A(j+S),G=this&&this!==Pe&&this instanceof m?g:e;++q<j;)U[q]=c[q];for(;S--;)U[q++]=arguments[++b];return jt(G,l?s:this,U)}return m}function qu(e){return function(r,s,c){return c&&typeof c!="number"&&Xt(r,s,c)&&(s=c=t),r=ei(r),s===t?(s=r,r=0):s=ei(s),c=c===t?r<s?1:-1:ei(c),ad(r,s,c,e)}}function ks(e){return function(r,s){return typeof r=="string"&&typeof s=="string"||(r=Sr(r),s=Sr(s)),e(r,s)}}function ju(e,r,s,c,l,g,m,b,S,q){var j=r&he,U=j?m:t,G=j?t:m,ee=j?g:t,se=j?t:g;r|=j?pe:F,r&=~(j?F:pe),r&ue||(r&=~(re|ce));var we=[e,r,l,ee,U,se,G,b,S,q],ae=s.apply(t,we);return Co(e)&&Qu(ae,we),ae.placeholder=c,Yu(ae,e,r)}function bo(e){var r=Dt[e];return function(s,c){if(s=Sr(s),c=c==null?0:Bt(ve(c),292),c&&Yc(s)){var l=(Le(s)+"e").split("e"),g=r(l[0]+"e"+(+l[1]+c));return l=(Le(g)+"e").split("e"),+(l[0]+"e"+(+l[1]-c))}return r(s)}}var Ed=tn&&1/ms(new tn([,-0]))[1]==Re?function(e){return new tn(e)}:ko;function zu(e){return function(r){var s=Vt(r);return s==me?Qa(r):s==De?zf(r):Tf(r,e(r))}}function Qr(e,r,s,c,l,g,m,b){var S=r&ce;if(!S&&typeof e!="function")throw new _r(f);var q=c?c.length:0;if(q||(r&=~(pe|F),c=l=t),m=m===t?m:Lt(ve(m),0),b=b===t?b:ve(b),q-=l?l.length:0,r&F){var j=c,U=l;c=l=t}var G=S?t:xo(e),ee=[e,r,s,c,l,j,U,g,m,b];if(G&&qd(ee,G),e=ee[0],r=ee[1],s=ee[2],c=ee[3],l=ee[4],b=ee[9]=ee[9]===t?S?0:e.length:Lt(ee[9]-q,0),!b&&r&(he|fe)&&(r&=~(he|fe)),!r||r==re)var se=wd(e,r,s);else r==he||r==fe?se=_d(e,r,b):(r==pe||r==(re|pe))&&!l.length?se=bd(e,r,s,c):se=Ms.apply(t,ee);var we=G?wu:Qu;return Yu(we(se,ee),e,r)}function Mu(e,r,s,c){return e===t||Tr(e,en[s])&&!je.call(c,s)?r:e}function Uu(e,r,s,c,l,g){return ct(e)&&ct(r)&&(g.set(r,e),Ls(e,r,t,Uu,g),g.delete(r)),e}function Id(e){return $n(e)?t:e}function Hu(e,r,s,c,l,g){var m=s&N,b=e.length,S=r.length;if(b!=S&&!(m&&S>b))return!1;var q=g.get(e),j=g.get(r);if(q&&j)return q==r&&j==e;var U=-1,G=!0,ee=s&K?new Ni:t;for(g.set(e,r),g.set(r,e);++U<b;){var se=e[U],we=r[U];if(c)var ae=m?c(we,se,U,r,e,g):c(se,we,U,e,r,g);if(ae!==t){if(ae)continue;G=!1;break}if(ee){if(!Ka(r,function(Ie,Oe){if(!wn(ee,Oe)&&(se===Ie||l(se,Ie,s,c,g)))return ee.push(Oe)})){G=!1;break}}else if(!(se===we||l(se,we,s,c,g))){G=!1;break}}return g.delete(e),g.delete(r),G}function xd(e,r,s,c,l,g,m){switch(s){case ke:if(e.byteLength!=r.byteLength||e.byteOffset!=r.byteOffset)return!1;e=e.buffer,r=r.buffer;case Ne:return!(e.byteLength!=r.byteLength||!g(new xs(e),new xs(r)));case T:case C:case Te:return Tr(+e,+r);case E:return e.name==r.name&&e.message==r.message;case st:case Je:return e==r+"";case me:var b=Qa;case De:var S=c&N;if(b||(b=ms),e.size!=r.size&&!S)return!1;var q=m.get(e);if(q)return q==r;c|=K,m.set(e,r);var j=Hu(b(e),b(r),c,l,g,m);return m.delete(e),j;case Qe:if(xn)return xn.call(e)==xn.call(r)}return!1}function Sd(e,r,s,c,l,g){var m=s&N,b=Eo(e),S=b.length,q=Eo(r),j=q.length;if(S!=j&&!m)return!1;for(var U=S;U--;){var G=b[U];if(!(m?G in r:je.call(r,G)))return!1}var ee=g.get(e),se=g.get(r);if(ee&&se)return ee==r&&se==e;var we=!0;g.set(e,r),g.set(r,e);for(var ae=m;++U<S;){G=b[U];var Ie=e[G],Oe=r[G];if(c)var gr=m?c(Oe,Ie,G,r,e,g):c(Ie,Oe,G,e,r,g);if(!(gr===t?Ie===Oe||l(Ie,Oe,s,c,g):gr)){we=!1;break}ae||(ae=G=="constructor")}if(we&&!ae){var Zt=e.constructor,yr=r.constructor;Zt!=yr&&"constructor"in e&&"constructor"in r&&!(typeof Zt=="function"&&Zt instanceof Zt&&typeof yr=="function"&&yr instanceof yr)&&(we=!1)}return g.delete(e),g.delete(r),we}function Yr(e){return Ro(Wu(e,t,ih),e+"")}function Eo(e){return cu(e,zt,Po)}function Io(e){return cu(e,ar,ku)}var xo=Rs?function(e){return Rs.get(e)}:ko;function Ks(e){for(var r=e.name+"",s=rn[r],c=je.call(rn,r)?s.length:0;c--;){var l=s[c],g=l.func;if(g==null||g==e)return l.name}return r}function on(e){var r=je.call(p,"placeholder")?p:e;return r.placeholder}function ne(){var e=p.iteratee||Uo;return e=e===Uo?lu:e,arguments.length?e(arguments[0],arguments[1]):e}function Bs(e,r){var s=e.__data__;return $d(r)?s[typeof r=="string"?"string":"hash"]:s.map}function So(e){for(var r=zt(e),s=r.length;s--;){var c=r[s],l=e[c];r[s]=[c,l,Vu(l)]}return r}function Di(e,r){var s=Lf(e,r);return hu(s)?s:t}function Pd(e){var r=je.call(e,Ri),s=e[Ri];try{e[Ri]=t;var c=!0}catch{}var l=Es.call(e);return c&&(r?e[Ri]=s:delete e[Ri]),l}var Po=Xa?function(e){return e==null?[]:(e=Ge(e),ui(Xa(e),function(r){return Jc.call(e,r)}))}:Ko,ku=Xa?function(e){for(var r=[];e;)hi(r,Po(e)),e=Ss(e);return r}:Ko,Vt=Yt;(Za&&Vt(new Za(new ArrayBuffer(1)))!=ke||bn&&Vt(new bn)!=me||eo&&Vt(eo.resolve())!=xt||tn&&Vt(new tn)!=De||En&&Vt(new En)!=Me)&&(Vt=function(e){var r=Yt(e),s=r==xe?e.constructor:t,c=s?Li(s):"";if(c)switch(c){case cp:return ke;case up:return me;case hp:return xt;case lp:return De;case fp:return Me}return r});function Od(e,r,s){for(var c=-1,l=s.length;++c<l;){var g=s[c],m=g.size;switch(g.type){case"drop":e+=m;break;case"dropRight":r-=m;break;case"take":r=Bt(r,e+m);break;case"takeRight":e=Lt(e,r-m);break}}return{start:e,end:r}}function Cd(e){var r=e.match(We);return r?r[1].split(At):[]}function Ku(e,r,s){r=gi(r,e);for(var c=-1,l=r.length,g=!1;++c<l;){var m=Ur(r[c]);if(!(g=e!=null&&s(e,m)))break;e=e[m]}return g||++c!=l?g:(l=e==null?0:e.length,!!l&&Xs(l)&&Xr(m,l)&&(ge(e)||qi(e)))}function Ad(e){var r=e.length,s=new e.constructor(r);return r&&typeof e[0]=="string"&&je.call(e,"index")&&(s.index=e.index,s.input=e.input),s}function Bu(e){return typeof e.constructor=="function"&&!Tn(e)?nn(Ss(e)):{}}function Rd(e,r,s){var c=e.constructor;switch(r){case Ne:return wo(e);case T:case C:return new c(+e);case ke:return pd(e,s);case ht:case qe:case St:case Ft:case Ut:case Ht:case qt:case Wt:case rr:return Ou(e,s);case me:return new c;case Te:case Je:return new c(e);case st:return dd(e);case De:return new c;case Qe:return gd(e)}}function Td(e,r){var s=r.length;if(!s)return e;var c=s-1;return r[c]=(s>1?"& ":"")+r[c],r=r.join(s>2?", ":" "),e.replace(yt,`{ 35/* [wrapped with `+r+`] */ 36`)}function Nd(e){return ge(e)||qi(e)||!!(Qc&&e&&e[Qc])}function Xr(e,r){var s=typeof e;return r=r??J,!!r&&(s=="number"||s!="symbol"&&Ca.test(e))&&e>-1&&e%1==0&&e<r}function Xt(e,r,s){if(!ct(s))return!1;var c=typeof r;return(c=="number"?sr(s)&&Xr(r,s.length):c=="string"&&r in s)?Tr(s[r],e):!1}function Oo(e,r){if(ge(e))return!1;var s=typeof e;return s=="number"||s=="symbol"||s=="boolean"||e==null||dr(e)?!0:Pt.test(e)||!rt.test(e)||r!=null&&e in Ge(r)}function $d(e){var r=typeof e;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?e!=="__proto__":e===null}function Co(e){var r=Ks(e),s=p[r];if(typeof s!="function"||!(r in Se.prototype))return!1;if(e===s)return!0;var c=xo(s);return!!c&&e===c[0]}function Fd(e){return!!Vc&&Vc in e}var Dd=_s?Zr:Bo;function Tn(e){var r=e&&e.constructor,s=typeof r=="function"&&r.prototype||en;return e===s}function Vu(e){return e===e&&!ct(e)}function Gu(e,r){return function(s){return s==null?!1:s[e]===r&&(r!==t||e in Ge(s))}}function Ld(e){var r=Qs(e,function(c){return s.size===d&&s.clear(),c}),s=r.cache;return r}function qd(e,r){var s=e[1],c=r[1],l=s|c,g=l<(re|ce|H),m=c==H&&s==he||c==H&&s==W&&e[7].length<=r[8]||c==(H|W)&&r[7].length<=r[8]&&s==he;if(!(g||m))return e;c&re&&(e[2]=r[2],l|=s&re?0:ue);var b=r[3];if(b){var S=e[3];e[3]=S?Au(S,b,r[4]):b,e[4]=S?li(e[3],_):r[4]}return b=r[5],b&&(S=e[5],e[5]=S?Ru(S,b,r[6]):b,e[6]=S?li(e[5],_):r[6]),b=r[7],b&&(e[7]=b),c&H&&(e[8]=e[8]==null?r[8]:Bt(e[8],r[8])),e[9]==null&&(e[9]=r[9]),e[0]=r[0],e[1]=l,e}function jd(e){var r=[];if(e!=null)for(var s in Ge(e))r.push(s);return r}function zd(e){return Es.call(e)}function Wu(e,r,s){return r=Lt(r===t?e.length-1:r,0),function(){for(var c=arguments,l=-1,g=Lt(c.length-r,0),m=A(g);++l<g;)m[l]=c[r+l];l=-1;for(var b=A(r+1);++l<r;)b[l]=c[l];return b[r]=s(m),jt(e,this,b)}}function Ju(e,r){return r.length<2?e:Fi(e,Ir(r,0,-1))}function Md(e,r){for(var s=e.length,c=Bt(r.length,s),l=nr(e);c--;){var g=r[c];e[c]=Xr(g,s)?l[g]:t}return e}function Ao(e,r){if(!(r==="constructor"&&typeof e[r]=="function")&&r!="__proto__")return e[r]}var Qu=Xu(wu),Nn=tp||function(e,r){return Pe.setTimeout(e,r)},Ro=Xu(ud);function Yu(e,r,s){var c=r+"";return Ro(e,Td(c,Ud(Cd(c),s)))}function Xu(e){var r=0,s=0;return function(){var c=sp(),l=et-(c-s);if(s=c,l>0){if(++r>=Ae)return arguments[0]}else r=0;return e.apply(t,arguments)}}function Vs(e,r){var s=-1,c=e.length,l=c-1;for(r=r===t?c:r;++s<r;){var g=lo(s,l),m=e[g];e[g]=e[s],e[s]=m}return e.length=r,e}var Zu=Ld(function(e){var r=[];return e.charCodeAt(0)===46&&r.push(""),e.replace(Ot,function(s,c,l,g){r.push(l?g.replace(Ea,"$1"):c||s)}),r});function Ur(e){if(typeof e=="string"||dr(e))return e;var r=e+"";return r=="0"&&1/e==-Re?"-0":r}function Li(e){if(e!=null){try{return bs.call(e)}catch{}try{return e+""}catch{}}return""}function Ud(e,r){return wr(Dr,function(s){var c="_."+s[0];r&s[1]&&!ys(e,c)&&e.push(c)}),e.sort()}function eh(e){if(e instanceof Se)return e.clone();var r=new br(e.__wrapped__,e.__chain__);return r.__actions__=nr(e.__actions__),r.__index__=e.__index__,r.__values__=e.__values__,r}function Hd(e,r,s){(s?Xt(e,r,s):r===t)?r=1:r=Lt(ve(r),0);var c=e==null?0:e.length;if(!c||r<1)return[];for(var l=0,g=0,m=A(Cs(c/r));l<c;)m[g++]=Ir(e,l,l+=r);return m}function kd(e){for(var r=-1,s=e==null?0:e.length,c=0,l=[];++r<s;){var g=e[r];g&&(l[c++]=g)}return l}function Kd(){var e=arguments.length;if(!e)return[];for(var r=A(e-1),s=arguments[0],c=e;c--;)r[c-1]=arguments[c];return hi(ge(s)?nr(s):[s],kt(r,1))}var Bd=be(function(e,r){return bt(e)?Pn(e,kt(r,1,bt,!0)):[]}),Vd=be(function(e,r){var s=xr(r);return bt(s)&&(s=t),bt(e)?Pn(e,kt(r,1,bt,!0),ne(s,2)):[]}),Gd=be(function(e,r){var s=xr(r);return bt(s)&&(s=t),bt(e)?Pn(e,kt(r,1,bt,!0),t,s):[]});function Wd(e,r,s){var c=e==null?0:e.length;return c?(r=s||r===t?1:ve(r),Ir(e,r<0?0:r,c)):[]}function Jd(e,r,s){var c=e==null?0:e.length;return c?(r=s||r===t?1:ve(r),r=c-r,Ir(e,0,r<0?0:r)):[]}function Qd(e,r){return e&&e.length?js(e,ne(r,3),!0,!0):[]}function Yd(e,r){return e&&e.length?js(e,ne(r,3),!0):[]}function Xd(e,r,s,c){var l=e==null?0:e.length;return l?(s&&typeof s!="number"&&Xt(e,r,s)&&(s=0,c=l),Kp(e,r,s,c)):[]}function th(e,r,s){var c=e==null?0:e.length;if(!c)return-1;var l=s==null?0:ve(s);return l<0&&(l=Lt(c+l,0)),vs(e,ne(r,3),l)}function rh(e,r,s){var c=e==null?0:e.length;if(!c)return-1;var l=c-1;return s!==t&&(l=ve(s),l=s<0?Lt(c+l,0):Bt(l,c-1)),vs(e,ne(r,3),l,!0)}function ih(e){var r=e==null?0:e.length;return r?kt(e,1):[]}function Zd(e){var r=e==null?0:e.length;return r?kt(e,Re):[]}function eg(e,r){var s=e==null?0:e.length;return s?(r=r===t?1:ve(r),kt(e,r)):[]}function tg(e){for(var r=-1,s=e==null?0:e.length,c={};++r<s;){var l=e[r];c[l[0]]=l[1]}return c}function nh(e){return e&&e.length?e[0]:t}function rg(e,r,s){var c=e==null?0:e.length;if(!c)return-1;var l=s==null?0:ve(s);return l<0&&(l=Lt(c+l,0)),Qi(e,r,l)}function ig(e){var r=e==null?0:e.length;return r?Ir(e,0,-1):[]}var ng=be(function(e){var r=it(e,vo);return r.length&&r[0]===e[0]?ao(r):[]}),sg=be(function(e){var r=xr(e),s=it(e,vo);return r===xr(s)?r=t:s.pop(),s.length&&s[0]===e[0]?ao(s,ne(r,2)):[]}),ag=be(function(e){var r=xr(e),s=it(e,vo);return r=typeof r=="function"?r:t,r&&s.pop(),s.length&&s[0]===e[0]?ao(s,t,r):[]});function og(e,r){return e==null?"":ip.call(e,r)}function xr(e){var r=e==null?0:e.length;return r?e[r-1]:t}function cg(e,r,s){var c=e==null?0:e.length;if(!c)return-1;var l=c;return s!==t&&(l=ve(s),l=l<0?Lt(c+l,0):Bt(l,c-1)),r===r?Uf(e,r,l):vs(e,jc,l,!0)}function ug(e,r){return e&&e.length?gu(e,ve(r)):t}var hg=be(sh);function sh(e,r){return e&&e.length&&r&&r.length?ho(e,r):e}function lg(e,r,s){return e&&e.length&&r&&r.length?ho(e,r,ne(s,2)):e}function fg(e,r,s){return e&&e.length&&r&&r.length?ho(e,r,t,s):e}var pg=Yr(function(e,r){var s=e==null?0:e.length,c=ro(e,r);return mu(e,it(r,function(l){return Xr(l,s)?+l:l}).sort(Cu)),c});function dg(e,r){var s=[];if(!(e&&e.length))return s;var c=-1,l=[],g=e.length;for(r=ne(r,3);++c<g;){var m=e[c];r(m,c,e)&&(s.push(m),l.push(c))}return mu(e,l),s}function To(e){return e==null?e:op.call(e)}function gg(e,r,s){var c=e==null?0:e.length;return c?(s&&typeof s!="number"&&Xt(e,r,s)?(r=0,s=c):(r=r==null?0:ve(r),s=s===t?c:ve(s)),Ir(e,r,s)):[]}function yg(e,r){return qs(e,r)}function vg(e,r,s){return po(e,r,ne(s,2))}function mg(e,r){var s=e==null?0:e.length;if(s){var c=qs(e,r);if(c<s&&Tr(e[c],r))return c}return-1}function wg(e,r){return qs(e,r,!0)}function _g(e,r,s){return po(e,r,ne(s,2),!0)}function bg(e,r){var s=e==null?0:e.length;if(s){var c=qs(e,r,!0)-1;if(Tr(e[c],r))return c}return-1}function Eg(e){return e&&e.length?_u(e):[]}function Ig(e,r){return e&&e.length?_u(e,ne(r,2)):[]}function xg(e){var r=e==null?0:e.length;return r?Ir(e,1,r):[]}function Sg(e,r,s){return e&&e.length?(r=s||r===t?1:ve(r),Ir(e,0,r<0?0:r)):[]}function Pg(e,r,s){var c=e==null?0:e.length;return c?(r=s||r===t?1:ve(r),r=c-r,Ir(e,r<0?0:r,c)):[]}function Og(e,r){return e&&e.length?js(e,ne(r,3),!1,!0):[]}function Cg(e,r){return e&&e.length?js(e,ne(r,3)):[]}var Ag=be(function(e){return di(kt(e,1,bt,!0))}),Rg=be(function(e){var r=xr(e);return bt(r)&&(r=t),di(kt(e,1,bt,!0),ne(r,2))}),Tg=be(function(e){var r=xr(e);return r=typeof r=="function"?r:t,di(kt(e,1,bt,!0),t,r)});function Ng(e){return e&&e.length?di(e):[]}function $g(e,r){return e&&e.length?di(e,ne(r,2)):[]}function Fg(e,r){return r=typeof r=="function"?r:t,e&&e.length?di(e,t,r):[]}function No(e){if(!(e&&e.length))return[];var r=0;return e=ui(e,function(s){if(bt(s))return r=Lt(s.length,r),!0}),Wa(r,function(s){return it(e,Ba(s))})}function ah(e,r){if(!(e&&e.length))return[];var s=No(e);return r==null?s:it(s,function(c){return jt(r,t,c)})}var Dg=be(function(e,r){return bt(e)?Pn(e,r):[]}),Lg=be(function(e){return yo(ui(e,bt))}),qg=be(function(e){var r=xr(e);return bt(r)&&(r=t),yo(ui(e,bt),ne(r,2))}),jg=be(function(e){var r=xr(e);return r=typeof r=="function"?r:t,yo(ui(e,bt),t,r)}),zg=be(No);function Mg(e,r){return xu(e||[],r||[],Sn)}function Ug(e,r){return xu(e||[],r||[],An)}var Hg=be(function(e){var r=e.length,s=r>1?e[r-1]:t;return s=typeof s=="function"?(e.pop(),s):t,ah(e,s)});function oh(e){var r=p(e);return r.__chain__=!0,r}function kg(e,r){return r(e),e}function Gs(e,r){return r(e)}var Kg=Yr(function(e){var r=e.length,s=r?e[0]:0,c=this.__wrapped__,l=function(g){return ro(g,e)};return r>1||this.__actions__.length||!(c instanceof Se)||!Xr(s)?this.thru(l):(c=c.slice(s,+s+(r?1:0)),c.__actions__.push({func:Gs,args:[l],thisArg:t}),new br(c,this.__chain__).thru(function(g){return r&&!g.length&&g.push(t),g}))});function Bg(){return oh(this)}function Vg(){return new br(this.value(),this.__chain__)}function Gg(){this.__values__===t&&(this.__values__=bh(this.value()));var e=this.__index__>=this.__values__.length,r=e?t:this.__values__[this.__index__++];return{done:e,value:r}}function Wg(){return this}function Jg(e){for(var r,s=this;s instanceof Ns;){var c=eh(s);c.__index__=0,c.__values__=t,r?l.__wrapped__=c:r=c;var l=c;s=s.__wrapped__}return l.__wrapped__=e,r}function Qg(){var e=this.__wrapped__;if(e instanceof Se){var r=e;return this.__actions__.length&&(r=new Se(this)),r=r.reverse(),r.__actions__.push({func:Gs,args:[To],thisArg:t}),new br(r,this.__chain__)}return this.thru(To)}function Yg(){return Iu(this.__wrapped__,this.__actions__)}var Xg=zs(function(e,r,s){je.call(e,s)?++e[s]:Jr(e,s,1)});function Zg(e,r,s){var c=ge(e)?Lc:kp;return s&&Xt(e,r,s)&&(r=t),c(e,ne(r,3))}function ey(e,r){var s=ge(e)?ui:au;return s(e,ne(r,3))}var ty=Fu(th),ry=Fu(rh);function iy(e,r){return kt(Ws(e,r),1)}function ny(e,r){return kt(Ws(e,r),Re)}function sy(e,r,s){return s=s===t?1:ve(s),kt(Ws(e,r),s)}function ch(e,r){var s=ge(e)?wr:pi;return s(e,ne(r,3))}function uh(e,r){var s=ge(e)?xf:su;return s(e,ne(r,3))}var ay=zs(function(e,r,s){je.call(e,s)?e[s].push(r):Jr(e,s,[r])});function oy(e,r,s,c){e=sr(e)?e:un(e),s=s&&!c?ve(s):0;var l=e.length;return s<0&&(s=Lt(l+s,0)),Zs(e)?s<=l&&e.indexOf(r,s)>-1:!!l&&Qi(e,r,s)>-1}var cy=be(function(e,r,s){var c=-1,l=typeof r=="function",g=sr(e)?A(e.length):[];return pi(e,function(m){g[++c]=l?jt(r,m,s):On(m,r,s)}),g}),uy=zs(function(e,r,s){Jr(e,s,r)});function Ws(e,r){var s=ge(e)?it:fu;return s(e,ne(r,3))}function hy(e,r,s,c){return e==null?[]:(ge(r)||(r=r==null?[]:[r]),s=c?t:s,ge(s)||(s=s==null?[]:[s]),yu(e,r,s))}var ly=zs(function(e,r,s){e[s?0:1].push(r)},function(){return[[],[]]});function fy(e,r,s){var c=ge(e)?ka:Mc,l=arguments.length<3;return c(e,ne(r,4),s,l,pi)}function py(e,r,s){var c=ge(e)?Sf:Mc,l=arguments.length<3;return c(e,ne(r,4),s,l,su)}function dy(e,r){var s=ge(e)?ui:au;return s(e,Ys(ne(r,3)))}function gy(e){var r=ge(e)?tu:od;return r(e)}function yy(e,r,s){(s?Xt(e,r,s):r===t)?r=1:r=ve(r);var c=ge(e)?jp:cd;return c(e,r)}function vy(e){var r=ge(e)?zp:hd;return r(e)}function my(e){if(e==null)return 0;if(sr(e))return Zs(e)?Xi(e):e.length;var r=Vt(e);return r==me||r==De?e.size:co(e).length}function wy(e,r,s){var c=ge(e)?Ka:ld;return s&&Xt(e,r,s)&&(r=t),c(e,ne(r,3))}var _y=be(function(e,r){if(e==null)return[];var s=r.length;return s>1&&Xt(e,r[0],r[1])?r=[]:s>2&&Xt(r[0],r[1],r[2])&&(r=[r[0]]),yu(e,kt(r,1),[])}),Js=ep||function(){return Pe.Date.now()};function by(e,r){if(typeof r!="function")throw new _r(f);return e=ve(e),function(){if(--e<1)return r.apply(this,arguments)}}function hh(e,r,s){return r=s?t:r,r=e&&r==null?e.length:r,Qr(e,H,t,t,t,t,r)}function lh(e,r){var s;if(typeof r!="function")throw new _r(f);return e=ve(e),function(){return--e>0&&(s=r.apply(this,arguments)),e<=1&&(r=t),s}}var $o=be(function(e,r,s){var c=re;if(s.length){var l=li(s,on($o));c|=pe}return Qr(e,c,r,s,l)}),fh=be(function(e,r,s){var c=re|ce;if(s.length){var l=li(s,on(fh));c|=pe}return Qr(r,c,e,s,l)});function ph(e,r,s){r=s?t:r;var c=Qr(e,he,t,t,t,t,t,r);return c.placeholder=ph.placeholder,c}function dh(e,r,s){r=s?t:r;var c=Qr(e,fe,t,t,t,t,t,r);return c.placeholder=dh.placeholder,c}function gh(e,r,s){var c,l,g,m,b,S,q=0,j=!1,U=!1,G=!0;if(typeof e!="function")throw new _r(f);r=Sr(r)||0,ct(s)&&(j=!!s.leading,U="maxWait"in s,g=U?Lt(Sr(s.maxWait)||0,r):g,G="trailing"in s?!!s.trailing:G);function ee(Et){var Nr=c,ti=l;return c=l=t,q=Et,m=e.apply(ti,Nr),m}function se(Et){return q=Et,b=Nn(Ie,r),j?ee(Et):m}function we(Et){var Nr=Et-S,ti=Et-q,Fh=r-Nr;return U?Bt(Fh,g-ti):Fh}function ae(Et){var Nr=Et-S,ti=Et-q;return S===t||Nr>=r||Nr<0||U&&ti>=g}function Ie(){var Et=Js();if(ae(Et))return Oe(Et);b=Nn(Ie,we(Et))}function Oe(Et){return b=t,G&&c?ee(Et):(c=l=t,m)}function gr(){b!==t&&Su(b),q=0,c=S=l=b=t}function Zt(){return b===t?m:Oe(Js())}function yr(){var Et=Js(),Nr=ae(Et);if(c=arguments,l=this,S=Et,Nr){if(b===t)return se(S);if(U)return Su(b),b=Nn(Ie,r),ee(S)}return b===t&&(b=Nn(Ie,r)),m}return yr.cancel=gr,yr.flush=Zt,yr}var Ey=be(function(e,r){return nu(e,1,r)}),Iy=be(function(e,r,s){return nu(e,Sr(r)||0,s)});function xy(e){return Qr(e,ye)}function Qs(e,r){if(typeof e!="function"||r!=null&&typeof r!="function")throw new _r(f);var s=function(){var c=arguments,l=r?r.apply(this,c):c[0],g=s.cache;if(g.has(l))return g.get(l);var m=e.apply(this,c);return s.cache=g.set(l,m)||g,m};return s.cache=new(Qs.Cache||Wr),s}Qs.Cache=Wr;function Ys(e){if(typeof e!="function")throw new _r(f);return function(){var r=arguments;switch(r.length){case 0:return!e.call(this);case 1:return!e.call(this,r[0]);case 2:return!e.call(this,r[0],r[1]);case 3:return!e.call(this,r[0],r[1],r[2])}return!e.apply(this,r)}}function Sy(e){return lh(2,e)}var Py=fd(function(e,r){r=r.length==1&&ge(r[0])?it(r[0],fr(ne())):it(kt(r,1),fr(ne()));var s=r.length;return be(function(c){for(var l=-1,g=Bt(c.length,s);++l<g;)c[l]=r[l].call(this,c[l]);return jt(e,this,c)})}),Fo=be(function(e,r){var s=li(r,on(Fo));return Qr(e,pe,t,r,s)}),yh=be(function(e,r){var s=li(r,on(yh));return Qr(e,F,t,r,s)}),Oy=Yr(function(e,r){return Qr(e,W,t,t,t,r)});function Cy(e,r){if(typeof e!="function")throw new _r(f);return r=r===t?r:ve(r),be(e,r)}function Ay(e,r){if(typeof e!="function")throw new _r(f);return r=r==null?0:Lt(ve(r),0),be(function(s){var c=s[r],l=yi(s,0,r);return c&&hi(l,c),jt(e,this,l)})}function Ry(e,r,s){var c=!0,l=!0;if(typeof e!="function")throw new _r(f);return ct(s)&&(c="leading"in s?!!s.leading:c,l="trailing"in s?!!s.trailing:l),gh(e,r,{leading:c,maxWait:r,trailing:l})}function Ty(e){return hh(e,1)}function Ny(e,r){return Fo(mo(r),e)}function $y(){if(!arguments.length)return[];var e=arguments[0];return ge(e)?e:[e]}function Fy(e){return Er(e,L)}function Dy(e,r){return r=typeof r=="function"?r:t,Er(e,L,r)}function Ly(e){return Er(e,O|L)}function qy(e,r){return r=typeof r=="function"?r:t,Er(e,O|L,r)}function jy(e,r){return r==null||iu(e,r,zt(r))}function Tr(e,r){return e===r||e!==e&&r!==r}var zy=ks(so),My=ks(function(e,r){return e>=r}),qi=uu(function(){return arguments}())?uu:function(e){return vt(e)&&je.call(e,"callee")&&!Jc.call(e,"callee")},ge=A.isArray,Uy=Qt?fr(Qt):Jp;function sr(e){return e!=null&&Xs(e.length)&&!Zr(e)}function bt(e){return vt(e)&&sr(e)}function Hy(e){return e===!0||e===!1||vt(e)&&Yt(e)==T}var vi=rp||Bo,ky=Cr?fr(Cr):Qp;function Ky(e){return vt(e)&&e.nodeType===1&&!$n(e)}function By(e){if(e==null)return!0;if(sr(e)&&(ge(e)||typeof e=="string"||typeof e.splice=="function"||vi(e)||cn(e)||qi(e)))return!e.length;var r=Vt(e);if(r==me||r==De)return!e.size;if(Tn(e))return!co(e).length;for(var s in e)if(je.call(e,s))return!1;return!0}function Vy(e,r){return Cn(e,r)}function Gy(e,r,s){s=typeof s=="function"?s:t;var c=s?s(e,r):t;return c===t?Cn(e,r,t,s):!!c}function Do(e){if(!vt(e))return!1;var r=Yt(e);return r==E||r==h||typeof e.message=="string"&&typeof e.name=="string"&&!$n(e)}function Wy(e){return typeof e=="number"&&Yc(e)}function Zr(e){if(!ct(e))return!1;var r=Yt(e);return r==Z||r==oe||r==$||r==mt}function vh(e){return typeof e=="number"&&e==ve(e)}function Xs(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=J}function ct(e){var r=typeof e;return e!=null&&(r=="object"||r=="function")}function vt(e){return e!=null&&typeof e=="object"}var mh=mr?fr(mr):Xp;function Jy(e,r){return e===r||oo(e,r,So(r))}function Qy(e,r,s){return s=typeof s=="function"?s:t,oo(e,r,So(r),s)}function Yy(e){return wh(e)&&e!=+e}function Xy(e){if(Dd(e))throw new le(u);return hu(e)}function Zy(e){return e===null}function e0(e){return e==null}function wh(e){return typeof e=="number"||vt(e)&&Yt(e)==Te}function $n(e){if(!vt(e)||Yt(e)!=xe)return!1;var r=Ss(e);if(r===null)return!0;var s=je.call(r,"constructor")&&r.constructor;return typeof s=="function"&&s instanceof s&&bs.call(s)==Qf}var Lo=jr?fr(jr):Zp;function t0(e){return vh(e)&&e>=-J&&e<=J}var _h=mn?fr(mn):ed;function Zs(e){return typeof e=="string"||!ge(e)&&vt(e)&&Yt(e)==Je}function dr(e){return typeof e=="symbol"||vt(e)&&Yt(e)==Qe}var cn=Ai?fr(Ai):td;function r0(e){return e===t}function i0(e){return vt(e)&&Vt(e)==Me}function n0(e){return vt(e)&&Yt(e)==Ye}var s0=ks(uo),a0=ks(function(e,r){return e<=r});function bh(e){if(!e)return[];if(sr(e))return Zs(e)?Ar(e):nr(e);if(_n&&e[_n])return jf(e[_n]());var r=Vt(e),s=r==me?Qa:r==De?ms:un;return s(e)}function ei(e){if(!e)return e===0?e:0;if(e=Sr(e),e===Re||e===-Re){var r=e<0?-1:1;return r*B}return e===e?e:0}function ve(e){var r=ei(e),s=r%1;return r===r?s?r-s:r:0}function Eh(e){return e?$i(ve(e),0,V):0}function Sr(e){if(typeof e=="number")return e;if(dr(e))return k;if(ct(e)){var r=typeof e.valueOf=="function"?e.valueOf():e;e=ct(r)?r+"":r}if(typeof e!="string")return e===0?e:+e;e=Uc(e);var s=Sa.test(e);return s||Oa.test(e)?de(e.slice(2),s?2:8):xa.test(e)?k:+e}function Ih(e){return Mr(e,ar(e))}function o0(e){return e?$i(ve(e),-J,J):e===0?e:0}function Le(e){return e==null?"":pr(e)}var c0=sn(function(e,r){if(Tn(r)||sr(r)){Mr(r,zt(r),e);return}for(var s in r)je.call(r,s)&&Sn(e,s,r[s])}),xh=sn(function(e,r){Mr(r,ar(r),e)}),ea=sn(function(e,r,s,c){Mr(r,ar(r),e,c)}),u0=sn(function(e,r,s,c){Mr(r,zt(r),e,c)}),h0=Yr(ro);function l0(e,r){var s=nn(e);return r==null?s:ru(s,r)}var f0=be(function(e,r){e=Ge(e);var s=-1,c=r.length,l=c>2?r[2]:t;for(l&&Xt(r[0],r[1],l)&&(c=1);++s<c;)for(var g=r[s],m=ar(g),b=-1,S=m.length;++b<S;){var q=m[b],j=e[q];(j===t||Tr(j,en[q])&&!je.call(e,q))&&(e[q]=g[q])}return e}),p0=be(function(e){return e.push(t,Uu),jt(Sh,t,e)});function d0(e,r){return qc(e,ne(r,3),zr)}function g0(e,r){return qc(e,ne(r,3),no)}function y0(e,r){return e==null?e:io(e,ne(r,3),ar)}function v0(e,r){return e==null?e:ou(e,ne(r,3),ar)}function m0(e,r){return e&&zr(e,ne(r,3))}function w0(e,r){return e&&no(e,ne(r,3))}function _0(e){return e==null?[]:Ds(e,zt(e))}function b0(e){return e==null?[]:Ds(e,ar(e))}function qo(e,r,s){var c=e==null?t:Fi(e,r);return c===t?s:c}function E0(e,r){return e!=null&&Ku(e,r,Bp)}function jo(e,r){return e!=null&&Ku(e,r,Vp)}var I0=Lu(function(e,r,s){r!=null&&typeof r.toString!="function"&&(r=Es.call(r)),e[r]=s},Mo(or)),x0=Lu(function(e,r,s){r!=null&&typeof r.toString!="function"&&(r=Es.call(r)),je.call(e,r)?e[r].push(s):e[r]=[s]},ne),S0=be(On);function zt(e){return sr(e)?eu(e):co(e)}function ar(e){return sr(e)?eu(e,!0):rd(e)}function P0(e,r){var s={};return r=ne(r,3),zr(e,function(c,l,g){Jr(s,r(c,l,g),c)}),s}function O0(e,r){var s={};return r=ne(r,3),zr(e,function(c,l,g){Jr(s,l,r(c,l,g))}),s}var C0=sn(function(e,r,s){Ls(e,r,s)}),Sh=sn(function(e,r,s,c){Ls(e,r,s,c)}),A0=Yr(function(e,r){var s={};if(e==null)return s;var c=!1;r=it(r,function(g){return g=gi(g,e),c||(c=g.length>1),g}),Mr(e,Io(e),s),c&&(s=Er(s,O|P|L,Id));for(var l=r.length;l--;)go(s,r[l]);return s});function R0(e,r){return Ph(e,Ys(ne(r)))}var T0=Yr(function(e,r){return e==null?{}:nd(e,r)});function Ph(e,r){if(e==null)return{};var s=it(Io(e),function(c){return[c]});return r=ne(r),vu(e,s,function(c,l){return r(c,l[0])})}function N0(e,r,s){r=gi(r,e);var c=-1,l=r.length;for(l||(l=1,e=t);++c<l;){var g=e==null?t:e[Ur(r[c])];g===t&&(c=l,g=s),e=Zr(g)?g.call(e):g}return e}function $0(e,r,s){return e==null?e:An(e,r,s)}function F0(e,r,s,c){return c=typeof c=="function"?c:t,e==null?e:An(e,r,s,c)}var Oh=zu(zt),Ch=zu(ar);function D0(e,r,s){var c=ge(e),l=c||vi(e)||cn(e);if(r=ne(r,4),s==null){var g=e&&e.constructor;l?s=c?new g:[]:ct(e)?s=Zr(g)?nn(Ss(e)):{}:s={}}return(l?wr:zr)(e,function(m,b,S){return r(s,m,b,S)}),s}function L0(e,r){return e==null?!0:go(e,r)}function q0(e,r,s){return e==null?e:Eu(e,r,mo(s))}function j0(e,r,s,c){return c=typeof c=="function"?c:t,e==null?e:Eu(e,r,mo(s),c)}function un(e){return e==null?[]:Ja(e,zt(e))}function z0(e){return e==null?[]:Ja(e,ar(e))}function M0(e,r,s){return s===t&&(s=r,r=t),s!==t&&(s=Sr(s),s=s===s?s:0),r!==t&&(r=Sr(r),r=r===r?r:0),$i(Sr(e),r,s)}function U0(e,r,s){return r=ei(r),s===t?(s=r,r=0):s=ei(s),e=Sr(e),Gp(e,r,s)}function H0(e,r,s){if(s&&typeof s!="boolean"&&Xt(e,r,s)&&(r=s=t),s===t&&(typeof r=="boolean"?(s=r,r=t):typeof e=="boolean"&&(s=e,e=t)),e===t&&r===t?(e=0,r=1):(e=ei(e),r===t?(r=e,e=0):r=ei(r)),e>r){var c=e;e=r,r=c}if(s||e%1||r%1){var l=Xc();return Bt(e+l*(r-e+Be("1e-"+((l+"").length-1))),r)}return lo(e,r)}var k0=an(function(e,r,s){return r=r.toLowerCase(),e+(s?Ah(r):r)});function Ah(e){return zo(Le(e).toLowerCase())}function Rh(e){return e=Le(e),e&&e.replace(Br,$f).replace(Ma,"")}function K0(e,r,s){e=Le(e),r=pr(r);var c=e.length;s=s===t?c:$i(ve(s),0,c);var l=s;return s-=r.length,s>=0&&e.slice(s,l)==r}function B0(e){return e=Le(e),e&&tt.test(e)?e.replace(xi,Ff):e}function V0(e){return e=Le(e),e&&Ct.test(e)?e.replace(dt,"\\$&"):e}var G0=an(function(e,r,s){return e+(s?"-":"")+r.toLowerCase()}),W0=an(function(e,r,s){return e+(s?" ":"")+r.toLowerCase()}),J0=$u("toLowerCase");function Q0(e,r,s){e=Le(e),r=ve(r);var c=r?Xi(e):0;if(!r||c>=r)return e;var l=(r-c)/2;return Hs(As(l),s)+e+Hs(Cs(l),s)}function Y0(e,r,s){e=Le(e),r=ve(r);var c=r?Xi(e):0;return r&&c<r?e+Hs(r-c,s):e}function X0(e,r,s){e=Le(e),r=ve(r);var c=r?Xi(e):0;return r&&c<r?Hs(r-c,s)+e:e}function Z0(e,r,s){return s||r==null?r=0:r&&(r=+r),ap(Le(e).replace(gt,""),r||0)}function ev(e,r,s){return(s?Xt(e,r,s):r===t)?r=1:r=ve(r),fo(Le(e),r)}function tv(){var e=arguments,r=Le(e[0]);return e.length<3?r:r.replace(e[1],e[2])}var rv=an(function(e,r,s){return e+(s?"_":"")+r.toLowerCase()});function iv(e,r,s){return s&&typeof s!="number"&&Xt(e,r,s)&&(r=s=t),s=s===t?V:s>>>0,s?(e=Le(e),e&&(typeof r=="string"||r!=null&&!Lo(r))&&(r=pr(r),!r&&Yi(e))?yi(Ar(e),0,s):e.split(r,s)):[]}var nv=an(function(e,r,s){return e+(s?" ":"")+zo(r)});function sv(e,r,s){return e=Le(e),s=s==null?0:$i(ve(s),0,e.length),r=pr(r),e.slice(s,s+r.length)==r}function av(e,r,s){var c=p.templateSettings;s&&Xt(e,r,s)&&(r=t),e=Le(e),r=ea({},r,c,Mu);var l=ea({},r.imports,c.imports,Mu),g=zt(l),m=Ja(l,g),b,S,q=0,j=r.interpolate||ki,U="__p += '",G=Ya((r.escape||
vendor: 9,690 bytes, lines 36-53
36ki).source+"|"+j.source+"|"+(j===ot?Ia:ki).source+"|"+(r.evaluate||ki).source+"|$","g"),ee="//# sourceURL="+(je.call(r,"sourceURL")?(r.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Ua+"]")+` 37`;e.replace(G,function(ae,Ie,Oe,gr,Zt,yr){return Oe||(Oe=gr),U+=e.slice(q,yr).replace(Aa,Df),Ie&&(b=!0,U+=`' + 38__e(`+Ie+`) + 39'`),Zt&&(S=!0,U+=`'; 40`+Zt+`; 41__p += '`),Oe&&(U+=`' + 42((__t = (`+Oe+`)) == null ? '' : __t) + 43'`),q=yr+ae.length,ae}),U+=`'; 44`;var se=je.call(r,"variable")&&r.variable;if(!se)U=`with (obj) { 45`+U+` 46} 47`;else if(ba.test(se))throw new le(y);U=(S?U.replace(Lr,""):U).replace(Jt,"$1").replace(Kr,"$1;"),U="function("+(se||"obj")+`) { 48`+(se?"":`obj || (obj = {}); 49`)+"var __t, __p = ''"+(b?", __e = _.escape":"")+(S?`, __j = Array.prototype.join; 50function print() { __p += __j.call(arguments, '') } 51`:`; 52`)+U+`return __p 53}`;var we=Nh(function(){return Fe(g,ee+"return "+U).apply(t,m)});if(we.source=U,Do(we))throw we;return we}function ov(e){return Le(e).toLowerCase()}function cv(e){return Le(e).toUpperCase()}function uv(e,r,s){if(e=Le(e),e&&(s||r===t))return Uc(e);if(!e||!(r=pr(r)))return e;var c=Ar(e),l=Ar(r),g=Hc(c,l),m=kc(c,l)+1;return yi(c,g,m).join("")}function hv(e,r,s){if(e=Le(e),e&&(s||r===t))return e.slice(0,Bc(e)+1);if(!e||!(r=pr(r)))return e;var c=Ar(e),l=kc(c,Ar(r))+1;return yi(c,0,l).join("")}function lv(e,r,s){if(e=Le(e),e&&(s||r===t))return e.replace(gt,"");if(!e||!(r=pr(r)))return e;var c=Ar(e),l=Hc(c,Ar(r));return yi(c,l).join("")}function fv(e,r){var s=te,c=Ee;if(ct(r)){var l="separator"in r?r.separator:l;s="length"in r?ve(r.length):s,c="omission"in r?pr(r.omission):c}e=Le(e);var g=e.length;if(Yi(e)){var m=Ar(e);g=m.length}if(s>=g)return e;var b=s-Xi(c);if(b<1)return c;var S=m?yi(m,0,b).join(""):e.slice(0,b);if(l===t)return S+c;if(m&&(b+=S.length-b),Lo(l)){if(e.slice(b).search(l)){var q,j=S;for(l.global||(l=Ya(l.source,Le(vr.exec(l))+"g")),l.lastIndex=0;q=l.exec(j);)var U=q.index;S=S.slice(0,U===t?b:U)}}else if(e.indexOf(pr(l),b)!=b){var G=S.lastIndexOf(l);G>-1&&(S=S.slice(0,G))}return S+c}function pv(e){return e=Le(e),e&<.test(e)?e.replace(oi,Hf):e}var dv=an(function(e,r,s){return e+(s?" ":"")+r.toUpperCase()}),zo=$u("toUpperCase");function Th(e,r,s){return e=Le(e),r=s?t:r,r===t?qf(e)?Bf(e):Cf(e):e.match(r)||[]}var Nh=be(function(e,r){try{return jt(e,t,r)}catch(s){return Do(s)?s:new le(s)}}),gv=Yr(function(e,r){return wr(r,function(s){s=Ur(s),Jr(e,s,$o(e[s],e))}),e});function yv(e){var r=e==null?0:e.length,s=ne();return e=r?it(e,function(c){if(typeof c[1]!="function")throw new _r(f);return[s(c[0]),c[1]]}):[],be(function(c){for(var l=-1;++l<r;){var g=e[l];if(jt(g[0],this,c))return jt(g[1],this,c)}})}function vv(e){return Hp(Er(e,O))}function Mo(e){return function(){return e}}function mv(e,r){return e==null||e!==e?r:e}var wv=Du(),_v=Du(!0);function or(e){return e}function Uo(e){return lu(typeof e=="function"?e:Er(e,O))}function bv(e){return pu(Er(e,O))}function Ev(e,r){return du(e,Er(r,O))}var Iv=be(function(e,r){return function(s){return On(s,e,r)}}),xv=be(function(e,r){return function(s){return On(e,s,r)}});function Ho(e,r,s){var c=zt(r),l=Ds(r,c);s==null&&!(ct(r)&&(l.length||!c.length))&&(s=r,r=e,e=this,l=Ds(r,zt(r)));var g=!(ct(s)&&"chain"in s)||!!s.chain,m=Zr(e);return wr(l,function(b){var S=r[b];e[b]=S,m&&(e.prototype[b]=function(){var q=this.__chain__;if(g||q){var j=e(this.__wrapped__),U=j.__actions__=nr(this.__actions__);return U.push({func:S,args:arguments,thisArg:e}),j.__chain__=q,j}return S.apply(e,hi([this.value()],arguments))})}),e}function Sv(){return Pe._===this&&(Pe._=Yf),this}function ko(){}function Pv(e){return e=ve(e),be(function(r){return gu(r,e)})}var Ov=_o(it),Cv=_o(Lc),Av=_o(Ka);function $h(e){return Oo(e)?Ba(Ur(e)):sd(e)}function Rv(e){return function(r){return e==null?t:Fi(e,r)}}var Tv=qu(),Nv=qu(!0);function Ko(){return[]}function Bo(){return!1}function $v(){return{}}function Fv(){return""}function Dv(){return!0}function Lv(e,r){if(e=ve(e),e<1||e>J)return[];var s=V,c=Bt(e,V);r=ne(r),e-=V;for(var l=Wa(c,r);++s<e;)r(s);return l}function qv(e){return ge(e)?it(e,Ur):dr(e)?[e]:nr(Zu(Le(e)))}function jv(e){var r=++Jf;return Le(e)+r}var zv=Us(function(e,r){return e+r},0),Mv=bo("ceil"),Uv=Us(function(e,r){return e/r},1),Hv=bo("floor");function kv(e){return e&&e.length?Fs(e,or,so):t}function Kv(e,r){return e&&e.length?Fs(e,ne(r,2),so):t}function Bv(e){return zc(e,or)}function Vv(e,r){return zc(e,ne(r,2))}function Gv(e){return e&&e.length?Fs(e,or,uo):t}function Wv(e,r){return e&&e.length?Fs(e,ne(r,2),uo):t}var Jv=Us(function(e,r){return e*r},1),Qv=bo("round"),Yv=Us(function(e,r){return e-r},0);function Xv(e){return e&&e.length?Ga(e,or):0}function Zv(e,r){return e&&e.length?Ga(e,ne(r,2)):0}return p.after=by,p.ary=hh,p.assign=c0,p.assignIn=xh,p.assignInWith=ea,p.assignWith=u0,p.at=h0,p.before=lh,p.bind=$o,p.bindAll=gv,p.bindKey=fh,p.castArray=$y,p.chain=oh,p.chunk=Hd,p.compact=kd,p.concat=Kd,p.cond=yv,p.conforms=vv,p.constant=Mo,p.countBy=Xg,p.create=l0,p.curry=ph,p.curryRight=dh,p.debounce=gh,p.defaults=f0,p.defaultsDeep=p0,p.defer=Ey,p.delay=Iy,p.difference=Bd,p.differenceBy=Vd,p.differenceWith=Gd,p.drop=Wd,p.dropRight=Jd,p.dropRightWhile=Qd,p.dropWhile=Yd,p.fill=Xd,p.filter=ey,p.flatMap=iy,p.flatMapDeep=ny,p.flatMapDepth=sy,p.flatten=ih,p.flattenDeep=Zd,p.flattenDepth=eg,p.flip=xy,p.flow=wv,p.flowRight=_v,p.fromPairs=tg,p.functions=_0,p.functionsIn=b0,p.groupBy=ay,p.initial=ig,p.intersection=ng,p.intersectionBy=sg,p.intersectionWith=ag,p.invert=I0,p.invertBy=x0,p.invokeMap=cy,p.iteratee=Uo,p.keyBy=uy,p.keys=zt,p.keysIn=ar,p.map=Ws,p.mapKeys=P0,p.mapValues=O0,p.matches=bv,p.matchesProperty=Ev,p.memoize=Qs,p.merge=C0,p.mergeWith=Sh,p.method=Iv,p.methodOf=xv,p.mixin=Ho,p.negate=Ys,p.nthArg=Pv,p.omit=A0,p.omitBy=R0,p.once=Sy,p.orderBy=hy,p.over=Ov,p.overArgs=Py,p.overEvery=Cv,p.overSome=Av,p.partial=Fo,p.partialRight=yh,p.partition=ly,p.pick=T0,p.pickBy=Ph,p.property=$h,p.propertyOf=Rv,p.pull=hg,p.pullAll=sh,p.pullAllBy=lg,p.pullAllWith=fg,p.pullAt=pg,p.range=Tv,p.rangeRight=Nv,p.rearg=Oy,p.reject=dy,p.remove=dg,p.rest=Cy,p.reverse=To,p.sampleSize=yy,p.set=$0,p.setWith=F0,p.shuffle=vy,p.slice=gg,p.sortBy=_y,p.sortedUniq=Eg,p.sortedUniqBy=Ig,p.split=iv,p.spread=Ay,p.tail=xg,p.take=Sg,p.takeRight=Pg,p.takeRightWhile=Og,p.takeWhile=Cg,p.tap=kg,p.throttle=Ry,p.thru=Gs,p.toArray=bh,p.toPairs=Oh,p.toPairsIn=Ch,p.toPath=qv,p.toPlainObject=Ih,p.transform=D0,p.unary=Ty,p.union=Ag,p.unionBy=Rg,p.unionWith=Tg,p.uniq=Ng,p.uniqBy=$g,p.uniqWith=Fg,p.unset=L0,p.unzip=No,p.unzipWith=ah,p.update=q0,p.updateWith=j0,p.values=un,p.valuesIn=z0,p.without=Dg,p.words=Th,p.wrap=Ny,p.xor=Lg,p.xorBy=qg,p.xorWith=jg,p.zip=zg,p.zipObject=Mg,p.zipObjectDeep=Ug,p.zipWith=Hg,p.entries=Oh,p.entriesIn=Ch,p.extend=xh,p.extendWith=ea,Ho(p,p),p.add=zv,p.attempt=Nh,p.camelCase=k0,p.capitalize=Ah,p.ceil=Mv,p.clamp=M0,p.clone=Fy,p.cloneDeep=Ly,p.cloneDeepWith=qy,p.cloneWith=Dy,p.conformsTo=jy,p.deburr=Rh,p.defaultTo=mv,p.divide=Uv,p.endsWith=K0,p.eq=Tr,p.escape=B0,p.escapeRegExp=V0,p.every=Zg,p.find=ty,p.findIndex=th,p.findKey=d0,p.findLast=ry,p.findLastIndex=rh,p.findLastKey=g0,p.floor=Hv,p.forEach=ch,p.forEachRight=uh,p.forIn=y0,p.forInRight=v0,p.forOwn=m0,p.forOwnRight=w0,p.get=qo,p.gt=zy,p.gte=My,p.has=E0,p.hasIn=jo,p.head=nh,p.identity=or,p.includes=oy,p.indexOf=rg,p.inRange=U0,p.invoke=S0,p.isArguments=qi,p.isArray=ge,p.isArrayBuffer=Uy,p.isArrayLike=sr,p.isArrayLikeObject=bt,p.isBoolean=Hy,p.isBuffer=vi,p.isDate=ky,p.isElement=Ky,p.isEmpty=By,p.isEqual=Vy,p.isEqualWith=Gy,p.isError=Do,p.isFinite=Wy,p.isFunction=Zr,p.isInteger=vh,p.isLength=Xs,p.isMap=mh,p.isMatch=Jy,p.isMatchWith=Qy,p.isNaN=Yy,p.isNative=Xy,p.isNil=e0,p.isNull=Zy,p.isNumber=wh,p.isObject=ct,p.isObjectLike=vt,p.isPlainObject=$n,p.isRegExp=Lo,p.isSafeInteger=t0,p.isSet=_h,p.isString=Zs,p.isSymbol=dr,p.isTypedArray=cn,p.isUndefined=r0,p.isWeakMap=i0,p.isWeakSet=n0,p.join=og,p.kebabCase=G0,p.last=xr,p.lastIndexOf=cg,p.lowerCase=W0,p.lowerFirst=J0,p.lt=s0,p.lte=a0,p.max=kv,p.maxBy=Kv,p.mean=Bv,p.meanBy=Vv,p.min=Gv,p.minBy=Wv,p.stubArray=Ko,p.stubFalse=Bo,p.stubObject=$v,p.stubString=Fv,p.stubTrue=Dv,p.multiply=Jv,p.nth=ug,p.noConflict=Sv,p.noop=ko,p.now=Js,p.pad=Q0,p.padEnd=Y0,p.padStart=X0,p.parseInt=Z0,p.random=H0,p.reduce=fy,p.reduceRight=py,p.repeat=ev,p.replace=tv,p.result=N0,p.round=Qv,p.runInContext=x,p.sample=gy,p.size=my,p.snakeCase=rv,p.some=wy,p.sortedIndex=yg,p.sortedIndexBy=vg,p.sortedIndexOf=mg,p.sortedLastIndex=wg,p.sortedLastIndexBy=_g,p.sortedLastIndexOf=bg,p.startCase=nv,p.startsWith=sv,p.subtract=Yv,p.sum=Xv,p.sumBy=Zv,p.template=av,p.times=Lv,p.toFinite=ei,p.toInteger=ve,p.toLength=Eh,p.toLower=ov,p.toNumber=Sr,p.toSafeInteger=o0,p.toString=Le,p.toUpper=cv,p.trim=uv,p.trimEnd=hv,p.trimStart=lv,p.truncate=fv,p.unescape=pv,p.uniqueId=jv,p.upperCase=dv,p.upperFirst=zo,p.each=ch,p.eachRight=uh,p.first=nh,Ho(p,function(){var e={};return zr(p,function(r,s){je.call(p.prototype,s)||(e[s]=r)}),e}(),{chain:!1}),p.VERSION=n,wr(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){p[e].placeholder=p}),wr(["drop","take"],function(e,r){Se.prototype[e]=function(s){s=s===t?1:Lt(ve(s),0);var c=this.__filtered__&&!r?new Se(this):this.clone();return c.__filtered__?c.__takeCount__=Bt(s,c.__takeCount__):c.__views__.push({size:Bt(s,V),type:e+(c.__dir__<0?"Right":"")}),c},Se.prototype[e+"Right"]=function(s){return this.reverse()[e](s).reverse()}}),wr(["filter","map","takeWhile"],function(e,r){var s=r+1,c=s==R||s==ze;Se.prototype[e]=function(l){var g=this.clone();return g.__iteratees__.push({iteratee:ne(l,3),type:s}),g.__filtered__=g.__filtered__||c,g}}),wr(["head","last"],function(e,r){var s="take"+(r?"Right":"");
53Se.prototype[e]=function(){return this[s](1).value()[0]}}),wr(["initial","tail"],function(e,r){var s="drop"+(r?"":"Right");Se.prototype[e]=function(){return this.__filtered__?new Se(this):this[s](1)}}),Se.prototype.compact=function(){return this.filter(or)},Se.prototype.find=function(e){return this.filter(e).head()},Se.prototype.findLast=function(e){return this.reverse().find(e)},Se.prototype.invokeMap=be(function(e,r){return typeof e=="function"?new Se(this):this.map(function(s){return On(s,e,r)})}),Se.prototype.reject=function(e){return this.filter(Ys(ne(e)))},Se.prototype.slice=function(e,r){e=ve(e);var s=this;return s.__filtered__&&(e>0||r<0)?new Se(s):(e<0?s=s.takeRight(-e):e&&(s=s.drop(e)),r!==t&&(r=ve(r),s=r<0?s.dropRight(-r):s.take(r-e)),s)},Se.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Se.prototype.toArray=function(){return this.take(V)},zr(Se.prototype,function(e,r){var s=/^(?:filter|find|map|reject)|While$/.test(r),c=/^(?:head|last)$/.test(r),l=p[c?"take"+(r=="last"?"Right":""):r],g=c||/^find/.test(r);l&&(p.prototype[r]=function(){var m=this.__wrapped__,b=c?[1]:arguments,S=m instanceof Se,q=b[0],j=S||ge(m),U=function(Ie){var Oe=l.apply(p,hi([Ie],b));return c&&G?Oe[0]:Oe};j&&s&&typeof q=="function"&&q.length!=1&&(S=j=!1);var G=this.__chain__,ee=!!this.__actions__.length,se=g&&!G,we=S&&!ee;if(!g&&j){m=we?m:new Se(this);var ae=e.apply(m,b);return ae.__actions__.push({func:Gs,args:[U],thisArg:t}),new br(ae,G)}return se&&we?e.apply(this,b):(ae=this.thru(U),se?c?ae.value()[0]:ae.value():ae)})}),wr(["pop","push","shift","sort","splice","unshift"],function(e){var r=ws[e],s=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",c=/^(?:pop|shift)$/.test(e);p.prototype[e]=function(){var l=arguments;if(c&&!this.__chain__){var g=this.value();return r.apply(ge(g)?g:[],l)}return this[s](function(m){return r.apply(ge(m)?m:[],l)})}}),zr(Se.prototype,function(e,r){var s=p[r];if(s){var c=s.name+"";je.call(rn,c)||(rn[c]=[]),rn[c].push({name:r,func:s})}}),rn[Ms(t,ce).name]=[{name:"wrapper",func:t}],Se.prototype.clone=pp,Se.prototype.reverse=dp,Se.prototype.value=gp,p.prototype.at=Kg,p.prototype.chain=Bg,p.prototype.commit=Vg,p.prototype.next=Gg,p.prototype.plant=Jg,p.prototype.reverse=Qg,p.prototype.toJSON=p.prototype.valueOf=p.prototype.value=Yg,p.prototype.first=p.prototype.head,_n&&(p.prototype[_n]=Wg),p},Zi=Vf();_t?((_t.exports=Zi)._=Zi,Ve._=Zi):Pe._=Zi}).call(Mn)})(_c,_c.exports);var zE=Object.defineProperty,ME=Object.defineProperties,UE=Object.getOwnPropertyDescriptors,Cl=Object.getOwnPropertySymbols,HE=Object.prototype.hasOwnProperty,kE=Object.prototype.propertyIsEnumerable,Al=(o,i,t)=>i in o?zE(o,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[i]=t,aa=(o,i)=>{for(var t in i||(i={}))HE.call(i,t)&&Al(o,t,i[t]);if(Cl)for(var t of Cl(i))kE.call(i,t)&&Al(o,t,i[t]);return o},KE=(o,i)=>ME(o,UE(i));function Ei(o,i,t){var n;const a=zm(o);return((n=i.rpcMap)==null?void 0:n[a.reference])||`${jE}?chainId=${a.namespace}:${a.reference}&projectId=${t}`}function Hi(o){return o.includes(":")?o.split(":")[1]:o}function bf(o){return o.map(i=>`${i.split(":")[0]}:${i.split(":")[1]}`)}function BE(o,i){const t=Object.keys(i.namespaces).filter(a=>a.includes(o));if(!t.length)return[];const n=[];return t.forEach(a=>{const u=i.namespaces[a].accounts;n.push(...u)}),n}function VE(o={},i={}){const t=Rl(o),n=Rl(i);return _c.exports.merge(t,n)}function Rl(o){var i,t,n,a;const u={};if(!ua(o))return u;for(const[f,y]of Object.entries(o)){const w=kl(f)?[f]:y.chains,d=y.methods||[],_=y.events||[],O=y.rpcMap||{},P=Un(f);u[P]=KE(aa(aa({},u[P]),y),{chains:Go(w,(i=u[P])==null?void 0:i.chains),methods:Go(d,(t=u[P])==null?void 0:t.methods),events:Go(_,(n=u[P])==null?void 0:n.events),rpcMap:aa(aa({},O),(a=u[P])==null?void 0:a.rpcMap)})}return u}function GE(o){return o.includes(":")?o.split(":")[2]:o}function WE(o){const i={};for(const[t,n]of Object.entries(o)){const a=n.methods||[],u=n.events||[],f=n.accounts||[],y=kl(t)?[t]:n.chains?n.chains:bf(n.accounts);i[t]={chains:y,methods:a,events:u,accounts:f}}return i}function sc(o){return typeof o=="number"?o:o.includes("0x")?parseInt(o,16):o.includes(":")?Number(o.split(":")[1]):Number(o)}const Ef={},nt=o=>Ef[o],ac=(o,i)=>{Ef[o]=i};class JE{constructor(i){this.name="polkadot",this.namespace=i.namespace,this.events=nt("events"),this.client=nt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(i){this.namespace=Object.assign(this.namespace,i)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const i=this.namespace.chains[0];if(!i)throw new Error("ChainId not found");return i.split(":")[1]}request(i){return this.namespace.methods.includes(i.request.method)?this.client.request(i):this.getHttpProvider().request(i.request)}setDefaultChain(i,t){this.httpProviders[i]||this.setHttpProvider(i,t),this.chainId=i,this.events.emit(ai.DEFAULT_CHAIN_CHANGED,`${this.name}:${i}`)}getAccounts(){const i=this.namespace.accounts;return i?i.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const i={};return this.namespace.chains.forEach(t=>{var n;const a=Hi(t);
53i[a]=this.createHttpProvider(a,(n=this.namespace.rpcMap)==null?void 0:n[t])}),i}getHttpProvider(){const i=`${this.name}:${this.chainId}`,t=this.httpProviders[i];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${i} not found`);return t}setHttpProvider(i,t){const n=this.createHttpProvider(i,t);n&&(this.httpProviders[i]=n)}createHttpProvider(i,t){const n=t||Ei(i,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${i}`);return new si(new Ii(n,nt("disableProviderPing")))}}class QE{constructor(i){this.name="eip155",this.namespace=i.namespace,this.events=nt("events"),this.client=nt("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(i){switch(i.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(i);case"eth_chainId":return parseInt(this.getDefaultChain())}return this.namespace.methods.includes(i.request.method)?await this.client.request(i):this.getHttpProvider().request(i.request)}updateNamespace(i){this.namespace=Object.assign(this.namespace,i)}setDefaultChain(i,t){this.httpProviders[i]||this.setHttpProvider(parseInt(i),t),this.chainId=parseInt(i),this.events.emit(ai.DEFAULT_CHAIN_CHANGED,`${this.name}:${i}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const i=this.namespace.chains[0];if(!i)throw new Error("ChainId not found");return i.split(":")[1]}createHttpProvider(i,t){const n=t||Ei(`${this.name}:${i}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${i}`);return new si(new Ii(n,nt("disableProviderPing")))}setHttpProvider(i,t){const n=this.createHttpProvider(i,t);n&&(this.httpProviders[i]=n)}createHttpProviders(){const i={};return this.namespace.chains.forEach(t=>{var n;const a=parseInt(Hi(t));i[a]=this.createHttpProvider(a,(n=this.namespace.rpcMap)==null?void 0:n[t])}),i}getAccounts(){const i=this.namespace.accounts;return i?[...new Set(i.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}getHttpProvider(){const i=this.chainId,t=this.httpProviders[i];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${i} not found`);return t}async handleSwitchChain(i){var t,n;let a=i.request.params?(t=i.request.params[0])==null?void 0:t.chainId:"0x0";a=a.startsWith("0x")?a:`0x${a}`;const u=parseInt(a,16);if(this.isChainApproved(u))this.setDefaultChain(`${u}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:i.topic,request:{method:i.request.method,params:[{chainId:a}]},chainId:(n=this.namespace.chains)==null?void 0:n[0]}),this.setDefaultChain(`${u}`);else throw new Error(`Failed to switch to chain 'eip155:${u}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(i){return this.namespace.chains.includes(`${this.name}:${i}`)}}class YE{constructor(i){this.name="solana",this.namespace=i.namespace,this.events=nt("events"),this.client=nt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(i){this.namespace=Object.assign(this.namespace,i)}requestAccounts(){return this.getAccounts()}request(i){return this.namespace.methods.includes(i.request.method)?this.client.request(i):this.getHttpProvider().request(i.request)}setDefaultChain(i,t){this.httpProviders[i]||this.setHttpProvider(i,t),this.chainId=i,this.events.emit(ai.DEFAULT_CHAIN_CHANGED,`${this.name}:${i}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const i=this.namespace.chains[0];if(!i)throw new Error("ChainId not found");return i.split(":")[1]}getAccounts(){const i=this.namespace.accounts;return i?[...new Set(i.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const i={};return this.namespace.chains.forEach(t=>{var n;const a=Hi(t);
53i[a]=this.createHttpProvider(a,(n=this.namespace.rpcMap)==null?void 0:n[t])}),i}getHttpProvider(){const i=`${this.name}:${this.chainId}`,t=this.httpProviders[i];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${i} not found`);return t}setHttpProvider(i,t){const n=this.createHttpProvider(i,t);n&&(this.httpProviders[i]=n)}createHttpProvider(i,t){const n=t||Ei(i,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${i}`);return new si(new Ii(n,nt("disableProviderPing")))}}class XE{constructor(i){this.name="cosmos",this.namespace=i.namespace,this.events=nt("events"),this.client=nt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(i){this.namespace=Object.assign(this.namespace,i)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const i=this.namespace.chains[0];if(!i)throw new Error("ChainId not found");return i.split(":")[1]}request(i){return this.namespace.methods.includes(i.request.method)?this.client.request(i):this.getHttpProvider().request(i.request)}setDefaultChain(i,t){this.httpProviders[i]||this.setHttpProvider(i,t),this.chainId=i,this.events.emit(ai.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const i=this.namespace.accounts;return i?[...new Set(i.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const i={};return this.namespace.chains.forEach(t=>{var n;const a=Hi(t);i[a]=this.createHttpProvider(a,(n=this.namespace.rpcMap)==null?void 0:n[t])}),i}getHttpProvider(){const i=`${this.name}:${this.chainId}`,t=this.httpProviders[i];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${i} not found`);return t}setHttpProvider(i,t){const n=this.createHttpProvider(i,t);n&&(this.httpProviders[i]=n)}createHttpProvider(i,t){const n=t||Ei(i,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${i}`);return new si(new Ii(n,nt("disableProviderPing")))}}class ZE{constructor(i){this.name="cip34",this.namespace=i.namespace,this.events=nt("events"),this.client=nt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(i){this.namespace=Object.assign(this.namespace,i)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const i=this.namespace.chains[0];if(!i)throw new Error("ChainId not found");return i.split(":")[1]}request(i){return this.namespace.methods.includes(i.request.method)?this.client.request(i):this.getHttpProvider().request(i.request)}setDefaultChain(i,t){this.httpProviders[i]||this.setHttpProvider(i,t),this.chainId=i,this.events.emit(ai.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const i=this.namespace.accounts;return i?[...new Set(i.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const i={};return this.namespace.chains.forEach(t=>{const n=this.getCardanoRPCUrl(t),a=Hi(t);i[a]=this.createHttpProvider(a,n)}),i}getHttpProvider(){const i=`${this.name}:${this.chainId}`,t=this.httpProviders[i];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${i} not found`);return t}getCardanoRPCUrl(i){const t=this.namespace.rpcMap;if(t)return t[i]}setHttpProvider(i,t){const n=this.createHttpProvider(i,t);n&&(this.httpProviders[i]=n)}createHttpProvider(i,t){const n=t||this.getCardanoRPCUrl(i);if(!n)throw new Error(`No RPC url provided for chainId: ${i}`);return new si(new Ii(n,nt("disableProviderPing")))}}class eI{constructor(i){this.name="elrond",this.namespace=i.namespace,this.events=nt("events"),this.client=nt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(i){this.namespace=Object.assign(this.namespace,i)}requestAccounts(){return this.getAccounts()}request(i){return this.namespace.methods.includes(i.request.method)?this.client.request(i):this.getHttpProvider().request(i.request)}setDefaultChain(i,t){this.httpProviders[i]||this.setHttpProvider(i,t),this.chainId=i,this.events.emit(ai.DEFAULT_CHAIN_CHANGED,`${this.name}:${i}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const i=this.namespace.chains[0];if(!i)throw new Error("ChainId not found");return i.split(":")[1]}getAccounts(){const i=this.namespace.accounts;return i?[...new Set(i.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const i={};return this.namespace.chains.forEach(t=>{var n;const a=Hi(t);
53i[a]=this.createHttpProvider(a,(n=this.namespace.rpcMap)==null?void 0:n[t])}),i}getHttpProvider(){const i=`${this.name}:${this.chainId}`,t=this.httpProviders[i];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${i} not found`);return t}setHttpProvider(i,t){const n=this.createHttpProvider(i,t);n&&(this.httpProviders[i]=n)}createHttpProvider(i,t){const n=t||Ei(i,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${i}`);return new si(new Ii(n,nt("disableProviderPing")))}}class tI{constructor(i){this.name="multiversx",this.namespace=i.namespace,this.events=nt("events"),this.client=nt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(i){this.namespace=Object.assign(this.namespace,i)}requestAccounts(){return this.getAccounts()}request(i){return this.namespace.methods.includes(i.request.method)?this.client.request(i):this.getHttpProvider().request(i.request)}setDefaultChain(i,t){this.httpProviders[i]||this.setHttpProvider(i,t),this.chainId=i,this.events.emit(ai.DEFAULT_CHAIN_CHANGED,`${this.name}:${i}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const i=this.namespace.chains[0];if(!i)throw new Error("ChainId not found");return i.split(":")[1]}getAccounts(){const i=this.namespace.accounts;return i?[...new Set(i.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const i={};return this.namespace.chains.forEach(t=>{var n;const a=Hi(t);i[a]=this.createHttpProvider(a,(n=this.namespace.rpcMap)==null?void 0:n[t])}),i}getHttpProvider(){const i=`${this.name}:${this.chainId}`,t=this.httpProviders[i];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${i} not found`);return t}setHttpProvider(i,t){const n=this.createHttpProvider(i,t);n&&(this.httpProviders[i]=n)}createHttpProvider(i,t){const n=t||Ei(i,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${i}`);return new si(new Ii(n,nt("disableProviderPing")))}}class rI{constructor(i){this.name="near",this.namespace=i.namespace,this.events=nt("events"),this.client=nt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(i){this.namespace=Object.assign(this.namespace,i)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const i=this.namespace.chains[0];if(!i)throw new Error("ChainId not found");return i.split(":")[1]}request(i){return this.namespace.methods.includes(i.request.method)?this.client.request(i):this.getHttpProvider().request(i.request)}setDefaultChain(i,t){if(this.chainId=i,!this.httpProviders[i]){const n=t||Ei(`${this.name}:${i}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${i}`);this.setHttpProvider(i,n)}this.events.emit(ai.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const i=this.namespace.accounts;return i?i.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const i={};return this.namespace.chains.forEach(t=>{var n;i[t]=this.createHttpProvider(t,(n=this.namespace.rpcMap)==null?void 0:n[t])}),i}getHttpProvider(){const i=`${this.name}:${this.chainId}`,t=this.httpProviders[i];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${i} not found`);return t}setHttpProvider(i,t){const n=this.createHttpProvider(i,t);n&&(this.httpProviders[i]=n)}createHttpProvider(i,t){const n=t||Ei(i,this.namespace);return typeof n>"u"?void 0:new si(new Ii(n,nt("disableProviderPing")))}}var iI=Object.defineProperty,nI=Object.defineProperties,sI=Object.getOwnPropertyDescriptors,Tl=Object.getOwnPropertySymbols,aI=Object.prototype.hasOwnProperty,oI=Object.prototype.propertyIsEnumerable,Nl=(o,i,t)=>i in o?iI(o,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[i]=t,oa=(o,i)=>{for(var t in i||(i={}))aI.call(i,t)&&Nl(o,t,i[t]);if(Tl)for(var t of Tl(i))oI.call(i,t)&&Nl(o,t,i[t]);return o},oc=(o,i)=>nI(o,sI(i));class Fc{constructor(i){this.events=new Sc,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=i,this.logger=typeof(i==null?void 0:i.logger)<"u"&&typeof(i==null?void 0:i.logger)!="string"?i.logger:Ce.pino(Ce.getDefaultLoggerOptions({level:(i==null?void 0:i.logger)||Pl})),this.disableProviderPing=(i==null?void 0:i.disableProviderPing)||!1}static async init(i){const t=new Fc(i);return await t.initialize(),t}async request(i,t){const[n,a]=this.validateChain(t);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(n).request({request:oa({},i),chainId:`${n}:${a}`,topic:this.session.topic})}sendAsync(i,t,n){this.request(i,n).then(a=>t(null,a)).catch(a=>t(a,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");
53return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var i;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(i=this.session)==null?void 0:i.topic,reason:tr("USER_DISCONNECTED")}),await this.cleanup()}async connect(i){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(i),await this.cleanupPendingPairings(),!i.skipPairing)return await this.pair(i.pairingTopic)}on(i,t){this.events.on(i,t)}once(i,t){this.events.once(i,t)}removeListener(i,t){this.events.removeListener(i,t)}off(i,t){this.events.off(i,t)}get isWalletConnect(){return!0}async pair(i){this.shouldAbortPairingAttempt=!1;let t=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(t>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:n,approval:a}=await this.client.connect({pairingTopic:i,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});n&&(this.uri=n,this.events.emit("display_uri",n)),await a().then(u=>{this.session=u,this.namespaces||(this.namespaces=WE(u.namespaces),this.persist("namespaces",this.namespaces))}).catch(u=>{if(u.message!==wf)throw u;t++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(i,t){try{if(!this.session)return;const[n,a]=this.validateChain(i);this.getProvider(n).setDefaultChain(a,t)}catch(n){if(!/Please call connect/.test(n.message))throw n}}async cleanupPendingPairings(i={}){this.logger.info("Cleaning up inactive pairings...");const t=this.client.pairing.getAll();if(pn(t)){for(const n of t)i.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.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){const i=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[i]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await FE.init({logger:this.providerOpts.logger||Pl,relayUrl:this.providerOpts.relayUrl||DE,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 new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const i=[...new Set(Object.keys(this.session.namespaces).map(t=>Un(t)))];ac("client",this.client),ac("events",this.events),ac("disableProviderPing",this.disableProviderPing),i.forEach(t=>{if(!this.session)return;const n=BE(t,this.session),a=bf(n),u=VE(this.namespaces,this.optionalNamespaces),f=oc(oa({},u[t]),{accounts:n,chains:a});switch(t){case"eip155":this.rpcProviders[t]=new QE({namespace:f});break;case"solana":this.rpcProviders[t]=new YE({namespace:f});break;case"cosmos":this.rpcProviders[t]=new XE({namespace:f});break;case"polkadot":this.rpcProviders[t]=new JE({namespace:f});break;case"cip34":this.rpcProviders[t]=new ZE({namespace:f});break;case"elrond":this.rpcProviders[t]=new eI({namespace:f});break;case"multiversx":this.rpcProviders[t]=new tI({namespace:f});break;case"near":this.rpcProviders[t]=new rI({namespace:f});break}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",i=>{this.events.emit("session_ping",i)}),this.client.on("session_event",i=>{const{params:t}=i,{event:n}=t;if(n.name==="accountsChanged"){const a=n.data;a&&pn(a)&&this.events.emit("accountsChanged",a.map(GE))}else if(n.name==="chainChanged"){const a=t.chainId,u=t.event.data,f=Un(a),y=sc(a)!==sc(u)?`${f}:${sc(u)}`:a;this.onChainChanged(y)}else this.events.emit(n.name,n.data);this.events.emit("session_event",i)}),this.client.on("session_update",({topic:i,params:t})=>{var n;const{namespaces:a}=t,u=(n=this.client)==null?void 0:n.session.get(i);this.session=oc(oa({},u),{namespaces:a}),this.onSessionUpdate(),this.events.emit("session_update",{topic:i,params:t})}),this.client.on("session_delete",async i=>{await this.cleanup(),this.events.emit("session_delete",i),this.events.emit("disconnect",oc(oa({},tr("USER_DISCONNECTED")),{data:i.topic}))}),this.on(ai.DEFAULT_CHAIN_CHANGED,i=>{this.onChainChanged(i,!0)})}getProvider(i){if(!this.rpcProviders[i])throw new Error(`Provider not found: ${i}`);return this.rpcProviders[i]}
53onSessionUpdate(){Object.keys(this.rpcProviders).forEach(i=>{var t;this.getProvider(i).updateNamespace((t=this.session)==null?void 0:t.namespaces[i])})}setNamespaces(i){const{namespaces:t,optionalNamespaces:n,sessionProperties:a}=i;t&&Object.keys(t).length&&(this.namespaces=t),n&&Object.keys(n).length&&(this.optionalNamespaces=n),this.sessionProperties=a,this.persist("namespaces",t),this.persist("optionalNamespaces",n)}validateChain(i){const[t,n]=(i==null?void 0:i.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[t,n];if(t&&!Object.keys(this.namespaces||{}).map(f=>Un(f)).includes(t))throw new Error(`Namespace '${t}' is not configured. Please call connect() first with namespace config.`);if(t&&n)return[t,n];const a=Un(Object.keys(this.namespaces)[0]),u=this.rpcProviders[a].getDefaultChain();return[a,u]}async requestAccounts(){const[i]=this.validateChain();return await this.getProvider(i).requestAccounts()}onChainChanged(i,t=!1){var n;if(!this.namespaces)return;const[a,u]=this.validateChain(i);t||this.getProvider(a).setDefaultChain(u),((n=this.namespaces[a])!=null?n:this.namespaces[`${a}:${u}`]).defaultChain=u,this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",u)}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(i,t){this.client.core.storage.setItem(`${Ol}/${i}`,t)}async getFromStore(i){return await this.client.core.storage.getItem(`${Ol}/${i}`)}}const cI=Fc,uI="wc",hI="ethereum_provider",lI=`${uI}@2:${hI}:`,fI="https://rpc.walletconnect.com/v1/",bc=["eth_sendTransaction","personal_sign"],pI=["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"],Ec=["chainChanged","accountsChanged"],dI=["chainChanged","accountsChanged","message","disconnect","connect"];var gI=Object.defineProperty,yI=Object.defineProperties,vI=Object.getOwnPropertyDescriptors,$l=Object.getOwnPropertySymbols,mI=Object.prototype.hasOwnProperty,wI=Object.prototype.propertyIsEnumerable,Fl=(o,i,t)=>i in o?gI(o,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[i]=t,kn=(o,i)=>{for(var t in i||(i={}))mI.call(i,t)&&Fl(o,t,i[t]);if($l)for(var t of $l(i))wI.call(i,t)&&Fl(o,t,i[t]);return o},Dl=(o,i)=>yI(o,vI(i));function ga(o){return Number(o[0].split(":")[1])}function cc(o){return`0x${o.toString(16)}`}function _I(o){const{chains:i,optionalChains:t,methods:n,optionalMethods:a,events:u,optionalEvents:f,rpcMap:y}=o;if(!pn(i))throw new Error("Invalid chains");const w={chains:i,methods:n||bc,events:u||Ec,rpcMap:kn({},i.length?{[ga(i)]:y[ga(i)]}:{})},d=u==null?void 0:u.filter(L=>!Ec.includes(L)),_=n==null?void 0:n.filter(L=>!bc.includes(L));if(!t&&!f&&!a&&!(d!=null&&d.length)&&!(_!=null&&_.length))return{required:i.length?w:void 0};const O=(d==null?void 0:d.length)&&(_==null?void 0:_.length)||!t,P={chains:[...new Set(O?w.chains.concat(t||[]):t)],methods:[...new Set(w.methods.concat(a!=null&&a.length?a:pI))],events:[...new Set(w.events.concat(f!=null&&f.length?f:dI))],rpcMap:y};return{required:i.length?w:void 0,optional:t.length?P:void 0}}class Dc{constructor(){this.events=new kr.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=lI,this.on=(i,t)=>(this.events.on(i,t),this),this.once=(i,t)=>(this.events.once(i,t),this),this.removeListener=(i,t)=>(this.events.removeListener(i,t),this),this.off=(i,t)=>(this.events.off(i,t),this),this.parseAccount=i=>this.isCompatibleChainId(i)?this.parseAccountId(i).address:i,this.signer={},this.rpc={}}static async init(i){const t=new Dc;return await t.initialize(i),t}async request(i){return await this.signer.request(i,this.formatChainId(this.chainId))}sendAsync(i,t){this.signer.sendAsync(i,t,this.formatChainId(this.chainId))}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(i){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(i);const{required:t,optional:n}=_I(this.rpc);try{const a=await new Promise(async(f,y)=>{var w;this.rpc.showQrModal&&((w=this.modal)==null||w.subscribeModal(d=>{!d.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),y(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(Dl(kn({namespaces:kn({},t&&{[this.namespace]:t})},n&&{optionalNamespaces:{[this.namespace]:n}}),{pairingTopic:i==null?void 0:i.pairingTopic})).then(d=>{f(d)}).catch(d=>{y(new Error(d.message))})});if(!a)return;const u=Mm(a.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:u),this.setAccounts(u),this.events.emit("connect",{chainId:cc(this.chainId)})}catch(a){throw this.signer.logger.error(a),a}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",i=>{const{params:t}=i,{event:n}=t;n.name==="accountsChanged"?(this.accounts=this.parseAccounts(n.data),this.events.emit("accountsChanged",this.accounts)):n.name==="chainChanged"?this.setChainId(this.formatChainId(n.data)):this.events.emit(n.name,n.data),this.events.emit("session_event",i)}),this.signer.on("chainChanged",i=>{const t=parseInt(i);this.chainId=t,this.events.emit("chainChanged",cc(this.chainId)),this.persist()}),this.signer.on("session_update",i=>{this.events.emit("session_update",i)}),this.signer.on("session_delete",i=>{this.reset(),this.events.emit("session_delete",i),this.events.emit("disconnect",Dl(kn({},tr("USER_DISCONNECTED")),{data:i.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",i=>{var t,n;this.rpc.showQrModal&&((t=this.modal)==null||t.closeModal(),(n=this.modal)==null||n.openModal({uri:i})),this.events.emit("display_uri",i)})}switchEthereumChain(i){this.request({method:"wallet_switchEthereumChain",params:[{chainId:i.toString(16)}]})}isCompatibleChainId(i){return typeof i=="string"?i.startsWith(`${this.namespace}:`):!1}formatChainId(i){return`${this.namespace}:${i}`}parseChainId(i){return Number(i.split(":")[1])}setChainIds(i){const t=i.filter(n=>this.isCompatibleChainId(n)).map(n=>this.parseChainId(n));t.length&&(this.chainId=t[0],this.events.emit("chainChanged",cc(this.chainId)),this.persist())}setChainId(i){if(this.isCompatibleChainId(i)){const t=this.parseChainId(i);this.chainId=t,this.switchEthereumChain(t)}}parseAccountId(i){const[t,n,a]=i.split(":");return{chainId:`${t}:${n}`,address:a}}setAccounts(i){this.accounts=i.filter(t=>this.parseChainId(this.parseAccountId(t).chainId)===this.chainId).map(t=>this.parseAccountId(t).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(i){var t,n;const a=(t=i==null?void 0:i.chains)!=null?t:[],u=(n=i==null?void 0:i.optionalChains)!=null?n:[],f=a.concat(u);if(!f.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const y=a.length?(i==null?void 0:i.methods)||bc:[],w=a.length?(i==null?void 0:i.events)||Ec:[],d=(i==null?void 0:i.optionalMethods)||[],_=(i==null?void 0:i.optionalEvents)||[],O=(i==null?void 0:i.rpcMap)||this.buildRpcMap(f,i.projectId),P=(i==null?void 0:i.qrModalOptions)||void 0;return{chains:a==null?void 0:a.map(L=>this.formatChainId(L)),optionalChains:u.map(L=>this.formatChainId(L)),methods:y,events:w,optionalMethods:d,optionalEvents:_,rpcMap:O,showQrModal:!!(i!=null&&i.showQrModal),qrModalOptions:P,projectId:i.projectId,metadata:i.metadata}}buildRpcMap(i,t){const n={};
53return i.forEach(a=>{n[a]=this.getRpcUrl(a,t)}),n}async initialize(i){if(this.rpc=this.getRpcConfig(i),this.chainId=this.rpc.chains.length?ga(this.rpc.chains):ga(this.rpc.optionalChains),this.signer=await cI.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:i.disableProviderPing,relayUrl:i.relayUrl,storageOptions:i.storageOptions}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let t;try{const{WalletConnectModal:n}=await Um(()=>import("./index-72e12380.js").then(a=>a.i),["assets/index-72e12380.js","assets/index-fcdc5867.js","assets/index-9c814ea6.css"]);t=n}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(t)try{this.modal=new t(kn({walletConnectVersion:2,projectId:this.rpc.projectId,standaloneChains:this.rpc.chains},this.rpc.qrModalOptions))}catch(n){throw this.signer.logger.error(n),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(i){if(!i)return;const{chains:t,optionalChains:n,rpcMap:a}=i;t&&pn(t)&&(this.rpc.chains=t.map(u=>this.formatChainId(u)),t.forEach(u=>{this.rpc.rpcMap[u]=(a==null?void 0:a[u])||this.getRpcUrl(u)})),n&&pn(n)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=n==null?void 0:n.map(u=>
53this.formatChainId(u)),n.forEach(u=>{this.rpc.rpcMap[u]=(a==null?void 0:a[u])||this.getRpcUrl(u)}))}getRpcUrl(i,t){var n;return((n=this.rpc.rpcMap)==null?void 0:n[i])||`${fI}?chainId=eip155:${i}&projectId=${t||this.rpc.projectId}`}async loadPersistedSession(){if(!this.session)return;const i=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),t=this.session.namespaces[`${this.namespace}:${i}`]?this.session.namespaces[`${this.namespace}:${i}`]:this.session.namespaces[this.namespace];this.setChainIds(i?[this.formatChainId(i)]:t==null?void 0:t.accounts),this.setAccounts(t==null?void 0:t.accounts)}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(i){return typeof i=="string"||i instanceof String?[this.parseAccount(i)]:i.map(t=>this.parseAccount(t))}}const $I=Dc;export{$I as EthereumProvider,dI as OPTIONAL_EVENTS,pI as OPTIONAL_METHODS,Ec as REQUIRED_EVENTS,bc as REQUIRED_METHODS,Dc as default};
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.