@dcl/vesting-dashboard 3.0.4 → 3.0.5-8759059417.commit-9b93e5a

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import{p as ei,g as Ll,c as e6,r as r6,a as Ie,B as fa,e as Di,b as ql,s as i6,d as Xi,W as jl,f as dd,_ as n6}from"./index-44db7f20.js";import{t as s6}from"./tslib.es6-c2094241.js";var pd=globalThis&&globalThis.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,s=t.length,a;n<s;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return r.concat(a||Array.prototype.slice.call(t))},o6=function(){function r(t,e,n){this.name=t,this.version=e,this.os=n,this.type="browser"}return r}(),a6=function(){function r(t){this.version=t,this.type="node",this.name="node",this.os=ei.platform}return r}(),u6=function(){function r(t,e,n,s){this.name=t,this.version=e,this.os=n,this.bot=s,this.type="bot-device"}return r}(),c6=function(){function r(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return r}(),h6=function(){function r(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return r}(),l6=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,f6=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,gd=3,d6=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["pie",/^Microsoft Pocket Internet Explorer\/(\d+\.\d+)$/],["pie",/^Mozilla\/\d\.\d+\s\(compatible;\s(?:MSP?IE|MSInternet Explorer) (\d+\.\d+);.*Windows CE.*\)$/],["netfront",/^Mozilla\/\d\.\d+.*NetFront\/(\d.\d)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FB[AS]V\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["curl",/^curl\/([0-9\.]+)$/],["searchbot",l6]],md=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Windows CE",/Windows CE|WinCE|Microsoft Pocket Internet Explorer/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function p6(r){return r?vd(r):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new h6:typeof navigator<"u"?vd(navigator.userAgent):v6()}function g6(r){return r!==""&&d6.reduce(function(t,e){var n=e[0],s=e[1];if(t)return t;var a=s.exec(r);return!!a&&[n,a]},!1)}function vd(r){var t=g6(r);if(!t)return null;var e=t[0],n=t[1];if(e==="searchbot")return new c6;var s=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);s?s.length<gd&&(s=pd(pd([],s,!0),y6(gd-s.length),!0)):s=[];var a=s.join("."),c=m6(r),l=f6.exec(r);return l&&l[1]?new u6(e,a,c,l[1]):new o6(e,a,c)}function m6(r){for(var t=0,e=md.length;t<e;t++){var n=md[t],s=n[0],a=n[1],c=a.exec(r);if(c)return s}return null}function v6(){var r=typeof ei<"u"&&ei.version;return r?new a6(ei.version.slice(1)):null}function y6(r){for(var t=[],e=0;e<r;e++)t.push("0");return t}var bt={};const Mn=Ll(s6);var Ph={},zo={},yd;function w6(){if(yd)return zo;yd=1,Object.defineProperty(zo,"__esModule",{value:!0}),zo.delay=void 0;function r(t){return new Promise(e=>{setTimeout(()=>{e(!0)},t)})}return zo.delay=r,zo}var ws={},Oh={},bs={},wd;function b6(){return wd||(wd=1,Object.defineProperty(bs,"__esModule",{value:!0}),bs.ONE_THOUSAND=bs.ONE_HUNDRED=void 0,bs.ONE_HUNDRED=100,bs.ONE_THOUSAND=1e3),bs}var Nh={},bd;function _6(){return bd||(bd=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.ONE_YEAR=r.FOUR_WEEKS=r.THREE_WEEKS=r.TWO_WEEKS=r.ONE_WEEK=r.THIRTY_DAYS=r.SEVEN_DAYS=r.FIVE_DAYS=r.THREE_DAYS=r.ONE_DAY=r.TWENTY_FOUR_HOURS=r.TWELVE_HOURS=r.SIX_HOURS=r.THREE_HOURS=r.ONE_HOUR=r.SIXTY_MINUTES=r.THIRTY_MINUTES=r.TEN_MINUTES=r.FIVE_MINUTES=r.ONE_MINUTE=r.SIXTY_SECONDS=r.THIRTY_SECONDS=r.TEN_SECONDS=r.FIVE_SECONDS=r.ONE_SECOND=void 0,r.ONE_SECOND=1,r.FIVE_SECONDS=5,r.TEN_SECONDS=10,r.THIRTY_SECONDS=30,r.SIXTY_SECONDS=60,r.ONE_MINUTE=r.SIXTY_SECONDS,r.FIVE_MINUTES=r.ONE_MINUTE*5,r.TEN_MINUTES=r.ONE_MINUTE*10,r.THIRTY_MINUTES=r.ONE_MINUTE*30,r.SIXTY_MINUTES=r.ONE_MINUTE*60,r.ONE_HOUR=r.SIXTY_MINUTES,r.THREE_HOURS=r.ONE_HOUR*3,r.SIX_HOURS=r.ONE_HOUR*6,r.TWELVE_HOURS=r.ONE_HOUR*12,r.TWENTY_FOUR_HOURS=r.ONE_HOUR*24,r.ONE_DAY=r.TWENTY_FOUR_HOURS,r.THREE_DAYS=r.ONE_DAY*3,r.FIVE_DAYS=r.ONE_DAY*5,r.SEVEN_DAYS=r.ONE_DAY*7,r.THIRTY_DAYS=r.ONE_DAY*30,r.ONE_WEEK=r.SEVEN_DAYS,r.TWO_WEEKS=r.ONE_WEEK*2,r.THREE_WEEKS=r.ONE_WEEK*3,r.FOUR_WEEKS=r.ONE_WEEK*4,r.ONE_YEAR=r.ONE_DAY*365}(Nh)),Nh}var _d;function x1(){return _d||(_d=1,function(r){Object.defineProperty(r,"__esModule",{value:!0});const t=Mn;t.__exportStar(b6(),r),t.__exportStar(_6(),r)}(Oh)),Oh}var Ed;function E6(){if(Ed)return ws;Ed=1,Object.defineProperty(ws,"__esModule",{value:!0}),ws.fromMiliseconds=ws.toMiliseconds=void 0;const r=x1();function t(n){return n*r.ONE_THOUSAND}ws.toMiliseconds=t;function e(n){return Math.floor(n/r.ONE_THOUSAND)}return ws.fromMiliseconds=e,ws}var Ad;function A6(){return Ad||(Ad=1,function(r){Object.defineProperty(r,"__esModule",{value:!0});const t=Mn;t.__exportStar(w6(),r),t.__exportStar(E6(),r)}(Ph)),Ph}var Js={},Sd;function S6(){if(Sd)return Js;Sd=1,Object.defineProperty(Js,"__esModule",{value:!0}),Js.Watch=void 0;class r{constructor(){this.timestamps=new Map}start(e){if(this.timestamps.has(e))throw new Error(`Watch already started for label: ${e}`);this.timestamps.set(e,{started:Date.now()})}stop(e){const n=this.get(e);if(typeof n.elapsed<"u")throw new Error(`Watch already stopped for label: ${e}`);const s=Date.now()-n.started;this.timestamps.set(e,{started:n.started,elapsed:s})}get(e){const n=this.timestamps.get(e);if(typeof n>"u")throw new Error(`No timestamp found for label: ${e}`);return n}elapsed(e){const n=this.get(e);return n.elapsed||Date.now()-n.started}}return Js.Watch=r,Js.default=r,Js}var Rh={},ko={},Id;function I6(){if(Id)return ko;Id=1,Object.defineProperty(ko,"__esModule",{value:!0}),ko.IWatch=void 0;class r{}return ko.IWatch=r,ko}var Dd;function D6(){return Dd||(Dd=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),Mn.__exportStar(I6(),r)}(Rh)),Rh}(function(r){Object.defineProperty(r,"__esModule",{value:!0});const t=Mn;t.__exportStar(A6(),r),t.__exportStar(S6(),r),t.__exportStar(D6(),r),t.__exportStar(x1(),r)})(bt);var je={};Object.defineProperty(je,"__esModule",{value:!0});je.getLocalStorage=je.getLocalStorageOrThrow=je.getCrypto=je.getCryptoOrThrow=M1=je.getLocation=je.getLocationOrThrow=zl=je.getNavigator=je.getNavigatorOrThrow=$l=je.getDocument=je.getDocumentOrThrow=je.getFromWindowOrThrow=je.getFromWindow=void 0;function Ms(r){let t;return typeof window<"u"&&typeof window[r]<"u"&&(t=window[r]),t}je.getFromWindow=Ms;function fo(r){const t=Ms(r);if(!t)throw new Error(`${r} is not defined in Window`);return t}je.getFromWindowOrThrow=fo;function x6(){return fo("document")}je.getDocumentOrThrow=x6;function M6(){return Ms("document")}var $l=je.getDocument=M6;function C6(){return fo("navigator")}je.getNavigatorOrThrow=C6;function P6(){return Ms("navigator")}var zl=je.getNavigator=P6;function O6(){return fo("location")}je.getLocationOrThrow=O6;function N6(){return Ms("location")}var M1=je.getLocation=N6;function R6(){return fo("crypto")}je.getCryptoOrThrow=R6;function T6(){return Ms("crypto")}je.getCrypto=T6;function F6(){return fo("localStorage")}je.getLocalStorageOrThrow=F6;function U6(){return Ms("localStorage")}je.getLocalStorage=U6;var kl={};Object.defineProperty(kl,"__esModule",{value:!0});var C1=kl.getWindowMetadata=void 0;const xd=je;function B6(){let r,t;try{r=xd.getDocumentOrThrow(),t=xd.getLocationOrThrow()}catch{return null}function e(){const E=r.getElementsByTagName("link"),x=[];for(let I=0;I<E.length;I++){const R=E[I],Y=R.getAttribute("rel");if(Y&&Y.toLowerCase().indexOf("icon")>-1){const W=R.getAttribute("href");if(W)if(W.toLowerCase().indexOf("https:")===-1&&W.toLowerCase().indexOf("http:")===-1&&W.indexOf("//")!==0){let tt=t.protocol+"//"+t.host;if(W.indexOf("/")===0)tt+=W;else{const K=t.pathname.split("/");K.pop();const V=K.join("/");tt+=V+"/"+W}x.push(tt)}else if(W.indexOf("//")===0){const tt=t.protocol+W;x.push(tt)}else x.push(W)}}return x}function n(...E){const x=r.getElementsByTagName("meta");for(let I=0;I<x.length;I++){const R=x[I],Y=["itemprop","property","name"].map(W=>R.getAttribute(W)).filter(W=>W?E.includes(W):!1);if(Y.length&&Y){const W=R.getAttribute("content");if(W)return W}}return""}function s(){let E=n("name","og:site_name","og:title","twitter:title");return E||(E=r.title),E}function a(){return n("description","og:description","twitter:description","keywords")}const c=s(),l=a(),d=t.origin,f=e();return{description:l,url:d,icons:f,name:c}}C1=kl.getWindowMetadata=B6;var na={},L6=r=>encodeURIComponent(r).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`),P1="%[a-f0-9]{2}",Md=new RegExp("("+P1+")|([^%]+?)","gi"),Cd=new RegExp("("+P1+")+","gi");function dl(r,t){try{return[decodeURIComponent(r.join(""))]}catch{}if(r.length===1)return r;t=t||1;var e=r.slice(0,t),n=r.slice(t);return Array.prototype.concat.call([],dl(e),dl(n))}function q6(r){try{return decodeURIComponent(r)}catch{for(var t=r.match(Md)||[],e=1;e<t.length;e++)r=dl(t,e).join(""),t=r.match(Md)||[];return r}}function j6(r){for(var t={"%FE%FF":"��","%FF%FE":"��"},e=Cd.exec(r);e;){try{t[e[0]]=decodeURIComponent(e[0])}catch{var n=q6(e[0]);n!==e[0]&&(t[e[0]]=n)}e=Cd.exec(r)}t["%C2"]="�";for(var s=Object.keys(t),a=0;a<s.length;a++){var c=s[a];r=r.replace(new RegExp(c,"g"),t[c])}return r}var $6=function(r){if(typeof r!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof r+"`");try{return r=r.replace(/\+/g," "),decodeURIComponent(r)}catch{return j6(r)}},z6=(r,t)=>{if(!(typeof r=="string"&&typeof t=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(t==="")return[r];const e=r.indexOf(t);return e===-1?[r]:[r.slice(0,e),r.slice(e+t.length)]},k6=function(r,t){for(var e={},n=Object.keys(r),s=Array.isArray(t),a=0;a<n.length;a++){var c=n[a],l=r[c];(s?t.indexOf(c)!==-1:t(c,l,r))&&(e[c]=l)}return e};(function(r){const t=L6,e=$6,n=z6,s=k6,a=K=>K==null,c=Symbol("encodeFragmentIdentifier");function l(K){switch(K.arrayFormat){case"index":return V=>(B,z)=>{const $=B.length;return z===void 0||K.skipNull&&z===null||K.skipEmptyString&&z===""?B:z===null?[...B,[w(V,K),"[",$,"]"].join("")]:[...B,[w(V,K),"[",w($,K),"]=",w(z,K)].join("")]};case"bracket":return V=>(B,z)=>z===void 0||K.skipNull&&z===null||K.skipEmptyString&&z===""?B:z===null?[...B,[w(V,K),"[]"].join("")]:[...B,[w(V,K),"[]=",w(z,K)].join("")];case"colon-list-separator":return V=>(B,z)=>z===void 0||K.skipNull&&z===null||K.skipEmptyString&&z===""?B:z===null?[...B,[w(V,K),":list="].join("")]:[...B,[w(V,K),":list=",w(z,K)].join("")];case"comma":case"separator":case"bracket-separator":{const V=K.arrayFormat==="bracket-separator"?"[]=":"=";return B=>(z,$)=>$===void 0||K.skipNull&&$===null||K.skipEmptyString&&$===""?z:($=$===null?"":$,z.length===0?[[w(B,K),V,w($,K)].join("")]:[[z,w($,K)].join(K.arrayFormatSeparator)])}default:return V=>(B,z)=>z===void 0||K.skipNull&&z===null||K.skipEmptyString&&z===""?B:z===null?[...B,w(V,K)]:[...B,[w(V,K),"=",w(z,K)].join("")]}}function d(K){let V;switch(K.arrayFormat){case"index":return(B,z,$)=>{if(V=/\[(\d*)\]$/.exec(B),B=B.replace(/\[\d*\]$/,""),!V){$[B]=z;return}$[B]===void 0&&($[B]={}),$[B][V[1]]=z};case"bracket":return(B,z,$)=>{if(V=/(\[\])$/.exec(B),B=B.replace(/\[\]$/,""),!V){$[B]=z;return}if($[B]===void 0){$[B]=[z];return}$[B]=[].concat($[B],z)};case"colon-list-separator":return(B,z,$)=>{if(V=/(:list)$/.exec(B),B=B.replace(/:list$/,""),!V){$[B]=z;return}if($[B]===void 0){$[B]=[z];return}$[B]=[].concat($[B],z)};case"comma":case"separator":return(B,z,$)=>{const v=typeof z=="string"&&z.includes(K.arrayFormatSeparator),T=typeof z=="string"&&!v&&E(z,K).includes(K.arrayFormatSeparator);z=T?E(z,K):z;const st=v||T?z.split(K.arrayFormatSeparator).map(ft=>E(ft,K)):z===null?z:E(z,K);$[B]=st};case"bracket-separator":return(B,z,$)=>{const v=/(\[\])$/.test(B);if(B=B.replace(/\[\]$/,""),!v){$[B]=z&&E(z,K);return}const T=z===null?[]:z.split(K.arrayFormatSeparator).map(st=>E(st,K));if($[B]===void 0){$[B]=T;return}$[B]=[].concat($[B],T)};default:return(B,z,$)=>{if($[B]===void 0){$[B]=z;return}$[B]=[].concat($[B],z)}}}function f(K){if(typeof K!="string"||K.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function w(K,V){return V.encode?V.strict?t(K):encodeURIComponent(K):K}function E(K,V){return V.decode?e(K):K}function x(K){return Array.isArray(K)?K.sort():typeof K=="object"?x(Object.keys(K)).sort((V,B)=>Number(V)-Number(B)).map(V=>K[V]):K}function I(K){const V=K.indexOf("#");return V!==-1&&(K=K.slice(0,V)),K}function R(K){let V="";const B=K.indexOf("#");return B!==-1&&(V=K.slice(B)),V}function Y(K){K=I(K);const V=K.indexOf("?");return V===-1?"":K.slice(V+1)}function W(K,V){return V.parseNumbers&&!Number.isNaN(Number(K))&&typeof K=="string"&&K.trim()!==""?K=Number(K):V.parseBooleans&&K!==null&&(K.toLowerCase()==="true"||K.toLowerCase()==="false")&&(K=K.toLowerCase()==="true"),K}function tt(K,V){V=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},V),f(V.arrayFormatSeparator);const B=d(V),z=Object.create(null);if(typeof K!="string"||(K=K.trim().replace(/^[?#&]/,""),!K))return z;for(const $ of K.split("&")){if($==="")continue;let[v,T]=n(V.decode?$.replace(/\+/g," "):$,"=");T=T===void 0?null:["comma","separator","bracket-separator"].includes(V.arrayFormat)?T:E(T,V),B(E(v,V),T,z)}for(const $ of Object.keys(z)){const v=z[$];if(typeof v=="object"&&v!==null)for(const T of Object.keys(v))v[T]=W(v[T],V);else z[$]=W(v,V)}return V.sort===!1?z:(V.sort===!0?Object.keys(z).sort():Object.keys(z).sort(V.sort)).reduce(($,v)=>{const T=z[v];return T&&typeof T=="object"&&!Array.isArray(T)?$[v]=x(T):$[v]=T,$},Object.create(null))}r.extract=Y,r.parse=tt,r.stringify=(K,V)=>{if(!K)return"";V=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},V),f(V.arrayFormatSeparator);const B=T=>V.skipNull&&a(K[T])||V.skipEmptyString&&K[T]==="",z=l(V),$={};for(const T of Object.keys(K))B(T)||($[T]=K[T]);const v=Object.keys($);return V.sort!==!1&&v.sort(V.sort),v.map(T=>{const st=K[T];return st===void 0?"":st===null?w(T,V):Array.isArray(st)?st.length===0&&V.arrayFormat==="bracket-separator"?w(T,V)+"[]":st.reduce(z(T),[]).join("&"):w(T,V)+"="+w(st,V)}).filter(T=>T.length>0).join("&")},r.parseUrl=(K,V)=>{V=Object.assign({decode:!0},V);const[B,z]=n(K,"#");return Object.assign({url:B.split("?")[0]||"",query:tt(Y(K),V)},V&&V.parseFragmentIdentifier&&z?{fragmentIdentifier:E(z,V)}:{})},r.stringifyUrl=(K,V)=>{V=Object.assign({encode:!0,strict:!0,[c]:!0},V);const B=I(K.url).split("?")[0]||"",z=r.extract(K.url),$=r.parse(z,{sort:!1}),v=Object.assign($,K.query);let T=r.stringify(v,V);T&&(T=`?${T}`);let st=R(K.url);return K.fragmentIdentifier&&(st=`#${V[c]?w(K.fragmentIdentifier,V):K.fragmentIdentifier}`),`${B}${T}${st}`},r.pick=(K,V,B)=>{B=Object.assign({parseFragmentIdentifier:!0,[c]:!1},B);const{url:z,query:$,fragmentIdentifier:v}=r.parseUrl(K,B);return r.stringifyUrl({url:z,query:s($,V),fragmentIdentifier:v},B)},r.exclude=(K,V,B)=>{const z=Array.isArray(V)?$=>!V.includes($):($,v)=>!V($,v);return r.pick(K,z,B)}})(na);var Hl={},ac={},oe={},O1={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});function t(l,d){var f=l>>>16&65535,w=l&65535,E=d>>>16&65535,x=d&65535;return w*x+(f*x+w*E<<16>>>0)|0}r.mul=Math.imul||t;function e(l,d){return l+d|0}r.add=e;function n(l,d){return l-d|0}r.sub=n;function s(l,d){return l<<d|l>>>32-d}r.rotl=s;function a(l,d){return l<<32-d|l>>>d}r.rotr=a;function c(l){return typeof l=="number"&&isFinite(l)&&Math.floor(l)===l}r.isInteger=Number.isInteger||c,r.MAX_SAFE_INTEGER=9007199254740991,r.isSafeInteger=function(l){return r.isInteger(l)&&l>=-r.MAX_SAFE_INTEGER&&l<=r.MAX_SAFE_INTEGER}})(O1);Object.defineProperty(oe,"__esModule",{value:!0});var N1=O1;function H6(r,t){return t===void 0&&(t=0),(r[t+0]<<8|r[t+1])<<16>>16}oe.readInt16BE=H6;function K6(r,t){return t===void 0&&(t=0),(r[t+0]<<8|r[t+1])>>>0}oe.readUint16BE=K6;function V6(r,t){return t===void 0&&(t=0),(r[t+1]<<8|r[t])<<16>>16}oe.readInt16LE=V6;function G6(r,t){return t===void 0&&(t=0),(r[t+1]<<8|r[t])>>>0}oe.readUint16LE=G6;function R1(r,t,e){return t===void 0&&(t=new Uint8Array(2)),e===void 0&&(e=0),t[e+0]=r>>>8,t[e+1]=r>>>0,t}oe.writeUint16BE=R1;oe.writeInt16BE=R1;function T1(r,t,e){return t===void 0&&(t=new Uint8Array(2)),e===void 0&&(e=0),t[e+0]=r>>>0,t[e+1]=r>>>8,t}oe.writeUint16LE=T1;oe.writeInt16LE=T1;function pl(r,t){return t===void 0&&(t=0),r[t]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3]}oe.readInt32BE=pl;function gl(r,t){return t===void 0&&(t=0),(r[t]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3])>>>0}oe.readUint32BE=gl;function ml(r,t){return t===void 0&&(t=0),r[t+3]<<24|r[t+2]<<16|r[t+1]<<8|r[t]}oe.readInt32LE=ml;function vl(r,t){return t===void 0&&(t=0),(r[t+3]<<24|r[t+2]<<16|r[t+1]<<8|r[t])>>>0}oe.readUint32LE=vl;function Gu(r,t,e){return t===void 0&&(t=new Uint8Array(4)),e===void 0&&(e=0),t[e+0]=r>>>24,t[e+1]=r>>>16,t[e+2]=r>>>8,t[e+3]=r>>>0,t}oe.writeUint32BE=Gu;oe.writeInt32BE=Gu;function Wu(r,t,e){return t===void 0&&(t=new Uint8Array(4)),e===void 0&&(e=0),t[e+0]=r>>>0,t[e+1]=r>>>8,t[e+2]=r>>>16,t[e+3]=r>>>24,t}oe.writeUint32LE=Wu;oe.writeInt32LE=Wu;function W6(r,t){t===void 0&&(t=0);var e=pl(r,t),n=pl(r,t+4);return e*4294967296+n-(n>>31)*4294967296}oe.readInt64BE=W6;function Y6(r,t){t===void 0&&(t=0);var e=gl(r,t),n=gl(r,t+4);return e*4294967296+n}oe.readUint64BE=Y6;function Q6(r,t){t===void 0&&(t=0);var e=ml(r,t),n=ml(r,t+4);return n*4294967296+e-(e>>31)*4294967296}oe.readInt64LE=Q6;function J6(r,t){t===void 0&&(t=0);var e=vl(r,t),n=vl(r,t+4);return n*4294967296+e}oe.readUint64LE=J6;function F1(r,t,e){return t===void 0&&(t=new Uint8Array(8)),e===void 0&&(e=0),Gu(r/4294967296>>>0,t,e),Gu(r>>>0,t,e+4),t}oe.writeUint64BE=F1;oe.writeInt64BE=F1;function U1(r,t,e){return t===void 0&&(t=new Uint8Array(8)),e===void 0&&(e=0),Wu(r>>>0,t,e),Wu(r/4294967296>>>0,t,e+4),t}oe.writeUint64LE=U1;oe.writeInt64LE=U1;function X6(r,t,e){if(e===void 0&&(e=0),r%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(r/8>t.length-e)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,s=1,a=r/8+e-1;a>=e;a--)n+=t[a]*s,s*=256;return n}oe.readUintBE=X6;function Z6(r,t,e){if(e===void 0&&(e=0),r%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(r/8>t.length-e)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,s=1,a=e;a<e+r/8;a++)n+=t[a]*s,s*=256;return n}oe.readUintLE=Z6;function t_(r,t,e,n){if(e===void 0&&(e=new Uint8Array(r/8)),n===void 0&&(n=0),r%8!==0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!N1.isSafeInteger(t))throw new Error("writeUintBE value must be an integer");for(var s=1,a=r/8+n-1;a>=n;a--)e[a]=t/s&255,s*=256;return e}oe.writeUintBE=t_;function e_(r,t,e,n){if(e===void 0&&(e=new Uint8Array(r/8)),n===void 0&&(n=0),r%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!N1.isSafeInteger(t))throw new Error("writeUintLE value must be an integer");for(var s=1,a=n;a<n+r/8;a++)e[a]=t/s&255,s*=256;return e}oe.writeUintLE=e_;function r_(r,t){t===void 0&&(t=0);var e=new DataView(r.buffer,r.byteOffset,r.byteLength);return e.getFloat32(t)}oe.readFloat32BE=r_;function i_(r,t){t===void 0&&(t=0);var e=new DataView(r.buffer,r.byteOffset,r.byteLength);return e.getFloat32(t,!0)}oe.readFloat32LE=i_;function n_(r,t){t===void 0&&(t=0);var e=new DataView(r.buffer,r.byteOffset,r.byteLength);return e.getFloat64(t)}oe.readFloat64BE=n_;function s_(r,t){t===void 0&&(t=0);var e=new DataView(r.buffer,r.byteOffset,r.byteLength);return e.getFloat64(t,!0)}oe.readFloat64LE=s_;function o_(r,t,e){t===void 0&&(t=new Uint8Array(4)),e===void 0&&(e=0);var n=new DataView(t.buffer,t.byteOffset,t.byteLength);return n.setFloat32(e,r),t}oe.writeFloat32BE=o_;function a_(r,t,e){t===void 0&&(t=new Uint8Array(4)),e===void 0&&(e=0);var n=new DataView(t.buffer,t.byteOffset,t.byteLength);return n.setFloat32(e,r,!0),t}oe.writeFloat32LE=a_;function u_(r,t,e){t===void 0&&(t=new Uint8Array(8)),e===void 0&&(e=0);var n=new DataView(t.buffer,t.byteOffset,t.byteLength);return n.setFloat64(e,r),t}oe.writeFloat64BE=u_;function c_(r,t,e){t===void 0&&(t=new Uint8Array(8)),e===void 0&&(e=0);var n=new DataView(t.buffer,t.byteOffset,t.byteLength);return n.setFloat64(e,r,!0),t}oe.writeFloat64LE=c_;var ni={};Object.defineProperty(ni,"__esModule",{value:!0});function h_(r){for(var t=0;t<r.length;t++)r[t]=0;return r}ni.wipe=h_;Object.defineProperty(ac,"__esModule",{value:!0});var wr=oe,yl=ni,l_=20;function f_(r,t,e){for(var n=1634760805,s=857760878,a=2036477234,c=1797285236,l=e[3]<<24|e[2]<<16|e[1]<<8|e[0],d=e[7]<<24|e[6]<<16|e[5]<<8|e[4],f=e[11]<<24|e[10]<<16|e[9]<<8|e[8],w=e[15]<<24|e[14]<<16|e[13]<<8|e[12],E=e[19]<<24|e[18]<<16|e[17]<<8|e[16],x=e[23]<<24|e[22]<<16|e[21]<<8|e[20],I=e[27]<<24|e[26]<<16|e[25]<<8|e[24],R=e[31]<<24|e[30]<<16|e[29]<<8|e[28],Y=t[3]<<24|t[2]<<16|t[1]<<8|t[0],W=t[7]<<24|t[6]<<16|t[5]<<8|t[4],tt=t[11]<<24|t[10]<<16|t[9]<<8|t[8],K=t[15]<<24|t[14]<<16|t[13]<<8|t[12],V=n,B=s,z=a,$=c,v=l,T=d,st=f,ft=w,pt=E,gt=x,h=I,y=R,b=Y,C=W,M=tt,N=K,q=0;q<l_;q+=2)V=V+v|0,b^=V,b=b>>>32-16|b<<16,pt=pt+b|0,v^=pt,v=v>>>32-12|v<<12,B=B+T|0,C^=B,C=C>>>32-16|C<<16,gt=gt+C|0,T^=gt,T=T>>>32-12|T<<12,z=z+st|0,M^=z,M=M>>>32-16|M<<16,h=h+M|0,st^=h,st=st>>>32-12|st<<12,$=$+ft|0,N^=$,N=N>>>32-16|N<<16,y=y+N|0,ft^=y,ft=ft>>>32-12|ft<<12,z=z+st|0,M^=z,M=M>>>32-8|M<<8,h=h+M|0,st^=h,st=st>>>32-7|st<<7,$=$+ft|0,N^=$,N=N>>>32-8|N<<8,y=y+N|0,ft^=y,ft=ft>>>32-7|ft<<7,B=B+T|0,C^=B,C=C>>>32-8|C<<8,gt=gt+C|0,T^=gt,T=T>>>32-7|T<<7,V=V+v|0,b^=V,b=b>>>32-8|b<<8,pt=pt+b|0,v^=pt,v=v>>>32-7|v<<7,V=V+T|0,N^=V,N=N>>>32-16|N<<16,h=h+N|0,T^=h,T=T>>>32-12|T<<12,B=B+st|0,b^=B,b=b>>>32-16|b<<16,y=y+b|0,st^=y,st=st>>>32-12|st<<12,z=z+ft|0,C^=z,C=C>>>32-16|C<<16,pt=pt+C|0,ft^=pt,ft=ft>>>32-12|ft<<12,$=$+v|0,M^=$,M=M>>>32-16|M<<16,gt=gt+M|0,v^=gt,v=v>>>32-12|v<<12,z=z+ft|0,C^=z,C=C>>>32-8|C<<8,pt=pt+C|0,ft^=pt,ft=ft>>>32-7|ft<<7,$=$+v|0,M^=$,M=M>>>32-8|M<<8,gt=gt+M|0,v^=gt,v=v>>>32-7|v<<7,B=B+st|0,b^=B,b=b>>>32-8|b<<8,y=y+b|0,st^=y,st=st>>>32-7|st<<7,V=V+T|0,N^=V,N=N>>>32-8|N<<8,h=h+N|0,T^=h,T=T>>>32-7|T<<7;wr.writeUint32LE(V+n|0,r,0),wr.writeUint32LE(B+s|0,r,4),wr.writeUint32LE(z+a|0,r,8),wr.writeUint32LE($+c|0,r,12),wr.writeUint32LE(v+l|0,r,16),wr.writeUint32LE(T+d|0,r,20),wr.writeUint32LE(st+f|0,r,24),wr.writeUint32LE(ft+w|0,r,28),wr.writeUint32LE(pt+E|0,r,32),wr.writeUint32LE(gt+x|0,r,36),wr.writeUint32LE(h+I|0,r,40),wr.writeUint32LE(y+R|0,r,44),wr.writeUint32LE(b+Y|0,r,48),wr.writeUint32LE(C+W|0,r,52),wr.writeUint32LE(M+tt|0,r,56),wr.writeUint32LE(N+K|0,r,60)}function B1(r,t,e,n,s){if(s===void 0&&(s=0),r.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length<e.length)throw new Error("ChaCha: destination is shorter than source");var a,c;if(s===0){if(t.length!==8&&t.length!==12)throw new Error("ChaCha nonce must be 8 or 12 bytes");a=new Uint8Array(16),c=a.length-t.length,a.set(t,c)}else{if(t.length!==16)throw new Error("ChaCha nonce with counter must be 16 bytes");a=t,c=s}for(var l=new Uint8Array(64),d=0;d<e.length;d+=64){f_(l,a,r);for(var f=d;f<d+64&&f<e.length;f++)n[f]=e[f]^l[f-d];p_(a,0,c)}return yl.wipe(l),s===0&&yl.wipe(a),n}ac.streamXOR=B1;function d_(r,t,e,n){return n===void 0&&(n=0),yl.wipe(e),B1(r,t,e,e,n)}ac.stream=d_;function p_(r,t,e){for(var n=1;e--;)n=n+(r[t]&255)|0,r[t]=n&255,n>>>=8,t++;if(n>0)throw new Error("ChaCha: counter overflow")}var L1={},Jn={};Object.defineProperty(Jn,"__esModule",{value:!0});function g_(r,t,e){return~(r-1)&t|r-1&e}Jn.select=g_;function m_(r,t){return(r|0)-(t|0)-1>>>31&1}Jn.lessOrEqual=m_;function q1(r,t){if(r.length!==t.length)return 0;for(var e=0,n=0;n<r.length;n++)e|=r[n]^t[n];return 1&e-1>>>8}Jn.compare=q1;function v_(r,t){return r.length===0||t.length===0?!1:q1(r,t)!==0}Jn.equal=v_;(function(r){Object.defineProperty(r,"__esModule",{value:!0});var t=Jn,e=ni;r.DIGEST_LENGTH=16;var n=function(){function c(l){this.digestLength=r.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var d=l[0]|l[1]<<8;this._r[0]=d&8191;var f=l[2]|l[3]<<8;this._r[1]=(d>>>13|f<<3)&8191;var w=l[4]|l[5]<<8;this._r[2]=(f>>>10|w<<6)&7939;var E=l[6]|l[7]<<8;this._r[3]=(w>>>7|E<<9)&8191;var x=l[8]|l[9]<<8;this._r[4]=(E>>>4|x<<12)&255,this._r[5]=x>>>1&8190;var I=l[10]|l[11]<<8;this._r[6]=(x>>>14|I<<2)&8191;var R=l[12]|l[13]<<8;this._r[7]=(I>>>11|R<<5)&8065;var Y=l[14]|l[15]<<8;this._r[8]=(R>>>8|Y<<8)&8191,this._r[9]=Y>>>5&127,this._pad[0]=l[16]|l[17]<<8,this._pad[1]=l[18]|l[19]<<8,this._pad[2]=l[20]|l[21]<<8,this._pad[3]=l[22]|l[23]<<8,this._pad[4]=l[24]|l[25]<<8,this._pad[5]=l[26]|l[27]<<8,this._pad[6]=l[28]|l[29]<<8,this._pad[7]=l[30]|l[31]<<8}return c.prototype._blocks=function(l,d,f){for(var w=this._fin?0:2048,E=this._h[0],x=this._h[1],I=this._h[2],R=this._h[3],Y=this._h[4],W=this._h[5],tt=this._h[6],K=this._h[7],V=this._h[8],B=this._h[9],z=this._r[0],$=this._r[1],v=this._r[2],T=this._r[3],st=this._r[4],ft=this._r[5],pt=this._r[6],gt=this._r[7],h=this._r[8],y=this._r[9];f>=16;){var b=l[d+0]|l[d+1]<<8;E+=b&8191;var C=l[d+2]|l[d+3]<<8;x+=(b>>>13|C<<3)&8191;var M=l[d+4]|l[d+5]<<8;I+=(C>>>10|M<<6)&8191;var N=l[d+6]|l[d+7]<<8;R+=(M>>>7|N<<9)&8191;var q=l[d+8]|l[d+9]<<8;Y+=(N>>>4|q<<12)&8191,W+=q>>>1&8191;var S=l[d+10]|l[d+11]<<8;tt+=(q>>>14|S<<2)&8191;var g=l[d+12]|l[d+13]<<8;K+=(S>>>11|g<<5)&8191;var O=l[d+14]|l[d+15]<<8;V+=(g>>>8|O<<8)&8191,B+=O>>>5|w;var it=0,lt=it;lt+=E*z,lt+=x*(5*y),lt+=I*(5*h),lt+=R*(5*gt),lt+=Y*(5*pt),it=lt>>>13,lt&=8191,lt+=W*(5*ft),lt+=tt*(5*st),lt+=K*(5*T),lt+=V*(5*v),lt+=B*(5*$),it+=lt>>>13,lt&=8191;var _=it;_+=E*$,_+=x*z,_+=I*(5*y),_+=R*(5*h),_+=Y*(5*gt),it=_>>>13,_&=8191,_+=W*(5*pt),_+=tt*(5*ft),_+=K*(5*st),_+=V*(5*T),_+=B*(5*v),it+=_>>>13,_&=8191;var Z=it;Z+=E*v,Z+=x*$,Z+=I*z,Z+=R*(5*y),Z+=Y*(5*h),it=Z>>>13,Z&=8191,Z+=W*(5*gt),Z+=tt*(5*pt),Z+=K*(5*ft),Z+=V*(5*st),Z+=B*(5*T),it+=Z>>>13,Z&=8191;var U=it;U+=E*T,U+=x*v,U+=I*$,U+=R*z,U+=Y*(5*y),it=U>>>13,U&=8191,U+=W*(5*h),U+=tt*(5*gt),U+=K*(5*pt),U+=V*(5*ft),U+=B*(5*st),it+=U>>>13,U&=8191;var L=it;L+=E*st,L+=x*T,L+=I*v,L+=R*$,L+=Y*z,it=L>>>13,L&=8191,L+=W*(5*y),L+=tt*(5*h),L+=K*(5*gt),L+=V*(5*pt),L+=B*(5*ft),it+=L>>>13,L&=8191;var k=it;k+=E*ft,k+=x*st,k+=I*T,k+=R*v,k+=Y*$,it=k>>>13,k&=8191,k+=W*z,k+=tt*(5*y),k+=K*(5*h),k+=V*(5*gt),k+=B*(5*pt),it+=k>>>13,k&=8191;var p=it;p+=E*pt,p+=x*ft,p+=I*st,p+=R*T,p+=Y*v,it=p>>>13,p&=8191,p+=W*$,p+=tt*z,p+=K*(5*y),p+=V*(5*h),p+=B*(5*gt),it+=p>>>13,p&=8191;var F=it;F+=E*gt,F+=x*pt,F+=I*ft,F+=R*st,F+=Y*T,it=F>>>13,F&=8191,F+=W*v,F+=tt*$,F+=K*z,F+=V*(5*y),F+=B*(5*h),it+=F>>>13,F&=8191;var et=it;et+=E*h,et+=x*gt,et+=I*pt,et+=R*ft,et+=Y*st,it=et>>>13,et&=8191,et+=W*T,et+=tt*v,et+=K*$,et+=V*z,et+=B*(5*y),it+=et>>>13,et&=8191;var ct=it;ct+=E*y,ct+=x*h,ct+=I*gt,ct+=R*pt,ct+=Y*ft,it=ct>>>13,ct&=8191,ct+=W*st,ct+=tt*T,ct+=K*v,ct+=V*$,ct+=B*z,it+=ct>>>13,ct&=8191,it=(it<<2)+it|0,it=it+lt|0,lt=it&8191,it=it>>>13,_+=it,E=lt,x=_,I=Z,R=U,Y=L,W=k,tt=p,K=F,V=et,B=ct,d+=16,f-=16}this._h[0]=E,this._h[1]=x,this._h[2]=I,this._h[3]=R,this._h[4]=Y,this._h[5]=W,this._h[6]=tt,this._h[7]=K,this._h[8]=V,this._h[9]=B},c.prototype.finish=function(l,d){d===void 0&&(d=0);var f=new Uint16Array(10),w,E,x,I;if(this._leftover){for(I=this._leftover,this._buffer[I++]=1;I<16;I++)this._buffer[I]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(w=this._h[1]>>>13,this._h[1]&=8191,I=2;I<10;I++)this._h[I]+=w,w=this._h[I]>>>13,this._h[I]&=8191;for(this._h[0]+=w*5,w=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=w,w=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=w,f[0]=this._h[0]+5,w=f[0]>>>13,f[0]&=8191,I=1;I<10;I++)f[I]=this._h[I]+w,w=f[I]>>>13,f[I]&=8191;for(f[9]-=8192,E=(w^1)-1,I=0;I<10;I++)f[I]&=E;for(E=~E,I=0;I<10;I++)this._h[I]=this._h[I]&E|f[I];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,x=this._h[0]+this._pad[0],this._h[0]=x&65535,I=1;I<8;I++)x=(this._h[I]+this._pad[I]|0)+(x>>>16)|0,this._h[I]=x&65535;return l[d+0]=this._h[0]>>>0,l[d+1]=this._h[0]>>>8,l[d+2]=this._h[1]>>>0,l[d+3]=this._h[1]>>>8,l[d+4]=this._h[2]>>>0,l[d+5]=this._h[2]>>>8,l[d+6]=this._h[3]>>>0,l[d+7]=this._h[3]>>>8,l[d+8]=this._h[4]>>>0,l[d+9]=this._h[4]>>>8,l[d+10]=this._h[5]>>>0,l[d+11]=this._h[5]>>>8,l[d+12]=this._h[6]>>>0,l[d+13]=this._h[6]>>>8,l[d+14]=this._h[7]>>>0,l[d+15]=this._h[7]>>>8,this._finished=!0,this},c.prototype.update=function(l){var d=0,f=l.length,w;if(this._leftover){w=16-this._leftover,w>f&&(w=f);for(var E=0;E<w;E++)this._buffer[this._leftover+E]=l[d+E];if(f-=w,d+=w,this._leftover+=w,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(f>=16&&(w=f-f%16,this._blocks(l,d,w),d+=w,f-=w),f){for(var E=0;E<f;E++)this._buffer[this._leftover+E]=l[d+E];this._leftover+=f}return this},c.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var l=new Uint8Array(16);return this.finish(l),l},c.prototype.clean=function(){return e.wipe(this._buffer),e.wipe(this._r),e.wipe(this._h),e.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},c}();r.Poly1305=n;function s(c,l){var d=new n(c);d.update(l);var f=d.digest();return d.clean(),f}r.oneTimeAuth=s;function a(c,l){return c.length!==r.DIGEST_LENGTH||l.length!==r.DIGEST_LENGTH?!1:t.equal(c,l)}r.equal=a})(L1);(function(r){Object.defineProperty(r,"__esModule",{value:!0});var t=ac,e=L1,n=ni,s=oe,a=Jn;r.KEY_LENGTH=32,r.NONCE_LENGTH=12,r.TAG_LENGTH=16;var c=new Uint8Array(16),l=function(){function d(f){if(this.nonceLength=r.NONCE_LENGTH,this.tagLength=r.TAG_LENGTH,f.length!==r.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(f)}return d.prototype.seal=function(f,w,E,x){if(f.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var I=new Uint8Array(16);I.set(f,I.length-f.length);var R=new Uint8Array(32);t.stream(this._key,I,R,4);var Y=w.length+this.tagLength,W;if(x){if(x.length!==Y)throw new Error("ChaCha20Poly1305: incorrect destination length");W=x}else W=new Uint8Array(Y);return t.streamXOR(this._key,I,w,W,4),this._authenticate(W.subarray(W.length-this.tagLength,W.length),R,W.subarray(0,W.length-this.tagLength),E),n.wipe(I),W},d.prototype.open=function(f,w,E,x){if(f.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(w.length<this.tagLength)return null;var I=new Uint8Array(16);I.set(f,I.length-f.length);var R=new Uint8Array(32);t.stream(this._key,I,R,4);var Y=new Uint8Array(this.tagLength);if(this._authenticate(Y,R,w.subarray(0,w.length-this.tagLength),E),!a.equal(Y,w.subarray(w.length-this.tagLength,w.length)))return null;var W=w.length-this.tagLength,tt;if(x){if(x.length!==W)throw new Error("ChaCha20Poly1305: incorrect destination length");tt=x}else tt=new Uint8Array(W);return t.streamXOR(this._key,I,w.subarray(0,w.length-this.tagLength),tt,4),n.wipe(I),tt},d.prototype.clean=function(){return n.wipe(this._key),this},d.prototype._authenticate=function(f,w,E,x){var I=new e.Poly1305(w);x&&(I.update(x),x.length%16>0&&I.update(c.subarray(x.length%16))),I.update(E),E.length%16>0&&I.update(c.subarray(E.length%16));var R=new Uint8Array(8);x&&s.writeUint64LE(x.length,R),I.update(R),s.writeUint64LE(E.length,R),I.update(R);for(var Y=I.digest(),W=0;W<Y.length;W++)f[W]=Y[W];I.clean(),n.wipe(Y),n.wipe(R)},d}();r.ChaCha20Poly1305=l})(Hl);var j1={},da={},Kl={};Object.defineProperty(Kl,"__esModule",{value:!0});function y_(r){return typeof r.saveState<"u"&&typeof r.restoreState<"u"&&typeof r.cleanSavedState<"u"}Kl.isSerializableHash=y_;Object.defineProperty(da,"__esModule",{value:!0});var Gi=Kl,w_=Jn,b_=ni,$1=function(){function r(t,e){this._finished=!1,this._inner=new t,this._outer=new t,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var n=new Uint8Array(this.blockSize);e.length>this.blockSize?this._inner.update(e).finish(n).clean():n.set(e);for(var s=0;s<n.length;s++)n[s]^=54;this._inner.update(n);for(var s=0;s<n.length;s++)n[s]^=106;this._outer.update(n),Gi.isSerializableHash(this._inner)&&Gi.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),b_.wipe(n)}return r.prototype.reset=function(){if(!Gi.isSerializableHash(this._inner)||!Gi.isSerializableHash(this._outer))throw new Error("hmac: can't reset() because hash doesn't implement restoreState()");return this._inner.restoreState(this._innerKeyedState),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},r.prototype.clean=function(){Gi.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),Gi.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},r.prototype.update=function(t){return this._inner.update(t),this},r.prototype.finish=function(t){return this._finished?(this._outer.finish(t),this):(this._inner.finish(t),this._outer.update(t.subarray(0,this.digestLength)).finish(t),this._finished=!0,this)},r.prototype.digest=function(){var t=new Uint8Array(this.digestLength);return this.finish(t),t},r.prototype.saveState=function(){if(!Gi.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},r.prototype.restoreState=function(t){if(!Gi.isSerializableHash(this._inner)||!Gi.isSerializableHash(this._outer))throw new Error("hmac: can't restoreState() because hash doesn't implement it");return this._inner.restoreState(t),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},r.prototype.cleanSavedState=function(t){if(!Gi.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(t)},r}();da.HMAC=$1;function __(r,t,e){var n=new $1(r,t);n.update(e);var s=n.digest();return n.clean(),s}da.hmac=__;da.equal=w_.equal;Object.defineProperty(j1,"__esModule",{value:!0});var Pd=da,Od=ni,E_=function(){function r(t,e,n,s){n===void 0&&(n=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=t,this._info=s;var a=Pd.hmac(this._hash,n,e);this._hmac=new Pd.HMAC(t,a),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return r.prototype._fillBuffer=function(){this._counter[0]++;var t=this._counter[0];if(t===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),t>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},r.prototype.expand=function(t){for(var e=new Uint8Array(t),n=0;n<e.length;n++)this._bufpos===this._buffer.length&&this._fillBuffer(),e[n]=this._buffer[this._bufpos++];return e},r.prototype.clean=function(){this._hmac.clean(),Od.wipe(this._buffer),Od.wipe(this._counter),this._bufpos=0},r}(),A_=j1.HKDF=E_,po={},uc={},cc={};Object.defineProperty(cc,"__esModule",{value:!0});cc.BrowserRandomSource=void 0;const Nd=65536;class S_{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const t=typeof self<"u"?self.crypto||self.msCrypto:null;t&&t.getRandomValues!==void 0&&(this._crypto=t,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(t){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const e=new Uint8Array(t);for(let n=0;n<e.length;n+=Nd)this._crypto.getRandomValues(e.subarray(n,n+Math.min(e.length-n,Nd)));return e}}cc.BrowserRandomSource=S_;var hc={};Object.defineProperty(hc,"__esModule",{value:!0});hc.NodeRandomSource=void 0;const I_=ni;class D_{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof e6<"u"){const t=r6();t&&t.randomBytes&&(this._crypto=t,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(t){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let e=this._crypto.randomBytes(t);if(e.length!==t)throw new Error("NodeRandomSource: got fewer bytes than requested");const n=new Uint8Array(t);for(let s=0;s<n.length;s++)n[s]=e[s];return(0,I_.wipe)(e),n}}hc.NodeRandomSource=D_;Object.defineProperty(uc,"__esModule",{value:!0});uc.SystemRandomSource=void 0;const x_=cc,M_=hc;class C_{constructor(){if(this.isAvailable=!1,this.name="",this._source=new x_.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new M_.NodeRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Node";return}}randomBytes(t){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(t)}}uc.SystemRandomSource=C_;(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.randomStringForEntropy=r.randomString=r.randomUint32=r.randomBytes=r.defaultRandomSource=void 0;const t=uc,e=oe,n=ni;r.defaultRandomSource=new t.SystemRandomSource;function s(f,w=r.defaultRandomSource){return w.randomBytes(f)}r.randomBytes=s;function a(f=r.defaultRandomSource){const w=s(4,f),E=(0,e.readUint32LE)(w);return(0,n.wipe)(w),E}r.randomUint32=a;const c="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function l(f,w=c,E=r.defaultRandomSource){if(w.length<2)throw new Error("randomString charset is too short");if(w.length>256)throw new Error("randomString charset is too long");let x="";const I=w.length,R=256-256%I;for(;f>0;){const Y=s(Math.ceil(f*256/R),E);for(let W=0;W<Y.length&&f>0;W++){const tt=Y[W];tt<R&&(x+=w.charAt(tt%I),f--)}(0,n.wipe)(Y)}return x}r.randomString=l;function d(f,w=c,E=r.defaultRandomSource){const x=Math.ceil(f/(Math.log(w.length)/Math.LN2));return l(x,w,E)}r.randomStringForEntropy=d})(po);var lc={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});var t=oe,e=ni;r.DIGEST_LENGTH=32,r.BLOCK_SIZE=64;var n=function(){function l(){this.digestLength=r.DIGEST_LENGTH,this.blockSize=r.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return l.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},l.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},l.prototype.clean=function(){e.wipe(this._buffer),e.wipe(this._temp),this.reset()},l.prototype.update=function(d,f){if(f===void 0&&(f=d.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var w=0;if(this._bytesHashed+=f,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&f>0;)this._buffer[this._bufferLength++]=d[w++],f--;this._bufferLength===this.blockSize&&(a(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(f>=this.blockSize&&(w=a(this._temp,this._state,d,w,f),f%=this.blockSize);f>0;)this._buffer[this._bufferLength++]=d[w++],f--;return this},l.prototype.finish=function(d){if(!this._finished){var f=this._bytesHashed,w=this._bufferLength,E=f/536870912|0,x=f<<3,I=f%64<56?64:128;this._buffer[w]=128;for(var R=w+1;R<I-8;R++)this._buffer[R]=0;t.writeUint32BE(E,this._buffer,I-8),t.writeUint32BE(x,this._buffer,I-4),a(this._temp,this._state,this._buffer,0,I),this._finished=!0}for(var R=0;R<this.digestLength/4;R++)t.writeUint32BE(this._state[R],d,R*4);return this},l.prototype.digest=function(){var d=new Uint8Array(this.digestLength);return this.finish(d),d},l.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{state:new Int32Array(this._state),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},l.prototype.restoreState=function(d){return this._state.set(d.state),this._bufferLength=d.bufferLength,d.buffer&&this._buffer.set(d.buffer),this._bytesHashed=d.bytesHashed,this._finished=!1,this},l.prototype.cleanSavedState=function(d){e.wipe(d.state),d.buffer&&e.wipe(d.buffer),d.bufferLength=0,d.bytesHashed=0},l}();r.SHA256=n;var s=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function a(l,d,f,w,E){for(;E>=64;){for(var x=d[0],I=d[1],R=d[2],Y=d[3],W=d[4],tt=d[5],K=d[6],V=d[7],B=0;B<16;B++){var z=w+B*4;l[B]=t.readUint32BE(f,z)}for(var B=16;B<64;B++){var $=l[B-2],v=($>>>17|$<<32-17)^($>>>19|$<<32-19)^$>>>10;$=l[B-15];var T=($>>>7|$<<32-7)^($>>>18|$<<32-18)^$>>>3;l[B]=(v+l[B-7]|0)+(T+l[B-16]|0)}for(var B=0;B<64;B++){var v=(((W>>>6|W<<26)^(W>>>11|W<<21)^(W>>>25|W<<7))+(W&tt^~W&K)|0)+(V+(s[B]+l[B]|0)|0)|0,T=((x>>>2|x<<32-2)^(x>>>13|x<<32-13)^(x>>>22|x<<32-22))+(x&I^x&R^I&R)|0;V=K,K=tt,tt=W,W=Y+v|0,Y=R,R=I,I=x,x=v+T|0}d[0]+=x,d[1]+=I,d[2]+=R,d[3]+=Y,d[4]+=W,d[5]+=tt,d[6]+=K,d[7]+=V,w+=64,E-=64}return w}function c(l){var d=new n;d.update(l);var f=d.digest();return d.clean(),f}r.hash=c})(lc);var Vl={};(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.sharedKey=r.generateKeyPair=r.generateKeyPairFromSeed=r.scalarMultBase=r.scalarMult=r.SHARED_KEY_LENGTH=r.SECRET_KEY_LENGTH=r.PUBLIC_KEY_LENGTH=void 0;const t=po,e=ni;r.PUBLIC_KEY_LENGTH=32,r.SECRET_KEY_LENGTH=32,r.SHARED_KEY_LENGTH=32;function n(B){const z=new Float64Array(16);if(B)for(let $=0;$<B.length;$++)z[$]=B[$];return z}const s=new Uint8Array(32);s[0]=9;const a=n([56129,1]);function c(B){let z=1;for(let $=0;$<16;$++){let v=B[$]+z+65535;z=Math.floor(v/65536),B[$]=v-z*65536}B[0]+=z-1+37*(z-1)}function l(B,z,$){const v=~($-1);for(let T=0;T<16;T++){const st=v&(B[T]^z[T]);B[T]^=st,z[T]^=st}}function d(B,z){const $=n(),v=n();for(let T=0;T<16;T++)v[T]=z[T];c(v),c(v),c(v);for(let T=0;T<2;T++){$[0]=v[0]-65517;for(let ft=1;ft<15;ft++)$[ft]=v[ft]-65535-($[ft-1]>>16&1),$[ft-1]&=65535;$[15]=v[15]-32767-($[14]>>16&1);const st=$[15]>>16&1;$[14]&=65535,l(v,$,1-st)}for(let T=0;T<16;T++)B[2*T]=v[T]&255,B[2*T+1]=v[T]>>8}function f(B,z){for(let $=0;$<16;$++)B[$]=z[2*$]+(z[2*$+1]<<8);B[15]&=32767}function w(B,z,$){for(let v=0;v<16;v++)B[v]=z[v]+$[v]}function E(B,z,$){for(let v=0;v<16;v++)B[v]=z[v]-$[v]}function x(B,z,$){let v,T,st=0,ft=0,pt=0,gt=0,h=0,y=0,b=0,C=0,M=0,N=0,q=0,S=0,g=0,O=0,it=0,lt=0,_=0,Z=0,U=0,L=0,k=0,p=0,F=0,et=0,ct=0,at=0,Mt=0,Pt=0,It=0,Ee=0,$t=0,xt=$[0],Bt=$[1],_t=$[2],Et=$[3],Vt=$[4],yt=$[5],At=$[6],Ut=$[7],wt=$[8],Ct=$[9],Lt=$[10],Ot=$[11],Nt=$[12],se=$[13],Tt=$[14],Rt=$[15];v=z[0],st+=v*xt,ft+=v*Bt,pt+=v*_t,gt+=v*Et,h+=v*Vt,y+=v*yt,b+=v*At,C+=v*Ut,M+=v*wt,N+=v*Ct,q+=v*Lt,S+=v*Ot,g+=v*Nt,O+=v*se,it+=v*Tt,lt+=v*Rt,v=z[1],ft+=v*xt,pt+=v*Bt,gt+=v*_t,h+=v*Et,y+=v*Vt,b+=v*yt,C+=v*At,M+=v*Ut,N+=v*wt,q+=v*Ct,S+=v*Lt,g+=v*Ot,O+=v*Nt,it+=v*se,lt+=v*Tt,_+=v*Rt,v=z[2],pt+=v*xt,gt+=v*Bt,h+=v*_t,y+=v*Et,b+=v*Vt,C+=v*yt,M+=v*At,N+=v*Ut,q+=v*wt,S+=v*Ct,g+=v*Lt,O+=v*Ot,it+=v*Nt,lt+=v*se,_+=v*Tt,Z+=v*Rt,v=z[3],gt+=v*xt,h+=v*Bt,y+=v*_t,b+=v*Et,C+=v*Vt,M+=v*yt,N+=v*At,q+=v*Ut,S+=v*wt,g+=v*Ct,O+=v*Lt,it+=v*Ot,lt+=v*Nt,_+=v*se,Z+=v*Tt,U+=v*Rt,v=z[4],h+=v*xt,y+=v*Bt,b+=v*_t,C+=v*Et,M+=v*Vt,N+=v*yt,q+=v*At,S+=v*Ut,g+=v*wt,O+=v*Ct,it+=v*Lt,lt+=v*Ot,_+=v*Nt,Z+=v*se,U+=v*Tt,L+=v*Rt,v=z[5],y+=v*xt,b+=v*Bt,C+=v*_t,M+=v*Et,N+=v*Vt,q+=v*yt,S+=v*At,g+=v*Ut,O+=v*wt,it+=v*Ct,lt+=v*Lt,_+=v*Ot,Z+=v*Nt,U+=v*se,L+=v*Tt,k+=v*Rt,v=z[6],b+=v*xt,C+=v*Bt,M+=v*_t,N+=v*Et,q+=v*Vt,S+=v*yt,g+=v*At,O+=v*Ut,it+=v*wt,lt+=v*Ct,_+=v*Lt,Z+=v*Ot,U+=v*Nt,L+=v*se,k+=v*Tt,p+=v*Rt,v=z[7],C+=v*xt,M+=v*Bt,N+=v*_t,q+=v*Et,S+=v*Vt,g+=v*yt,O+=v*At,it+=v*Ut,lt+=v*wt,_+=v*Ct,Z+=v*Lt,U+=v*Ot,L+=v*Nt,k+=v*se,p+=v*Tt,F+=v*Rt,v=z[8],M+=v*xt,N+=v*Bt,q+=v*_t,S+=v*Et,g+=v*Vt,O+=v*yt,it+=v*At,lt+=v*Ut,_+=v*wt,Z+=v*Ct,U+=v*Lt,L+=v*Ot,k+=v*Nt,p+=v*se,F+=v*Tt,et+=v*Rt,v=z[9],N+=v*xt,q+=v*Bt,S+=v*_t,g+=v*Et,O+=v*Vt,it+=v*yt,lt+=v*At,_+=v*Ut,Z+=v*wt,U+=v*Ct,L+=v*Lt,k+=v*Ot,p+=v*Nt,F+=v*se,et+=v*Tt,ct+=v*Rt,v=z[10],q+=v*xt,S+=v*Bt,g+=v*_t,O+=v*Et,it+=v*Vt,lt+=v*yt,_+=v*At,Z+=v*Ut,U+=v*wt,L+=v*Ct,k+=v*Lt,p+=v*Ot,F+=v*Nt,et+=v*se,ct+=v*Tt,at+=v*Rt,v=z[11],S+=v*xt,g+=v*Bt,O+=v*_t,it+=v*Et,lt+=v*Vt,_+=v*yt,Z+=v*At,U+=v*Ut,L+=v*wt,k+=v*Ct,p+=v*Lt,F+=v*Ot,et+=v*Nt,ct+=v*se,at+=v*Tt,Mt+=v*Rt,v=z[12],g+=v*xt,O+=v*Bt,it+=v*_t,lt+=v*Et,_+=v*Vt,Z+=v*yt,U+=v*At,L+=v*Ut,k+=v*wt,p+=v*Ct,F+=v*Lt,et+=v*Ot,ct+=v*Nt,at+=v*se,Mt+=v*Tt,Pt+=v*Rt,v=z[13],O+=v*xt,it+=v*Bt,lt+=v*_t,_+=v*Et,Z+=v*Vt,U+=v*yt,L+=v*At,k+=v*Ut,p+=v*wt,F+=v*Ct,et+=v*Lt,ct+=v*Ot,at+=v*Nt,Mt+=v*se,Pt+=v*Tt,It+=v*Rt,v=z[14],it+=v*xt,lt+=v*Bt,_+=v*_t,Z+=v*Et,U+=v*Vt,L+=v*yt,k+=v*At,p+=v*Ut,F+=v*wt,et+=v*Ct,ct+=v*Lt,at+=v*Ot,Mt+=v*Nt,Pt+=v*se,It+=v*Tt,Ee+=v*Rt,v=z[15],lt+=v*xt,_+=v*Bt,Z+=v*_t,U+=v*Et,L+=v*Vt,k+=v*yt,p+=v*At,F+=v*Ut,et+=v*wt,ct+=v*Ct,at+=v*Lt,Mt+=v*Ot,Pt+=v*Nt,It+=v*se,Ee+=v*Tt,$t+=v*Rt,st+=38*_,ft+=38*Z,pt+=38*U,gt+=38*L,h+=38*k,y+=38*p,b+=38*F,C+=38*et,M+=38*ct,N+=38*at,q+=38*Mt,S+=38*Pt,g+=38*It,O+=38*Ee,it+=38*$t,T=1,v=st+T+65535,T=Math.floor(v/65536),st=v-T*65536,v=ft+T+65535,T=Math.floor(v/65536),ft=v-T*65536,v=pt+T+65535,T=Math.floor(v/65536),pt=v-T*65536,v=gt+T+65535,T=Math.floor(v/65536),gt=v-T*65536,v=h+T+65535,T=Math.floor(v/65536),h=v-T*65536,v=y+T+65535,T=Math.floor(v/65536),y=v-T*65536,v=b+T+65535,T=Math.floor(v/65536),b=v-T*65536,v=C+T+65535,T=Math.floor(v/65536),C=v-T*65536,v=M+T+65535,T=Math.floor(v/65536),M=v-T*65536,v=N+T+65535,T=Math.floor(v/65536),N=v-T*65536,v=q+T+65535,T=Math.floor(v/65536),q=v-T*65536,v=S+T+65535,T=Math.floor(v/65536),S=v-T*65536,v=g+T+65535,T=Math.floor(v/65536),g=v-T*65536,v=O+T+65535,T=Math.floor(v/65536),O=v-T*65536,v=it+T+65535,T=Math.floor(v/65536),it=v-T*65536,v=lt+T+65535,T=Math.floor(v/65536),lt=v-T*65536,st+=T-1+37*(T-1),T=1,v=st+T+65535,T=Math.floor(v/65536),st=v-T*65536,v=ft+T+65535,T=Math.floor(v/65536),ft=v-T*65536,v=pt+T+65535,T=Math.floor(v/65536),pt=v-T*65536,v=gt+T+65535,T=Math.floor(v/65536),gt=v-T*65536,v=h+T+65535,T=Math.floor(v/65536),h=v-T*65536,v=y+T+65535,T=Math.floor(v/65536),y=v-T*65536,v=b+T+65535,T=Math.floor(v/65536),b=v-T*65536,v=C+T+65535,T=Math.floor(v/65536),C=v-T*65536,v=M+T+65535,T=Math.floor(v/65536),M=v-T*65536,v=N+T+65535,T=Math.floor(v/65536),N=v-T*65536,v=q+T+65535,T=Math.floor(v/65536),q=v-T*65536,v=S+T+65535,T=Math.floor(v/65536),S=v-T*65536,v=g+T+65535,T=Math.floor(v/65536),g=v-T*65536,v=O+T+65535,T=Math.floor(v/65536),O=v-T*65536,v=it+T+65535,T=Math.floor(v/65536),it=v-T*65536,v=lt+T+65535,T=Math.floor(v/65536),lt=v-T*65536,st+=T-1+37*(T-1),B[0]=st,B[1]=ft,B[2]=pt,B[3]=gt,B[4]=h,B[5]=y,B[6]=b,B[7]=C,B[8]=M,B[9]=N,B[10]=q,B[11]=S,B[12]=g,B[13]=O,B[14]=it,B[15]=lt}function I(B,z){x(B,z,z)}function R(B,z){const $=n();for(let v=0;v<16;v++)$[v]=z[v];for(let v=253;v>=0;v--)I($,$),v!==2&&v!==4&&x($,$,z);for(let v=0;v<16;v++)B[v]=$[v]}function Y(B,z){const $=new Uint8Array(32),v=new Float64Array(80),T=n(),st=n(),ft=n(),pt=n(),gt=n(),h=n();for(let M=0;M<31;M++)$[M]=B[M];$[31]=B[31]&127|64,$[0]&=248,f(v,z);for(let M=0;M<16;M++)st[M]=v[M];T[0]=pt[0]=1;for(let M=254;M>=0;--M){const N=$[M>>>3]>>>(M&7)&1;l(T,st,N),l(ft,pt,N),w(gt,T,ft),E(T,T,ft),w(ft,st,pt),E(st,st,pt),I(pt,gt),I(h,T),x(T,ft,T),x(ft,st,gt),w(gt,T,ft),E(T,T,ft),I(st,T),E(ft,pt,h),x(T,ft,a),w(T,T,pt),x(ft,ft,T),x(T,pt,h),x(pt,st,v),I(st,gt),l(T,st,N),l(ft,pt,N)}for(let M=0;M<16;M++)v[M+16]=T[M],v[M+32]=ft[M],v[M+48]=st[M],v[M+64]=pt[M];const y=v.subarray(32),b=v.subarray(16);R(y,y),x(b,b,y);const C=new Uint8Array(32);return d(C,b),C}r.scalarMult=Y;function W(B){return Y(B,s)}r.scalarMultBase=W;function tt(B){if(B.length!==r.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${r.SECRET_KEY_LENGTH} bytes`);const z=new Uint8Array(B);return{publicKey:W(z),secretKey:z}}r.generateKeyPairFromSeed=tt;function K(B){const z=(0,t.randomBytes)(32,B),$=tt(z);return(0,e.wipe)(z),$}r.generateKeyPair=K;function V(B,z,$=!1){if(B.length!==r.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(z.length!==r.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const v=Y(B,z);if($){let T=0;for(let st=0;st<v.length;st++)T|=v[st];if(T===0)throw new Error("X25519: invalid shared key")}return v}r.sharedKey=V})(Vl);function Gl(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function z1(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?Gl(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function wl(r,t){t||(t=r.reduce((s,a)=>s+a.length,0));const e=z1(t);let n=0;for(const s of r)e.set(s,n),n+=s.length;return Gl(e)}function P_(r,t){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n<e.length;n++)e[n]=255;for(var s=0;s<r.length;s++){var a=r.charAt(s),c=a.charCodeAt(0);if(e[c]!==255)throw new TypeError(a+" is ambiguous");e[c]=s}var l=r.length,d=r.charAt(0),f=Math.log(l)/Math.log(256),w=Math.log(256)/Math.log(l);function E(R){if(R instanceof Uint8Array||(ArrayBuffer.isView(R)?R=new Uint8Array(R.buffer,R.byteOffset,R.byteLength):Array.isArray(R)&&(R=Uint8Array.from(R))),!(R instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(R.length===0)return"";for(var Y=0,W=0,tt=0,K=R.length;tt!==K&&R[tt]===0;)tt++,Y++;for(var V=(K-tt)*w+1>>>0,B=new Uint8Array(V);tt!==K;){for(var z=R[tt],$=0,v=V-1;(z!==0||$<W)&&v!==-1;v--,$++)z+=256*B[v]>>>0,B[v]=z%l>>>0,z=z/l>>>0;if(z!==0)throw new Error("Non-zero carry");W=$,tt++}for(var T=V-W;T!==V&&B[T]===0;)T++;for(var st=d.repeat(Y);T<V;++T)st+=r.charAt(B[T]);return st}function x(R){if(typeof R!="string")throw new TypeError("Expected String");if(R.length===0)return new Uint8Array;var Y=0;if(R[Y]!==" "){for(var W=0,tt=0;R[Y]===d;)W++,Y++;for(var K=(R.length-Y)*f+1>>>0,V=new Uint8Array(K);R[Y];){var B=e[R.charCodeAt(Y)];if(B===255)return;for(var z=0,$=K-1;(B!==0||z<tt)&&$!==-1;$--,z++)B+=l*V[$]>>>0,V[$]=B%256>>>0,B=B/256>>>0;if(B!==0)throw new Error("Non-zero carry");tt=z,Y++}if(R[Y]!==" "){for(var v=K-tt;v!==K&&V[v]===0;)v++;for(var T=new Uint8Array(W+(K-v)),st=W;v!==K;)T[st++]=V[v++];return T}}}function I(R){var Y=x(R);if(Y)return Y;throw new Error(`Non-${t} character`)}return{encode:E,decodeUnsafe:x,decode:I}}var O_=P_,N_=O_;const R_=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},T_=r=>new TextEncoder().encode(r),F_=r=>new TextDecoder().decode(r);class U_{constructor(t,e,n){this.name=t,this.prefix=e,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}}class B_{constructor(t,e,n){if(this.name=t,this.prefix=e,e.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=e.codePointAt(0),this.baseDecode=n}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return k1(this,t)}}class L_{constructor(t){this.decoders=t}or(t){return k1(this,t)}decode(t){const e=t[0],n=this.decoders[e];if(n)return n.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const k1=(r,t)=>new L_({...r.decoders||{[r.prefix]:r},...t.decoders||{[t.prefix]:t}});class q_{constructor(t,e,n,s){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=s,this.encoder=new U_(t,e,n),this.decoder=new B_(t,e,s)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}}const fc=({name:r,prefix:t,encode:e,decode:n})=>new q_(r,t,e,n),pa=({prefix:r,name:t,alphabet:e})=>{const{encode:n,decode:s}=N_(e,t);return fc({prefix:r,name:t,encode:n,decode:a=>R_(s(a))})},j_=(r,t,e,n)=>{const s={};for(let w=0;w<t.length;++w)s[t[w]]=w;let a=r.length;for(;r[a-1]==="=";)--a;const c=new Uint8Array(a*e/8|0);let l=0,d=0,f=0;for(let w=0;w<a;++w){const E=s[r[w]];if(E===void 0)throw new SyntaxError(`Non-${n} character`);d=d<<e|E,l+=e,l>=8&&(l-=8,c[f++]=255&d>>l)}if(l>=e||255&d<<8-l)throw new SyntaxError("Unexpected end of data");return c},$_=(r,t,e)=>{const n=t[t.length-1]==="=",s=(1<<e)-1;let a="",c=0,l=0;for(let d=0;d<r.length;++d)for(l=l<<8|r[d],c+=8;c>e;)c-=e,a+=t[s&l>>c];if(c&&(a+=t[s&l<<e-c]),n)for(;a.length*e&7;)a+="=";return a},gr=({name:r,prefix:t,bitsPerChar:e,alphabet:n})=>fc({prefix:t,name:r,encode(s){return $_(s,n,e)},decode(s){return j_(s,n,e,r)}}),z_=fc({prefix:"\0",name:"identity",encode:r=>F_(r),decode:r=>T_(r)}),k_=Object.freeze(Object.defineProperty({__proto__:null,identity:z_},Symbol.toStringTag,{value:"Module"})),H_=gr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),K_=Object.freeze(Object.defineProperty({__proto__:null,base2:H_},Symbol.toStringTag,{value:"Module"})),V_=gr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),G_=Object.freeze(Object.defineProperty({__proto__:null,base8:V_},Symbol.toStringTag,{value:"Module"})),W_=pa({prefix:"9",name:"base10",alphabet:"0123456789"}),Y_=Object.freeze(Object.defineProperty({__proto__:null,base10:W_},Symbol.toStringTag,{value:"Module"})),Q_=gr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),J_=gr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),X_=Object.freeze(Object.defineProperty({__proto__:null,base16:Q_,base16upper:J_},Symbol.toStringTag,{value:"Module"})),Z_=gr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),tE=gr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),eE=gr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),rE=gr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),iE=gr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),nE=gr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),sE=gr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),oE=gr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),aE=gr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),uE=Object.freeze(Object.defineProperty({__proto__:null,base32:Z_,base32hex:iE,base32hexpad:sE,base32hexpadupper:oE,base32hexupper:nE,base32pad:eE,base32padupper:rE,base32upper:tE,base32z:aE},Symbol.toStringTag,{value:"Module"})),cE=pa({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),hE=pa({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),lE=Object.freeze(Object.defineProperty({__proto__:null,base36:cE,base36upper:hE},Symbol.toStringTag,{value:"Module"})),fE=pa({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),dE=pa({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),pE=Object.freeze(Object.defineProperty({__proto__:null,base58btc:fE,base58flickr:dE},Symbol.toStringTag,{value:"Module"})),gE=gr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),mE=gr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),vE=gr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),yE=gr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),wE=Object.freeze(Object.defineProperty({__proto__:null,base64:gE,base64pad:mE,base64url:vE,base64urlpad:yE},Symbol.toStringTag,{value:"Module"})),H1=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),bE=H1.reduce((r,t,e)=>(r[e]=t,r),[]),_E=H1.reduce((r,t,e)=>(r[t.codePointAt(0)]=e,r),[]);function EE(r){return r.reduce((t,e)=>(t+=bE[e],t),"")}function AE(r){const t=[];for(const e of r){const n=_E[e.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(n)}return new Uint8Array(t)}const SE=fc({prefix:"🚀",name:"base256emoji",encode:EE,decode:AE}),IE=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:SE},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;const Rd={...k_,...K_,...G_,...Y_,...X_,...uE,...lE,...pE,...wE,...IE};function K1(r,t,e,n){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:n}}}const Td=K1("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Th=K1("ascii","a",r=>{let t="a";for(let e=0;e<r.length;e++)t+=String.fromCharCode(r[e]);return t},r=>{r=r.substring(1);const t=z1(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}),V1={utf8:Td,"utf-8":Td,hex:Rd.base16,latin1:Th,ascii:Th,binary:Th,...Rd};function kr(r,t="utf8"){const e=V1[t];if(!e)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Gl(globalThis.Buffer.from(r,"utf-8")):e.decoder.decode(`${e.prefix}${r}`)}function Rr(r,t="utf8"){const e=V1[t];if(!e)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString("utf8"):e.encoder.encode(r).substring(1)}const DE={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe"}},xE=":";function Uu(r){const[t,e]=r.split(xE);return{namespace:t,reference:e}}function Fd(r,t=[]){const e=[];return Object.keys(r).forEach(n=>{if(t.length&&!t.includes(n))return;const s=r[n];e.push(...s.accounts)}),e}function G1(r,t){return r.includes(":")?[r]:t.chains||[]}var ME=Object.defineProperty,Ud=Object.getOwnPropertySymbols,CE=Object.prototype.hasOwnProperty,PE=Object.prototype.propertyIsEnumerable,Bd=(r,t,e)=>t in r?ME(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ld=(r,t)=>{for(var e in t||(t={}))CE.call(t,e)&&Bd(r,e,t[e]);if(Ud)for(var e of Ud(t))PE.call(t,e)&&Bd(r,e,t[e]);return r};const OE="ReactNative",ti={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},NE="js";function sa(){return typeof ei<"u"&&typeof ei.versions<"u"&&typeof ei.versions.node<"u"}function go(){return!$l()&&!!zl()&&navigator.product===OE}function mo(){return!sa()&&!!zl()&&!!$l()}function ga(){return go()?ti.reactNative:sa()?ti.node:mo()?ti.browser:ti.unknown}function RE(){var r;try{return go()&&typeof Ie<"u"&&typeof(Ie==null?void 0:Ie.Application)<"u"?(r=Ie.Application)==null?void 0:r.applicationId:void 0}catch{return}}function TE(r,t){let e=na.parse(r);return e=Ld(Ld({},e),t),r=na.stringify(e),r}function FE(){return C1()||{name:"",description:"",url:"",icons:[""]}}function UE(){if(ga()===ti.reactNative&&typeof Ie<"u"&&typeof(Ie==null?void 0:Ie.Platform)<"u"){const{OS:e,Version:n}=Ie.Platform;return[e,n].join("-")}const r=p6();if(r===null)return"unknown";const t=r.os?r.os.replace(" ","").toLowerCase():"unknown";return r.type==="browser"?[t,r.name,r.version].join("-"):[t,r.version].join("-")}function BE(){var r;const t=ga();return t===ti.browser?[t,((r=M1())==null?void 0:r.host)||"unknown"].join(":"):t}function LE(r,t,e){const n=UE(),s=BE();return[[r,t].join("-"),[NE,e].join("-"),n,s].join("/")}function qE({protocol:r,version:t,relayUrl:e,sdkVersion:n,auth:s,projectId:a,useOnCloseEvent:c,bundleId:l}){const d=e.split("?"),f=LE(r,t,n),w={auth:s,ua:f,projectId:a,useOnCloseEvent:c||void 0,origin:l||void 0},E=TE(d[1]||"",w);return d[0]+"?"+E}function As(r,t){return r.filter(e=>t.includes(e)).length===r.length}function W1(r){return Object.fromEntries(r.entries())}function Y1(r){return new Map(Object.entries(r))}function Es(r=bt.FIVE_MINUTES,t){const e=bt.toMiliseconds(r||bt.FIVE_MINUTES);let n,s,a;return{resolve:c=>{a&&n&&(clearTimeout(a),n(c))},reject:c=>{a&&s&&(clearTimeout(a),s(c))},done:()=>new Promise((c,l)=>{a=setTimeout(()=>{l(new Error(t))},e),n=c,s=l})}}function oa(r,t,e){return new Promise(async(n,s)=>{const a=setTimeout(()=>s(new Error(e)),t);try{const c=await r;n(c)}catch(c){s(c)}clearTimeout(a)})}function Q1(r,t){if(typeof t=="string"&&t.startsWith(`${r}:`))return t;if(r.toLowerCase()==="topic"){if(typeof t!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${t}`}else if(r.toLowerCase()==="id"){if(typeof t!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${t}`}throw new Error(`Unknown expirer target type: ${r}`)}function jE(r){return Q1("topic",r)}function $E(r){return Q1("id",r)}function J1(r){const[t,e]=r.split(":"),n={id:void 0,topic:void 0};if(t==="topic"&&typeof e=="string")n.topic=e;else if(t==="id"&&Number.isInteger(Number(e)))n.id=Number(e);else throw new Error(`Invalid target, expected id:number or topic:string, got ${t}:${e}`);return n}function _r(r,t){return bt.fromMiliseconds((t||Date.now())+bt.toMiliseconds(r))}function Hn(r){return Date.now()>=bt.toMiliseconds(r)}function de(r,t){return`${r}${t?`:${t}`:""}`}function Bu(r=[],t=[]){return[...new Set([...r,...t])]}async function zE({id:r,topic:t,wcDeepLink:e}){try{if(!e)return;const n=typeof e=="string"?JSON.parse(e):e;let s=n==null?void 0:n.href;if(typeof s!="string")return;s.endsWith("/")&&(s=s.slice(0,-1));const a=`${s}/wc?requestId=${r}&sessionTopic=${t}`,c=ga();c===ti.browser?a.startsWith("https://")||a.startsWith("http://")?window.open(a,"_blank","noreferrer noopener"):window.open(a,"_self","noreferrer noopener"):c===ti.reactNative&&typeof(Ie==null?void 0:Ie.Linking)<"u"&&await Ie.Linking.openURL(a)}catch(n){console.error(n)}}async function kE(r,t){try{return await r.getItem(t)||(mo()?localStorage.getItem(t):void 0)}catch(e){console.error(e)}}var X1=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof Ie<"u"?Ie:typeof self<"u"?self:{};function HE(r){var t=r.default;if(typeof t=="function"){var e=function(){return t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(r).forEach(function(n){var s=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(e,n,s.get?s:{enumerable:!0,get:function(){return r[n]}})}),e}var Z1={exports:{}};/**
1
+ import{p as ei,g as Ll,c as e6,r as r6,a as Ie,B as fa,e as Di,b as ql,s as i6,d as Xi,W as jl,f as dd,_ as n6}from"./index-e272409d.js";import{t as s6}from"./tslib.es6-c2094241.js";var pd=globalThis&&globalThis.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var n=0,s=t.length,a;n<s;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return r.concat(a||Array.prototype.slice.call(t))},o6=function(){function r(t,e,n){this.name=t,this.version=e,this.os=n,this.type="browser"}return r}(),a6=function(){function r(t){this.version=t,this.type="node",this.name="node",this.os=ei.platform}return r}(),u6=function(){function r(t,e,n,s){this.name=t,this.version=e,this.os=n,this.bot=s,this.type="bot-device"}return r}(),c6=function(){function r(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return r}(),h6=function(){function r(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return r}(),l6=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,f6=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,gd=3,d6=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["pie",/^Microsoft Pocket Internet Explorer\/(\d+\.\d+)$/],["pie",/^Mozilla\/\d\.\d+\s\(compatible;\s(?:MSP?IE|MSInternet Explorer) (\d+\.\d+);.*Windows CE.*\)$/],["netfront",/^Mozilla\/\d\.\d+.*NetFront\/(\d.\d)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FB[AS]V\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["curl",/^curl\/([0-9\.]+)$/],["searchbot",l6]],md=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Windows CE",/Windows CE|WinCE|Microsoft Pocket Internet Explorer/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function p6(r){return r?vd(r):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new h6:typeof navigator<"u"?vd(navigator.userAgent):v6()}function g6(r){return r!==""&&d6.reduce(function(t,e){var n=e[0],s=e[1];if(t)return t;var a=s.exec(r);return!!a&&[n,a]},!1)}function vd(r){var t=g6(r);if(!t)return null;var e=t[0],n=t[1];if(e==="searchbot")return new c6;var s=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);s?s.length<gd&&(s=pd(pd([],s,!0),y6(gd-s.length),!0)):s=[];var a=s.join("."),c=m6(r),l=f6.exec(r);return l&&l[1]?new u6(e,a,c,l[1]):new o6(e,a,c)}function m6(r){for(var t=0,e=md.length;t<e;t++){var n=md[t],s=n[0],a=n[1],c=a.exec(r);if(c)return s}return null}function v6(){var r=typeof ei<"u"&&ei.version;return r?new a6(ei.version.slice(1)):null}function y6(r){for(var t=[],e=0;e<r;e++)t.push("0");return t}var bt={};const Mn=Ll(s6);var Ph={},zo={},yd;function w6(){if(yd)return zo;yd=1,Object.defineProperty(zo,"__esModule",{value:!0}),zo.delay=void 0;function r(t){return new Promise(e=>{setTimeout(()=>{e(!0)},t)})}return zo.delay=r,zo}var ws={},Oh={},bs={},wd;function b6(){return wd||(wd=1,Object.defineProperty(bs,"__esModule",{value:!0}),bs.ONE_THOUSAND=bs.ONE_HUNDRED=void 0,bs.ONE_HUNDRED=100,bs.ONE_THOUSAND=1e3),bs}var Nh={},bd;function _6(){return bd||(bd=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.ONE_YEAR=r.FOUR_WEEKS=r.THREE_WEEKS=r.TWO_WEEKS=r.ONE_WEEK=r.THIRTY_DAYS=r.SEVEN_DAYS=r.FIVE_DAYS=r.THREE_DAYS=r.ONE_DAY=r.TWENTY_FOUR_HOURS=r.TWELVE_HOURS=r.SIX_HOURS=r.THREE_HOURS=r.ONE_HOUR=r.SIXTY_MINUTES=r.THIRTY_MINUTES=r.TEN_MINUTES=r.FIVE_MINUTES=r.ONE_MINUTE=r.SIXTY_SECONDS=r.THIRTY_SECONDS=r.TEN_SECONDS=r.FIVE_SECONDS=r.ONE_SECOND=void 0,r.ONE_SECOND=1,r.FIVE_SECONDS=5,r.TEN_SECONDS=10,r.THIRTY_SECONDS=30,r.SIXTY_SECONDS=60,r.ONE_MINUTE=r.SIXTY_SECONDS,r.FIVE_MINUTES=r.ONE_MINUTE*5,r.TEN_MINUTES=r.ONE_MINUTE*10,r.THIRTY_MINUTES=r.ONE_MINUTE*30,r.SIXTY_MINUTES=r.ONE_MINUTE*60,r.ONE_HOUR=r.SIXTY_MINUTES,r.THREE_HOURS=r.ONE_HOUR*3,r.SIX_HOURS=r.ONE_HOUR*6,r.TWELVE_HOURS=r.ONE_HOUR*12,r.TWENTY_FOUR_HOURS=r.ONE_HOUR*24,r.ONE_DAY=r.TWENTY_FOUR_HOURS,r.THREE_DAYS=r.ONE_DAY*3,r.FIVE_DAYS=r.ONE_DAY*5,r.SEVEN_DAYS=r.ONE_DAY*7,r.THIRTY_DAYS=r.ONE_DAY*30,r.ONE_WEEK=r.SEVEN_DAYS,r.TWO_WEEKS=r.ONE_WEEK*2,r.THREE_WEEKS=r.ONE_WEEK*3,r.FOUR_WEEKS=r.ONE_WEEK*4,r.ONE_YEAR=r.ONE_DAY*365}(Nh)),Nh}var _d;function x1(){return _d||(_d=1,function(r){Object.defineProperty(r,"__esModule",{value:!0});const t=Mn;t.__exportStar(b6(),r),t.__exportStar(_6(),r)}(Oh)),Oh}var Ed;function E6(){if(Ed)return ws;Ed=1,Object.defineProperty(ws,"__esModule",{value:!0}),ws.fromMiliseconds=ws.toMiliseconds=void 0;const r=x1();function t(n){return n*r.ONE_THOUSAND}ws.toMiliseconds=t;function e(n){return Math.floor(n/r.ONE_THOUSAND)}return ws.fromMiliseconds=e,ws}var Ad;function A6(){return Ad||(Ad=1,function(r){Object.defineProperty(r,"__esModule",{value:!0});const t=Mn;t.__exportStar(w6(),r),t.__exportStar(E6(),r)}(Ph)),Ph}var Js={},Sd;function S6(){if(Sd)return Js;Sd=1,Object.defineProperty(Js,"__esModule",{value:!0}),Js.Watch=void 0;class r{constructor(){this.timestamps=new Map}start(e){if(this.timestamps.has(e))throw new Error(`Watch already started for label: ${e}`);this.timestamps.set(e,{started:Date.now()})}stop(e){const n=this.get(e);if(typeof n.elapsed<"u")throw new Error(`Watch already stopped for label: ${e}`);const s=Date.now()-n.started;this.timestamps.set(e,{started:n.started,elapsed:s})}get(e){const n=this.timestamps.get(e);if(typeof n>"u")throw new Error(`No timestamp found for label: ${e}`);return n}elapsed(e){const n=this.get(e);return n.elapsed||Date.now()-n.started}}return Js.Watch=r,Js.default=r,Js}var Rh={},ko={},Id;function I6(){if(Id)return ko;Id=1,Object.defineProperty(ko,"__esModule",{value:!0}),ko.IWatch=void 0;class r{}return ko.IWatch=r,ko}var Dd;function D6(){return Dd||(Dd=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),Mn.__exportStar(I6(),r)}(Rh)),Rh}(function(r){Object.defineProperty(r,"__esModule",{value:!0});const t=Mn;t.__exportStar(A6(),r),t.__exportStar(S6(),r),t.__exportStar(D6(),r),t.__exportStar(x1(),r)})(bt);var je={};Object.defineProperty(je,"__esModule",{value:!0});je.getLocalStorage=je.getLocalStorageOrThrow=je.getCrypto=je.getCryptoOrThrow=M1=je.getLocation=je.getLocationOrThrow=zl=je.getNavigator=je.getNavigatorOrThrow=$l=je.getDocument=je.getDocumentOrThrow=je.getFromWindowOrThrow=je.getFromWindow=void 0;function Ms(r){let t;return typeof window<"u"&&typeof window[r]<"u"&&(t=window[r]),t}je.getFromWindow=Ms;function fo(r){const t=Ms(r);if(!t)throw new Error(`${r} is not defined in Window`);return t}je.getFromWindowOrThrow=fo;function x6(){return fo("document")}je.getDocumentOrThrow=x6;function M6(){return Ms("document")}var $l=je.getDocument=M6;function C6(){return fo("navigator")}je.getNavigatorOrThrow=C6;function P6(){return Ms("navigator")}var zl=je.getNavigator=P6;function O6(){return fo("location")}je.getLocationOrThrow=O6;function N6(){return Ms("location")}var M1=je.getLocation=N6;function R6(){return fo("crypto")}je.getCryptoOrThrow=R6;function T6(){return Ms("crypto")}je.getCrypto=T6;function F6(){return fo("localStorage")}je.getLocalStorageOrThrow=F6;function U6(){return Ms("localStorage")}je.getLocalStorage=U6;var kl={};Object.defineProperty(kl,"__esModule",{value:!0});var C1=kl.getWindowMetadata=void 0;const xd=je;function B6(){let r,t;try{r=xd.getDocumentOrThrow(),t=xd.getLocationOrThrow()}catch{return null}function e(){const E=r.getElementsByTagName("link"),x=[];for(let I=0;I<E.length;I++){const R=E[I],Y=R.getAttribute("rel");if(Y&&Y.toLowerCase().indexOf("icon")>-1){const W=R.getAttribute("href");if(W)if(W.toLowerCase().indexOf("https:")===-1&&W.toLowerCase().indexOf("http:")===-1&&W.indexOf("//")!==0){let tt=t.protocol+"//"+t.host;if(W.indexOf("/")===0)tt+=W;else{const K=t.pathname.split("/");K.pop();const V=K.join("/");tt+=V+"/"+W}x.push(tt)}else if(W.indexOf("//")===0){const tt=t.protocol+W;x.push(tt)}else x.push(W)}}return x}function n(...E){const x=r.getElementsByTagName("meta");for(let I=0;I<x.length;I++){const R=x[I],Y=["itemprop","property","name"].map(W=>R.getAttribute(W)).filter(W=>W?E.includes(W):!1);if(Y.length&&Y){const W=R.getAttribute("content");if(W)return W}}return""}function s(){let E=n("name","og:site_name","og:title","twitter:title");return E||(E=r.title),E}function a(){return n("description","og:description","twitter:description","keywords")}const c=s(),l=a(),d=t.origin,f=e();return{description:l,url:d,icons:f,name:c}}C1=kl.getWindowMetadata=B6;var na={},L6=r=>encodeURIComponent(r).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`),P1="%[a-f0-9]{2}",Md=new RegExp("("+P1+")|([^%]+?)","gi"),Cd=new RegExp("("+P1+")+","gi");function dl(r,t){try{return[decodeURIComponent(r.join(""))]}catch{}if(r.length===1)return r;t=t||1;var e=r.slice(0,t),n=r.slice(t);return Array.prototype.concat.call([],dl(e),dl(n))}function q6(r){try{return decodeURIComponent(r)}catch{for(var t=r.match(Md)||[],e=1;e<t.length;e++)r=dl(t,e).join(""),t=r.match(Md)||[];return r}}function j6(r){for(var t={"%FE%FF":"��","%FF%FE":"��"},e=Cd.exec(r);e;){try{t[e[0]]=decodeURIComponent(e[0])}catch{var n=q6(e[0]);n!==e[0]&&(t[e[0]]=n)}e=Cd.exec(r)}t["%C2"]="�";for(var s=Object.keys(t),a=0;a<s.length;a++){var c=s[a];r=r.replace(new RegExp(c,"g"),t[c])}return r}var $6=function(r){if(typeof r!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof r+"`");try{return r=r.replace(/\+/g," "),decodeURIComponent(r)}catch{return j6(r)}},z6=(r,t)=>{if(!(typeof r=="string"&&typeof t=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(t==="")return[r];const e=r.indexOf(t);return e===-1?[r]:[r.slice(0,e),r.slice(e+t.length)]},k6=function(r,t){for(var e={},n=Object.keys(r),s=Array.isArray(t),a=0;a<n.length;a++){var c=n[a],l=r[c];(s?t.indexOf(c)!==-1:t(c,l,r))&&(e[c]=l)}return e};(function(r){const t=L6,e=$6,n=z6,s=k6,a=K=>K==null,c=Symbol("encodeFragmentIdentifier");function l(K){switch(K.arrayFormat){case"index":return V=>(B,z)=>{const $=B.length;return z===void 0||K.skipNull&&z===null||K.skipEmptyString&&z===""?B:z===null?[...B,[w(V,K),"[",$,"]"].join("")]:[...B,[w(V,K),"[",w($,K),"]=",w(z,K)].join("")]};case"bracket":return V=>(B,z)=>z===void 0||K.skipNull&&z===null||K.skipEmptyString&&z===""?B:z===null?[...B,[w(V,K),"[]"].join("")]:[...B,[w(V,K),"[]=",w(z,K)].join("")];case"colon-list-separator":return V=>(B,z)=>z===void 0||K.skipNull&&z===null||K.skipEmptyString&&z===""?B:z===null?[...B,[w(V,K),":list="].join("")]:[...B,[w(V,K),":list=",w(z,K)].join("")];case"comma":case"separator":case"bracket-separator":{const V=K.arrayFormat==="bracket-separator"?"[]=":"=";return B=>(z,$)=>$===void 0||K.skipNull&&$===null||K.skipEmptyString&&$===""?z:($=$===null?"":$,z.length===0?[[w(B,K),V,w($,K)].join("")]:[[z,w($,K)].join(K.arrayFormatSeparator)])}default:return V=>(B,z)=>z===void 0||K.skipNull&&z===null||K.skipEmptyString&&z===""?B:z===null?[...B,w(V,K)]:[...B,[w(V,K),"=",w(z,K)].join("")]}}function d(K){let V;switch(K.arrayFormat){case"index":return(B,z,$)=>{if(V=/\[(\d*)\]$/.exec(B),B=B.replace(/\[\d*\]$/,""),!V){$[B]=z;return}$[B]===void 0&&($[B]={}),$[B][V[1]]=z};case"bracket":return(B,z,$)=>{if(V=/(\[\])$/.exec(B),B=B.replace(/\[\]$/,""),!V){$[B]=z;return}if($[B]===void 0){$[B]=[z];return}$[B]=[].concat($[B],z)};case"colon-list-separator":return(B,z,$)=>{if(V=/(:list)$/.exec(B),B=B.replace(/:list$/,""),!V){$[B]=z;return}if($[B]===void 0){$[B]=[z];return}$[B]=[].concat($[B],z)};case"comma":case"separator":return(B,z,$)=>{const v=typeof z=="string"&&z.includes(K.arrayFormatSeparator),T=typeof z=="string"&&!v&&E(z,K).includes(K.arrayFormatSeparator);z=T?E(z,K):z;const st=v||T?z.split(K.arrayFormatSeparator).map(ft=>E(ft,K)):z===null?z:E(z,K);$[B]=st};case"bracket-separator":return(B,z,$)=>{const v=/(\[\])$/.test(B);if(B=B.replace(/\[\]$/,""),!v){$[B]=z&&E(z,K);return}const T=z===null?[]:z.split(K.arrayFormatSeparator).map(st=>E(st,K));if($[B]===void 0){$[B]=T;return}$[B]=[].concat($[B],T)};default:return(B,z,$)=>{if($[B]===void 0){$[B]=z;return}$[B]=[].concat($[B],z)}}}function f(K){if(typeof K!="string"||K.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function w(K,V){return V.encode?V.strict?t(K):encodeURIComponent(K):K}function E(K,V){return V.decode?e(K):K}function x(K){return Array.isArray(K)?K.sort():typeof K=="object"?x(Object.keys(K)).sort((V,B)=>Number(V)-Number(B)).map(V=>K[V]):K}function I(K){const V=K.indexOf("#");return V!==-1&&(K=K.slice(0,V)),K}function R(K){let V="";const B=K.indexOf("#");return B!==-1&&(V=K.slice(B)),V}function Y(K){K=I(K);const V=K.indexOf("?");return V===-1?"":K.slice(V+1)}function W(K,V){return V.parseNumbers&&!Number.isNaN(Number(K))&&typeof K=="string"&&K.trim()!==""?K=Number(K):V.parseBooleans&&K!==null&&(K.toLowerCase()==="true"||K.toLowerCase()==="false")&&(K=K.toLowerCase()==="true"),K}function tt(K,V){V=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},V),f(V.arrayFormatSeparator);const B=d(V),z=Object.create(null);if(typeof K!="string"||(K=K.trim().replace(/^[?#&]/,""),!K))return z;for(const $ of K.split("&")){if($==="")continue;let[v,T]=n(V.decode?$.replace(/\+/g," "):$,"=");T=T===void 0?null:["comma","separator","bracket-separator"].includes(V.arrayFormat)?T:E(T,V),B(E(v,V),T,z)}for(const $ of Object.keys(z)){const v=z[$];if(typeof v=="object"&&v!==null)for(const T of Object.keys(v))v[T]=W(v[T],V);else z[$]=W(v,V)}return V.sort===!1?z:(V.sort===!0?Object.keys(z).sort():Object.keys(z).sort(V.sort)).reduce(($,v)=>{const T=z[v];return T&&typeof T=="object"&&!Array.isArray(T)?$[v]=x(T):$[v]=T,$},Object.create(null))}r.extract=Y,r.parse=tt,r.stringify=(K,V)=>{if(!K)return"";V=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},V),f(V.arrayFormatSeparator);const B=T=>V.skipNull&&a(K[T])||V.skipEmptyString&&K[T]==="",z=l(V),$={};for(const T of Object.keys(K))B(T)||($[T]=K[T]);const v=Object.keys($);return V.sort!==!1&&v.sort(V.sort),v.map(T=>{const st=K[T];return st===void 0?"":st===null?w(T,V):Array.isArray(st)?st.length===0&&V.arrayFormat==="bracket-separator"?w(T,V)+"[]":st.reduce(z(T),[]).join("&"):w(T,V)+"="+w(st,V)}).filter(T=>T.length>0).join("&")},r.parseUrl=(K,V)=>{V=Object.assign({decode:!0},V);const[B,z]=n(K,"#");return Object.assign({url:B.split("?")[0]||"",query:tt(Y(K),V)},V&&V.parseFragmentIdentifier&&z?{fragmentIdentifier:E(z,V)}:{})},r.stringifyUrl=(K,V)=>{V=Object.assign({encode:!0,strict:!0,[c]:!0},V);const B=I(K.url).split("?")[0]||"",z=r.extract(K.url),$=r.parse(z,{sort:!1}),v=Object.assign($,K.query);let T=r.stringify(v,V);T&&(T=`?${T}`);let st=R(K.url);return K.fragmentIdentifier&&(st=`#${V[c]?w(K.fragmentIdentifier,V):K.fragmentIdentifier}`),`${B}${T}${st}`},r.pick=(K,V,B)=>{B=Object.assign({parseFragmentIdentifier:!0,[c]:!1},B);const{url:z,query:$,fragmentIdentifier:v}=r.parseUrl(K,B);return r.stringifyUrl({url:z,query:s($,V),fragmentIdentifier:v},B)},r.exclude=(K,V,B)=>{const z=Array.isArray(V)?$=>!V.includes($):($,v)=>!V($,v);return r.pick(K,z,B)}})(na);var Hl={},ac={},oe={},O1={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});function t(l,d){var f=l>>>16&65535,w=l&65535,E=d>>>16&65535,x=d&65535;return w*x+(f*x+w*E<<16>>>0)|0}r.mul=Math.imul||t;function e(l,d){return l+d|0}r.add=e;function n(l,d){return l-d|0}r.sub=n;function s(l,d){return l<<d|l>>>32-d}r.rotl=s;function a(l,d){return l<<32-d|l>>>d}r.rotr=a;function c(l){return typeof l=="number"&&isFinite(l)&&Math.floor(l)===l}r.isInteger=Number.isInteger||c,r.MAX_SAFE_INTEGER=9007199254740991,r.isSafeInteger=function(l){return r.isInteger(l)&&l>=-r.MAX_SAFE_INTEGER&&l<=r.MAX_SAFE_INTEGER}})(O1);Object.defineProperty(oe,"__esModule",{value:!0});var N1=O1;function H6(r,t){return t===void 0&&(t=0),(r[t+0]<<8|r[t+1])<<16>>16}oe.readInt16BE=H6;function K6(r,t){return t===void 0&&(t=0),(r[t+0]<<8|r[t+1])>>>0}oe.readUint16BE=K6;function V6(r,t){return t===void 0&&(t=0),(r[t+1]<<8|r[t])<<16>>16}oe.readInt16LE=V6;function G6(r,t){return t===void 0&&(t=0),(r[t+1]<<8|r[t])>>>0}oe.readUint16LE=G6;function R1(r,t,e){return t===void 0&&(t=new Uint8Array(2)),e===void 0&&(e=0),t[e+0]=r>>>8,t[e+1]=r>>>0,t}oe.writeUint16BE=R1;oe.writeInt16BE=R1;function T1(r,t,e){return t===void 0&&(t=new Uint8Array(2)),e===void 0&&(e=0),t[e+0]=r>>>0,t[e+1]=r>>>8,t}oe.writeUint16LE=T1;oe.writeInt16LE=T1;function pl(r,t){return t===void 0&&(t=0),r[t]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3]}oe.readInt32BE=pl;function gl(r,t){return t===void 0&&(t=0),(r[t]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3])>>>0}oe.readUint32BE=gl;function ml(r,t){return t===void 0&&(t=0),r[t+3]<<24|r[t+2]<<16|r[t+1]<<8|r[t]}oe.readInt32LE=ml;function vl(r,t){return t===void 0&&(t=0),(r[t+3]<<24|r[t+2]<<16|r[t+1]<<8|r[t])>>>0}oe.readUint32LE=vl;function Gu(r,t,e){return t===void 0&&(t=new Uint8Array(4)),e===void 0&&(e=0),t[e+0]=r>>>24,t[e+1]=r>>>16,t[e+2]=r>>>8,t[e+3]=r>>>0,t}oe.writeUint32BE=Gu;oe.writeInt32BE=Gu;function Wu(r,t,e){return t===void 0&&(t=new Uint8Array(4)),e===void 0&&(e=0),t[e+0]=r>>>0,t[e+1]=r>>>8,t[e+2]=r>>>16,t[e+3]=r>>>24,t}oe.writeUint32LE=Wu;oe.writeInt32LE=Wu;function W6(r,t){t===void 0&&(t=0);var e=pl(r,t),n=pl(r,t+4);return e*4294967296+n-(n>>31)*4294967296}oe.readInt64BE=W6;function Y6(r,t){t===void 0&&(t=0);var e=gl(r,t),n=gl(r,t+4);return e*4294967296+n}oe.readUint64BE=Y6;function Q6(r,t){t===void 0&&(t=0);var e=ml(r,t),n=ml(r,t+4);return n*4294967296+e-(e>>31)*4294967296}oe.readInt64LE=Q6;function J6(r,t){t===void 0&&(t=0);var e=vl(r,t),n=vl(r,t+4);return n*4294967296+e}oe.readUint64LE=J6;function F1(r,t,e){return t===void 0&&(t=new Uint8Array(8)),e===void 0&&(e=0),Gu(r/4294967296>>>0,t,e),Gu(r>>>0,t,e+4),t}oe.writeUint64BE=F1;oe.writeInt64BE=F1;function U1(r,t,e){return t===void 0&&(t=new Uint8Array(8)),e===void 0&&(e=0),Wu(r>>>0,t,e),Wu(r/4294967296>>>0,t,e+4),t}oe.writeUint64LE=U1;oe.writeInt64LE=U1;function X6(r,t,e){if(e===void 0&&(e=0),r%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(r/8>t.length-e)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,s=1,a=r/8+e-1;a>=e;a--)n+=t[a]*s,s*=256;return n}oe.readUintBE=X6;function Z6(r,t,e){if(e===void 0&&(e=0),r%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(r/8>t.length-e)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,s=1,a=e;a<e+r/8;a++)n+=t[a]*s,s*=256;return n}oe.readUintLE=Z6;function t_(r,t,e,n){if(e===void 0&&(e=new Uint8Array(r/8)),n===void 0&&(n=0),r%8!==0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!N1.isSafeInteger(t))throw new Error("writeUintBE value must be an integer");for(var s=1,a=r/8+n-1;a>=n;a--)e[a]=t/s&255,s*=256;return e}oe.writeUintBE=t_;function e_(r,t,e,n){if(e===void 0&&(e=new Uint8Array(r/8)),n===void 0&&(n=0),r%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!N1.isSafeInteger(t))throw new Error("writeUintLE value must be an integer");for(var s=1,a=n;a<n+r/8;a++)e[a]=t/s&255,s*=256;return e}oe.writeUintLE=e_;function r_(r,t){t===void 0&&(t=0);var e=new DataView(r.buffer,r.byteOffset,r.byteLength);return e.getFloat32(t)}oe.readFloat32BE=r_;function i_(r,t){t===void 0&&(t=0);var e=new DataView(r.buffer,r.byteOffset,r.byteLength);return e.getFloat32(t,!0)}oe.readFloat32LE=i_;function n_(r,t){t===void 0&&(t=0);var e=new DataView(r.buffer,r.byteOffset,r.byteLength);return e.getFloat64(t)}oe.readFloat64BE=n_;function s_(r,t){t===void 0&&(t=0);var e=new DataView(r.buffer,r.byteOffset,r.byteLength);return e.getFloat64(t,!0)}oe.readFloat64LE=s_;function o_(r,t,e){t===void 0&&(t=new Uint8Array(4)),e===void 0&&(e=0);var n=new DataView(t.buffer,t.byteOffset,t.byteLength);return n.setFloat32(e,r),t}oe.writeFloat32BE=o_;function a_(r,t,e){t===void 0&&(t=new Uint8Array(4)),e===void 0&&(e=0);var n=new DataView(t.buffer,t.byteOffset,t.byteLength);return n.setFloat32(e,r,!0),t}oe.writeFloat32LE=a_;function u_(r,t,e){t===void 0&&(t=new Uint8Array(8)),e===void 0&&(e=0);var n=new DataView(t.buffer,t.byteOffset,t.byteLength);return n.setFloat64(e,r),t}oe.writeFloat64BE=u_;function c_(r,t,e){t===void 0&&(t=new Uint8Array(8)),e===void 0&&(e=0);var n=new DataView(t.buffer,t.byteOffset,t.byteLength);return n.setFloat64(e,r,!0),t}oe.writeFloat64LE=c_;var ni={};Object.defineProperty(ni,"__esModule",{value:!0});function h_(r){for(var t=0;t<r.length;t++)r[t]=0;return r}ni.wipe=h_;Object.defineProperty(ac,"__esModule",{value:!0});var wr=oe,yl=ni,l_=20;function f_(r,t,e){for(var n=1634760805,s=857760878,a=2036477234,c=1797285236,l=e[3]<<24|e[2]<<16|e[1]<<8|e[0],d=e[7]<<24|e[6]<<16|e[5]<<8|e[4],f=e[11]<<24|e[10]<<16|e[9]<<8|e[8],w=e[15]<<24|e[14]<<16|e[13]<<8|e[12],E=e[19]<<24|e[18]<<16|e[17]<<8|e[16],x=e[23]<<24|e[22]<<16|e[21]<<8|e[20],I=e[27]<<24|e[26]<<16|e[25]<<8|e[24],R=e[31]<<24|e[30]<<16|e[29]<<8|e[28],Y=t[3]<<24|t[2]<<16|t[1]<<8|t[0],W=t[7]<<24|t[6]<<16|t[5]<<8|t[4],tt=t[11]<<24|t[10]<<16|t[9]<<8|t[8],K=t[15]<<24|t[14]<<16|t[13]<<8|t[12],V=n,B=s,z=a,$=c,v=l,T=d,st=f,ft=w,pt=E,gt=x,h=I,y=R,b=Y,C=W,M=tt,N=K,q=0;q<l_;q+=2)V=V+v|0,b^=V,b=b>>>32-16|b<<16,pt=pt+b|0,v^=pt,v=v>>>32-12|v<<12,B=B+T|0,C^=B,C=C>>>32-16|C<<16,gt=gt+C|0,T^=gt,T=T>>>32-12|T<<12,z=z+st|0,M^=z,M=M>>>32-16|M<<16,h=h+M|0,st^=h,st=st>>>32-12|st<<12,$=$+ft|0,N^=$,N=N>>>32-16|N<<16,y=y+N|0,ft^=y,ft=ft>>>32-12|ft<<12,z=z+st|0,M^=z,M=M>>>32-8|M<<8,h=h+M|0,st^=h,st=st>>>32-7|st<<7,$=$+ft|0,N^=$,N=N>>>32-8|N<<8,y=y+N|0,ft^=y,ft=ft>>>32-7|ft<<7,B=B+T|0,C^=B,C=C>>>32-8|C<<8,gt=gt+C|0,T^=gt,T=T>>>32-7|T<<7,V=V+v|0,b^=V,b=b>>>32-8|b<<8,pt=pt+b|0,v^=pt,v=v>>>32-7|v<<7,V=V+T|0,N^=V,N=N>>>32-16|N<<16,h=h+N|0,T^=h,T=T>>>32-12|T<<12,B=B+st|0,b^=B,b=b>>>32-16|b<<16,y=y+b|0,st^=y,st=st>>>32-12|st<<12,z=z+ft|0,C^=z,C=C>>>32-16|C<<16,pt=pt+C|0,ft^=pt,ft=ft>>>32-12|ft<<12,$=$+v|0,M^=$,M=M>>>32-16|M<<16,gt=gt+M|0,v^=gt,v=v>>>32-12|v<<12,z=z+ft|0,C^=z,C=C>>>32-8|C<<8,pt=pt+C|0,ft^=pt,ft=ft>>>32-7|ft<<7,$=$+v|0,M^=$,M=M>>>32-8|M<<8,gt=gt+M|0,v^=gt,v=v>>>32-7|v<<7,B=B+st|0,b^=B,b=b>>>32-8|b<<8,y=y+b|0,st^=y,st=st>>>32-7|st<<7,V=V+T|0,N^=V,N=N>>>32-8|N<<8,h=h+N|0,T^=h,T=T>>>32-7|T<<7;wr.writeUint32LE(V+n|0,r,0),wr.writeUint32LE(B+s|0,r,4),wr.writeUint32LE(z+a|0,r,8),wr.writeUint32LE($+c|0,r,12),wr.writeUint32LE(v+l|0,r,16),wr.writeUint32LE(T+d|0,r,20),wr.writeUint32LE(st+f|0,r,24),wr.writeUint32LE(ft+w|0,r,28),wr.writeUint32LE(pt+E|0,r,32),wr.writeUint32LE(gt+x|0,r,36),wr.writeUint32LE(h+I|0,r,40),wr.writeUint32LE(y+R|0,r,44),wr.writeUint32LE(b+Y|0,r,48),wr.writeUint32LE(C+W|0,r,52),wr.writeUint32LE(M+tt|0,r,56),wr.writeUint32LE(N+K|0,r,60)}function B1(r,t,e,n,s){if(s===void 0&&(s=0),r.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length<e.length)throw new Error("ChaCha: destination is shorter than source");var a,c;if(s===0){if(t.length!==8&&t.length!==12)throw new Error("ChaCha nonce must be 8 or 12 bytes");a=new Uint8Array(16),c=a.length-t.length,a.set(t,c)}else{if(t.length!==16)throw new Error("ChaCha nonce with counter must be 16 bytes");a=t,c=s}for(var l=new Uint8Array(64),d=0;d<e.length;d+=64){f_(l,a,r);for(var f=d;f<d+64&&f<e.length;f++)n[f]=e[f]^l[f-d];p_(a,0,c)}return yl.wipe(l),s===0&&yl.wipe(a),n}ac.streamXOR=B1;function d_(r,t,e,n){return n===void 0&&(n=0),yl.wipe(e),B1(r,t,e,e,n)}ac.stream=d_;function p_(r,t,e){for(var n=1;e--;)n=n+(r[t]&255)|0,r[t]=n&255,n>>>=8,t++;if(n>0)throw new Error("ChaCha: counter overflow")}var L1={},Jn={};Object.defineProperty(Jn,"__esModule",{value:!0});function g_(r,t,e){return~(r-1)&t|r-1&e}Jn.select=g_;function m_(r,t){return(r|0)-(t|0)-1>>>31&1}Jn.lessOrEqual=m_;function q1(r,t){if(r.length!==t.length)return 0;for(var e=0,n=0;n<r.length;n++)e|=r[n]^t[n];return 1&e-1>>>8}Jn.compare=q1;function v_(r,t){return r.length===0||t.length===0?!1:q1(r,t)!==0}Jn.equal=v_;(function(r){Object.defineProperty(r,"__esModule",{value:!0});var t=Jn,e=ni;r.DIGEST_LENGTH=16;var n=function(){function c(l){this.digestLength=r.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var d=l[0]|l[1]<<8;this._r[0]=d&8191;var f=l[2]|l[3]<<8;this._r[1]=(d>>>13|f<<3)&8191;var w=l[4]|l[5]<<8;this._r[2]=(f>>>10|w<<6)&7939;var E=l[6]|l[7]<<8;this._r[3]=(w>>>7|E<<9)&8191;var x=l[8]|l[9]<<8;this._r[4]=(E>>>4|x<<12)&255,this._r[5]=x>>>1&8190;var I=l[10]|l[11]<<8;this._r[6]=(x>>>14|I<<2)&8191;var R=l[12]|l[13]<<8;this._r[7]=(I>>>11|R<<5)&8065;var Y=l[14]|l[15]<<8;this._r[8]=(R>>>8|Y<<8)&8191,this._r[9]=Y>>>5&127,this._pad[0]=l[16]|l[17]<<8,this._pad[1]=l[18]|l[19]<<8,this._pad[2]=l[20]|l[21]<<8,this._pad[3]=l[22]|l[23]<<8,this._pad[4]=l[24]|l[25]<<8,this._pad[5]=l[26]|l[27]<<8,this._pad[6]=l[28]|l[29]<<8,this._pad[7]=l[30]|l[31]<<8}return c.prototype._blocks=function(l,d,f){for(var w=this._fin?0:2048,E=this._h[0],x=this._h[1],I=this._h[2],R=this._h[3],Y=this._h[4],W=this._h[5],tt=this._h[6],K=this._h[7],V=this._h[8],B=this._h[9],z=this._r[0],$=this._r[1],v=this._r[2],T=this._r[3],st=this._r[4],ft=this._r[5],pt=this._r[6],gt=this._r[7],h=this._r[8],y=this._r[9];f>=16;){var b=l[d+0]|l[d+1]<<8;E+=b&8191;var C=l[d+2]|l[d+3]<<8;x+=(b>>>13|C<<3)&8191;var M=l[d+4]|l[d+5]<<8;I+=(C>>>10|M<<6)&8191;var N=l[d+6]|l[d+7]<<8;R+=(M>>>7|N<<9)&8191;var q=l[d+8]|l[d+9]<<8;Y+=(N>>>4|q<<12)&8191,W+=q>>>1&8191;var S=l[d+10]|l[d+11]<<8;tt+=(q>>>14|S<<2)&8191;var g=l[d+12]|l[d+13]<<8;K+=(S>>>11|g<<5)&8191;var O=l[d+14]|l[d+15]<<8;V+=(g>>>8|O<<8)&8191,B+=O>>>5|w;var it=0,lt=it;lt+=E*z,lt+=x*(5*y),lt+=I*(5*h),lt+=R*(5*gt),lt+=Y*(5*pt),it=lt>>>13,lt&=8191,lt+=W*(5*ft),lt+=tt*(5*st),lt+=K*(5*T),lt+=V*(5*v),lt+=B*(5*$),it+=lt>>>13,lt&=8191;var _=it;_+=E*$,_+=x*z,_+=I*(5*y),_+=R*(5*h),_+=Y*(5*gt),it=_>>>13,_&=8191,_+=W*(5*pt),_+=tt*(5*ft),_+=K*(5*st),_+=V*(5*T),_+=B*(5*v),it+=_>>>13,_&=8191;var Z=it;Z+=E*v,Z+=x*$,Z+=I*z,Z+=R*(5*y),Z+=Y*(5*h),it=Z>>>13,Z&=8191,Z+=W*(5*gt),Z+=tt*(5*pt),Z+=K*(5*ft),Z+=V*(5*st),Z+=B*(5*T),it+=Z>>>13,Z&=8191;var U=it;U+=E*T,U+=x*v,U+=I*$,U+=R*z,U+=Y*(5*y),it=U>>>13,U&=8191,U+=W*(5*h),U+=tt*(5*gt),U+=K*(5*pt),U+=V*(5*ft),U+=B*(5*st),it+=U>>>13,U&=8191;var L=it;L+=E*st,L+=x*T,L+=I*v,L+=R*$,L+=Y*z,it=L>>>13,L&=8191,L+=W*(5*y),L+=tt*(5*h),L+=K*(5*gt),L+=V*(5*pt),L+=B*(5*ft),it+=L>>>13,L&=8191;var k=it;k+=E*ft,k+=x*st,k+=I*T,k+=R*v,k+=Y*$,it=k>>>13,k&=8191,k+=W*z,k+=tt*(5*y),k+=K*(5*h),k+=V*(5*gt),k+=B*(5*pt),it+=k>>>13,k&=8191;var p=it;p+=E*pt,p+=x*ft,p+=I*st,p+=R*T,p+=Y*v,it=p>>>13,p&=8191,p+=W*$,p+=tt*z,p+=K*(5*y),p+=V*(5*h),p+=B*(5*gt),it+=p>>>13,p&=8191;var F=it;F+=E*gt,F+=x*pt,F+=I*ft,F+=R*st,F+=Y*T,it=F>>>13,F&=8191,F+=W*v,F+=tt*$,F+=K*z,F+=V*(5*y),F+=B*(5*h),it+=F>>>13,F&=8191;var et=it;et+=E*h,et+=x*gt,et+=I*pt,et+=R*ft,et+=Y*st,it=et>>>13,et&=8191,et+=W*T,et+=tt*v,et+=K*$,et+=V*z,et+=B*(5*y),it+=et>>>13,et&=8191;var ct=it;ct+=E*y,ct+=x*h,ct+=I*gt,ct+=R*pt,ct+=Y*ft,it=ct>>>13,ct&=8191,ct+=W*st,ct+=tt*T,ct+=K*v,ct+=V*$,ct+=B*z,it+=ct>>>13,ct&=8191,it=(it<<2)+it|0,it=it+lt|0,lt=it&8191,it=it>>>13,_+=it,E=lt,x=_,I=Z,R=U,Y=L,W=k,tt=p,K=F,V=et,B=ct,d+=16,f-=16}this._h[0]=E,this._h[1]=x,this._h[2]=I,this._h[3]=R,this._h[4]=Y,this._h[5]=W,this._h[6]=tt,this._h[7]=K,this._h[8]=V,this._h[9]=B},c.prototype.finish=function(l,d){d===void 0&&(d=0);var f=new Uint16Array(10),w,E,x,I;if(this._leftover){for(I=this._leftover,this._buffer[I++]=1;I<16;I++)this._buffer[I]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(w=this._h[1]>>>13,this._h[1]&=8191,I=2;I<10;I++)this._h[I]+=w,w=this._h[I]>>>13,this._h[I]&=8191;for(this._h[0]+=w*5,w=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=w,w=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=w,f[0]=this._h[0]+5,w=f[0]>>>13,f[0]&=8191,I=1;I<10;I++)f[I]=this._h[I]+w,w=f[I]>>>13,f[I]&=8191;for(f[9]-=8192,E=(w^1)-1,I=0;I<10;I++)f[I]&=E;for(E=~E,I=0;I<10;I++)this._h[I]=this._h[I]&E|f[I];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,x=this._h[0]+this._pad[0],this._h[0]=x&65535,I=1;I<8;I++)x=(this._h[I]+this._pad[I]|0)+(x>>>16)|0,this._h[I]=x&65535;return l[d+0]=this._h[0]>>>0,l[d+1]=this._h[0]>>>8,l[d+2]=this._h[1]>>>0,l[d+3]=this._h[1]>>>8,l[d+4]=this._h[2]>>>0,l[d+5]=this._h[2]>>>8,l[d+6]=this._h[3]>>>0,l[d+7]=this._h[3]>>>8,l[d+8]=this._h[4]>>>0,l[d+9]=this._h[4]>>>8,l[d+10]=this._h[5]>>>0,l[d+11]=this._h[5]>>>8,l[d+12]=this._h[6]>>>0,l[d+13]=this._h[6]>>>8,l[d+14]=this._h[7]>>>0,l[d+15]=this._h[7]>>>8,this._finished=!0,this},c.prototype.update=function(l){var d=0,f=l.length,w;if(this._leftover){w=16-this._leftover,w>f&&(w=f);for(var E=0;E<w;E++)this._buffer[this._leftover+E]=l[d+E];if(f-=w,d+=w,this._leftover+=w,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(f>=16&&(w=f-f%16,this._blocks(l,d,w),d+=w,f-=w),f){for(var E=0;E<f;E++)this._buffer[this._leftover+E]=l[d+E];this._leftover+=f}return this},c.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var l=new Uint8Array(16);return this.finish(l),l},c.prototype.clean=function(){return e.wipe(this._buffer),e.wipe(this._r),e.wipe(this._h),e.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},c}();r.Poly1305=n;function s(c,l){var d=new n(c);d.update(l);var f=d.digest();return d.clean(),f}r.oneTimeAuth=s;function a(c,l){return c.length!==r.DIGEST_LENGTH||l.length!==r.DIGEST_LENGTH?!1:t.equal(c,l)}r.equal=a})(L1);(function(r){Object.defineProperty(r,"__esModule",{value:!0});var t=ac,e=L1,n=ni,s=oe,a=Jn;r.KEY_LENGTH=32,r.NONCE_LENGTH=12,r.TAG_LENGTH=16;var c=new Uint8Array(16),l=function(){function d(f){if(this.nonceLength=r.NONCE_LENGTH,this.tagLength=r.TAG_LENGTH,f.length!==r.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(f)}return d.prototype.seal=function(f,w,E,x){if(f.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var I=new Uint8Array(16);I.set(f,I.length-f.length);var R=new Uint8Array(32);t.stream(this._key,I,R,4);var Y=w.length+this.tagLength,W;if(x){if(x.length!==Y)throw new Error("ChaCha20Poly1305: incorrect destination length");W=x}else W=new Uint8Array(Y);return t.streamXOR(this._key,I,w,W,4),this._authenticate(W.subarray(W.length-this.tagLength,W.length),R,W.subarray(0,W.length-this.tagLength),E),n.wipe(I),W},d.prototype.open=function(f,w,E,x){if(f.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(w.length<this.tagLength)return null;var I=new Uint8Array(16);I.set(f,I.length-f.length);var R=new Uint8Array(32);t.stream(this._key,I,R,4);var Y=new Uint8Array(this.tagLength);if(this._authenticate(Y,R,w.subarray(0,w.length-this.tagLength),E),!a.equal(Y,w.subarray(w.length-this.tagLength,w.length)))return null;var W=w.length-this.tagLength,tt;if(x){if(x.length!==W)throw new Error("ChaCha20Poly1305: incorrect destination length");tt=x}else tt=new Uint8Array(W);return t.streamXOR(this._key,I,w.subarray(0,w.length-this.tagLength),tt,4),n.wipe(I),tt},d.prototype.clean=function(){return n.wipe(this._key),this},d.prototype._authenticate=function(f,w,E,x){var I=new e.Poly1305(w);x&&(I.update(x),x.length%16>0&&I.update(c.subarray(x.length%16))),I.update(E),E.length%16>0&&I.update(c.subarray(E.length%16));var R=new Uint8Array(8);x&&s.writeUint64LE(x.length,R),I.update(R),s.writeUint64LE(E.length,R),I.update(R);for(var Y=I.digest(),W=0;W<Y.length;W++)f[W]=Y[W];I.clean(),n.wipe(Y),n.wipe(R)},d}();r.ChaCha20Poly1305=l})(Hl);var j1={},da={},Kl={};Object.defineProperty(Kl,"__esModule",{value:!0});function y_(r){return typeof r.saveState<"u"&&typeof r.restoreState<"u"&&typeof r.cleanSavedState<"u"}Kl.isSerializableHash=y_;Object.defineProperty(da,"__esModule",{value:!0});var Gi=Kl,w_=Jn,b_=ni,$1=function(){function r(t,e){this._finished=!1,this._inner=new t,this._outer=new t,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var n=new Uint8Array(this.blockSize);e.length>this.blockSize?this._inner.update(e).finish(n).clean():n.set(e);for(var s=0;s<n.length;s++)n[s]^=54;this._inner.update(n);for(var s=0;s<n.length;s++)n[s]^=106;this._outer.update(n),Gi.isSerializableHash(this._inner)&&Gi.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),b_.wipe(n)}return r.prototype.reset=function(){if(!Gi.isSerializableHash(this._inner)||!Gi.isSerializableHash(this._outer))throw new Error("hmac: can't reset() because hash doesn't implement restoreState()");return this._inner.restoreState(this._innerKeyedState),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},r.prototype.clean=function(){Gi.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),Gi.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},r.prototype.update=function(t){return this._inner.update(t),this},r.prototype.finish=function(t){return this._finished?(this._outer.finish(t),this):(this._inner.finish(t),this._outer.update(t.subarray(0,this.digestLength)).finish(t),this._finished=!0,this)},r.prototype.digest=function(){var t=new Uint8Array(this.digestLength);return this.finish(t),t},r.prototype.saveState=function(){if(!Gi.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},r.prototype.restoreState=function(t){if(!Gi.isSerializableHash(this._inner)||!Gi.isSerializableHash(this._outer))throw new Error("hmac: can't restoreState() because hash doesn't implement it");return this._inner.restoreState(t),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},r.prototype.cleanSavedState=function(t){if(!Gi.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(t)},r}();da.HMAC=$1;function __(r,t,e){var n=new $1(r,t);n.update(e);var s=n.digest();return n.clean(),s}da.hmac=__;da.equal=w_.equal;Object.defineProperty(j1,"__esModule",{value:!0});var Pd=da,Od=ni,E_=function(){function r(t,e,n,s){n===void 0&&(n=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=t,this._info=s;var a=Pd.hmac(this._hash,n,e);this._hmac=new Pd.HMAC(t,a),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return r.prototype._fillBuffer=function(){this._counter[0]++;var t=this._counter[0];if(t===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),t>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},r.prototype.expand=function(t){for(var e=new Uint8Array(t),n=0;n<e.length;n++)this._bufpos===this._buffer.length&&this._fillBuffer(),e[n]=this._buffer[this._bufpos++];return e},r.prototype.clean=function(){this._hmac.clean(),Od.wipe(this._buffer),Od.wipe(this._counter),this._bufpos=0},r}(),A_=j1.HKDF=E_,po={},uc={},cc={};Object.defineProperty(cc,"__esModule",{value:!0});cc.BrowserRandomSource=void 0;const Nd=65536;class S_{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const t=typeof self<"u"?self.crypto||self.msCrypto:null;t&&t.getRandomValues!==void 0&&(this._crypto=t,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(t){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const e=new Uint8Array(t);for(let n=0;n<e.length;n+=Nd)this._crypto.getRandomValues(e.subarray(n,n+Math.min(e.length-n,Nd)));return e}}cc.BrowserRandomSource=S_;var hc={};Object.defineProperty(hc,"__esModule",{value:!0});hc.NodeRandomSource=void 0;const I_=ni;class D_{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof e6<"u"){const t=r6();t&&t.randomBytes&&(this._crypto=t,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(t){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let e=this._crypto.randomBytes(t);if(e.length!==t)throw new Error("NodeRandomSource: got fewer bytes than requested");const n=new Uint8Array(t);for(let s=0;s<n.length;s++)n[s]=e[s];return(0,I_.wipe)(e),n}}hc.NodeRandomSource=D_;Object.defineProperty(uc,"__esModule",{value:!0});uc.SystemRandomSource=void 0;const x_=cc,M_=hc;class C_{constructor(){if(this.isAvailable=!1,this.name="",this._source=new x_.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new M_.NodeRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Node";return}}randomBytes(t){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(t)}}uc.SystemRandomSource=C_;(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.randomStringForEntropy=r.randomString=r.randomUint32=r.randomBytes=r.defaultRandomSource=void 0;const t=uc,e=oe,n=ni;r.defaultRandomSource=new t.SystemRandomSource;function s(f,w=r.defaultRandomSource){return w.randomBytes(f)}r.randomBytes=s;function a(f=r.defaultRandomSource){const w=s(4,f),E=(0,e.readUint32LE)(w);return(0,n.wipe)(w),E}r.randomUint32=a;const c="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function l(f,w=c,E=r.defaultRandomSource){if(w.length<2)throw new Error("randomString charset is too short");if(w.length>256)throw new Error("randomString charset is too long");let x="";const I=w.length,R=256-256%I;for(;f>0;){const Y=s(Math.ceil(f*256/R),E);for(let W=0;W<Y.length&&f>0;W++){const tt=Y[W];tt<R&&(x+=w.charAt(tt%I),f--)}(0,n.wipe)(Y)}return x}r.randomString=l;function d(f,w=c,E=r.defaultRandomSource){const x=Math.ceil(f/(Math.log(w.length)/Math.LN2));return l(x,w,E)}r.randomStringForEntropy=d})(po);var lc={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});var t=oe,e=ni;r.DIGEST_LENGTH=32,r.BLOCK_SIZE=64;var n=function(){function l(){this.digestLength=r.DIGEST_LENGTH,this.blockSize=r.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return l.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},l.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},l.prototype.clean=function(){e.wipe(this._buffer),e.wipe(this._temp),this.reset()},l.prototype.update=function(d,f){if(f===void 0&&(f=d.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var w=0;if(this._bytesHashed+=f,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&f>0;)this._buffer[this._bufferLength++]=d[w++],f--;this._bufferLength===this.blockSize&&(a(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(f>=this.blockSize&&(w=a(this._temp,this._state,d,w,f),f%=this.blockSize);f>0;)this._buffer[this._bufferLength++]=d[w++],f--;return this},l.prototype.finish=function(d){if(!this._finished){var f=this._bytesHashed,w=this._bufferLength,E=f/536870912|0,x=f<<3,I=f%64<56?64:128;this._buffer[w]=128;for(var R=w+1;R<I-8;R++)this._buffer[R]=0;t.writeUint32BE(E,this._buffer,I-8),t.writeUint32BE(x,this._buffer,I-4),a(this._temp,this._state,this._buffer,0,I),this._finished=!0}for(var R=0;R<this.digestLength/4;R++)t.writeUint32BE(this._state[R],d,R*4);return this},l.prototype.digest=function(){var d=new Uint8Array(this.digestLength);return this.finish(d),d},l.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{state:new Int32Array(this._state),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},l.prototype.restoreState=function(d){return this._state.set(d.state),this._bufferLength=d.bufferLength,d.buffer&&this._buffer.set(d.buffer),this._bytesHashed=d.bytesHashed,this._finished=!1,this},l.prototype.cleanSavedState=function(d){e.wipe(d.state),d.buffer&&e.wipe(d.buffer),d.bufferLength=0,d.bytesHashed=0},l}();r.SHA256=n;var s=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function a(l,d,f,w,E){for(;E>=64;){for(var x=d[0],I=d[1],R=d[2],Y=d[3],W=d[4],tt=d[5],K=d[6],V=d[7],B=0;B<16;B++){var z=w+B*4;l[B]=t.readUint32BE(f,z)}for(var B=16;B<64;B++){var $=l[B-2],v=($>>>17|$<<32-17)^($>>>19|$<<32-19)^$>>>10;$=l[B-15];var T=($>>>7|$<<32-7)^($>>>18|$<<32-18)^$>>>3;l[B]=(v+l[B-7]|0)+(T+l[B-16]|0)}for(var B=0;B<64;B++){var v=(((W>>>6|W<<26)^(W>>>11|W<<21)^(W>>>25|W<<7))+(W&tt^~W&K)|0)+(V+(s[B]+l[B]|0)|0)|0,T=((x>>>2|x<<32-2)^(x>>>13|x<<32-13)^(x>>>22|x<<32-22))+(x&I^x&R^I&R)|0;V=K,K=tt,tt=W,W=Y+v|0,Y=R,R=I,I=x,x=v+T|0}d[0]+=x,d[1]+=I,d[2]+=R,d[3]+=Y,d[4]+=W,d[5]+=tt,d[6]+=K,d[7]+=V,w+=64,E-=64}return w}function c(l){var d=new n;d.update(l);var f=d.digest();return d.clean(),f}r.hash=c})(lc);var Vl={};(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.sharedKey=r.generateKeyPair=r.generateKeyPairFromSeed=r.scalarMultBase=r.scalarMult=r.SHARED_KEY_LENGTH=r.SECRET_KEY_LENGTH=r.PUBLIC_KEY_LENGTH=void 0;const t=po,e=ni;r.PUBLIC_KEY_LENGTH=32,r.SECRET_KEY_LENGTH=32,r.SHARED_KEY_LENGTH=32;function n(B){const z=new Float64Array(16);if(B)for(let $=0;$<B.length;$++)z[$]=B[$];return z}const s=new Uint8Array(32);s[0]=9;const a=n([56129,1]);function c(B){let z=1;for(let $=0;$<16;$++){let v=B[$]+z+65535;z=Math.floor(v/65536),B[$]=v-z*65536}B[0]+=z-1+37*(z-1)}function l(B,z,$){const v=~($-1);for(let T=0;T<16;T++){const st=v&(B[T]^z[T]);B[T]^=st,z[T]^=st}}function d(B,z){const $=n(),v=n();for(let T=0;T<16;T++)v[T]=z[T];c(v),c(v),c(v);for(let T=0;T<2;T++){$[0]=v[0]-65517;for(let ft=1;ft<15;ft++)$[ft]=v[ft]-65535-($[ft-1]>>16&1),$[ft-1]&=65535;$[15]=v[15]-32767-($[14]>>16&1);const st=$[15]>>16&1;$[14]&=65535,l(v,$,1-st)}for(let T=0;T<16;T++)B[2*T]=v[T]&255,B[2*T+1]=v[T]>>8}function f(B,z){for(let $=0;$<16;$++)B[$]=z[2*$]+(z[2*$+1]<<8);B[15]&=32767}function w(B,z,$){for(let v=0;v<16;v++)B[v]=z[v]+$[v]}function E(B,z,$){for(let v=0;v<16;v++)B[v]=z[v]-$[v]}function x(B,z,$){let v,T,st=0,ft=0,pt=0,gt=0,h=0,y=0,b=0,C=0,M=0,N=0,q=0,S=0,g=0,O=0,it=0,lt=0,_=0,Z=0,U=0,L=0,k=0,p=0,F=0,et=0,ct=0,at=0,Mt=0,Pt=0,It=0,Ee=0,$t=0,xt=$[0],Bt=$[1],_t=$[2],Et=$[3],Vt=$[4],yt=$[5],At=$[6],Ut=$[7],wt=$[8],Ct=$[9],Lt=$[10],Ot=$[11],Nt=$[12],se=$[13],Tt=$[14],Rt=$[15];v=z[0],st+=v*xt,ft+=v*Bt,pt+=v*_t,gt+=v*Et,h+=v*Vt,y+=v*yt,b+=v*At,C+=v*Ut,M+=v*wt,N+=v*Ct,q+=v*Lt,S+=v*Ot,g+=v*Nt,O+=v*se,it+=v*Tt,lt+=v*Rt,v=z[1],ft+=v*xt,pt+=v*Bt,gt+=v*_t,h+=v*Et,y+=v*Vt,b+=v*yt,C+=v*At,M+=v*Ut,N+=v*wt,q+=v*Ct,S+=v*Lt,g+=v*Ot,O+=v*Nt,it+=v*se,lt+=v*Tt,_+=v*Rt,v=z[2],pt+=v*xt,gt+=v*Bt,h+=v*_t,y+=v*Et,b+=v*Vt,C+=v*yt,M+=v*At,N+=v*Ut,q+=v*wt,S+=v*Ct,g+=v*Lt,O+=v*Ot,it+=v*Nt,lt+=v*se,_+=v*Tt,Z+=v*Rt,v=z[3],gt+=v*xt,h+=v*Bt,y+=v*_t,b+=v*Et,C+=v*Vt,M+=v*yt,N+=v*At,q+=v*Ut,S+=v*wt,g+=v*Ct,O+=v*Lt,it+=v*Ot,lt+=v*Nt,_+=v*se,Z+=v*Tt,U+=v*Rt,v=z[4],h+=v*xt,y+=v*Bt,b+=v*_t,C+=v*Et,M+=v*Vt,N+=v*yt,q+=v*At,S+=v*Ut,g+=v*wt,O+=v*Ct,it+=v*Lt,lt+=v*Ot,_+=v*Nt,Z+=v*se,U+=v*Tt,L+=v*Rt,v=z[5],y+=v*xt,b+=v*Bt,C+=v*_t,M+=v*Et,N+=v*Vt,q+=v*yt,S+=v*At,g+=v*Ut,O+=v*wt,it+=v*Ct,lt+=v*Lt,_+=v*Ot,Z+=v*Nt,U+=v*se,L+=v*Tt,k+=v*Rt,v=z[6],b+=v*xt,C+=v*Bt,M+=v*_t,N+=v*Et,q+=v*Vt,S+=v*yt,g+=v*At,O+=v*Ut,it+=v*wt,lt+=v*Ct,_+=v*Lt,Z+=v*Ot,U+=v*Nt,L+=v*se,k+=v*Tt,p+=v*Rt,v=z[7],C+=v*xt,M+=v*Bt,N+=v*_t,q+=v*Et,S+=v*Vt,g+=v*yt,O+=v*At,it+=v*Ut,lt+=v*wt,_+=v*Ct,Z+=v*Lt,U+=v*Ot,L+=v*Nt,k+=v*se,p+=v*Tt,F+=v*Rt,v=z[8],M+=v*xt,N+=v*Bt,q+=v*_t,S+=v*Et,g+=v*Vt,O+=v*yt,it+=v*At,lt+=v*Ut,_+=v*wt,Z+=v*Ct,U+=v*Lt,L+=v*Ot,k+=v*Nt,p+=v*se,F+=v*Tt,et+=v*Rt,v=z[9],N+=v*xt,q+=v*Bt,S+=v*_t,g+=v*Et,O+=v*Vt,it+=v*yt,lt+=v*At,_+=v*Ut,Z+=v*wt,U+=v*Ct,L+=v*Lt,k+=v*Ot,p+=v*Nt,F+=v*se,et+=v*Tt,ct+=v*Rt,v=z[10],q+=v*xt,S+=v*Bt,g+=v*_t,O+=v*Et,it+=v*Vt,lt+=v*yt,_+=v*At,Z+=v*Ut,U+=v*wt,L+=v*Ct,k+=v*Lt,p+=v*Ot,F+=v*Nt,et+=v*se,ct+=v*Tt,at+=v*Rt,v=z[11],S+=v*xt,g+=v*Bt,O+=v*_t,it+=v*Et,lt+=v*Vt,_+=v*yt,Z+=v*At,U+=v*Ut,L+=v*wt,k+=v*Ct,p+=v*Lt,F+=v*Ot,et+=v*Nt,ct+=v*se,at+=v*Tt,Mt+=v*Rt,v=z[12],g+=v*xt,O+=v*Bt,it+=v*_t,lt+=v*Et,_+=v*Vt,Z+=v*yt,U+=v*At,L+=v*Ut,k+=v*wt,p+=v*Ct,F+=v*Lt,et+=v*Ot,ct+=v*Nt,at+=v*se,Mt+=v*Tt,Pt+=v*Rt,v=z[13],O+=v*xt,it+=v*Bt,lt+=v*_t,_+=v*Et,Z+=v*Vt,U+=v*yt,L+=v*At,k+=v*Ut,p+=v*wt,F+=v*Ct,et+=v*Lt,ct+=v*Ot,at+=v*Nt,Mt+=v*se,Pt+=v*Tt,It+=v*Rt,v=z[14],it+=v*xt,lt+=v*Bt,_+=v*_t,Z+=v*Et,U+=v*Vt,L+=v*yt,k+=v*At,p+=v*Ut,F+=v*wt,et+=v*Ct,ct+=v*Lt,at+=v*Ot,Mt+=v*Nt,Pt+=v*se,It+=v*Tt,Ee+=v*Rt,v=z[15],lt+=v*xt,_+=v*Bt,Z+=v*_t,U+=v*Et,L+=v*Vt,k+=v*yt,p+=v*At,F+=v*Ut,et+=v*wt,ct+=v*Ct,at+=v*Lt,Mt+=v*Ot,Pt+=v*Nt,It+=v*se,Ee+=v*Tt,$t+=v*Rt,st+=38*_,ft+=38*Z,pt+=38*U,gt+=38*L,h+=38*k,y+=38*p,b+=38*F,C+=38*et,M+=38*ct,N+=38*at,q+=38*Mt,S+=38*Pt,g+=38*It,O+=38*Ee,it+=38*$t,T=1,v=st+T+65535,T=Math.floor(v/65536),st=v-T*65536,v=ft+T+65535,T=Math.floor(v/65536),ft=v-T*65536,v=pt+T+65535,T=Math.floor(v/65536),pt=v-T*65536,v=gt+T+65535,T=Math.floor(v/65536),gt=v-T*65536,v=h+T+65535,T=Math.floor(v/65536),h=v-T*65536,v=y+T+65535,T=Math.floor(v/65536),y=v-T*65536,v=b+T+65535,T=Math.floor(v/65536),b=v-T*65536,v=C+T+65535,T=Math.floor(v/65536),C=v-T*65536,v=M+T+65535,T=Math.floor(v/65536),M=v-T*65536,v=N+T+65535,T=Math.floor(v/65536),N=v-T*65536,v=q+T+65535,T=Math.floor(v/65536),q=v-T*65536,v=S+T+65535,T=Math.floor(v/65536),S=v-T*65536,v=g+T+65535,T=Math.floor(v/65536),g=v-T*65536,v=O+T+65535,T=Math.floor(v/65536),O=v-T*65536,v=it+T+65535,T=Math.floor(v/65536),it=v-T*65536,v=lt+T+65535,T=Math.floor(v/65536),lt=v-T*65536,st+=T-1+37*(T-1),T=1,v=st+T+65535,T=Math.floor(v/65536),st=v-T*65536,v=ft+T+65535,T=Math.floor(v/65536),ft=v-T*65536,v=pt+T+65535,T=Math.floor(v/65536),pt=v-T*65536,v=gt+T+65535,T=Math.floor(v/65536),gt=v-T*65536,v=h+T+65535,T=Math.floor(v/65536),h=v-T*65536,v=y+T+65535,T=Math.floor(v/65536),y=v-T*65536,v=b+T+65535,T=Math.floor(v/65536),b=v-T*65536,v=C+T+65535,T=Math.floor(v/65536),C=v-T*65536,v=M+T+65535,T=Math.floor(v/65536),M=v-T*65536,v=N+T+65535,T=Math.floor(v/65536),N=v-T*65536,v=q+T+65535,T=Math.floor(v/65536),q=v-T*65536,v=S+T+65535,T=Math.floor(v/65536),S=v-T*65536,v=g+T+65535,T=Math.floor(v/65536),g=v-T*65536,v=O+T+65535,T=Math.floor(v/65536),O=v-T*65536,v=it+T+65535,T=Math.floor(v/65536),it=v-T*65536,v=lt+T+65535,T=Math.floor(v/65536),lt=v-T*65536,st+=T-1+37*(T-1),B[0]=st,B[1]=ft,B[2]=pt,B[3]=gt,B[4]=h,B[5]=y,B[6]=b,B[7]=C,B[8]=M,B[9]=N,B[10]=q,B[11]=S,B[12]=g,B[13]=O,B[14]=it,B[15]=lt}function I(B,z){x(B,z,z)}function R(B,z){const $=n();for(let v=0;v<16;v++)$[v]=z[v];for(let v=253;v>=0;v--)I($,$),v!==2&&v!==4&&x($,$,z);for(let v=0;v<16;v++)B[v]=$[v]}function Y(B,z){const $=new Uint8Array(32),v=new Float64Array(80),T=n(),st=n(),ft=n(),pt=n(),gt=n(),h=n();for(let M=0;M<31;M++)$[M]=B[M];$[31]=B[31]&127|64,$[0]&=248,f(v,z);for(let M=0;M<16;M++)st[M]=v[M];T[0]=pt[0]=1;for(let M=254;M>=0;--M){const N=$[M>>>3]>>>(M&7)&1;l(T,st,N),l(ft,pt,N),w(gt,T,ft),E(T,T,ft),w(ft,st,pt),E(st,st,pt),I(pt,gt),I(h,T),x(T,ft,T),x(ft,st,gt),w(gt,T,ft),E(T,T,ft),I(st,T),E(ft,pt,h),x(T,ft,a),w(T,T,pt),x(ft,ft,T),x(T,pt,h),x(pt,st,v),I(st,gt),l(T,st,N),l(ft,pt,N)}for(let M=0;M<16;M++)v[M+16]=T[M],v[M+32]=ft[M],v[M+48]=st[M],v[M+64]=pt[M];const y=v.subarray(32),b=v.subarray(16);R(y,y),x(b,b,y);const C=new Uint8Array(32);return d(C,b),C}r.scalarMult=Y;function W(B){return Y(B,s)}r.scalarMultBase=W;function tt(B){if(B.length!==r.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${r.SECRET_KEY_LENGTH} bytes`);const z=new Uint8Array(B);return{publicKey:W(z),secretKey:z}}r.generateKeyPairFromSeed=tt;function K(B){const z=(0,t.randomBytes)(32,B),$=tt(z);return(0,e.wipe)(z),$}r.generateKeyPair=K;function V(B,z,$=!1){if(B.length!==r.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(z.length!==r.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const v=Y(B,z);if($){let T=0;for(let st=0;st<v.length;st++)T|=v[st];if(T===0)throw new Error("X25519: invalid shared key")}return v}r.sharedKey=V})(Vl);function Gl(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function z1(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?Gl(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function wl(r,t){t||(t=r.reduce((s,a)=>s+a.length,0));const e=z1(t);let n=0;for(const s of r)e.set(s,n),n+=s.length;return Gl(e)}function P_(r,t){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n<e.length;n++)e[n]=255;for(var s=0;s<r.length;s++){var a=r.charAt(s),c=a.charCodeAt(0);if(e[c]!==255)throw new TypeError(a+" is ambiguous");e[c]=s}var l=r.length,d=r.charAt(0),f=Math.log(l)/Math.log(256),w=Math.log(256)/Math.log(l);function E(R){if(R instanceof Uint8Array||(ArrayBuffer.isView(R)?R=new Uint8Array(R.buffer,R.byteOffset,R.byteLength):Array.isArray(R)&&(R=Uint8Array.from(R))),!(R instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(R.length===0)return"";for(var Y=0,W=0,tt=0,K=R.length;tt!==K&&R[tt]===0;)tt++,Y++;for(var V=(K-tt)*w+1>>>0,B=new Uint8Array(V);tt!==K;){for(var z=R[tt],$=0,v=V-1;(z!==0||$<W)&&v!==-1;v--,$++)z+=256*B[v]>>>0,B[v]=z%l>>>0,z=z/l>>>0;if(z!==0)throw new Error("Non-zero carry");W=$,tt++}for(var T=V-W;T!==V&&B[T]===0;)T++;for(var st=d.repeat(Y);T<V;++T)st+=r.charAt(B[T]);return st}function x(R){if(typeof R!="string")throw new TypeError("Expected String");if(R.length===0)return new Uint8Array;var Y=0;if(R[Y]!==" "){for(var W=0,tt=0;R[Y]===d;)W++,Y++;for(var K=(R.length-Y)*f+1>>>0,V=new Uint8Array(K);R[Y];){var B=e[R.charCodeAt(Y)];if(B===255)return;for(var z=0,$=K-1;(B!==0||z<tt)&&$!==-1;$--,z++)B+=l*V[$]>>>0,V[$]=B%256>>>0,B=B/256>>>0;if(B!==0)throw new Error("Non-zero carry");tt=z,Y++}if(R[Y]!==" "){for(var v=K-tt;v!==K&&V[v]===0;)v++;for(var T=new Uint8Array(W+(K-v)),st=W;v!==K;)T[st++]=V[v++];return T}}}function I(R){var Y=x(R);if(Y)return Y;throw new Error(`Non-${t} character`)}return{encode:E,decodeUnsafe:x,decode:I}}var O_=P_,N_=O_;const R_=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},T_=r=>new TextEncoder().encode(r),F_=r=>new TextDecoder().decode(r);class U_{constructor(t,e,n){this.name=t,this.prefix=e,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}}class B_{constructor(t,e,n){if(this.name=t,this.prefix=e,e.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=e.codePointAt(0),this.baseDecode=n}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return k1(this,t)}}class L_{constructor(t){this.decoders=t}or(t){return k1(this,t)}decode(t){const e=t[0],n=this.decoders[e];if(n)return n.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const k1=(r,t)=>new L_({...r.decoders||{[r.prefix]:r},...t.decoders||{[t.prefix]:t}});class q_{constructor(t,e,n,s){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=s,this.encoder=new U_(t,e,n),this.decoder=new B_(t,e,s)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}}const fc=({name:r,prefix:t,encode:e,decode:n})=>new q_(r,t,e,n),pa=({prefix:r,name:t,alphabet:e})=>{const{encode:n,decode:s}=N_(e,t);return fc({prefix:r,name:t,encode:n,decode:a=>R_(s(a))})},j_=(r,t,e,n)=>{const s={};for(let w=0;w<t.length;++w)s[t[w]]=w;let a=r.length;for(;r[a-1]==="=";)--a;const c=new Uint8Array(a*e/8|0);let l=0,d=0,f=0;for(let w=0;w<a;++w){const E=s[r[w]];if(E===void 0)throw new SyntaxError(`Non-${n} character`);d=d<<e|E,l+=e,l>=8&&(l-=8,c[f++]=255&d>>l)}if(l>=e||255&d<<8-l)throw new SyntaxError("Unexpected end of data");return c},$_=(r,t,e)=>{const n=t[t.length-1]==="=",s=(1<<e)-1;let a="",c=0,l=0;for(let d=0;d<r.length;++d)for(l=l<<8|r[d],c+=8;c>e;)c-=e,a+=t[s&l>>c];if(c&&(a+=t[s&l<<e-c]),n)for(;a.length*e&7;)a+="=";return a},gr=({name:r,prefix:t,bitsPerChar:e,alphabet:n})=>fc({prefix:t,name:r,encode(s){return $_(s,n,e)},decode(s){return j_(s,n,e,r)}}),z_=fc({prefix:"\0",name:"identity",encode:r=>F_(r),decode:r=>T_(r)}),k_=Object.freeze(Object.defineProperty({__proto__:null,identity:z_},Symbol.toStringTag,{value:"Module"})),H_=gr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),K_=Object.freeze(Object.defineProperty({__proto__:null,base2:H_},Symbol.toStringTag,{value:"Module"})),V_=gr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),G_=Object.freeze(Object.defineProperty({__proto__:null,base8:V_},Symbol.toStringTag,{value:"Module"})),W_=pa({prefix:"9",name:"base10",alphabet:"0123456789"}),Y_=Object.freeze(Object.defineProperty({__proto__:null,base10:W_},Symbol.toStringTag,{value:"Module"})),Q_=gr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),J_=gr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),X_=Object.freeze(Object.defineProperty({__proto__:null,base16:Q_,base16upper:J_},Symbol.toStringTag,{value:"Module"})),Z_=gr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),tE=gr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),eE=gr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),rE=gr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),iE=gr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),nE=gr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),sE=gr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),oE=gr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),aE=gr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),uE=Object.freeze(Object.defineProperty({__proto__:null,base32:Z_,base32hex:iE,base32hexpad:sE,base32hexpadupper:oE,base32hexupper:nE,base32pad:eE,base32padupper:rE,base32upper:tE,base32z:aE},Symbol.toStringTag,{value:"Module"})),cE=pa({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),hE=pa({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),lE=Object.freeze(Object.defineProperty({__proto__:null,base36:cE,base36upper:hE},Symbol.toStringTag,{value:"Module"})),fE=pa({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),dE=pa({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),pE=Object.freeze(Object.defineProperty({__proto__:null,base58btc:fE,base58flickr:dE},Symbol.toStringTag,{value:"Module"})),gE=gr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),mE=gr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),vE=gr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),yE=gr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),wE=Object.freeze(Object.defineProperty({__proto__:null,base64:gE,base64pad:mE,base64url:vE,base64urlpad:yE},Symbol.toStringTag,{value:"Module"})),H1=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),bE=H1.reduce((r,t,e)=>(r[e]=t,r),[]),_E=H1.reduce((r,t,e)=>(r[t.codePointAt(0)]=e,r),[]);function EE(r){return r.reduce((t,e)=>(t+=bE[e],t),"")}function AE(r){const t=[];for(const e of r){const n=_E[e.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(n)}return new Uint8Array(t)}const SE=fc({prefix:"🚀",name:"base256emoji",encode:EE,decode:AE}),IE=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:SE},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;const Rd={...k_,...K_,...G_,...Y_,...X_,...uE,...lE,...pE,...wE,...IE};function K1(r,t,e,n){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:n}}}const Td=K1("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Th=K1("ascii","a",r=>{let t="a";for(let e=0;e<r.length;e++)t+=String.fromCharCode(r[e]);return t},r=>{r=r.substring(1);const t=z1(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}),V1={utf8:Td,"utf-8":Td,hex:Rd.base16,latin1:Th,ascii:Th,binary:Th,...Rd};function kr(r,t="utf8"){const e=V1[t];if(!e)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Gl(globalThis.Buffer.from(r,"utf-8")):e.decoder.decode(`${e.prefix}${r}`)}function Rr(r,t="utf8"){const e=V1[t];if(!e)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString("utf8"):e.encoder.encode(r).substring(1)}const DE={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe"}},xE=":";function Uu(r){const[t,e]=r.split(xE);return{namespace:t,reference:e}}function Fd(r,t=[]){const e=[];return Object.keys(r).forEach(n=>{if(t.length&&!t.includes(n))return;const s=r[n];e.push(...s.accounts)}),e}function G1(r,t){return r.includes(":")?[r]:t.chains||[]}var ME=Object.defineProperty,Ud=Object.getOwnPropertySymbols,CE=Object.prototype.hasOwnProperty,PE=Object.prototype.propertyIsEnumerable,Bd=(r,t,e)=>t in r?ME(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ld=(r,t)=>{for(var e in t||(t={}))CE.call(t,e)&&Bd(r,e,t[e]);if(Ud)for(var e of Ud(t))PE.call(t,e)&&Bd(r,e,t[e]);return r};const OE="ReactNative",ti={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},NE="js";function sa(){return typeof ei<"u"&&typeof ei.versions<"u"&&typeof ei.versions.node<"u"}function go(){return!$l()&&!!zl()&&navigator.product===OE}function mo(){return!sa()&&!!zl()&&!!$l()}function ga(){return go()?ti.reactNative:sa()?ti.node:mo()?ti.browser:ti.unknown}function RE(){var r;try{return go()&&typeof Ie<"u"&&typeof(Ie==null?void 0:Ie.Application)<"u"?(r=Ie.Application)==null?void 0:r.applicationId:void 0}catch{return}}function TE(r,t){let e=na.parse(r);return e=Ld(Ld({},e),t),r=na.stringify(e),r}function FE(){return C1()||{name:"",description:"",url:"",icons:[""]}}function UE(){if(ga()===ti.reactNative&&typeof Ie<"u"&&typeof(Ie==null?void 0:Ie.Platform)<"u"){const{OS:e,Version:n}=Ie.Platform;return[e,n].join("-")}const r=p6();if(r===null)return"unknown";const t=r.os?r.os.replace(" ","").toLowerCase():"unknown";return r.type==="browser"?[t,r.name,r.version].join("-"):[t,r.version].join("-")}function BE(){var r;const t=ga();return t===ti.browser?[t,((r=M1())==null?void 0:r.host)||"unknown"].join(":"):t}function LE(r,t,e){const n=UE(),s=BE();return[[r,t].join("-"),[NE,e].join("-"),n,s].join("/")}function qE({protocol:r,version:t,relayUrl:e,sdkVersion:n,auth:s,projectId:a,useOnCloseEvent:c,bundleId:l}){const d=e.split("?"),f=LE(r,t,n),w={auth:s,ua:f,projectId:a,useOnCloseEvent:c||void 0,origin:l||void 0},E=TE(d[1]||"",w);return d[0]+"?"+E}function As(r,t){return r.filter(e=>t.includes(e)).length===r.length}function W1(r){return Object.fromEntries(r.entries())}function Y1(r){return new Map(Object.entries(r))}function Es(r=bt.FIVE_MINUTES,t){const e=bt.toMiliseconds(r||bt.FIVE_MINUTES);let n,s,a;return{resolve:c=>{a&&n&&(clearTimeout(a),n(c))},reject:c=>{a&&s&&(clearTimeout(a),s(c))},done:()=>new Promise((c,l)=>{a=setTimeout(()=>{l(new Error(t))},e),n=c,s=l})}}function oa(r,t,e){return new Promise(async(n,s)=>{const a=setTimeout(()=>s(new Error(e)),t);try{const c=await r;n(c)}catch(c){s(c)}clearTimeout(a)})}function Q1(r,t){if(typeof t=="string"&&t.startsWith(`${r}:`))return t;if(r.toLowerCase()==="topic"){if(typeof t!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${t}`}else if(r.toLowerCase()==="id"){if(typeof t!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${t}`}throw new Error(`Unknown expirer target type: ${r}`)}function jE(r){return Q1("topic",r)}function $E(r){return Q1("id",r)}function J1(r){const[t,e]=r.split(":"),n={id:void 0,topic:void 0};if(t==="topic"&&typeof e=="string")n.topic=e;else if(t==="id"&&Number.isInteger(Number(e)))n.id=Number(e);else throw new Error(`Invalid target, expected id:number or topic:string, got ${t}:${e}`);return n}function _r(r,t){return bt.fromMiliseconds((t||Date.now())+bt.toMiliseconds(r))}function Hn(r){return Date.now()>=bt.toMiliseconds(r)}function de(r,t){return`${r}${t?`:${t}`:""}`}function Bu(r=[],t=[]){return[...new Set([...r,...t])]}async function zE({id:r,topic:t,wcDeepLink:e}){try{if(!e)return;const n=typeof e=="string"?JSON.parse(e):e;let s=n==null?void 0:n.href;if(typeof s!="string")return;s.endsWith("/")&&(s=s.slice(0,-1));const a=`${s}/wc?requestId=${r}&sessionTopic=${t}`,c=ga();c===ti.browser?a.startsWith("https://")||a.startsWith("http://")?window.open(a,"_blank","noreferrer noopener"):window.open(a,"_self","noreferrer noopener"):c===ti.reactNative&&typeof(Ie==null?void 0:Ie.Linking)<"u"&&await Ie.Linking.openURL(a)}catch(n){console.error(n)}}async function kE(r,t){try{return await r.getItem(t)||(mo()?localStorage.getItem(t):void 0)}catch(e){console.error(e)}}var X1=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof Ie<"u"?Ie:typeof self<"u"?self:{};function HE(r){var t=r.default;if(typeof t=="function"){var e=function(){return t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(r).forEach(function(n){var s=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(e,n,s.get?s:{enumerable:!0,get:function(){return r[n]}})}),e}var Z1={exports:{}};/**
2
2
  * [js-sha3]{@link https://github.com/emn178/js-sha3}
3
3
  *
4
4
  * @version 0.8.0
@@ -40,4 +40,4 @@ __p += '`),be&&(dt+=`' +
40
40
  function print() { __p += __j.call(arguments, '') }
41
41
  `:`;
42
42
  `)+dt+`return __p
43
- }`;var ce=hd(function(){return Se(P,Ft+"return "+dt).apply(e,H)});if(ce.source=dt,wh(ce))throw ce;return ce}function u3(i){return Me(i).toLowerCase()}function c3(i){return Me(i).toUpperCase()}function h3(i,o,u){if(i=Me(i),i&&(u||o===e))return wf(i);if(!i||!(o=Yr(o)))return i;var m=Ci(i),A=Ci(o),P=bf(m,A),H=_f(m,A)+1;return $n(m,P,H).join("")}function l3(i,o,u){if(i=Me(i),i&&(u||o===e))return i.slice(0,Af(i)+1);if(!i||!(o=Yr(o)))return i;var m=Ci(i),A=_f(m,Ci(o))+1;return $n(m,0,A).join("")}function f3(i,o,u){if(i=Me(i),i&&(u||o===e))return i.replace(Yt,"");if(!i||!(o=Yr(o)))return i;var m=Ci(i),A=bf(m,Ci(o));return $n(m,A).join("")}function d3(i,o){var u=ft,m=pt;if(Ge(o)){var A="separator"in o?o.separator:A;u="length"in o?ae(o.length):u,m="omission"in o?Yr(o.omission):m}i=Me(i);var P=i.length;if(qs(i)){var H=Ci(i);P=H.length}if(u>=P)return i;var G=u-js(m);if(G<1)return m;var X=H?$n(H,0,G).join(""):i.slice(0,G);if(A===e)return X+m;if(H&&(G+=X.length-G),bh(A)){if(i.slice(G).search(A)){var ot,ut=X;for(A.global||(A=Uc(A.source,Me(le.exec(A))+"g")),A.lastIndex=0;ot=A.exec(ut);)var dt=ot.index;X=X.slice(0,dt===e?G:dt)}}else if(i.indexOf(Yr(A),G)!=G){var vt=X.lastIndexOf(A);vt>-1&&(X=X.slice(0,vt))}return X+m}function p3(i){return i=Me(i),i&&Gt.test(i)?i.replace(_e,km):i}var g3=Gs(function(i,o,u){return i+(u?" ":"")+o.toUpperCase()}),Ah=l0("toUpperCase");function cd(i,o,u){return i=Me(i),o=u?e:o,o===e?Lm(i)?Vm(i):Cm(i):i.match(o)||[]}var hd=he(function(i,o){try{return ar(i,e,o)}catch(u){return wh(u)?u:new ee(u)}}),m3=gn(function(i,o){return li(o,function(u){u=Vi(u),dn(i,u,vh(i[u],i))}),i});function v3(i){var o=i==null?0:i.length,u=jt();return i=o?ke(i,function(m){if(typeof m[1]!="function")throw new fi(c);return[u(m[0]),m[1]]}):[],he(function(m){for(var A=-1;++A<o;){var P=i[A];if(ar(P[0],this,m))return ar(P[1],this,m)}})}function y3(i){return kv(pi(i,E))}function Sh(i){return function(){return i}}function w3(i,o){return i==null||i!==i?o:i}var b3=d0(),_3=d0(!0);function qr(i){return i}function Ih(i){return kf(typeof i=="function"?i:pi(i,E))}function E3(i){return Kf(pi(i,E))}function A3(i,o){return Vf(i,pi(o,E))}var S3=he(function(i,o){return function(u){return Fo(u,i,o)}}),I3=he(function(i,o){return function(u){return Fo(i,u,o)}});function Dh(i,o,u){var m=ur(o),A=su(o,m);u==null&&!(Ge(o)&&(A.length||!m.length))&&(u=o,o=i,i=this,A=su(o,ur(o)));var P=!(Ge(u)&&"chain"in u)||!!u.chain,H=vn(i);return li(A,function(G){var X=o[G];i[G]=X,H&&(i.prototype[G]=function(){var ot=this.__chain__;if(P||ot){var ut=i(this.__wrapped__),dt=ut.__actions__=Ur(this.__actions__);return dt.push({func:X,args:arguments,thisArg:i}),ut.__chain__=ot,ut}return X.apply(i,Fn([this.value()],arguments))})}),i}function D3(){return we._===this&&(we._=Xm),this}function xh(){}function x3(i){return i=ae(i),he(function(o){return Gf(o,i)})}var M3=nh(ke),C3=nh(pf),P3=nh(Cc);function ld(i){return lh(i)?Pc(Vi(i)):oy(i)}function O3(i){return function(o){return i==null?e:gs(i,o)}}var N3=g0(),R3=g0(!0);function Mh(){return[]}function Ch(){return!1}function T3(){return{}}function F3(){return""}function U3(){return!0}function B3(i,o){if(i=ae(i),i<1||i>N)return[];var u=g,m=vr(i,g);o=jt(o),i-=g;for(var A=Rc(m,o);++u<i;)o(u);return A}function L3(i){return ie(i)?ke(i,Vi):Qr(i)?[i]:Ur(O0(Me(i)))}function q3(i){var o=++Qm;return Me(i)+o}var j3=lu(function(i,o){return i+o},0),$3=sh("ceil"),z3=lu(function(i,o){return i/o},1),k3=sh("floor");function H3(i){return i&&i.length?nu(i,qr,Hc):e}function K3(i,o){return i&&i.length?nu(i,jt(o,2),Hc):e}function V3(i){return vf(i,qr)}function G3(i,o){return vf(i,jt(o,2))}function W3(i){return i&&i.length?nu(i,qr,Wc):e}function Y3(i,o){return i&&i.length?nu(i,jt(o,2),Wc):e}var Q3=lu(function(i,o){return i*o},1),J3=sh("round"),X3=lu(function(i,o){return i-o},0);function Z3(i){return i&&i.length?Nc(i,qr):0}function t6(i,o){return i&&i.length?Nc(i,jt(o,2)):0}return D.after=Eb,D.ary=z0,D.assign=c2,D.assignIn=rd,D.assignInWith=Su,D.assignWith=h2,D.at=l2,D.before=k0,D.bind=vh,D.bindAll=m3,D.bindKey=H0,D.castArray=Tb,D.chain=q0,D.chunk=ky,D.compact=Hy,D.concat=Ky,D.cond=v3,D.conforms=y3,D.constant=Sh,D.countBy=Zw,D.create=f2,D.curry=K0,D.curryRight=V0,D.debounce=G0,D.defaults=d2,D.defaultsDeep=p2,D.defer=Ab,D.delay=Sb,D.difference=Vy,D.differenceBy=Gy,D.differenceWith=Wy,D.drop=Yy,D.dropRight=Qy,D.dropRightWhile=Jy,D.dropWhile=Xy,D.fill=Zy,D.filter=eb,D.flatMap=nb,D.flatMapDeep=sb,D.flatMapDepth=ob,D.flatten=F0,D.flattenDeep=tw,D.flattenDepth=ew,D.flip=Ib,D.flow=b3,D.flowRight=_3,D.fromPairs=rw,D.functions=_2,D.functionsIn=E2,D.groupBy=ab,D.initial=nw,D.intersection=sw,D.intersectionBy=ow,D.intersectionWith=aw,D.invert=S2,D.invertBy=I2,D.invokeMap=cb,D.iteratee=Ih,D.keyBy=hb,D.keys=ur,D.keysIn=Lr,D.map=yu,D.mapKeys=x2,D.mapValues=M2,D.matches=E3,D.matchesProperty=A3,D.memoize=bu,D.merge=C2,D.mergeWith=id,D.method=S3,D.methodOf=I3,D.mixin=Dh,D.negate=_u,D.nthArg=x3,D.omit=P2,D.omitBy=O2,D.once=Db,D.orderBy=lb,D.over=M3,D.overArgs=xb,D.overEvery=C3,D.overSome=P3,D.partial=yh,D.partialRight=W0,D.partition=fb,D.pick=N2,D.pickBy=nd,D.property=ld,D.propertyOf=O3,D.pull=lw,D.pullAll=B0,D.pullAllBy=fw,D.pullAllWith=dw,D.pullAt=pw,D.range=N3,D.rangeRight=R3,D.rearg=Mb,D.reject=gb,D.remove=gw,D.rest=Cb,D.reverse=gh,D.sampleSize=vb,D.set=T2,D.setWith=F2,D.shuffle=yb,D.slice=mw,D.sortBy=_b,D.sortedUniq=Aw,D.sortedUniqBy=Sw,D.split=n3,D.spread=Pb,D.tail=Iw,D.take=Dw,D.takeRight=xw,D.takeRightWhile=Mw,D.takeWhile=Cw,D.tap=Hw,D.throttle=Ob,D.thru=vu,D.toArray=Z0,D.toPairs=sd,D.toPairsIn=od,D.toPath=L3,D.toPlainObject=ed,D.transform=U2,D.unary=Nb,D.union=Pw,D.unionBy=Ow,D.unionWith=Nw,D.uniq=Rw,D.uniqBy=Tw,D.uniqWith=Fw,D.unset=B2,D.unzip=mh,D.unzipWith=L0,D.update=L2,D.updateWith=q2,D.values=Qs,D.valuesIn=j2,D.without=Uw,D.words=cd,D.wrap=Rb,D.xor=Bw,D.xorBy=Lw,D.xorWith=qw,D.zip=jw,D.zipObject=$w,D.zipObjectDeep=zw,D.zipWith=kw,D.entries=sd,D.entriesIn=od,D.extend=rd,D.extendWith=Su,Dh(D,D),D.add=j3,D.attempt=hd,D.camelCase=H2,D.capitalize=ad,D.ceil=$3,D.clamp=$2,D.clone=Fb,D.cloneDeep=Bb,D.cloneDeepWith=Lb,D.cloneWith=Ub,D.conformsTo=qb,D.deburr=ud,D.defaultTo=w3,D.divide=z3,D.endsWith=K2,D.eq=Oi,D.escape=V2,D.escapeRegExp=G2,D.every=tb,D.find=rb,D.findIndex=R0,D.findKey=g2,D.findLast=ib,D.findLastIndex=T0,D.findLastKey=m2,D.floor=k3,D.forEach=j0,D.forEachRight=$0,D.forIn=v2,D.forInRight=y2,D.forOwn=w2,D.forOwnRight=b2,D.get=_h,D.gt=jb,D.gte=$b,D.has=A2,D.hasIn=Eh,D.head=U0,D.identity=qr,D.includes=ub,D.indexOf=iw,D.inRange=z2,D.invoke=D2,D.isArguments=ys,D.isArray=ie,D.isArrayBuffer=zb,D.isArrayLike=Br,D.isArrayLikeObject=Je,D.isBoolean=kb,D.isBuffer=zn,D.isDate=Hb,D.isElement=Kb,D.isEmpty=Vb,D.isEqual=Gb,D.isEqualWith=Wb,D.isError=wh,D.isFinite=Yb,D.isFunction=vn,D.isInteger=Y0,D.isLength=Eu,D.isMap=Q0,D.isMatch=Qb,D.isMatchWith=Jb,D.isNaN=Xb,D.isNative=Zb,D.isNil=e2,D.isNull=t2,D.isNumber=J0,D.isObject=Ge,D.isObjectLike=We,D.isPlainObject=$o,D.isRegExp=bh,D.isSafeInteger=r2,D.isSet=X0,D.isString=Au,D.isSymbol=Qr,D.isTypedArray=Ys,D.isUndefined=i2,D.isWeakMap=n2,D.isWeakSet=s2,D.join=uw,D.kebabCase=W2,D.last=mi,D.lastIndexOf=cw,D.lowerCase=Y2,D.lowerFirst=Q2,D.lt=o2,D.lte=a2,D.max=H3,D.maxBy=K3,D.mean=V3,D.meanBy=G3,D.min=W3,D.minBy=Y3,D.stubArray=Mh,D.stubFalse=Ch,D.stubObject=T3,D.stubString=F3,D.stubTrue=U3,D.multiply=Q3,D.nth=hw,D.noConflict=D3,D.noop=xh,D.now=wu,D.pad=J2,D.padEnd=X2,D.padStart=Z2,D.parseInt=t3,D.random=k2,D.reduce=db,D.reduceRight=pb,D.repeat=e3,D.replace=r3,D.result=R2,D.round=J3,D.runInContext=J,D.sample=mb,D.size=wb,D.snakeCase=i3,D.some=bb,D.sortedIndex=vw,D.sortedIndexBy=yw,D.sortedIndexOf=ww,D.sortedLastIndex=bw,D.sortedLastIndexBy=_w,D.sortedLastIndexOf=Ew,D.startCase=s3,D.startsWith=o3,D.subtract=X3,D.sum=Z3,D.sumBy=t6,D.template=a3,D.times=B3,D.toFinite=yn,D.toInteger=ae,D.toLength=td,D.toLower=u3,D.toNumber=vi,D.toSafeInteger=u2,D.toString=Me,D.toUpper=c3,D.trim=h3,D.trimEnd=l3,D.trimStart=f3,D.truncate=d3,D.unescape=p3,D.uniqueId=q3,D.upperCase=g3,D.upperFirst=Ah,D.each=j0,D.eachRight=$0,D.first=U0,Dh(D,function(){var i={};return Hi(D,function(o,u){Ne.call(D.prototype,u)||(i[u]=o)}),i}(),{chain:!1}),D.VERSION=n,li(["bind","bindKey","curry","curryRight","partial","partialRight"],function(i){D[i].placeholder=D}),li(["drop","take"],function(i,o){ge.prototype[i]=function(u){u=u===e?1:nr(ae(u),0);var m=this.__filtered__&&!o?new ge(this):this.clone();return m.__filtered__?m.__takeCount__=vr(u,m.__takeCount__):m.__views__.push({size:vr(u,g),type:i+(m.__dir__<0?"Right":"")}),m},ge.prototype[i+"Right"]=function(u){return this.reverse()[i](u).reverse()}}),li(["filter","map","takeWhile"],function(i,o){var u=o+1,m=u==y||u==C;ge.prototype[i]=function(A){var P=this.clone();return P.__iteratees__.push({iteratee:jt(A,3),type:u}),P.__filtered__=P.__filtered__||m,P}}),li(["head","last"],function(i,o){var u="take"+(o?"Right":"");ge.prototype[i]=function(){return this[u](1).value()[0]}}),li(["initial","tail"],function(i,o){var u="drop"+(o?"":"Right");ge.prototype[i]=function(){return this.__filtered__?new ge(this):this[u](1)}}),ge.prototype.compact=function(){return this.filter(qr)},ge.prototype.find=function(i){return this.filter(i).head()},ge.prototype.findLast=function(i){return this.reverse().find(i)},ge.prototype.invokeMap=he(function(i,o){return typeof i=="function"?new ge(this):this.map(function(u){return Fo(u,i,o)})}),ge.prototype.reject=function(i){return this.filter(_u(jt(i)))},ge.prototype.slice=function(i,o){i=ae(i);var u=this;return u.__filtered__&&(i>0||o<0)?new ge(u):(i<0?u=u.takeRight(-i):i&&(u=u.drop(i)),o!==e&&(o=ae(o),u=o<0?u.dropRight(-o):u.take(o-i)),u)},ge.prototype.takeRightWhile=function(i){return this.reverse().takeWhile(i).reverse()},ge.prototype.toArray=function(){return this.take(g)},Hi(ge.prototype,function(i,o){var u=/^(?:filter|find|map|reject)|While$/.test(o),m=/^(?:head|last)$/.test(o),A=D[m?"take"+(o=="last"?"Right":""):o],P=m||/^find/.test(o);A&&(D.prototype[o]=function(){var H=this.__wrapped__,G=m?[1]:arguments,X=H instanceof ge,ot=G[0],ut=X||ie(H),dt=function(fe){var be=A.apply(D,Fn([fe],G));return m&&vt?be[0]:be};ut&&u&&typeof ot=="function"&&ot.length!=1&&(X=ut=!1);var vt=this.__chain__,Ft=!!this.__actions__.length,kt=P&&!vt,ce=X&&!Ft;if(!P&&ut){H=ce?H:new ge(this);var Ht=i.apply(H,G);return Ht.__actions__.push({func:vu,args:[dt],thisArg:e}),new di(Ht,vt)}return kt&&ce?i.apply(this,G):(Ht=this.thru(dt),kt?m?Ht.value()[0]:Ht.value():Ht)})}),li(["pop","push","shift","sort","splice","unshift"],function(i){var o=ka[i],u=/^(?:push|sort|unshift)$/.test(i)?"tap":"thru",m=/^(?:pop|shift)$/.test(i);D.prototype[i]=function(){var A=arguments;if(m&&!this.__chain__){var P=this.value();return o.apply(ie(P)?P:[],A)}return this[u](function(H){return o.apply(ie(H)?H:[],A)})}}),Hi(ge.prototype,function(i,o){var u=D[o];if(u){var m=u.name+"";Ne.call(Hs,m)||(Hs[m]=[]),Hs[m].push({name:o,func:u})}}),Hs[hu(e,tt).name]=[{name:"wrapper",func:e}],ge.prototype.clone=pv,ge.prototype.reverse=gv,ge.prototype.value=mv,D.prototype.at=Kw,D.prototype.chain=Vw,D.prototype.commit=Gw,D.prototype.next=Ww,D.prototype.plant=Qw,D.prototype.reverse=Jw,D.prototype.toJSON=D.prototype.valueOf=D.prototype.value=Xw,D.prototype.first=D.prototype.head,Mo&&(D.prototype[Mo]=Yw),D},$s=Gm();Qe?((Qe.exports=$s)._=$s,Le._=$s):we._=$s}).call(Xo)})(Fl,Fl.exports);var r9=Object.defineProperty,i9=Object.defineProperties,n9=Object.getOwnPropertyDescriptors,w1=Object.getOwnPropertySymbols,s9=Object.prototype.hasOwnProperty,o9=Object.prototype.propertyIsEnumerable,b1=(r,t,e)=>t in r?r9(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ru=(r,t)=>{for(var e in t||(t={}))s9.call(t,e)&&b1(r,e,t[e]);if(w1)for(var e of w1(t))o9.call(t,e)&&b1(r,e,t[e]);return r},a9=(r,t)=>i9(r,n9(t));function Qn(r,t,e){var n;const s=Uu(r);return((n=t.rpcMap)==null?void 0:n[s.reference])||`${e9}?chainId=${s.namespace}:${s.reference}&projectId=${e}`}function Rs(r){return r.includes(":")?r.split(":")[1]:r}function Em(r){return r.map(t=>`${t.split(":")[0]}:${t.split(":")[1]}`)}function u9(r,t){const e=Object.keys(t.namespaces).filter(s=>s.includes(r));if(!e.length)return[];const n=[];return e.forEach(s=>{const a=t.namespaces[s].accounts;n.push(...a)}),n}function ul(r={},t={}){const e=_1(r),n=_1(t);return Fl.exports.merge(e,n)}function _1(r){var t,e,n,s;const a={};if(!ca(r))return a;for(const[c,l]of Object.entries(r)){const d=rf(c)?[c]:l.chains,f=l.methods||[],w=l.events||[],E=l.rpcMap||{},x=ta(c);a[x]=a9(Ru(Ru({},a[x]),l),{chains:Bu(d,(t=a[x])==null?void 0:t.chains),methods:Bu(f,(e=a[x])==null?void 0:e.methods),events:Bu(w,(n=a[x])==null?void 0:n.events),rpcMap:Ru(Ru({},E),(s=a[x])==null?void 0:s.rpcMap)})}return a}function c9(r){return r.includes(":")?r.split(":")[2]:r}function E1(r){const t={};for(const[e,n]of Object.entries(r)){const s=n.methods||[],a=n.events||[],c=n.accounts||[],l=rf(e)?[e]:n.chains?n.chains:Em(n.accounts);t[e]={chains:l,methods:s,events:a,accounts:c}}return t}function cl(r){return typeof r=="number"?r:r.includes("0x")?parseInt(r,16):(r=r.includes(":")?r.split(":")[1]:r,isNaN(Number(r))?r:Number(r))}const Am={},He=r=>Am[r],hl=(r,t)=>{Am[r]=t};class h9{constructor(t){this.name="polkadot",this.namespace=t.namespace,this.events=He("events"),this.client=He("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Pn.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var n;const s=Rs(e);t[s]=this.createHttpProvider(s,(n=this.namespace.rpcMap)==null?void 0:n[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const n=this.createHttpProvider(t,e);n&&(this.httpProviders[t]=n)}createHttpProvider(t,e){const n=e||Qn(t,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${t}`);return new Cn(new Xn(n,He("disableProviderPing")))}}class l9{constructor(t){this.name="eip155",this.namespace=t.namespace,this.events=He("events"),this.client=He("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(t){switch(t.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(t);case"eth_chainId":return parseInt(this.getDefaultChain())}return this.namespace.methods.includes(t.request.method)?await this.client.request(t):this.getHttpProvider().request(t.request)}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(parseInt(t),e),this.chainId=parseInt(t),this.events.emit(Pn.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}createHttpProvider(t,e){const n=e||Qn(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${t}`);return new Cn(new Xn(n,He("disableProviderPing")))}setHttpProvider(t,e){const n=this.createHttpProvider(t,e);n&&(this.httpProviders[t]=n)}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var n;const s=parseInt(Rs(e));t[s]=this.createHttpProvider(s,(n=this.namespace.rpcMap)==null?void 0:n[e])}),t}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}getHttpProvider(){const t=this.chainId,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}async handleSwitchChain(t){var e,n;let s=t.request.params?(e=t.request.params[0])==null?void 0:e.chainId:"0x0";s=s.startsWith("0x")?s:`0x${s}`;const a=parseInt(s,16);if(this.isChainApproved(a))this.setDefaultChain(`${a}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:t.topic,request:{method:t.request.method,params:[{chainId:s}]},chainId:(n=this.namespace.chains)==null?void 0:n[0]}),this.setDefaultChain(`${a}`);else throw new Error(`Failed to switch to chain 'eip155:${a}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(t){return this.namespace.chains.includes(`${this.name}:${t}`)}}class f9{constructor(t){this.name="solana",this.namespace=t.namespace,this.events=He("events"),this.client=He("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Pn.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var n;const s=Rs(e);t[s]=this.createHttpProvider(s,(n=this.namespace.rpcMap)==null?void 0:n[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const n=this.createHttpProvider(t,e);n&&(this.httpProviders[t]=n)}createHttpProvider(t,e){const n=e||Qn(t,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${t}`);return new Cn(new Xn(n,He("disableProviderPing")))}}class d9{constructor(t){this.name="cosmos",this.namespace=t.namespace,this.events=He("events"),this.client=He("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Pn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var n;const s=Rs(e);t[s]=this.createHttpProvider(s,(n=this.namespace.rpcMap)==null?void 0:n[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const n=this.createHttpProvider(t,e);n&&(this.httpProviders[t]=n)}createHttpProvider(t,e){const n=e||Qn(t,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${t}`);return new Cn(new Xn(n,He("disableProviderPing")))}}class p9{constructor(t){this.name="cip34",this.namespace=t.namespace,this.events=He("events"),this.client=He("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Pn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{const n=this.getCardanoRPCUrl(e),s=Rs(e);t[s]=this.createHttpProvider(s,n)}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}getCardanoRPCUrl(t){const e=this.namespace.rpcMap;if(e)return e[t]}setHttpProvider(t,e){const n=this.createHttpProvider(t,e);n&&(this.httpProviders[t]=n)}createHttpProvider(t,e){const n=e||this.getCardanoRPCUrl(t);if(!n)throw new Error(`No RPC url provided for chainId: ${t}`);return new Cn(new Xn(n,He("disableProviderPing")))}}class g9{constructor(t){this.name="elrond",this.namespace=t.namespace,this.events=He("events"),this.client=He("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Pn.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var n;const s=Rs(e);t[s]=this.createHttpProvider(s,(n=this.namespace.rpcMap)==null?void 0:n[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const n=this.createHttpProvider(t,e);n&&(this.httpProviders[t]=n)}createHttpProvider(t,e){const n=e||Qn(t,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${t}`);return new Cn(new Xn(n,He("disableProviderPing")))}}class m9{constructor(t){this.name="multiversx",this.namespace=t.namespace,this.events=He("events"),this.client=He("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Pn.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var n;const s=Rs(e);t[s]=this.createHttpProvider(s,(n=this.namespace.rpcMap)==null?void 0:n[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const n=this.createHttpProvider(t,e);n&&(this.httpProviders[t]=n)}createHttpProvider(t,e){const n=e||Qn(t,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${t}`);return new Cn(new Xn(n,He("disableProviderPing")))}}class v9{constructor(t){this.name="near",this.namespace=t.namespace,this.events=He("events"),this.client=He("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){if(this.chainId=t,!this.httpProviders[t]){const n=e||Qn(`${this.name}:${t}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,n)}this.events.emit(Pn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var n;t[e]=this.createHttpProvider(e,(n=this.namespace.rpcMap)==null?void 0:n[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const n=this.createHttpProvider(t,e);n&&(this.httpProviders[t]=n)}createHttpProvider(t,e){const n=e||Qn(t,this.namespace);return typeof n>"u"?void 0:new Cn(new Xn(n,He("disableProviderPing")))}}var y9=Object.defineProperty,w9=Object.defineProperties,b9=Object.getOwnPropertyDescriptors,A1=Object.getOwnPropertySymbols,_9=Object.prototype.hasOwnProperty,E9=Object.prototype.propertyIsEnumerable,S1=(r,t,e)=>t in r?y9(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Tu=(r,t)=>{for(var e in t||(t={}))_9.call(t,e)&&S1(r,e,t[e]);if(A1)for(var e of A1(t))E9.call(t,e)&&S1(r,e,t[e]);return r},ll=(r,t)=>w9(r,b9(t));class ff{constructor(t){this.events=new jl,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=t,this.logger=typeof(t==null?void 0:t.logger)<"u"&&typeof(t==null?void 0:t.logger)!="string"?t.logger:ba(gc({level:(t==null?void 0:t.logger)||v1})),this.disableProviderPing=(t==null?void 0:t.disableProviderPing)||!1}static async init(t){const e=new ff(t);return await e.initialize(),e}async request(t,e,n){const[s,a]=this.validateChain(e);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(s).request({request:Tu({},t),chainId:`${s}:${a}`,topic:this.session.topic,expiry:n})}sendAsync(t,e,n,s){const a=new Date().getTime();this.request(t,n,s).then(c=>e(null,mc(a,c))).catch(c=>e(c,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var t;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(t=this.session)==null?void 0:t.topic,reason:Re("USER_DISCONNECTED")}),await this.cleanup()}async connect(t){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(t),await this.cleanupPendingPairings(),!t.skipPairing)return await this.pair(t.pairingTopic)}async authenticate(t){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(t),await this.cleanupPendingPairings();const{uri:e,response:n}=await this.client.authenticate(t);e&&(this.uri=e,this.events.emit("display_uri",e));const s=await n();if(this.session=s.session,this.session){const a=E1(this.session.namespaces);this.namespaces=ul(this.namespaces,a),this.persist("namespaces",this.namespaces),this.onConnect()}return s}on(t,e){this.events.on(t,e)}once(t,e){this.events.once(t,e)}removeListener(t,e){this.events.removeListener(t,e)}off(t,e){this.events.off(t,e)}get isWalletConnect(){return!0}async pair(t){this.shouldAbortPairingAttempt=!1;let e=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(e>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:n,approval:s}=await this.client.connect({pairingTopic:t,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});n&&(this.uri=n,this.events.emit("display_uri",n)),await s().then(a=>{this.session=a;const c=E1(a.namespaces);this.namespaces=ul(this.namespaces,c),this.persist("namespaces",this.namespaces)}).catch(a=>{if(a.message!==_m)throw a;e++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(t,e){try{if(!this.session)return;const[n,s]=this.validateChain(t);this.getProvider(n).setDefaultChain(s,e)}catch(n){if(!/Please call connect/.test(n.message))throw n}}async cleanupPendingPairings(t={}){this.logger.info("Cleaning up inactive pairings...");const e=this.client.pairing.getAll();if(un(e)){for(const n of e)t.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.topic);this.logger.info(`Inactive pairings cleared: ${e.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 t=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[t]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await lf.init({logger:this.providerOpts.logger||v1,relayUrl:this.providerOpts.relayUrl||X7,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 t=[...new Set(Object.keys(this.session.namespaces).map(e=>ta(e)))];hl("client",this.client),hl("events",this.events),hl("disableProviderPing",this.disableProviderPing),t.forEach(e=>{if(!this.session)return;const n=u9(e,this.session),s=Em(n),a=ul(this.namespaces,this.optionalNamespaces),c=ll(Tu({},a[e]),{accounts:n,chains:s});switch(e){case"eip155":this.rpcProviders[e]=new l9({namespace:c});break;case"solana":this.rpcProviders[e]=new f9({namespace:c});break;case"cosmos":this.rpcProviders[e]=new d9({namespace:c});break;case"polkadot":this.rpcProviders[e]=new h9({namespace:c});break;case"cip34":this.rpcProviders[e]=new p9({namespace:c});break;case"elrond":this.rpcProviders[e]=new g9({namespace:c});break;case"multiversx":this.rpcProviders[e]=new m9({namespace:c});break;case"near":this.rpcProviders[e]=new v9({namespace:c});break}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",t=>{this.events.emit("session_ping",t)}),this.client.on("session_event",t=>{const{params:e}=t,{event:n}=e;if(n.name==="accountsChanged"){const s=n.data;s&&un(s)&&this.events.emit("accountsChanged",s.map(c9))}else if(n.name==="chainChanged"){const s=e.chainId,a=e.event.data,c=ta(s),l=cl(s)!==cl(a)?`${c}:${cl(a)}`:s;this.onChainChanged(l)}else this.events.emit(n.name,n.data);this.events.emit("session_event",t)}),this.client.on("session_update",({topic:t,params:e})=>{var n;const{namespaces:s}=e,a=(n=this.client)==null?void 0:n.session.get(t);this.session=ll(Tu({},a),{namespaces:s}),this.onSessionUpdate(),this.events.emit("session_update",{topic:t,params:e})}),this.client.on("session_delete",async t=>{await this.cleanup(),this.events.emit("session_delete",t),this.events.emit("disconnect",ll(Tu({},Re("USER_DISCONNECTED")),{data:t.topic}))}),this.on(Pn.DEFAULT_CHAIN_CHANGED,t=>{this.onChainChanged(t,!0)})}getProvider(t){if(!this.rpcProviders[t])throw new Error(`Provider not found: ${t}`);return this.rpcProviders[t]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(t=>{var e;this.getProvider(t).updateNamespace((e=this.session)==null?void 0:e.namespaces[t])})}setNamespaces(t){const{namespaces:e,optionalNamespaces:n,sessionProperties:s}=t;e&&Object.keys(e).length&&(this.namespaces=e),n&&Object.keys(n).length&&(this.optionalNamespaces=n),this.sessionProperties=s,this.persist("namespaces",e),this.persist("optionalNamespaces",n)}validateChain(t){const[e,n]=(t==null?void 0:t.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[e,n];if(e&&!Object.keys(this.namespaces||{}).map(c=>ta(c)).includes(e))throw new Error(`Namespace '${e}' is not configured. Please call connect() first with namespace config.`);if(e&&n)return[e,n];const s=ta(Object.keys(this.namespaces)[0]),a=this.rpcProviders[s].getDefaultChain();return[s,a]}async requestAccounts(){const[t]=this.validateChain();return await this.getProvider(t).requestAccounts()}onChainChanged(t,e=!1){if(!this.namespaces)return;const[n,s]=this.validateChain(t);s&&(e||this.getProvider(n).setDefaultChain(s),this.namespaces[n]?this.namespaces[n].defaultChain=s:this.namespaces[`${n}:${s}`]?this.namespaces[`${n}:${s}`].defaultChain=s:this.namespaces[`${n}:${s}`]={defaultChain:s},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",s))}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(t,e){this.client.core.storage.setItem(`${y1}/${t}`,e)}async getFromStore(t){return await this.client.core.storage.getItem(`${y1}/${t}`)}}const A9=ff,S9="wc",I9="ethereum_provider",D9=`${S9}@2:${I9}:`,x9="https://rpc.walletconnect.com/v1/",Ul=["eth_sendTransaction","personal_sign"],M9=["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"],Bl=["chainChanged","accountsChanged"],C9=["chainChanged","accountsChanged","message","disconnect","connect"];var P9=Object.defineProperty,O9=Object.defineProperties,N9=Object.getOwnPropertyDescriptors,I1=Object.getOwnPropertySymbols,R9=Object.prototype.hasOwnProperty,T9=Object.prototype.propertyIsEnumerable,D1=(r,t,e)=>t in r?P9(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,no=(r,t)=>{for(var e in t||(t={}))R9.call(t,e)&&D1(r,e,t[e]);if(I1)for(var e of I1(t))T9.call(t,e)&&D1(r,e,t[e]);return r},fl=(r,t)=>O9(r,N9(t));function oc(r){return Number(r[0].split(":")[1])}function Fu(r){return`0x${r.toString(16)}`}function F9(r){const{chains:t,optionalChains:e,methods:n,optionalMethods:s,events:a,optionalEvents:c,rpcMap:l}=r;if(!un(t))throw new Error("Invalid chains");const d={chains:t,methods:n||Ul,events:a||Bl,rpcMap:no({},t.length?{[oc(t)]:l[oc(t)]}:{})},f=a==null?void 0:a.filter(I=>!Bl.includes(I)),w=n==null?void 0:n.filter(I=>!Ul.includes(I));if(!e&&!c&&!s&&!(f!=null&&f.length)&&!(w!=null&&w.length))return{required:t.length?d:void 0};const E=(f==null?void 0:f.length)&&(w==null?void 0:w.length)||!e,x={chains:[...new Set(E?d.chains.concat(e||[]):e)],methods:[...new Set(d.methods.concat(s!=null&&s.length?s:M9))],events:[...new Set(d.events.concat(c!=null&&c.length?c:C9))],rpcMap:l};return{required:t.length?d:void 0,optional:e.length?x:void 0}}class df{constructor(){this.events=new Di.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=D9,this.on=(t,e)=>(this.events.on(t,e),this),this.once=(t,e)=>(this.events.once(t,e),this),this.removeListener=(t,e)=>(this.events.removeListener(t,e),this),this.off=(t,e)=>(this.events.off(t,e),this),this.parseAccount=t=>this.isCompatibleChainId(t)?this.parseAccountId(t).address:t,this.signer={},this.rpc={}}static async init(t){const e=new df;return await e.initialize(t),e}async request(t,e){return await this.signer.request(t,this.formatChainId(this.chainId),e)}sendAsync(t,e,n){this.signer.sendAsync(t,e,this.formatChainId(this.chainId),n)}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(t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(t);const{required:e,optional:n}=F9(this.rpc);try{const s=await new Promise(async(c,l)=>{var d;this.rpc.showQrModal&&((d=this.modal)==null||d.subscribeModal(f=>{!f.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),l(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(fl(no({namespaces:no({},e&&{[this.namespace]:e})},n&&{optionalNamespaces:{[this.namespace]:n}}),{pairingTopic:t==null?void 0:t.pairingTopic})).then(f=>{c(f)}).catch(f=>{l(new Error(f.message))})});if(!s)return;const a=Fd(s.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:a),this.setAccounts(a),this.events.emit("connect",{chainId:Fu(this.chainId)})}catch(s){throw this.signer.logger.error(s),s}finally{this.modal&&this.modal.closeModal()}}async authenticate(t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts({chains:t==null?void 0:t.chains});try{const e=await new Promise(async(s,a)=>{var c;this.rpc.showQrModal&&((c=this.modal)==null||c.subscribeModal(l=>{!l.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),a(new Error("Connection request reset. Please try again.")))})),await this.signer.authenticate(fl(no({},t),{chains:this.rpc.chains})).then(l=>{s(l)}).catch(l=>{a(new Error(l.message))})}),n=e.session;if(n){const s=Fd(n.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:s),this.setAccounts(s),this.events.emit("connect",{chainId:Fu(this.chainId)})}return e}catch(e){throw this.signer.logger.error(e),e}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",t=>{const{params:e}=t,{event:n}=e;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",t)}),this.signer.on("chainChanged",t=>{const e=parseInt(t);this.chainId=e,this.events.emit("chainChanged",Fu(this.chainId)),this.persist()}),this.signer.on("session_update",t=>{this.events.emit("session_update",t)}),this.signer.on("session_delete",t=>{this.reset(),this.events.emit("session_delete",t),this.events.emit("disconnect",fl(no({},Re("USER_DISCONNECTED")),{data:t.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",t=>{var e,n;this.rpc.showQrModal&&((e=this.modal)==null||e.closeModal(),(n=this.modal)==null||n.openModal({uri:t})),this.events.emit("display_uri",t)})}switchEthereumChain(t){this.request({method:"wallet_switchEthereumChain",params:[{chainId:t.toString(16)}]})}isCompatibleChainId(t){return typeof t=="string"?t.startsWith(`${this.namespace}:`):!1}formatChainId(t){return`${this.namespace}:${t}`}parseChainId(t){return Number(t.split(":")[1])}setChainIds(t){const e=t.filter(n=>this.isCompatibleChainId(n)).map(n=>this.parseChainId(n));e.length&&(this.chainId=e[0],this.events.emit("chainChanged",Fu(this.chainId)),this.persist())}setChainId(t){if(this.isCompatibleChainId(t)){const e=this.parseChainId(t);this.chainId=e,this.switchEthereumChain(e)}}parseAccountId(t){const[e,n,s]=t.split(":");return{chainId:`${e}:${n}`,address:s}}setAccounts(t){this.accounts=t.filter(e=>this.parseChainId(this.parseAccountId(e).chainId)===this.chainId).map(e=>this.parseAccountId(e).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(t){var e,n;const s=(e=t==null?void 0:t.chains)!=null?e:[],a=(n=t==null?void 0:t.optionalChains)!=null?n:[],c=s.concat(a);if(!c.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const l=s.length?(t==null?void 0:t.methods)||Ul:[],d=s.length?(t==null?void 0:t.events)||Bl:[],f=(t==null?void 0:t.optionalMethods)||[],w=(t==null?void 0:t.optionalEvents)||[],E=(t==null?void 0:t.rpcMap)||this.buildRpcMap(c,t.projectId),x=(t==null?void 0:t.qrModalOptions)||void 0;return{chains:s==null?void 0:s.map(I=>this.formatChainId(I)),optionalChains:a.map(I=>this.formatChainId(I)),methods:l,events:d,optionalMethods:f,optionalEvents:w,rpcMap:E,showQrModal:!!(t!=null&&t.showQrModal),qrModalOptions:x,projectId:t.projectId,metadata:t.metadata}}buildRpcMap(t,e){const n={};return t.forEach(s=>{n[s]=this.getRpcUrl(s,e)}),n}async initialize(t){if(this.rpc=this.getRpcConfig(t),this.chainId=this.rpc.chains.length?oc(this.rpc.chains):oc(this.rpc.optionalChains),this.signer=await A9.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:t.disableProviderPing,relayUrl:t.relayUrl,storageOptions:t.storageOptions}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let e;try{const{WalletConnectModal:n}=await n6(()=>import("./index-0eba2d2b.js").then(s=>s.i),["assets/index-0eba2d2b.js","assets/index-44db7f20.js","assets/index-f1f26bc2.css"]);e=n}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(e)try{this.modal=new e(no({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(n){throw this.signer.logger.error(n),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(t){if(!t)return;const{chains:e,optionalChains:n,rpcMap:s}=t;e&&un(e)&&(this.rpc.chains=e.map(a=>this.formatChainId(a)),e.forEach(a=>{this.rpc.rpcMap[a]=(s==null?void 0:s[a])||this.getRpcUrl(a)})),n&&un(n)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=n==null?void 0:n.map(a=>this.formatChainId(a)),n.forEach(a=>{this.rpc.rpcMap[a]=(s==null?void 0:s[a])||this.getRpcUrl(a)}))}getRpcUrl(t,e){var n;return((n=this.rpc.rpcMap)==null?void 0:n[t])||`${x9}?chainId=eip155:${t}&projectId=${e||this.rpc.projectId}`}async loadPersistedSession(){if(this.session)try{const t=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),e=this.session.namespaces[`${this.namespace}:${t}`]?this.session.namespaces[`${this.namespace}:${t}`]:this.session.namespaces[this.namespace];this.setChainIds(t?[this.formatChainId(t)]:e==null?void 0:e.accounts),this.setAccounts(e==null?void 0:e.accounts)}catch(t){this.signer.logger.error("Failed to load persisted session, clearing state..."),this.signer.logger.error(t),await this.disconnect().catch(e=>this.signer.logger.warn(e))}}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(t){return typeof t=="string"||t instanceof String?[this.parseAccount(t)]:t.map(e=>this.parseAccount(e))}}const cM=df;export{cM as EthereumProvider,C9 as OPTIONAL_EVENTS,M9 as OPTIONAL_METHODS,Bl as REQUIRED_EVENTS,Ul as REQUIRED_METHODS,df as default};
43
+ }`;var ce=hd(function(){return Se(P,Ft+"return "+dt).apply(e,H)});if(ce.source=dt,wh(ce))throw ce;return ce}function u3(i){return Me(i).toLowerCase()}function c3(i){return Me(i).toUpperCase()}function h3(i,o,u){if(i=Me(i),i&&(u||o===e))return wf(i);if(!i||!(o=Yr(o)))return i;var m=Ci(i),A=Ci(o),P=bf(m,A),H=_f(m,A)+1;return $n(m,P,H).join("")}function l3(i,o,u){if(i=Me(i),i&&(u||o===e))return i.slice(0,Af(i)+1);if(!i||!(o=Yr(o)))return i;var m=Ci(i),A=_f(m,Ci(o))+1;return $n(m,0,A).join("")}function f3(i,o,u){if(i=Me(i),i&&(u||o===e))return i.replace(Yt,"");if(!i||!(o=Yr(o)))return i;var m=Ci(i),A=bf(m,Ci(o));return $n(m,A).join("")}function d3(i,o){var u=ft,m=pt;if(Ge(o)){var A="separator"in o?o.separator:A;u="length"in o?ae(o.length):u,m="omission"in o?Yr(o.omission):m}i=Me(i);var P=i.length;if(qs(i)){var H=Ci(i);P=H.length}if(u>=P)return i;var G=u-js(m);if(G<1)return m;var X=H?$n(H,0,G).join(""):i.slice(0,G);if(A===e)return X+m;if(H&&(G+=X.length-G),bh(A)){if(i.slice(G).search(A)){var ot,ut=X;for(A.global||(A=Uc(A.source,Me(le.exec(A))+"g")),A.lastIndex=0;ot=A.exec(ut);)var dt=ot.index;X=X.slice(0,dt===e?G:dt)}}else if(i.indexOf(Yr(A),G)!=G){var vt=X.lastIndexOf(A);vt>-1&&(X=X.slice(0,vt))}return X+m}function p3(i){return i=Me(i),i&&Gt.test(i)?i.replace(_e,km):i}var g3=Gs(function(i,o,u){return i+(u?" ":"")+o.toUpperCase()}),Ah=l0("toUpperCase");function cd(i,o,u){return i=Me(i),o=u?e:o,o===e?Lm(i)?Vm(i):Cm(i):i.match(o)||[]}var hd=he(function(i,o){try{return ar(i,e,o)}catch(u){return wh(u)?u:new ee(u)}}),m3=gn(function(i,o){return li(o,function(u){u=Vi(u),dn(i,u,vh(i[u],i))}),i});function v3(i){var o=i==null?0:i.length,u=jt();return i=o?ke(i,function(m){if(typeof m[1]!="function")throw new fi(c);return[u(m[0]),m[1]]}):[],he(function(m){for(var A=-1;++A<o;){var P=i[A];if(ar(P[0],this,m))return ar(P[1],this,m)}})}function y3(i){return kv(pi(i,E))}function Sh(i){return function(){return i}}function w3(i,o){return i==null||i!==i?o:i}var b3=d0(),_3=d0(!0);function qr(i){return i}function Ih(i){return kf(typeof i=="function"?i:pi(i,E))}function E3(i){return Kf(pi(i,E))}function A3(i,o){return Vf(i,pi(o,E))}var S3=he(function(i,o){return function(u){return Fo(u,i,o)}}),I3=he(function(i,o){return function(u){return Fo(i,u,o)}});function Dh(i,o,u){var m=ur(o),A=su(o,m);u==null&&!(Ge(o)&&(A.length||!m.length))&&(u=o,o=i,i=this,A=su(o,ur(o)));var P=!(Ge(u)&&"chain"in u)||!!u.chain,H=vn(i);return li(A,function(G){var X=o[G];i[G]=X,H&&(i.prototype[G]=function(){var ot=this.__chain__;if(P||ot){var ut=i(this.__wrapped__),dt=ut.__actions__=Ur(this.__actions__);return dt.push({func:X,args:arguments,thisArg:i}),ut.__chain__=ot,ut}return X.apply(i,Fn([this.value()],arguments))})}),i}function D3(){return we._===this&&(we._=Xm),this}function xh(){}function x3(i){return i=ae(i),he(function(o){return Gf(o,i)})}var M3=nh(ke),C3=nh(pf),P3=nh(Cc);function ld(i){return lh(i)?Pc(Vi(i)):oy(i)}function O3(i){return function(o){return i==null?e:gs(i,o)}}var N3=g0(),R3=g0(!0);function Mh(){return[]}function Ch(){return!1}function T3(){return{}}function F3(){return""}function U3(){return!0}function B3(i,o){if(i=ae(i),i<1||i>N)return[];var u=g,m=vr(i,g);o=jt(o),i-=g;for(var A=Rc(m,o);++u<i;)o(u);return A}function L3(i){return ie(i)?ke(i,Vi):Qr(i)?[i]:Ur(O0(Me(i)))}function q3(i){var o=++Qm;return Me(i)+o}var j3=lu(function(i,o){return i+o},0),$3=sh("ceil"),z3=lu(function(i,o){return i/o},1),k3=sh("floor");function H3(i){return i&&i.length?nu(i,qr,Hc):e}function K3(i,o){return i&&i.length?nu(i,jt(o,2),Hc):e}function V3(i){return vf(i,qr)}function G3(i,o){return vf(i,jt(o,2))}function W3(i){return i&&i.length?nu(i,qr,Wc):e}function Y3(i,o){return i&&i.length?nu(i,jt(o,2),Wc):e}var Q3=lu(function(i,o){return i*o},1),J3=sh("round"),X3=lu(function(i,o){return i-o},0);function Z3(i){return i&&i.length?Nc(i,qr):0}function t6(i,o){return i&&i.length?Nc(i,jt(o,2)):0}return D.after=Eb,D.ary=z0,D.assign=c2,D.assignIn=rd,D.assignInWith=Su,D.assignWith=h2,D.at=l2,D.before=k0,D.bind=vh,D.bindAll=m3,D.bindKey=H0,D.castArray=Tb,D.chain=q0,D.chunk=ky,D.compact=Hy,D.concat=Ky,D.cond=v3,D.conforms=y3,D.constant=Sh,D.countBy=Zw,D.create=f2,D.curry=K0,D.curryRight=V0,D.debounce=G0,D.defaults=d2,D.defaultsDeep=p2,D.defer=Ab,D.delay=Sb,D.difference=Vy,D.differenceBy=Gy,D.differenceWith=Wy,D.drop=Yy,D.dropRight=Qy,D.dropRightWhile=Jy,D.dropWhile=Xy,D.fill=Zy,D.filter=eb,D.flatMap=nb,D.flatMapDeep=sb,D.flatMapDepth=ob,D.flatten=F0,D.flattenDeep=tw,D.flattenDepth=ew,D.flip=Ib,D.flow=b3,D.flowRight=_3,D.fromPairs=rw,D.functions=_2,D.functionsIn=E2,D.groupBy=ab,D.initial=nw,D.intersection=sw,D.intersectionBy=ow,D.intersectionWith=aw,D.invert=S2,D.invertBy=I2,D.invokeMap=cb,D.iteratee=Ih,D.keyBy=hb,D.keys=ur,D.keysIn=Lr,D.map=yu,D.mapKeys=x2,D.mapValues=M2,D.matches=E3,D.matchesProperty=A3,D.memoize=bu,D.merge=C2,D.mergeWith=id,D.method=S3,D.methodOf=I3,D.mixin=Dh,D.negate=_u,D.nthArg=x3,D.omit=P2,D.omitBy=O2,D.once=Db,D.orderBy=lb,D.over=M3,D.overArgs=xb,D.overEvery=C3,D.overSome=P3,D.partial=yh,D.partialRight=W0,D.partition=fb,D.pick=N2,D.pickBy=nd,D.property=ld,D.propertyOf=O3,D.pull=lw,D.pullAll=B0,D.pullAllBy=fw,D.pullAllWith=dw,D.pullAt=pw,D.range=N3,D.rangeRight=R3,D.rearg=Mb,D.reject=gb,D.remove=gw,D.rest=Cb,D.reverse=gh,D.sampleSize=vb,D.set=T2,D.setWith=F2,D.shuffle=yb,D.slice=mw,D.sortBy=_b,D.sortedUniq=Aw,D.sortedUniqBy=Sw,D.split=n3,D.spread=Pb,D.tail=Iw,D.take=Dw,D.takeRight=xw,D.takeRightWhile=Mw,D.takeWhile=Cw,D.tap=Hw,D.throttle=Ob,D.thru=vu,D.toArray=Z0,D.toPairs=sd,D.toPairsIn=od,D.toPath=L3,D.toPlainObject=ed,D.transform=U2,D.unary=Nb,D.union=Pw,D.unionBy=Ow,D.unionWith=Nw,D.uniq=Rw,D.uniqBy=Tw,D.uniqWith=Fw,D.unset=B2,D.unzip=mh,D.unzipWith=L0,D.update=L2,D.updateWith=q2,D.values=Qs,D.valuesIn=j2,D.without=Uw,D.words=cd,D.wrap=Rb,D.xor=Bw,D.xorBy=Lw,D.xorWith=qw,D.zip=jw,D.zipObject=$w,D.zipObjectDeep=zw,D.zipWith=kw,D.entries=sd,D.entriesIn=od,D.extend=rd,D.extendWith=Su,Dh(D,D),D.add=j3,D.attempt=hd,D.camelCase=H2,D.capitalize=ad,D.ceil=$3,D.clamp=$2,D.clone=Fb,D.cloneDeep=Bb,D.cloneDeepWith=Lb,D.cloneWith=Ub,D.conformsTo=qb,D.deburr=ud,D.defaultTo=w3,D.divide=z3,D.endsWith=K2,D.eq=Oi,D.escape=V2,D.escapeRegExp=G2,D.every=tb,D.find=rb,D.findIndex=R0,D.findKey=g2,D.findLast=ib,D.findLastIndex=T0,D.findLastKey=m2,D.floor=k3,D.forEach=j0,D.forEachRight=$0,D.forIn=v2,D.forInRight=y2,D.forOwn=w2,D.forOwnRight=b2,D.get=_h,D.gt=jb,D.gte=$b,D.has=A2,D.hasIn=Eh,D.head=U0,D.identity=qr,D.includes=ub,D.indexOf=iw,D.inRange=z2,D.invoke=D2,D.isArguments=ys,D.isArray=ie,D.isArrayBuffer=zb,D.isArrayLike=Br,D.isArrayLikeObject=Je,D.isBoolean=kb,D.isBuffer=zn,D.isDate=Hb,D.isElement=Kb,D.isEmpty=Vb,D.isEqual=Gb,D.isEqualWith=Wb,D.isError=wh,D.isFinite=Yb,D.isFunction=vn,D.isInteger=Y0,D.isLength=Eu,D.isMap=Q0,D.isMatch=Qb,D.isMatchWith=Jb,D.isNaN=Xb,D.isNative=Zb,D.isNil=e2,D.isNull=t2,D.isNumber=J0,D.isObject=Ge,D.isObjectLike=We,D.isPlainObject=$o,D.isRegExp=bh,D.isSafeInteger=r2,D.isSet=X0,D.isString=Au,D.isSymbol=Qr,D.isTypedArray=Ys,D.isUndefined=i2,D.isWeakMap=n2,D.isWeakSet=s2,D.join=uw,D.kebabCase=W2,D.last=mi,D.lastIndexOf=cw,D.lowerCase=Y2,D.lowerFirst=Q2,D.lt=o2,D.lte=a2,D.max=H3,D.maxBy=K3,D.mean=V3,D.meanBy=G3,D.min=W3,D.minBy=Y3,D.stubArray=Mh,D.stubFalse=Ch,D.stubObject=T3,D.stubString=F3,D.stubTrue=U3,D.multiply=Q3,D.nth=hw,D.noConflict=D3,D.noop=xh,D.now=wu,D.pad=J2,D.padEnd=X2,D.padStart=Z2,D.parseInt=t3,D.random=k2,D.reduce=db,D.reduceRight=pb,D.repeat=e3,D.replace=r3,D.result=R2,D.round=J3,D.runInContext=J,D.sample=mb,D.size=wb,D.snakeCase=i3,D.some=bb,D.sortedIndex=vw,D.sortedIndexBy=yw,D.sortedIndexOf=ww,D.sortedLastIndex=bw,D.sortedLastIndexBy=_w,D.sortedLastIndexOf=Ew,D.startCase=s3,D.startsWith=o3,D.subtract=X3,D.sum=Z3,D.sumBy=t6,D.template=a3,D.times=B3,D.toFinite=yn,D.toInteger=ae,D.toLength=td,D.toLower=u3,D.toNumber=vi,D.toSafeInteger=u2,D.toString=Me,D.toUpper=c3,D.trim=h3,D.trimEnd=l3,D.trimStart=f3,D.truncate=d3,D.unescape=p3,D.uniqueId=q3,D.upperCase=g3,D.upperFirst=Ah,D.each=j0,D.eachRight=$0,D.first=U0,Dh(D,function(){var i={};return Hi(D,function(o,u){Ne.call(D.prototype,u)||(i[u]=o)}),i}(),{chain:!1}),D.VERSION=n,li(["bind","bindKey","curry","curryRight","partial","partialRight"],function(i){D[i].placeholder=D}),li(["drop","take"],function(i,o){ge.prototype[i]=function(u){u=u===e?1:nr(ae(u),0);var m=this.__filtered__&&!o?new ge(this):this.clone();return m.__filtered__?m.__takeCount__=vr(u,m.__takeCount__):m.__views__.push({size:vr(u,g),type:i+(m.__dir__<0?"Right":"")}),m},ge.prototype[i+"Right"]=function(u){return this.reverse()[i](u).reverse()}}),li(["filter","map","takeWhile"],function(i,o){var u=o+1,m=u==y||u==C;ge.prototype[i]=function(A){var P=this.clone();return P.__iteratees__.push({iteratee:jt(A,3),type:u}),P.__filtered__=P.__filtered__||m,P}}),li(["head","last"],function(i,o){var u="take"+(o?"Right":"");ge.prototype[i]=function(){return this[u](1).value()[0]}}),li(["initial","tail"],function(i,o){var u="drop"+(o?"":"Right");ge.prototype[i]=function(){return this.__filtered__?new ge(this):this[u](1)}}),ge.prototype.compact=function(){return this.filter(qr)},ge.prototype.find=function(i){return this.filter(i).head()},ge.prototype.findLast=function(i){return this.reverse().find(i)},ge.prototype.invokeMap=he(function(i,o){return typeof i=="function"?new ge(this):this.map(function(u){return Fo(u,i,o)})}),ge.prototype.reject=function(i){return this.filter(_u(jt(i)))},ge.prototype.slice=function(i,o){i=ae(i);var u=this;return u.__filtered__&&(i>0||o<0)?new ge(u):(i<0?u=u.takeRight(-i):i&&(u=u.drop(i)),o!==e&&(o=ae(o),u=o<0?u.dropRight(-o):u.take(o-i)),u)},ge.prototype.takeRightWhile=function(i){return this.reverse().takeWhile(i).reverse()},ge.prototype.toArray=function(){return this.take(g)},Hi(ge.prototype,function(i,o){var u=/^(?:filter|find|map|reject)|While$/.test(o),m=/^(?:head|last)$/.test(o),A=D[m?"take"+(o=="last"?"Right":""):o],P=m||/^find/.test(o);A&&(D.prototype[o]=function(){var H=this.__wrapped__,G=m?[1]:arguments,X=H instanceof ge,ot=G[0],ut=X||ie(H),dt=function(fe){var be=A.apply(D,Fn([fe],G));return m&&vt?be[0]:be};ut&&u&&typeof ot=="function"&&ot.length!=1&&(X=ut=!1);var vt=this.__chain__,Ft=!!this.__actions__.length,kt=P&&!vt,ce=X&&!Ft;if(!P&&ut){H=ce?H:new ge(this);var Ht=i.apply(H,G);return Ht.__actions__.push({func:vu,args:[dt],thisArg:e}),new di(Ht,vt)}return kt&&ce?i.apply(this,G):(Ht=this.thru(dt),kt?m?Ht.value()[0]:Ht.value():Ht)})}),li(["pop","push","shift","sort","splice","unshift"],function(i){var o=ka[i],u=/^(?:push|sort|unshift)$/.test(i)?"tap":"thru",m=/^(?:pop|shift)$/.test(i);D.prototype[i]=function(){var A=arguments;if(m&&!this.__chain__){var P=this.value();return o.apply(ie(P)?P:[],A)}return this[u](function(H){return o.apply(ie(H)?H:[],A)})}}),Hi(ge.prototype,function(i,o){var u=D[o];if(u){var m=u.name+"";Ne.call(Hs,m)||(Hs[m]=[]),Hs[m].push({name:o,func:u})}}),Hs[hu(e,tt).name]=[{name:"wrapper",func:e}],ge.prototype.clone=pv,ge.prototype.reverse=gv,ge.prototype.value=mv,D.prototype.at=Kw,D.prototype.chain=Vw,D.prototype.commit=Gw,D.prototype.next=Ww,D.prototype.plant=Qw,D.prototype.reverse=Jw,D.prototype.toJSON=D.prototype.valueOf=D.prototype.value=Xw,D.prototype.first=D.prototype.head,Mo&&(D.prototype[Mo]=Yw),D},$s=Gm();Qe?((Qe.exports=$s)._=$s,Le._=$s):we._=$s}).call(Xo)})(Fl,Fl.exports);var r9=Object.defineProperty,i9=Object.defineProperties,n9=Object.getOwnPropertyDescriptors,w1=Object.getOwnPropertySymbols,s9=Object.prototype.hasOwnProperty,o9=Object.prototype.propertyIsEnumerable,b1=(r,t,e)=>t in r?r9(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ru=(r,t)=>{for(var e in t||(t={}))s9.call(t,e)&&b1(r,e,t[e]);if(w1)for(var e of w1(t))o9.call(t,e)&&b1(r,e,t[e]);return r},a9=(r,t)=>i9(r,n9(t));function Qn(r,t,e){var n;const s=Uu(r);return((n=t.rpcMap)==null?void 0:n[s.reference])||`${e9}?chainId=${s.namespace}:${s.reference}&projectId=${e}`}function Rs(r){return r.includes(":")?r.split(":")[1]:r}function Em(r){return r.map(t=>`${t.split(":")[0]}:${t.split(":")[1]}`)}function u9(r,t){const e=Object.keys(t.namespaces).filter(s=>s.includes(r));if(!e.length)return[];const n=[];return e.forEach(s=>{const a=t.namespaces[s].accounts;n.push(...a)}),n}function ul(r={},t={}){const e=_1(r),n=_1(t);return Fl.exports.merge(e,n)}function _1(r){var t,e,n,s;const a={};if(!ca(r))return a;for(const[c,l]of Object.entries(r)){const d=rf(c)?[c]:l.chains,f=l.methods||[],w=l.events||[],E=l.rpcMap||{},x=ta(c);a[x]=a9(Ru(Ru({},a[x]),l),{chains:Bu(d,(t=a[x])==null?void 0:t.chains),methods:Bu(f,(e=a[x])==null?void 0:e.methods),events:Bu(w,(n=a[x])==null?void 0:n.events),rpcMap:Ru(Ru({},E),(s=a[x])==null?void 0:s.rpcMap)})}return a}function c9(r){return r.includes(":")?r.split(":")[2]:r}function E1(r){const t={};for(const[e,n]of Object.entries(r)){const s=n.methods||[],a=n.events||[],c=n.accounts||[],l=rf(e)?[e]:n.chains?n.chains:Em(n.accounts);t[e]={chains:l,methods:s,events:a,accounts:c}}return t}function cl(r){return typeof r=="number"?r:r.includes("0x")?parseInt(r,16):(r=r.includes(":")?r.split(":")[1]:r,isNaN(Number(r))?r:Number(r))}const Am={},He=r=>Am[r],hl=(r,t)=>{Am[r]=t};class h9{constructor(t){this.name="polkadot",this.namespace=t.namespace,this.events=He("events"),this.client=He("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Pn.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var n;const s=Rs(e);t[s]=this.createHttpProvider(s,(n=this.namespace.rpcMap)==null?void 0:n[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const n=this.createHttpProvider(t,e);n&&(this.httpProviders[t]=n)}createHttpProvider(t,e){const n=e||Qn(t,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${t}`);return new Cn(new Xn(n,He("disableProviderPing")))}}class l9{constructor(t){this.name="eip155",this.namespace=t.namespace,this.events=He("events"),this.client=He("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(t){switch(t.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(t);case"eth_chainId":return parseInt(this.getDefaultChain())}return this.namespace.methods.includes(t.request.method)?await this.client.request(t):this.getHttpProvider().request(t.request)}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(parseInt(t),e),this.chainId=parseInt(t),this.events.emit(Pn.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}createHttpProvider(t,e){const n=e||Qn(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${t}`);return new Cn(new Xn(n,He("disableProviderPing")))}setHttpProvider(t,e){const n=this.createHttpProvider(t,e);n&&(this.httpProviders[t]=n)}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var n;const s=parseInt(Rs(e));t[s]=this.createHttpProvider(s,(n=this.namespace.rpcMap)==null?void 0:n[e])}),t}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}getHttpProvider(){const t=this.chainId,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}async handleSwitchChain(t){var e,n;let s=t.request.params?(e=t.request.params[0])==null?void 0:e.chainId:"0x0";s=s.startsWith("0x")?s:`0x${s}`;const a=parseInt(s,16);if(this.isChainApproved(a))this.setDefaultChain(`${a}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:t.topic,request:{method:t.request.method,params:[{chainId:s}]},chainId:(n=this.namespace.chains)==null?void 0:n[0]}),this.setDefaultChain(`${a}`);else throw new Error(`Failed to switch to chain 'eip155:${a}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(t){return this.namespace.chains.includes(`${this.name}:${t}`)}}class f9{constructor(t){this.name="solana",this.namespace=t.namespace,this.events=He("events"),this.client=He("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Pn.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var n;const s=Rs(e);t[s]=this.createHttpProvider(s,(n=this.namespace.rpcMap)==null?void 0:n[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const n=this.createHttpProvider(t,e);n&&(this.httpProviders[t]=n)}createHttpProvider(t,e){const n=e||Qn(t,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${t}`);return new Cn(new Xn(n,He("disableProviderPing")))}}class d9{constructor(t){this.name="cosmos",this.namespace=t.namespace,this.events=He("events"),this.client=He("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Pn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var n;const s=Rs(e);t[s]=this.createHttpProvider(s,(n=this.namespace.rpcMap)==null?void 0:n[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const n=this.createHttpProvider(t,e);n&&(this.httpProviders[t]=n)}createHttpProvider(t,e){const n=e||Qn(t,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${t}`);return new Cn(new Xn(n,He("disableProviderPing")))}}class p9{constructor(t){this.name="cip34",this.namespace=t.namespace,this.events=He("events"),this.client=He("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Pn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{const n=this.getCardanoRPCUrl(e),s=Rs(e);t[s]=this.createHttpProvider(s,n)}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}getCardanoRPCUrl(t){const e=this.namespace.rpcMap;if(e)return e[t]}setHttpProvider(t,e){const n=this.createHttpProvider(t,e);n&&(this.httpProviders[t]=n)}createHttpProvider(t,e){const n=e||this.getCardanoRPCUrl(t);if(!n)throw new Error(`No RPC url provided for chainId: ${t}`);return new Cn(new Xn(n,He("disableProviderPing")))}}class g9{constructor(t){this.name="elrond",this.namespace=t.namespace,this.events=He("events"),this.client=He("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Pn.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var n;const s=Rs(e);t[s]=this.createHttpProvider(s,(n=this.namespace.rpcMap)==null?void 0:n[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const n=this.createHttpProvider(t,e);n&&(this.httpProviders[t]=n)}createHttpProvider(t,e){const n=e||Qn(t,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${t}`);return new Cn(new Xn(n,He("disableProviderPing")))}}class m9{constructor(t){this.name="multiversx",this.namespace=t.namespace,this.events=He("events"),this.client=He("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Pn.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var n;const s=Rs(e);t[s]=this.createHttpProvider(s,(n=this.namespace.rpcMap)==null?void 0:n[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const n=this.createHttpProvider(t,e);n&&(this.httpProviders[t]=n)}createHttpProvider(t,e){const n=e||Qn(t,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${t}`);return new Cn(new Xn(n,He("disableProviderPing")))}}class v9{constructor(t){this.name="near",this.namespace=t.namespace,this.events=He("events"),this.client=He("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){if(this.chainId=t,!this.httpProviders[t]){const n=e||Qn(`${this.name}:${t}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,n)}this.events.emit(Pn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var n;t[e]=this.createHttpProvider(e,(n=this.namespace.rpcMap)==null?void 0:n[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const n=this.createHttpProvider(t,e);n&&(this.httpProviders[t]=n)}createHttpProvider(t,e){const n=e||Qn(t,this.namespace);return typeof n>"u"?void 0:new Cn(new Xn(n,He("disableProviderPing")))}}var y9=Object.defineProperty,w9=Object.defineProperties,b9=Object.getOwnPropertyDescriptors,A1=Object.getOwnPropertySymbols,_9=Object.prototype.hasOwnProperty,E9=Object.prototype.propertyIsEnumerable,S1=(r,t,e)=>t in r?y9(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Tu=(r,t)=>{for(var e in t||(t={}))_9.call(t,e)&&S1(r,e,t[e]);if(A1)for(var e of A1(t))E9.call(t,e)&&S1(r,e,t[e]);return r},ll=(r,t)=>w9(r,b9(t));class ff{constructor(t){this.events=new jl,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=t,this.logger=typeof(t==null?void 0:t.logger)<"u"&&typeof(t==null?void 0:t.logger)!="string"?t.logger:ba(gc({level:(t==null?void 0:t.logger)||v1})),this.disableProviderPing=(t==null?void 0:t.disableProviderPing)||!1}static async init(t){const e=new ff(t);return await e.initialize(),e}async request(t,e,n){const[s,a]=this.validateChain(e);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(s).request({request:Tu({},t),chainId:`${s}:${a}`,topic:this.session.topic,expiry:n})}sendAsync(t,e,n,s){const a=new Date().getTime();this.request(t,n,s).then(c=>e(null,mc(a,c))).catch(c=>e(c,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var t;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(t=this.session)==null?void 0:t.topic,reason:Re("USER_DISCONNECTED")}),await this.cleanup()}async connect(t){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(t),await this.cleanupPendingPairings(),!t.skipPairing)return await this.pair(t.pairingTopic)}async authenticate(t){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(t),await this.cleanupPendingPairings();const{uri:e,response:n}=await this.client.authenticate(t);e&&(this.uri=e,this.events.emit("display_uri",e));const s=await n();if(this.session=s.session,this.session){const a=E1(this.session.namespaces);this.namespaces=ul(this.namespaces,a),this.persist("namespaces",this.namespaces),this.onConnect()}return s}on(t,e){this.events.on(t,e)}once(t,e){this.events.once(t,e)}removeListener(t,e){this.events.removeListener(t,e)}off(t,e){this.events.off(t,e)}get isWalletConnect(){return!0}async pair(t){this.shouldAbortPairingAttempt=!1;let e=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(e>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:n,approval:s}=await this.client.connect({pairingTopic:t,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});n&&(this.uri=n,this.events.emit("display_uri",n)),await s().then(a=>{this.session=a;const c=E1(a.namespaces);this.namespaces=ul(this.namespaces,c),this.persist("namespaces",this.namespaces)}).catch(a=>{if(a.message!==_m)throw a;e++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(t,e){try{if(!this.session)return;const[n,s]=this.validateChain(t);this.getProvider(n).setDefaultChain(s,e)}catch(n){if(!/Please call connect/.test(n.message))throw n}}async cleanupPendingPairings(t={}){this.logger.info("Cleaning up inactive pairings...");const e=this.client.pairing.getAll();if(un(e)){for(const n of e)t.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.topic);this.logger.info(`Inactive pairings cleared: ${e.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 t=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[t]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await lf.init({logger:this.providerOpts.logger||v1,relayUrl:this.providerOpts.relayUrl||X7,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 t=[...new Set(Object.keys(this.session.namespaces).map(e=>ta(e)))];hl("client",this.client),hl("events",this.events),hl("disableProviderPing",this.disableProviderPing),t.forEach(e=>{if(!this.session)return;const n=u9(e,this.session),s=Em(n),a=ul(this.namespaces,this.optionalNamespaces),c=ll(Tu({},a[e]),{accounts:n,chains:s});switch(e){case"eip155":this.rpcProviders[e]=new l9({namespace:c});break;case"solana":this.rpcProviders[e]=new f9({namespace:c});break;case"cosmos":this.rpcProviders[e]=new d9({namespace:c});break;case"polkadot":this.rpcProviders[e]=new h9({namespace:c});break;case"cip34":this.rpcProviders[e]=new p9({namespace:c});break;case"elrond":this.rpcProviders[e]=new g9({namespace:c});break;case"multiversx":this.rpcProviders[e]=new m9({namespace:c});break;case"near":this.rpcProviders[e]=new v9({namespace:c});break}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",t=>{this.events.emit("session_ping",t)}),this.client.on("session_event",t=>{const{params:e}=t,{event:n}=e;if(n.name==="accountsChanged"){const s=n.data;s&&un(s)&&this.events.emit("accountsChanged",s.map(c9))}else if(n.name==="chainChanged"){const s=e.chainId,a=e.event.data,c=ta(s),l=cl(s)!==cl(a)?`${c}:${cl(a)}`:s;this.onChainChanged(l)}else this.events.emit(n.name,n.data);this.events.emit("session_event",t)}),this.client.on("session_update",({topic:t,params:e})=>{var n;const{namespaces:s}=e,a=(n=this.client)==null?void 0:n.session.get(t);this.session=ll(Tu({},a),{namespaces:s}),this.onSessionUpdate(),this.events.emit("session_update",{topic:t,params:e})}),this.client.on("session_delete",async t=>{await this.cleanup(),this.events.emit("session_delete",t),this.events.emit("disconnect",ll(Tu({},Re("USER_DISCONNECTED")),{data:t.topic}))}),this.on(Pn.DEFAULT_CHAIN_CHANGED,t=>{this.onChainChanged(t,!0)})}getProvider(t){if(!this.rpcProviders[t])throw new Error(`Provider not found: ${t}`);return this.rpcProviders[t]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(t=>{var e;this.getProvider(t).updateNamespace((e=this.session)==null?void 0:e.namespaces[t])})}setNamespaces(t){const{namespaces:e,optionalNamespaces:n,sessionProperties:s}=t;e&&Object.keys(e).length&&(this.namespaces=e),n&&Object.keys(n).length&&(this.optionalNamespaces=n),this.sessionProperties=s,this.persist("namespaces",e),this.persist("optionalNamespaces",n)}validateChain(t){const[e,n]=(t==null?void 0:t.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[e,n];if(e&&!Object.keys(this.namespaces||{}).map(c=>ta(c)).includes(e))throw new Error(`Namespace '${e}' is not configured. Please call connect() first with namespace config.`);if(e&&n)return[e,n];const s=ta(Object.keys(this.namespaces)[0]),a=this.rpcProviders[s].getDefaultChain();return[s,a]}async requestAccounts(){const[t]=this.validateChain();return await this.getProvider(t).requestAccounts()}onChainChanged(t,e=!1){if(!this.namespaces)return;const[n,s]=this.validateChain(t);s&&(e||this.getProvider(n).setDefaultChain(s),this.namespaces[n]?this.namespaces[n].defaultChain=s:this.namespaces[`${n}:${s}`]?this.namespaces[`${n}:${s}`].defaultChain=s:this.namespaces[`${n}:${s}`]={defaultChain:s},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",s))}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(t,e){this.client.core.storage.setItem(`${y1}/${t}`,e)}async getFromStore(t){return await this.client.core.storage.getItem(`${y1}/${t}`)}}const A9=ff,S9="wc",I9="ethereum_provider",D9=`${S9}@2:${I9}:`,x9="https://rpc.walletconnect.com/v1/",Ul=["eth_sendTransaction","personal_sign"],M9=["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"],Bl=["chainChanged","accountsChanged"],C9=["chainChanged","accountsChanged","message","disconnect","connect"];var P9=Object.defineProperty,O9=Object.defineProperties,N9=Object.getOwnPropertyDescriptors,I1=Object.getOwnPropertySymbols,R9=Object.prototype.hasOwnProperty,T9=Object.prototype.propertyIsEnumerable,D1=(r,t,e)=>t in r?P9(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,no=(r,t)=>{for(var e in t||(t={}))R9.call(t,e)&&D1(r,e,t[e]);if(I1)for(var e of I1(t))T9.call(t,e)&&D1(r,e,t[e]);return r},fl=(r,t)=>O9(r,N9(t));function oc(r){return Number(r[0].split(":")[1])}function Fu(r){return`0x${r.toString(16)}`}function F9(r){const{chains:t,optionalChains:e,methods:n,optionalMethods:s,events:a,optionalEvents:c,rpcMap:l}=r;if(!un(t))throw new Error("Invalid chains");const d={chains:t,methods:n||Ul,events:a||Bl,rpcMap:no({},t.length?{[oc(t)]:l[oc(t)]}:{})},f=a==null?void 0:a.filter(I=>!Bl.includes(I)),w=n==null?void 0:n.filter(I=>!Ul.includes(I));if(!e&&!c&&!s&&!(f!=null&&f.length)&&!(w!=null&&w.length))return{required:t.length?d:void 0};const E=(f==null?void 0:f.length)&&(w==null?void 0:w.length)||!e,x={chains:[...new Set(E?d.chains.concat(e||[]):e)],methods:[...new Set(d.methods.concat(s!=null&&s.length?s:M9))],events:[...new Set(d.events.concat(c!=null&&c.length?c:C9))],rpcMap:l};return{required:t.length?d:void 0,optional:e.length?x:void 0}}class df{constructor(){this.events=new Di.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=D9,this.on=(t,e)=>(this.events.on(t,e),this),this.once=(t,e)=>(this.events.once(t,e),this),this.removeListener=(t,e)=>(this.events.removeListener(t,e),this),this.off=(t,e)=>(this.events.off(t,e),this),this.parseAccount=t=>this.isCompatibleChainId(t)?this.parseAccountId(t).address:t,this.signer={},this.rpc={}}static async init(t){const e=new df;return await e.initialize(t),e}async request(t,e){return await this.signer.request(t,this.formatChainId(this.chainId),e)}sendAsync(t,e,n){this.signer.sendAsync(t,e,this.formatChainId(this.chainId),n)}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(t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(t);const{required:e,optional:n}=F9(this.rpc);try{const s=await new Promise(async(c,l)=>{var d;this.rpc.showQrModal&&((d=this.modal)==null||d.subscribeModal(f=>{!f.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),l(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(fl(no({namespaces:no({},e&&{[this.namespace]:e})},n&&{optionalNamespaces:{[this.namespace]:n}}),{pairingTopic:t==null?void 0:t.pairingTopic})).then(f=>{c(f)}).catch(f=>{l(new Error(f.message))})});if(!s)return;const a=Fd(s.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:a),this.setAccounts(a),this.events.emit("connect",{chainId:Fu(this.chainId)})}catch(s){throw this.signer.logger.error(s),s}finally{this.modal&&this.modal.closeModal()}}async authenticate(t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts({chains:t==null?void 0:t.chains});try{const e=await new Promise(async(s,a)=>{var c;this.rpc.showQrModal&&((c=this.modal)==null||c.subscribeModal(l=>{!l.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),a(new Error("Connection request reset. Please try again.")))})),await this.signer.authenticate(fl(no({},t),{chains:this.rpc.chains})).then(l=>{s(l)}).catch(l=>{a(new Error(l.message))})}),n=e.session;if(n){const s=Fd(n.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:s),this.setAccounts(s),this.events.emit("connect",{chainId:Fu(this.chainId)})}return e}catch(e){throw this.signer.logger.error(e),e}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",t=>{const{params:e}=t,{event:n}=e;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",t)}),this.signer.on("chainChanged",t=>{const e=parseInt(t);this.chainId=e,this.events.emit("chainChanged",Fu(this.chainId)),this.persist()}),this.signer.on("session_update",t=>{this.events.emit("session_update",t)}),this.signer.on("session_delete",t=>{this.reset(),this.events.emit("session_delete",t),this.events.emit("disconnect",fl(no({},Re("USER_DISCONNECTED")),{data:t.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",t=>{var e,n;this.rpc.showQrModal&&((e=this.modal)==null||e.closeModal(),(n=this.modal)==null||n.openModal({uri:t})),this.events.emit("display_uri",t)})}switchEthereumChain(t){this.request({method:"wallet_switchEthereumChain",params:[{chainId:t.toString(16)}]})}isCompatibleChainId(t){return typeof t=="string"?t.startsWith(`${this.namespace}:`):!1}formatChainId(t){return`${this.namespace}:${t}`}parseChainId(t){return Number(t.split(":")[1])}setChainIds(t){const e=t.filter(n=>this.isCompatibleChainId(n)).map(n=>this.parseChainId(n));e.length&&(this.chainId=e[0],this.events.emit("chainChanged",Fu(this.chainId)),this.persist())}setChainId(t){if(this.isCompatibleChainId(t)){const e=this.parseChainId(t);this.chainId=e,this.switchEthereumChain(e)}}parseAccountId(t){const[e,n,s]=t.split(":");return{chainId:`${e}:${n}`,address:s}}setAccounts(t){this.accounts=t.filter(e=>this.parseChainId(this.parseAccountId(e).chainId)===this.chainId).map(e=>this.parseAccountId(e).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(t){var e,n;const s=(e=t==null?void 0:t.chains)!=null?e:[],a=(n=t==null?void 0:t.optionalChains)!=null?n:[],c=s.concat(a);if(!c.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const l=s.length?(t==null?void 0:t.methods)||Ul:[],d=s.length?(t==null?void 0:t.events)||Bl:[],f=(t==null?void 0:t.optionalMethods)||[],w=(t==null?void 0:t.optionalEvents)||[],E=(t==null?void 0:t.rpcMap)||this.buildRpcMap(c,t.projectId),x=(t==null?void 0:t.qrModalOptions)||void 0;return{chains:s==null?void 0:s.map(I=>this.formatChainId(I)),optionalChains:a.map(I=>this.formatChainId(I)),methods:l,events:d,optionalMethods:f,optionalEvents:w,rpcMap:E,showQrModal:!!(t!=null&&t.showQrModal),qrModalOptions:x,projectId:t.projectId,metadata:t.metadata}}buildRpcMap(t,e){const n={};return t.forEach(s=>{n[s]=this.getRpcUrl(s,e)}),n}async initialize(t){if(this.rpc=this.getRpcConfig(t),this.chainId=this.rpc.chains.length?oc(this.rpc.chains):oc(this.rpc.optionalChains),this.signer=await A9.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:t.disableProviderPing,relayUrl:t.relayUrl,storageOptions:t.storageOptions}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let e;try{const{WalletConnectModal:n}=await n6(()=>import("./index-7c892f2a.js").then(s=>s.i),["assets/index-7c892f2a.js","assets/index-e272409d.js","assets/index-dd35e6b5.css"]);e=n}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(e)try{this.modal=new e(no({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(n){throw this.signer.logger.error(n),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(t){if(!t)return;const{chains:e,optionalChains:n,rpcMap:s}=t;e&&un(e)&&(this.rpc.chains=e.map(a=>this.formatChainId(a)),e.forEach(a=>{this.rpc.rpcMap[a]=(s==null?void 0:s[a])||this.getRpcUrl(a)})),n&&un(n)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=n==null?void 0:n.map(a=>this.formatChainId(a)),n.forEach(a=>{this.rpc.rpcMap[a]=(s==null?void 0:s[a])||this.getRpcUrl(a)}))}getRpcUrl(t,e){var n;return((n=this.rpc.rpcMap)==null?void 0:n[t])||`${x9}?chainId=eip155:${t}&projectId=${e||this.rpc.projectId}`}async loadPersistedSession(){if(this.session)try{const t=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),e=this.session.namespaces[`${this.namespace}:${t}`]?this.session.namespaces[`${this.namespace}:${t}`]:this.session.namespaces[this.namespace];this.setChainIds(t?[this.formatChainId(t)]:e==null?void 0:e.accounts),this.setAccounts(e==null?void 0:e.accounts)}catch(t){this.signer.logger.error("Failed to load persisted session, clearing state..."),this.signer.logger.error(t),await this.disconnect().catch(e=>this.signer.logger.warn(e))}}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(t){return typeof t=="string"||t instanceof String?[this.parseAccount(t)]:t.map(e=>this.parseAccount(e))}}const cM=df;export{cM as EthereumProvider,C9 as OPTIONAL_EVENTS,M9 as OPTIONAL_METHODS,Bl as REQUIRED_EVENTS,Ul as REQUIRED_METHODS,df as default};