New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@walletconnect/utils

Package Overview
Dependencies
Maintainers
12
Versions
691
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@walletconnect/utils - npm Package Compare versions

Comparing version 2.18.1-canary-viem-1 to 2.18.1-canary-ws-1

4

dist/index.cjs.js

@@ -1,3 +0,3 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Rr=require("detect-browser"),me=require("@walletconnect/time"),ae=require("@walletconnect/window-getters"),Tr=require("@walletconnect/window-metadata"),Ur=require("viem"),_r=require("@walletconnect/relay-auth"),N=require("uint8arrays"),Cr=require("elliptic"),Pr=require("@walletconnect/relay-api");const $e=":";function We(e){const[t,n]=e.split($e);return{namespace:t,reference:n}}function $t(e){const{namespace:t,reference:n}=e;return[t,n].join($e)}function Je(e){const[t,n,r]=e.split($e);return{namespace:t,reference:n,address:r}}function Lt(e){const{namespace:t,reference:n,address:r}=e;return[t,n,r].join($e)}function Ye(e,t){const n=[];return e.forEach(r=>{const o=t(r);n.includes(o)||n.push(o)}),n}function Bt(e){const{address:t}=Je(e);return t}function jt(e){const{namespace:t,reference:n}=Je(e);return $t({namespace:t,reference:n})}function $r(e,t){const{namespace:n,reference:r}=We(t);return Lt({namespace:n,reference:r,address:e})}function Lr(e){return Ye(e,Bt)}function kt(e){return Ye(e,jt)}function Br(e,t=[]){const n=[];return Object.keys(e).forEach(r=>{if(t.length&&!t.includes(r))return;const o=e[r];n.push(...o.accounts)}),n}function jr(e,t=[]){const n=[];return Object.keys(e).forEach(r=>{if(t.length&&!t.includes(r))return;const o=e[r];n.push(...kt(o.accounts))}),n}function kr(e,t=[]){const n=[];return Object.keys(e).forEach(r=>{if(t.length&&!t.includes(r))return;const o=e[r];n.push(...Le(r,o))}),n}function Le(e,t){return e.includes(":")?[e]:t.chains||[]}const Vt="ReactNative",H={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},Be=" ",Vr=":",Dt="/",Xe=2,Dr=1e3,Mt="js";function Qe(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function te(){return!ae.getDocument()&&!!ae.getNavigator()&&navigator.product===Vt}function Mr(){return te()&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"&&(global==null?void 0:global.Platform.OS)==="android"}function Fr(){return te()&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"&&(global==null?void 0:global.Platform.OS)==="ios"}function Ie(){return!Qe()&&!!ae.getNavigator()&&!!ae.getDocument()}function ue(){return te()?H.reactNative:Qe()?H.node:Ie()?H.browser:H.unknown}function Hr(){var e;try{return te()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(e=global.Application)==null?void 0:e.applicationId:void 0}catch{return}}function Ft(e,t){const n=new URLSearchParams(e);for(const r of Object.keys(t).sort())if(t.hasOwnProperty(r)){const o=t[r];o!==void 0&&n.set(r,o)}return n.toString()}function Kr(){return Tr.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function qr(e,t){var n;const r=ue(),o={protocol:e,version:t,env:r};return r==="browser"&&(o.host=((n=ae.getLocation())==null?void 0:n.host)||"unknown"),o}function Ht(){if(ue()===H.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:n,Version:r}=global.Platform;return[n,r].join("-")}const e=Rr.detect();if(e===null)return"unknown";const t=e.os?e.os.replace(" ","").toLowerCase():"unknown";return e.type==="browser"?[t,e.name,e.version].join("-"):[t,e.version].join("-")}function Kt(){var e;const t=ue();return t===H.browser?[t,((e=ae.getLocation())==null?void 0:e.host)||"unknown"].join(":"):t}function qt(e,t,n){const r=Ht(),o=Kt();return[[e,t].join("-"),[Mt,n].join("-"),r,o].join("/")}function zr({protocol:e,version:t,relayUrl:n,sdkVersion:r,auth:o,projectId:s,useOnCloseEvent:i,bundleId:c,packageName:u}){const a=n.split("?"),l=qt(e,t,r),f={auth:o,ua:l,projectId:s,useOnCloseEvent:i||void 0,packageName:u||void 0,bundleId:c||void 0},d=Ft(a[1]||"",f);return a[0]+"?"+d}function Gr(e){let t=(e.match(/^[^:]+(?=:\/\/)/gi)||[])[0];const n=typeof t<"u"?e.split("://")[1]:e;return t=t==="wss"?"https":"http",[t,n].join("://")}function Wr(e,t,n){if(!e[t]||typeof e[t]!==n)throw new Error(`Missing or invalid "${t}" param`)}function zt(e,t=Xe){return Gt(e.split(Dt),t)}function Jr(e){return zt(e).join(Be)}function ne(e,t){return e.filter(n=>t.includes(n)).length===e.length}function Gt(e,t=Xe){return e.slice(Math.max(e.length-t,0))}function Yr(e){return Object.fromEntries(e.entries())}function Xr(e){return new Map(Object.entries(e))}function Qr(e,t){const n={};return Object.keys(e).forEach(r=>{n[r]=t(e[r])}),n}const Zr=e=>e;function Wt(e){return e.trim().replace(/^\w/,t=>t.toUpperCase())}function eo(e){return e.split(Be).map(t=>Wt(t)).join(Be)}function to(e=me.FIVE_MINUTES,t){const n=me.toMiliseconds(e||me.FIVE_MINUTES);let r,o,s,i;return{resolve:c=>{s&&r&&(clearTimeout(s),r(c),i=Promise.resolve(c))},reject:c=>{s&&o&&(clearTimeout(s),o(c))},done:()=>new Promise((c,u)=>{if(i)return c(i);s=setTimeout(()=>{const a=new Error(t);i=Promise.reject(a),u(a)},n),r=c,o=u})}}function no(e,t,n){return new Promise(async(r,o)=>{const s=setTimeout(()=>o(new Error(n)),t);try{const i=await e;r(i)}catch(i){o(i)}clearTimeout(s)})}function Ze(e,t){if(typeof t=="string"&&t.startsWith(`${e}:`))return t;if(e.toLowerCase()==="topic"){if(typeof t!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${t}`}else if(e.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: ${e}`)}function ro(e){return Ze("topic",e)}function oo(e){return Ze("id",e)}function so(e){const[t,n]=e.split(":"),r={id:void 0,topic:void 0};if(t==="topic"&&typeof n=="string")r.topic=n;else if(t==="id"&&Number.isInteger(Number(n)))r.id=Number(n);else throw new Error(`Invalid target, expected id:number or topic:string, got ${t}:${n}`);return r}function io(e,t){return me.fromMiliseconds((t||Date.now())+me.toMiliseconds(e))}function co(e){return Date.now()>=me.toMiliseconds(e)}function ao(e,t){return`${e}${t?`:${t}`:""}`}function Q(e=[],t=[]){return[...new Set([...e,...t])]}async function uo({id:e,topic:t,wcDeepLink:n}){var r;try{if(!n)return;const o=typeof n=="string"?JSON.parse(n):n,s=o?.href;if(typeof s!="string")return;const i=Jt(s,e,t),c=ue();if(c===H.browser){if(!((r=ae.getDocument())!=null&&r.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}Yt(i)}else c===H.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(i)}catch(o){console.error(o)}}function Jt(e,t,n){const r=`requestId=${t}&sessionTopic=${n}`;e.endsWith("/")&&(e=e.slice(0,-1));let o=`${e}`;if(e.startsWith("https://t.me")){const s=e.includes("?")?"&startapp=":"?startapp=";o=`${o}${s}${Zt(r,!0)}`}else o=`${o}/wc?${r}`;return o}function Yt(e){let t="_self";Qt()?t="_top":(Xt()||e.startsWith("https://")||e.startsWith("http://"))&&(t="_blank"),window.open(e,t,"noreferrer noopener")}async function fo(e,t){let n="";try{if(Ie()&&(n=localStorage.getItem(t),n))return n;n=await e.getItem(t)}catch(r){console.error(r)}return n}function et(e,t){return e.filter(n=>t.includes(n))}function lo(e,t){if(!e.includes(t))return null;const n=e.split(/([&,?,=])/),r=n.indexOf(t);return n[r+2]}function po(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function ho(){return typeof process<"u"&&process.env.IS_VITEST==="true"}function Xt(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function Qt(){try{return window.self!==window.top}catch{return!1}}function Zt(e,t=!1){const n=Buffer.from(e).toString("base64");return t?n.replace(/[=]/g,""):n}function tt(e){return Buffer.from(e,"base64").toString("utf-8")}function go(e){return new Promise(t=>setTimeout(t,e))}function Oe(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function yo(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function je(e,...t){if(!yo(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function nt(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Oe(e.outputLen),Oe(e.blockLen)}function be(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function en(e,t){je(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}const ke=BigInt(2**32-1),tn=BigInt(32);function mo(e,t=!1){return t?{h:Number(e&ke),l:Number(e>>tn&ke)}:{h:Number(e>>tn&ke)|0,l:Number(e&ke)|0}}function bo(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let o=0;o<e.length;o++){const{h:s,l:i}=mo(e[o],t);[n[o],r[o]]=[s,i]}return[n,r]}const wo=(e,t,n)=>e<<n|t>>>32-n,Eo=(e,t,n)=>t<<n|e>>>32-n,vo=(e,t,n)=>t<<n-32|e>>>64-n,xo=(e,t,n)=>e<<n-32|t>>>64-n,we=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function Ao(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function rt(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function W(e,t){return e<<32-t|e>>>t}const nn=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function So(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function rn(e){for(let t=0;t<e.length;t++)e[t]=So(e[t])}function No(e){if(typeof e!="string")throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function Ee(e){return typeof e=="string"&&(e=No(e)),je(e),e}class ot{clone(){return this._cloneInto()}}function on(e){const t=r=>e().update(Ee(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function Re(e=32){if(we&&typeof we.getRandomValues=="function")return we.getRandomValues(new Uint8Array(e));if(we&&typeof we.randomBytes=="function")return we.randomBytes(e);throw new Error("crypto.getRandomValues must be defined")}const sn=[],cn=[],an=[],Io=BigInt(0),Te=BigInt(1),Oo=BigInt(2),Ro=BigInt(7),To=BigInt(256),Uo=BigInt(113);for(let e=0,t=Te,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],sn.push(2*(5*r+n)),cn.push((e+1)*(e+2)/2%64);let o=Io;for(let s=0;s<7;s++)t=(t<<Te^(t>>Ro)*Uo)%To,t&Oo&&(o^=Te<<(Te<<BigInt(s))-Te);an.push(o)}const[_o,Co]=bo(an,!0),un=(e,t,n)=>n>32?vo(e,t,n):wo(e,t,n),fn=(e,t,n)=>n>32?xo(e,t,n):Eo(e,t,n);function Po(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let i=0;i<10;i++)n[i]=e[i]^e[i+10]^e[i+20]^e[i+30]^e[i+40];for(let i=0;i<10;i+=2){const c=(i+8)%10,u=(i+2)%10,a=n[u],l=n[u+1],f=un(a,l,1)^n[c],d=fn(a,l,1)^n[c+1];for(let g=0;g<50;g+=10)e[i+g]^=f,e[i+g+1]^=d}let o=e[2],s=e[3];for(let i=0;i<24;i++){const c=cn[i],u=un(o,s,c),a=fn(o,s,c),l=sn[i];o=e[l],s=e[l+1],e[l]=u,e[l+1]=a}for(let i=0;i<50;i+=10){for(let c=0;c<10;c++)n[c]=e[i+c];for(let c=0;c<10;c++)e[i+c]^=~n[(c+2)%10]&n[(c+4)%10]}e[0]^=_o[r],e[1]^=Co[r]}n.fill(0)}class Pt extends ot{constructor(t,n,r,o=!1,s=24){if(super(),this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=o,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Oe(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=Ao(this.state)}keccak(){nn||rn(this.state32),Po(this.state32,this.rounds),nn||rn(this.state32),this.posOut=0,this.pos=0}update(t){be(this);const{blockLen:n,state:r}=this;t=Ee(t);const o=t.length;for(let s=0;s<o;){const i=Math.min(n-this.pos,o-s);for(let c=0;c<i;c++)r[this.pos++]^=t[s++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:r,blockLen:o}=this;t[r]^=n,(n&128)!==0&&r===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){be(this,!1),je(t),this.finish();const n=this.state,{blockLen:r}=this;for(let o=0,s=t.length;o<s;){this.posOut>=r&&this.keccak();const i=Math.min(r-this.posOut,s-o);t.set(n.subarray(this.posOut,this.posOut+i),o),this.posOut+=i,o+=i}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Oe(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(en(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:o,rounds:s,enableXOF:i}=this;return t||(t=new Pt(n,r,o,i,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=r,t.outputLen=o,t.enableXOF=i,t.destroyed=this.destroyed,t}}const $o=(e,t,n)=>on(()=>new Pt(t,e,n)),Lo=$o(1,136,256/8),Bo="https://rpc.walletconnect.org/v1";function st(e){const t=`Ethereum Signed Message:
${e.length}`,n=new TextEncoder().encode(t+e);return"0x"+Buffer.from(Lo(n)).toString("hex")}async function ln(e,t,n,r,o,s){switch(n.t){case"eip191":return await dn(e,t,n.s);case"eip1271":return await pn(e,t,n.s,r,o,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${n.t}`)}}async function dn(e,t,n){const r=await Ur.recoverAddress({hash:st(t),signature:n});return console.log("recoveredAddress: ",r),r.toLowerCase()===e.toLowerCase()}async function pn(e,t,n,r,o,s){const i=We(r);if(!i.namespace||!i.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${r}`);try{const c="0x1626ba7e",u="0000000000000000000000000000000000000000000000000000000000000040",a="0000000000000000000000000000000000000000000000000000000000000041",l=n.substring(2),f=st(t).substring(2),d=c+f+u+a+l,g=await fetch(`${s||Bo}/?chainId=${r}&projectId=${o}`,{method:"POST",body:JSON.stringify({id:jo(),jsonrpc:"2.0",method:"eth_call",params:[{to:e,data:d},"latest"]})}),{result:y}=await g.json();return y?y.slice(0,c.length).toLowerCase()===c.toLowerCase():!1}catch(c){return console.error("isValidEip1271Signature: ",c),!1}}function jo(){return Date.now()+Math.floor(Math.random()*1e3)}var ko=Object.defineProperty,Vo=Object.defineProperties,Do=Object.getOwnPropertyDescriptors,hn=Object.getOwnPropertySymbols,Mo=Object.prototype.hasOwnProperty,Fo=Object.prototype.propertyIsEnumerable,gn=(e,t,n)=>t in e?ko(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,it=(e,t)=>{for(var n in t||(t={}))Mo.call(t,n)&&gn(e,n,t[n]);if(hn)for(var n of hn(t))Fo.call(t,n)&&gn(e,n,t[n]);return e},yn=(e,t)=>Vo(e,Do(t));const Ho="did:pkh:",Ve=e=>e?.split(":"),mn=e=>{const t=e&&Ve(e);if(t)return e.includes(Ho)?t[3]:t[1]},bn=e=>{const t=e&&Ve(e);if(t)return t[2]+":"+t[3]},ct=e=>{const t=e&&Ve(e);if(t)return t.pop()};async function Ko(e){const{cacao:t,projectId:n}=e,{s:r,p:o}=t,s=wn(o,o.iss),i=ct(o.iss);return await ln(i,s,r,bn(o.iss),n)}const wn=(e,t)=>{const n=`${e.domain} wants you to sign in with your Ethereum account:`,r=ct(t);if(!e.aud&&!e.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let o=e.statement||void 0;const s=`URI: ${e.aud||e.uri}`,i=`Version: ${e.version}`,c=`Chain ID: ${mn(t)}`,u=`Nonce: ${e.nonce}`,a=`Issued At: ${e.iat}`,l=e.exp?`Expiration Time: ${e.exp}`:void 0,f=e.nbf?`Not Before: ${e.nbf}`:void 0,d=e.requestId?`Request ID: ${e.requestId}`:void 0,g=e.resources?`Resources:${e.resources.map(p=>`
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Rr=require("detect-browser"),me=require("@walletconnect/time"),ae=require("@walletconnect/window-getters"),Tr=require("@walletconnect/window-metadata"),Ur=require("@ethersproject/transactions"),_r=require("@walletconnect/relay-auth"),N=require("uint8arrays"),Cr=require("elliptic"),Pr=require("@walletconnect/relay-api");const $e=":";function We(e){const[t,n]=e.split($e);return{namespace:t,reference:n}}function $t(e){const{namespace:t,reference:n}=e;return[t,n].join($e)}function Je(e){const[t,n,r]=e.split($e);return{namespace:t,reference:n,address:r}}function Lt(e){const{namespace:t,reference:n,address:r}=e;return[t,n,r].join($e)}function Ye(e,t){const n=[];return e.forEach(r=>{const o=t(r);n.includes(o)||n.push(o)}),n}function Bt(e){const{address:t}=Je(e);return t}function jt(e){const{namespace:t,reference:n}=Je(e);return $t({namespace:t,reference:n})}function $r(e,t){const{namespace:n,reference:r}=We(t);return Lt({namespace:n,reference:r,address:e})}function Lr(e){return Ye(e,Bt)}function kt(e){return Ye(e,jt)}function Br(e,t=[]){const n=[];return Object.keys(e).forEach(r=>{if(t.length&&!t.includes(r))return;const o=e[r];n.push(...o.accounts)}),n}function jr(e,t=[]){const n=[];return Object.keys(e).forEach(r=>{if(t.length&&!t.includes(r))return;const o=e[r];n.push(...kt(o.accounts))}),n}function kr(e,t=[]){const n=[];return Object.keys(e).forEach(r=>{if(t.length&&!t.includes(r))return;const o=e[r];n.push(...Le(r,o))}),n}function Le(e,t){return e.includes(":")?[e]:t.chains||[]}const Vt="ReactNative",H={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},Be=" ",Vr=":",Dt="/",Xe=2,Dr=1e3,Mt="js";function Qe(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function te(){return!ae.getDocument()&&!!ae.getNavigator()&&navigator.product===Vt}function Mr(){return te()&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"&&(global==null?void 0:global.Platform.OS)==="android"}function Fr(){return te()&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"&&(global==null?void 0:global.Platform.OS)==="ios"}function Ie(){return!Qe()&&!!ae.getNavigator()&&!!ae.getDocument()}function ue(){return te()?H.reactNative:Qe()?H.node:Ie()?H.browser:H.unknown}function Hr(){var e;try{return te()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(e=global.Application)==null?void 0:e.applicationId:void 0}catch{return}}function Ft(e,t){const n=new URLSearchParams(e);for(const r of Object.keys(t).sort())if(t.hasOwnProperty(r)){const o=t[r];o!==void 0&&n.set(r,o)}return n.toString()}function Kr(){return Tr.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function qr(e,t){var n;const r=ue(),o={protocol:e,version:t,env:r};return r==="browser"&&(o.host=((n=ae.getLocation())==null?void 0:n.host)||"unknown"),o}function Ht(){if(ue()===H.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:n,Version:r}=global.Platform;return[n,r].join("-")}const e=Rr.detect();if(e===null)return"unknown";const t=e.os?e.os.replace(" ","").toLowerCase():"unknown";return e.type==="browser"?[t,e.name,e.version].join("-"):[t,e.version].join("-")}function Kt(){var e;const t=ue();return t===H.browser?[t,((e=ae.getLocation())==null?void 0:e.host)||"unknown"].join(":"):t}function qt(e,t,n){const r=Ht(),o=Kt();return[[e,t].join("-"),[Mt,n].join("-"),r,o].join("/")}function zr({protocol:e,version:t,relayUrl:n,sdkVersion:r,auth:o,projectId:s,useOnCloseEvent:i,bundleId:c,packageName:u}){const a=n.split("?"),l=qt(e,t,r),f={auth:o,ua:l,projectId:s,useOnCloseEvent:i||void 0,packageName:u||void 0,bundleId:c||void 0},d=Ft(a[1]||"",f);return a[0]+"?"+d}function Gr(e){let t=(e.match(/^[^:]+(?=:\/\/)/gi)||[])[0];const n=typeof t<"u"?e.split("://")[1]:e;return t=t==="wss"?"https":"http",[t,n].join("://")}function Wr(e,t,n){if(!e[t]||typeof e[t]!==n)throw new Error(`Missing or invalid "${t}" param`)}function zt(e,t=Xe){return Gt(e.split(Dt),t)}function Jr(e){return zt(e).join(Be)}function ne(e,t){return e.filter(n=>t.includes(n)).length===e.length}function Gt(e,t=Xe){return e.slice(Math.max(e.length-t,0))}function Yr(e){return Object.fromEntries(e.entries())}function Xr(e){return new Map(Object.entries(e))}function Qr(e,t){const n={};return Object.keys(e).forEach(r=>{n[r]=t(e[r])}),n}const Zr=e=>e;function Wt(e){return e.trim().replace(/^\w/,t=>t.toUpperCase())}function eo(e){return e.split(Be).map(t=>Wt(t)).join(Be)}function to(e=me.FIVE_MINUTES,t){const n=me.toMiliseconds(e||me.FIVE_MINUTES);let r,o,s,i;return{resolve:c=>{s&&r&&(clearTimeout(s),r(c),i=Promise.resolve(c))},reject:c=>{s&&o&&(clearTimeout(s),o(c))},done:()=>new Promise((c,u)=>{if(i)return c(i);s=setTimeout(()=>{const a=new Error(t);i=Promise.reject(a),u(a)},n),r=c,o=u})}}function no(e,t,n){return new Promise(async(r,o)=>{const s=setTimeout(()=>o(new Error(n)),t);try{const i=await e;r(i)}catch(i){o(i)}clearTimeout(s)})}function Ze(e,t){if(typeof t=="string"&&t.startsWith(`${e}:`))return t;if(e.toLowerCase()==="topic"){if(typeof t!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${t}`}else if(e.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: ${e}`)}function ro(e){return Ze("topic",e)}function oo(e){return Ze("id",e)}function so(e){const[t,n]=e.split(":"),r={id:void 0,topic:void 0};if(t==="topic"&&typeof n=="string")r.topic=n;else if(t==="id"&&Number.isInteger(Number(n)))r.id=Number(n);else throw new Error(`Invalid target, expected id:number or topic:string, got ${t}:${n}`);return r}function io(e,t){return me.fromMiliseconds((t||Date.now())+me.toMiliseconds(e))}function co(e){return Date.now()>=me.toMiliseconds(e)}function ao(e,t){return`${e}${t?`:${t}`:""}`}function Q(e=[],t=[]){return[...new Set([...e,...t])]}async function uo({id:e,topic:t,wcDeepLink:n}){var r;try{if(!n)return;const o=typeof n=="string"?JSON.parse(n):n,s=o?.href;if(typeof s!="string")return;const i=Jt(s,e,t),c=ue();if(c===H.browser){if(!((r=ae.getDocument())!=null&&r.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}Yt(i)}else c===H.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(i)}catch(o){console.error(o)}}function Jt(e,t,n){const r=`requestId=${t}&sessionTopic=${n}`;e.endsWith("/")&&(e=e.slice(0,-1));let o=`${e}`;if(e.startsWith("https://t.me")){const s=e.includes("?")?"&startapp=":"?startapp=";o=`${o}${s}${Zt(r,!0)}`}else o=`${o}/wc?${r}`;return o}function Yt(e){let t="_self";Qt()?t="_top":(Xt()||e.startsWith("https://")||e.startsWith("http://"))&&(t="_blank"),window.open(e,t,"noreferrer noopener")}async function fo(e,t){let n="";try{if(Ie()&&(n=localStorage.getItem(t),n))return n;n=await e.getItem(t)}catch(r){console.error(r)}return n}function et(e,t){return e.filter(n=>t.includes(n))}function lo(e,t){if(!e.includes(t))return null;const n=e.split(/([&,?,=])/),r=n.indexOf(t);return n[r+2]}function po(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function ho(){return typeof process<"u"&&process.env.IS_VITEST==="true"}function Xt(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function Qt(){try{return window.self!==window.top}catch{return!1}}function Zt(e,t=!1){const n=Buffer.from(e).toString("base64");return t?n.replace(/[=]/g,""):n}function tt(e){return Buffer.from(e,"base64").toString("utf-8")}function go(e){return new Promise(t=>setTimeout(t,e))}function Oe(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function yo(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function je(e,...t){if(!yo(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function nt(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Oe(e.outputLen),Oe(e.blockLen)}function be(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function en(e,t){je(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}const ke=BigInt(2**32-1),tn=BigInt(32);function mo(e,t=!1){return t?{h:Number(e&ke),l:Number(e>>tn&ke)}:{h:Number(e>>tn&ke)|0,l:Number(e&ke)|0}}function bo(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let o=0;o<e.length;o++){const{h:s,l:i}=mo(e[o],t);[n[o],r[o]]=[s,i]}return[n,r]}const wo=(e,t,n)=>e<<n|t>>>32-n,Eo=(e,t,n)=>t<<n|e>>>32-n,vo=(e,t,n)=>t<<n-32|e>>>64-n,xo=(e,t,n)=>e<<n-32|t>>>64-n,we=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function Ao(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function rt(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function W(e,t){return e<<32-t|e>>>t}const nn=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function So(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function rn(e){for(let t=0;t<e.length;t++)e[t]=So(e[t])}function No(e){if(typeof e!="string")throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function Ee(e){return typeof e=="string"&&(e=No(e)),je(e),e}class ot{clone(){return this._cloneInto()}}function on(e){const t=r=>e().update(Ee(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function Re(e=32){if(we&&typeof we.getRandomValues=="function")return we.getRandomValues(new Uint8Array(e));if(we&&typeof we.randomBytes=="function")return we.randomBytes(e);throw new Error("crypto.getRandomValues must be defined")}const sn=[],cn=[],an=[],Io=BigInt(0),Te=BigInt(1),Oo=BigInt(2),Ro=BigInt(7),To=BigInt(256),Uo=BigInt(113);for(let e=0,t=Te,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],sn.push(2*(5*r+n)),cn.push((e+1)*(e+2)/2%64);let o=Io;for(let s=0;s<7;s++)t=(t<<Te^(t>>Ro)*Uo)%To,t&Oo&&(o^=Te<<(Te<<BigInt(s))-Te);an.push(o)}const[_o,Co]=bo(an,!0),un=(e,t,n)=>n>32?vo(e,t,n):wo(e,t,n),fn=(e,t,n)=>n>32?xo(e,t,n):Eo(e,t,n);function Po(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let i=0;i<10;i++)n[i]=e[i]^e[i+10]^e[i+20]^e[i+30]^e[i+40];for(let i=0;i<10;i+=2){const c=(i+8)%10,u=(i+2)%10,a=n[u],l=n[u+1],f=un(a,l,1)^n[c],d=fn(a,l,1)^n[c+1];for(let g=0;g<50;g+=10)e[i+g]^=f,e[i+g+1]^=d}let o=e[2],s=e[3];for(let i=0;i<24;i++){const c=cn[i],u=un(o,s,c),a=fn(o,s,c),l=sn[i];o=e[l],s=e[l+1],e[l]=u,e[l+1]=a}for(let i=0;i<50;i+=10){for(let c=0;c<10;c++)n[c]=e[i+c];for(let c=0;c<10;c++)e[i+c]^=~n[(c+2)%10]&n[(c+4)%10]}e[0]^=_o[r],e[1]^=Co[r]}n.fill(0)}class Pt extends ot{constructor(t,n,r,o=!1,s=24){if(super(),this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=o,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Oe(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=Ao(this.state)}keccak(){nn||rn(this.state32),Po(this.state32,this.rounds),nn||rn(this.state32),this.posOut=0,this.pos=0}update(t){be(this);const{blockLen:n,state:r}=this;t=Ee(t);const o=t.length;for(let s=0;s<o;){const i=Math.min(n-this.pos,o-s);for(let c=0;c<i;c++)r[this.pos++]^=t[s++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:r,blockLen:o}=this;t[r]^=n,(n&128)!==0&&r===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){be(this,!1),je(t),this.finish();const n=this.state,{blockLen:r}=this;for(let o=0,s=t.length;o<s;){this.posOut>=r&&this.keccak();const i=Math.min(r-this.posOut,s-o);t.set(n.subarray(this.posOut,this.posOut+i),o),this.posOut+=i,o+=i}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Oe(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(en(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:o,rounds:s,enableXOF:i}=this;return t||(t=new Pt(n,r,o,i,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=r,t.outputLen=o,t.enableXOF=i,t.destroyed=this.destroyed,t}}const $o=(e,t,n)=>on(()=>new Pt(t,e,n)),Lo=$o(1,136,256/8),Bo="https://rpc.walletconnect.org/v1";function st(e){const t=`Ethereum Signed Message:
${e.length}`,n=new TextEncoder().encode(t+e);return"0x"+Buffer.from(Lo(n)).toString("hex")}async function ln(e,t,n,r,o,s){switch(n.t){case"eip191":return dn(e,t,n.s);case"eip1271":return await pn(e,t,n.s,r,o,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${n.t}`)}}function dn(e,t,n){return Ur.recoverAddress(st(t),n).toLowerCase()===e.toLowerCase()}async function pn(e,t,n,r,o,s){const i=We(r);if(!i.namespace||!i.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${r}`);try{const c="0x1626ba7e",u="0000000000000000000000000000000000000000000000000000000000000040",a="0000000000000000000000000000000000000000000000000000000000000041",l=n.substring(2),f=st(t).substring(2),d=c+f+u+a+l,g=await fetch(`${s||Bo}/?chainId=${r}&projectId=${o}`,{method:"POST",body:JSON.stringify({id:jo(),jsonrpc:"2.0",method:"eth_call",params:[{to:e,data:d},"latest"]})}),{result:y}=await g.json();return y?y.slice(0,c.length).toLowerCase()===c.toLowerCase():!1}catch(c){return console.error("isValidEip1271Signature: ",c),!1}}function jo(){return Date.now()+Math.floor(Math.random()*1e3)}var ko=Object.defineProperty,Vo=Object.defineProperties,Do=Object.getOwnPropertyDescriptors,hn=Object.getOwnPropertySymbols,Mo=Object.prototype.hasOwnProperty,Fo=Object.prototype.propertyIsEnumerable,gn=(e,t,n)=>t in e?ko(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,it=(e,t)=>{for(var n in t||(t={}))Mo.call(t,n)&&gn(e,n,t[n]);if(hn)for(var n of hn(t))Fo.call(t,n)&&gn(e,n,t[n]);return e},yn=(e,t)=>Vo(e,Do(t));const Ho="did:pkh:",Ve=e=>e?.split(":"),mn=e=>{const t=e&&Ve(e);if(t)return e.includes(Ho)?t[3]:t[1]},bn=e=>{const t=e&&Ve(e);if(t)return t[2]+":"+t[3]},ct=e=>{const t=e&&Ve(e);if(t)return t.pop()};async function Ko(e){const{cacao:t,projectId:n}=e,{s:r,p:o}=t,s=wn(o,o.iss),i=ct(o.iss);return await ln(i,s,r,bn(o.iss),n)}const wn=(e,t)=>{const n=`${e.domain} wants you to sign in with your Ethereum account:`,r=ct(t);if(!e.aud&&!e.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let o=e.statement||void 0;const s=`URI: ${e.aud||e.uri}`,i=`Version: ${e.version}`,c=`Chain ID: ${mn(t)}`,u=`Nonce: ${e.nonce}`,a=`Issued At: ${e.iat}`,l=e.exp?`Expiration Time: ${e.exp}`:void 0,f=e.nbf?`Not Before: ${e.nbf}`:void 0,d=e.requestId?`Request ID: ${e.requestId}`:void 0,g=e.resources?`Resources:${e.resources.map(p=>`
- ${p}`).join("")}`:void 0,y=Me(e.resources);if(y){const p=re(y);o=ft(o,p)}return[n,r,"",o,"",s,i,c,u,a,l,f,d,g].filter(p=>p!=null).join(`

@@ -4,0 +4,0 @@ `)};function qo(e,t,n){return n.includes("did:pkh:")||(n=`did:pkh:${n}`),{h:{t:"caip122"},p:{iss:n,domain:e.domain,aud:e.aud,version:e.version,nonce:e.nonce,iat:e.iat,statement:e.statement,requestId:e.requestId,resources:e.resources,nbf:e.nbf,exp:e.exp},s:t}}function zo(e){var t;const{authPayload:n,chains:r,methods:o}=e,s=n.statement||"";if(!(r!=null&&r.length))return n;const i=n.chains,c=et(i,r);if(!(c!=null&&c.length))throw new Error("No supported chains");const u=En(n.resources);if(!u)return n;J(u);const a=vn(u,"eip155");let l=n?.resources||[];if(a!=null&&a.length){const f=xn(a),d=et(f,o);if(!(d!=null&&d.length))throw new Error(`Supported methods don't satisfy the requested: ${JSON.stringify(f)}, supported: ${JSON.stringify(o)}`);const g=at("request",d,{chains:c}),y=In(u,"eip155",g);l=((t=n?.resources)==null?void 0:t.slice(0,-1))||[],l.push(De(y))}return yn(it({},n),{statement:Rn(s,Me(l)),chains:c,resources:n!=null&&n.resources||l.length>0?l:void 0})}function En(e){const t=Me(e);if(t&&ut(t))return re(t)}function Go(e,t){var n;return(n=e?.att)==null?void 0:n.hasOwnProperty(t)}function vn(e,t){var n,r;return(n=e?.att)!=null&&n[t]?Object.keys((r=e?.att)==null?void 0:r[t]):[]}function Wo(e){return e?.map(t=>Object.keys(t))||[]}function xn(e){return e?.map(t=>{var n;return(n=t.split("/"))==null?void 0:n[1]})||[]}function An(e){return Buffer.from(JSON.stringify(e)).toString("base64")}function Sn(e){return JSON.parse(Buffer.from(e,"base64").toString("utf-8"))}function J(e){if(!e)throw new Error("No recap provided, value is undefined");if(!e.att)throw new Error("No `att` property found");const t=Object.keys(e.att);if(!(t!=null&&t.length))throw new Error("No resources found in `att` property");t.forEach(n=>{const r=e.att[n];if(Array.isArray(r))throw new Error(`Resource must be an object: ${n}`);if(typeof r!="object")throw new Error(`Resource must be an object: ${n}`);if(!Object.keys(r).length)throw new Error(`Resource object is empty: ${n}`);Object.keys(r).forEach(o=>{const s=r[o];if(!Array.isArray(s))throw new Error(`Ability limits ${o} must be an array of objects, found: ${s}`);if(!s.length)throw new Error(`Value of ${o} is empty array, must be an array with objects`);s.forEach(i=>{if(typeof i!="object")throw new Error(`Ability limits (${o}) must be an array of objects, found: ${i}`)})})})}function Nn(e,t,n,r={}){return n?.sort((o,s)=>o.localeCompare(s)),{att:{[e]:at(t,n,r)}}}function In(e,t,n){var r;return e.att[t]=it({},n),((r=Object.keys(e.att))==null?void 0:r.sort((o,s)=>o.localeCompare(s))).reduce((o,s)=>(o.att[s]=e.att[s],o),{att:{}})}function at(e,t,n={}){t=t?.sort((o,s)=>o.localeCompare(s));const r=t.map(o=>({[`${e}/${o}`]:[n]}));return Object.assign({},...r)}function De(e){return J(e),`urn:recap:${An(e).replace(/=/g,"")}`}function re(e){const t=Sn(e.replace("urn:recap:",""));return J(t),t}function Jo(e,t,n){const r=Nn(e,t,n);return De(r)}function ut(e){return e&&e.includes("urn:recap:")}function Yo(e,t){const n=re(e),r=re(t),o=On(n,r);return De(o)}function On(e,t){J(e),J(t);const n=Object.keys(e.att).concat(Object.keys(t.att)).sort((o,s)=>o.localeCompare(s)),r={att:{}};return n.forEach(o=>{var s,i;Object.keys(((s=e.att)==null?void 0:s[o])||{}).concat(Object.keys(((i=t.att)==null?void 0:i[o])||{})).sort((c,u)=>c.localeCompare(u)).forEach(c=>{var u,a;r.att[o]=yn(it({},r.att[o]),{[c]:((u=e.att[o])==null?void 0:u[c])||((a=t.att[o])==null?void 0:a[c])})})}),r}function ft(e="",t){J(t);const n="I further authorize the stated URI to perform the following actions on my behalf: ";if(e.includes(n))return e;const r=[];let o=0;Object.keys(t.att).forEach(c=>{const u=Object.keys(t.att[c]).map(f=>({ability:f.split("/")[0],action:f.split("/")[1]}));u.sort((f,d)=>f.action.localeCompare(d.action));const a={};u.forEach(f=>{a[f.ability]||(a[f.ability]=[]),a[f.ability].push(f.action)});const l=Object.keys(a).map(f=>(o++,`(${o}) '${f}': '${a[f].join("', '")}' for '${c}'.`));r.push(l.join(", ").replace(".,","."))});const s=r.join(" "),i=`${n}${s}`;return`${e?e+" ":""}${i}`}function Xo(e){var t;const n=re(e);J(n);const r=(t=n.att)==null?void 0:t.eip155;return r?Object.keys(r).map(o=>o.split("/")[1]):[]}function Qo(e){const t=re(e);J(t);const n=[];return Object.values(t.att).forEach(r=>{Object.values(r).forEach(o=>{var s;(s=o?.[0])!=null&&s.chains&&n.push(o[0].chains)})}),[...new Set(n.flat())]}function Rn(e,t){if(!t)return e;const n=re(t);return J(n),ft(e,n)}function Me(e){if(!e)return;const t=e?.[e.length-1];return ut(t)?t:void 0}function lt(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Tn(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function K(e,...t){if(!Tn(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function Un(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Zo(e,t){K(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function _n(e){if(typeof e!="boolean")throw new Error(`boolean expected, not ${e}`)}const oe=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),es=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),ts=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!ts)throw new Error("Non little-endian hardware is not supported");function ns(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function dt(e){if(typeof e=="string")e=ns(e);else if(Tn(e))e=pt(e);else throw new Error("Uint8Array expected, got "+typeof e);return e}function rs(e,t){if(t==null||typeof t!="object")throw new Error("options must be defined");return Object.assign(e,t)}function os(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}const ss=(e,t)=>{function n(r,...o){if(K(r),e.nonceLength!==void 0){const l=o[0];if(!l)throw new Error("nonce / iv required");e.varSizeNonce?K(l):K(l,e.nonceLength)}const s=e.tagLength;s&&o[1]!==void 0&&K(o[1]);const i=t(r,...o),c=(l,f)=>{if(f!==void 0){if(l!==2)throw new Error("cipher output not supported");K(f)}};let u=!1;return{encrypt(l,f){if(u)throw new Error("cannot encrypt() twice with same key + nonce");return u=!0,K(l),c(i.encrypt.length,f),i.encrypt(l,f)},decrypt(l,f){if(K(l),s&&l.length<s)throw new Error("invalid ciphertext length: smaller than tagLength="+s);return c(i.decrypt.length,f),i.decrypt(l,f)}}}return Object.assign(n,e),n};function Cn(e,t,n=!0){if(t===void 0)return new Uint8Array(e);if(t.length!==e)throw new Error("invalid output length, expected "+e+", got: "+t.length);if(n&&!is(t))throw new Error("invalid output, must be aligned");return t}function Pn(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const o=BigInt(32),s=BigInt(4294967295),i=Number(n>>o&s),c=Number(n&s),u=r?4:0,a=r?0:4;e.setUint32(t+u,i,r),e.setUint32(t+a,c,r)}function is(e){return e.byteOffset%4===0}function pt(e){return Uint8Array.from(e)}function ve(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}const $n=e=>Uint8Array.from(e.split("").map(t=>t.charCodeAt(0))),cs=$n("expand 16-byte k"),as=$n("expand 32-byte k"),us=oe(cs),fs=oe(as);function x(e,t){return e<<t|e>>>32-t}function ht(e){return e.byteOffset%4===0}const Fe=64,ls=16,Ln=2**32-1,Bn=new Uint32Array;function ds(e,t,n,r,o,s,i,c){const u=o.length,a=new Uint8Array(Fe),l=oe(a),f=ht(o)&&ht(s),d=f?oe(o):Bn,g=f?oe(s):Bn;for(let y=0;y<u;i++){if(e(t,n,r,l,i,c),i>=Ln)throw new Error("arx: counter overflow");const p=Math.min(Fe,u-y);if(f&&p===Fe){const m=y/4;if(y%4!==0)throw new Error("arx: invalid block position");for(let B=0,b;B<ls;B++)b=m+B,g[b]=d[b]^l[B];y+=Fe;continue}for(let m=0,B;m<p;m++)B=y+m,s[B]=o[B]^a[m];y+=p}}function ps(e,t){const{allowShortKeys:n,extendNonceFn:r,counterLength:o,counterRight:s,rounds:i}=rs({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if(typeof e!="function")throw new Error("core must be a function");return lt(o),lt(i),_n(s),_n(n),(c,u,a,l,f=0)=>{K(c),K(u),K(a);const d=a.length;if(l===void 0&&(l=new Uint8Array(d)),K(l),lt(f),f<0||f>=Ln)throw new Error("arx: counter overflow");if(l.length<d)throw new Error(`arx: output (${l.length}) is shorter than data (${d})`);const g=[];let y=c.length,p,m;if(y===32)g.push(p=pt(c)),m=fs;else if(y===16&&n)p=new Uint8Array(32),p.set(c),p.set(c,16),m=us,g.push(p);else throw new Error(`arx: invalid 32-byte key, got length=${y}`);ht(u)||g.push(u=pt(u));const B=oe(p);if(r){if(u.length!==24)throw new Error("arx: extended nonce must be 24 bytes");r(m,B,oe(u.subarray(0,16)),B),u=u.subarray(16)}const b=16-o;if(b!==u.length)throw new Error(`arx: nonce must be ${b} or 16 bytes`);if(b!==12){const S=new Uint8Array(12);S.set(u,s?0:12-u.length),u=S,g.push(u)}const U=oe(u);return ds(e,m,B,U,a,l,f,i),ve(...g),l}}const M=(e,t)=>e[t++]&255|(e[t++]&255)<<8;class hs{constructor(t){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,t=dt(t),K(t,32);const n=M(t,0),r=M(t,2),o=M(t,4),s=M(t,6),i=M(t,8),c=M(t,10),u=M(t,12),a=M(t,14);this.r[0]=n&8191,this.r[1]=(n>>>13|r<<3)&8191,this.r[2]=(r>>>10|o<<6)&7939,this.r[3]=(o>>>7|s<<9)&8191,this.r[4]=(s>>>4|i<<12)&255,this.r[5]=i>>>1&8190,this.r[6]=(i>>>14|c<<2)&8191,this.r[7]=(c>>>11|u<<5)&8065,this.r[8]=(u>>>8|a<<8)&8191,this.r[9]=a>>>5&127;for(let l=0;l<8;l++)this.pad[l]=M(t,16+2*l)}process(t,n,r=!1){const o=r?0:2048,{h:s,r:i}=this,c=i[0],u=i[1],a=i[2],l=i[3],f=i[4],d=i[5],g=i[6],y=i[7],p=i[8],m=i[9],B=M(t,n+0),b=M(t,n+2),U=M(t,n+4),S=M(t,n+6),V=M(t,n+8),E=M(t,n+10),L=M(t,n+12),j=M(t,n+14);let v=s[0]+(B&8191),A=s[1]+((B>>>13|b<<3)&8191),w=s[2]+((b>>>10|U<<6)&8191),P=s[3]+((U>>>7|S<<9)&8191),I=s[4]+((S>>>4|V<<12)&8191),_=s[5]+(V>>>1&8191),O=s[6]+((V>>>14|E<<2)&8191),R=s[7]+((E>>>11|L<<5)&8191),T=s[8]+((L>>>8|j<<8)&8191),C=s[9]+(j>>>5|o),h=0,k=h+v*c+A*(5*m)+w*(5*p)+P*(5*y)+I*(5*g);h=k>>>13,k&=8191,k+=_*(5*d)+O*(5*f)+R*(5*l)+T*(5*a)+C*(5*u),h+=k>>>13,k&=8191;let D=h+v*u+A*c+w*(5*m)+P*(5*p)+I*(5*y);h=D>>>13,D&=8191,D+=_*(5*g)+O*(5*d)+R*(5*f)+T*(5*l)+C*(5*a),h+=D>>>13,D&=8191;let $=h+v*a+A*u+w*c+P*(5*m)+I*(5*p);h=$>>>13,$&=8191,$+=_*(5*y)+O*(5*g)+R*(5*d)+T*(5*f)+C*(5*l),h+=$>>>13,$&=8191;let z=h+v*l+A*a+w*u+P*c+I*(5*m);h=z>>>13,z&=8191,z+=_*(5*p)+O*(5*y)+R*(5*g)+T*(5*d)+C*(5*f),h+=z>>>13,z&=8191;let Y=h+v*f+A*l+w*a+P*u+I*c;h=Y>>>13,Y&=8191,Y+=_*(5*m)+O*(5*p)+R*(5*y)+T*(5*g)+C*(5*d),h+=Y>>>13,Y&=8191;let X=h+v*d+A*f+w*l+P*a+I*u;h=X>>>13,X&=8191,X+=_*c+O*(5*m)+R*(5*p)+T*(5*y)+C*(5*g),h+=X>>>13,X&=8191;let pe=h+v*g+A*d+w*f+P*l+I*a;h=pe>>>13,pe&=8191,pe+=_*u+O*c+R*(5*m)+T*(5*p)+C*(5*y),h+=pe>>>13,pe&=8191;let he=h+v*y+A*g+w*d+P*f+I*l;h=he>>>13,he&=8191,he+=_*a+O*u+R*c+T*(5*m)+C*(5*p),h+=he>>>13,he&=8191;let ge=h+v*p+A*y+w*g+P*d+I*f;h=ge>>>13,ge&=8191,ge+=_*l+O*a+R*u+T*c+C*(5*m),h+=ge>>>13,ge&=8191;let ye=h+v*m+A*p+w*y+P*g+I*d;h=ye>>>13,ye&=8191,ye+=_*f+O*l+R*a+T*u+C*c,h+=ye>>>13,ye&=8191,h=(h<<2)+h|0,h=h+k|0,k=h&8191,h=h>>>13,D+=h,s[0]=k,s[1]=D,s[2]=$,s[3]=z,s[4]=Y,s[5]=X,s[6]=pe,s[7]=he,s[8]=ge,s[9]=ye}finalize(){const{h:t,pad:n}=this,r=new Uint16Array(10);let o=t[1]>>>13;t[1]&=8191;for(let c=2;c<10;c++)t[c]+=o,o=t[c]>>>13,t[c]&=8191;t[0]+=o*5,o=t[0]>>>13,t[0]&=8191,t[1]+=o,o=t[1]>>>13,t[1]&=8191,t[2]+=o,r[0]=t[0]+5,o=r[0]>>>13,r[0]&=8191;for(let c=1;c<10;c++)r[c]=t[c]+o,o=r[c]>>>13,r[c]&=8191;r[9]-=8192;let s=(o^1)-1;for(let c=0;c<10;c++)r[c]&=s;s=~s;for(let c=0;c<10;c++)t[c]=t[c]&s|r[c];t[0]=(t[0]|t[1]<<13)&65535,t[1]=(t[1]>>>3|t[2]<<10)&65535,t[2]=(t[2]>>>6|t[3]<<7)&65535,t[3]=(t[3]>>>9|t[4]<<4)&65535,t[4]=(t[4]>>>12|t[5]<<1|t[6]<<14)&65535,t[5]=(t[6]>>>2|t[7]<<11)&65535,t[6]=(t[7]>>>5|t[8]<<8)&65535,t[7]=(t[8]>>>8|t[9]<<5)&65535;let i=t[0]+n[0];t[0]=i&65535;for(let c=1;c<8;c++)i=(t[c]+n[c]|0)+(i>>>16)|0,t[c]=i&65535;ve(r)}update(t){Un(this);const{buffer:n,blockLen:r}=this;t=dt(t);const o=t.length;for(let s=0;s<o;){const i=Math.min(r-this.pos,o-s);if(i===r){for(;r<=o-s;s+=r)this.process(t,s);continue}n.set(t.subarray(s,s+i),this.pos),this.pos+=i,s+=i,this.pos===r&&(this.process(n,0,!1),this.pos=0)}return this}destroy(){ve(this.h,this.r,this.buffer,this.pad)}digestInto(t){Un(this),Zo(t,this),this.finished=!0;const{buffer:n,h:r}=this;let{pos:o}=this;if(o){for(n[o++]=1;o<16;o++)n[o]=0;this.process(n,0,!0)}this.finalize();let s=0;for(let i=0;i<8;i++)t[s++]=r[i]>>>0,t[s++]=r[i]>>>8;return t}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}}function gs(e){const t=(r,o)=>e(o).update(dt(r)).digest(),n=e(new Uint8Array(32));return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=r=>e(r),t}const ys=gs(e=>new hs(e));function ms(e,t,n,r,o,s=20){let i=e[0],c=e[1],u=e[2],a=e[3],l=t[0],f=t[1],d=t[2],g=t[3],y=t[4],p=t[5],m=t[6],B=t[7],b=o,U=n[0],S=n[1],V=n[2],E=i,L=c,j=u,v=a,A=l,w=f,P=d,I=g,_=y,O=p,R=m,T=B,C=b,h=U,k=S,D=V;for(let z=0;z<s;z+=2)E=E+A|0,C=x(C^E,16),_=_+C|0,A=x(A^_,12),E=E+A|0,C=x(C^E,8),_=_+C|0,A=x(A^_,7),L=L+w|0,h=x(h^L,16),O=O+h|0,w=x(w^O,12),L=L+w|0,h=x(h^L,8),O=O+h|0,w=x(w^O,7),j=j+P|0,k=x(k^j,16),R=R+k|0,P=x(P^R,12),j=j+P|0,k=x(k^j,8),R=R+k|0,P=x(P^R,7),v=v+I|0,D=x(D^v,16),T=T+D|0,I=x(I^T,12),v=v+I|0,D=x(D^v,8),T=T+D|0,I=x(I^T,7),E=E+w|0,D=x(D^E,16),R=R+D|0,w=x(w^R,12),E=E+w|0,D=x(D^E,8),R=R+D|0,w=x(w^R,7),L=L+P|0,C=x(C^L,16),T=T+C|0,P=x(P^T,12),L=L+P|0,C=x(C^L,8),T=T+C|0,P=x(P^T,7),j=j+I|0,h=x(h^j,16),_=_+h|0,I=x(I^_,12),j=j+I|0,h=x(h^j,8),_=_+h|0,I=x(I^_,7),v=v+A|0,k=x(k^v,16),O=O+k|0,A=x(A^O,12),v=v+A|0,k=x(k^v,8),O=O+k|0,A=x(A^O,7);let $=0;r[$++]=i+E|0,r[$++]=c+L|0,r[$++]=u+j|0,r[$++]=a+v|0,r[$++]=l+A|0,r[$++]=f+w|0,r[$++]=d+P|0,r[$++]=g+I|0,r[$++]=y+_|0,r[$++]=p+O|0,r[$++]=m+R|0,r[$++]=B+T|0,r[$++]=b+C|0,r[$++]=U+h|0,r[$++]=S+k|0,r[$++]=V+D|0}const bs=ps(ms,{counterRight:!1,counterLength:4,allowShortKeys:!1}),ws=new Uint8Array(16),jn=(e,t)=>{e.update(t);const n=t.length%16;n&&e.update(ws.subarray(n))},Es=new Uint8Array(32);function kn(e,t,n,r,o){const s=e(t,n,Es),i=ys.create(s);o&&jn(i,o),jn(i,r);const c=new Uint8Array(16),u=es(c);Pn(u,0,BigInt(o?o.length:0),!0),Pn(u,8,BigInt(r.length),!0),i.update(c);const a=i.digest();return ve(s,c),a}const vs=e=>(t,n,r)=>({encrypt(s,i){const c=s.length;i=Cn(c+16,i,!1),i.set(s);const u=i.subarray(0,-16);e(t,n,u,u,1);const a=kn(e,t,n,u,r);return i.set(a,c),ve(a),i},decrypt(s,i){i=Cn(s.length-16,i,!1);const c=s.subarray(0,-16),u=s.subarray(-16),a=kn(e,t,n,c,r);if(!os(u,a))throw new Error("invalid tag");return i.set(s.subarray(0,-16)),e(t,n,i,i,1),ve(a),i}}),Vn=ss({blockSize:64,nonceLength:12,tagLength:16},vs(bs));class Dn extends ot{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,nt(t);const r=Ee(n);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const o=this.blockLen,s=new Uint8Array(o);s.set(r.length>o?t.create().update(r).digest():r);for(let i=0;i<s.length;i++)s[i]^=54;this.iHash.update(s),this.oHash=t.create();for(let i=0;i<s.length;i++)s[i]^=106;this.oHash.update(s),s.fill(0)}update(t){return be(this),this.iHash.update(t),this}digestInto(t){be(this),je(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:r,finished:o,destroyed:s,blockLen:i,outputLen:c}=this;return t=t,t.finished=o,t.destroyed=s,t.blockLen=i,t.outputLen=c,t.oHash=n._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const gt=(e,t,n)=>new Dn(e,t).update(n).digest();gt.create=(e,t)=>new Dn(e,t);function xs(e,t,n){return nt(e),n===void 0&&(n=new Uint8Array(e.outputLen)),gt(e,Ee(n),Ee(t))}const yt=new Uint8Array([0]),Mn=new Uint8Array;function As(e,t,n,r=32){if(nt(e),Oe(r),r>255*e.outputLen)throw new Error("Length should be <= 255*HashLen");const o=Math.ceil(r/e.outputLen);n===void 0&&(n=Mn);const s=new Uint8Array(o*e.outputLen),i=gt.create(e,t),c=i._cloneInto(),u=new Uint8Array(i.outputLen);for(let a=0;a<o;a++)yt[0]=a+1,c.update(a===0?Mn:u).update(n).update(yt).digestInto(u),s.set(u,e.outputLen*a),i._cloneInto(c);return i.destroy(),c.destroy(),u.fill(0),yt.fill(0),s.slice(0,r)}const Ss=(e,t,n,r,o)=>As(e,xs(e,t,n),r,o);function Ns(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const o=BigInt(32),s=BigInt(4294967295),i=Number(n>>o&s),c=Number(n&s),u=r?4:0,a=r?0:4;e.setUint32(t+u,i,r),e.setUint32(t+a,c,r)}function Is(e,t,n){return e&t^~e&n}function Os(e,t,n){return e&t^e&n^t&n}class Rs extends ot{constructor(t,n,r,o){super(),this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=rt(this.buffer)}update(t){be(this);const{view:n,buffer:r,blockLen:o}=this;t=Ee(t);const s=t.length;for(let i=0;i<s;){const c=Math.min(o-this.pos,s-i);if(c===o){const u=rt(t);for(;o<=s-i;i+=o)this.process(u,i);continue}r.set(t.subarray(i,i+c),this.pos),this.pos+=c,i+=c,this.pos===o&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){be(this),en(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:o,isLE:s}=this;let{pos:i}=this;n[i++]=128,this.buffer.subarray(i).fill(0),this.padOffset>o-i&&(this.process(r,0),i=0);for(let f=i;f<o;f++)n[f]=0;Ns(r,o-8,BigInt(this.length*8),s),this.process(r,0);const c=rt(t),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const a=u/4,l=this.get();if(a>l.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<a;f++)c.setUint32(4*f,l[f],s)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:r,length:o,finished:s,destroyed:i,pos:c}=this;return t.length=o,t.pos=c,t.finished=s,t.destroyed=i,o%n&&t.buffer.set(r),t}}const Ts=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),se=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),ie=new Uint32Array(64);class Us extends Rs{constructor(){super(64,32,8,!1),this.A=se[0]|0,this.B=se[1]|0,this.C=se[2]|0,this.D=se[3]|0,this.E=se[4]|0,this.F=se[5]|0,this.G=se[6]|0,this.H=se[7]|0}get(){const{A:t,B:n,C:r,D:o,E:s,F:i,G:c,H:u}=this;return[t,n,r,o,s,i,c,u]}set(t,n,r,o,s,i,c,u){this.A=t|0,this.B=n|0,this.C=r|0,this.D=o|0,this.E=s|0,this.F=i|0,this.G=c|0,this.H=u|0}process(t,n){for(let f=0;f<16;f++,n+=4)ie[f]=t.getUint32(n,!1);for(let f=16;f<64;f++){const d=ie[f-15],g=ie[f-2],y=W(d,7)^W(d,18)^d>>>3,p=W(g,17)^W(g,19)^g>>>10;ie[f]=p+ie[f-7]+y+ie[f-16]|0}let{A:r,B:o,C:s,D:i,E:c,F:u,G:a,H:l}=this;for(let f=0;f<64;f++){const d=W(c,6)^W(c,11)^W(c,25),g=l+d+Is(c,u,a)+Ts[f]+ie[f]|0,p=(W(r,2)^W(r,13)^W(r,22))+Os(r,o,s)|0;l=a,a=u,u=c,c=i+g|0,i=s,s=o,o=r,r=g+p|0}r=r+this.A|0,o=o+this.B|0,s=s+this.C|0,i=i+this.D|0,c=c+this.E|0,u=u+this.F|0,a=a+this.G|0,l=l+this.H|0,this.set(r,o,s,i,c,u,a,l)}roundClean(){ie.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const He=on(()=>new Us);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Fn=BigInt(0);function mt(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Hn(e){if(!mt(e))throw new Error("Uint8Array expected")}const _s=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Cs(e){Hn(e);let t="";for(let n=0;n<e.length;n++)t+=_s[e[n]];return t}function Ps(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?Fn:BigInt("0x"+e)}const Z={_0:48,_9:57,A:65,F:70,a:97,f:102};function Kn(e){if(e>=Z._0&&e<=Z._9)return e-Z._0;if(e>=Z.A&&e<=Z.F)return e-(Z.A-10);if(e>=Z.a&&e<=Z.f)return e-(Z.a-10)}function qn(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);const t=e.length,n=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let o=0,s=0;o<n;o++,s+=2){const i=Kn(e.charCodeAt(s)),c=Kn(e.charCodeAt(s+1));if(i===void 0||c===void 0){const u=e[s]+e[s+1];throw new Error('hex string expected, got non-hex character "'+u+'" at index '+s)}r[o]=i*16+c}return r}function zn(e){return Hn(e),Ps(Cs(Uint8Array.from(e).reverse()))}function $s(e,t){return qn(e.toString(16).padStart(t*2,"0"))}function Ls(e,t){return $s(e,t).reverse()}function Gn(e,t,n){let r;if(typeof t=="string")try{r=qn(t)}catch(s){throw new Error(e+" must be hex string or Uint8Array, cause: "+s)}else if(mt(t))r=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");const o=r.length;if(typeof n=="number"&&o!==n)throw new Error(e+" of length "+n+" expected, got "+o);return r}const bt=e=>typeof e=="bigint"&&Fn<=e;function Bs(e,t,n){return bt(e)&&bt(t)&&bt(n)&&t<=e&&e<n}function Wn(e,t,n,r){if(!Bs(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}const js={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||mt(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function ks(e,t,n={}){const r=(o,s,i)=>{const c=js[s];if(typeof c!="function")throw new Error("invalid validator function");const u=e[o];if(!(i&&u===void 0)&&!c(u,e))throw new Error("param "+String(o)+" is invalid. Expected "+s+", got "+u)};for(const[o,s]of Object.entries(t))r(o,s,!1);for(const[o,s]of Object.entries(n))r(o,s,!0);return e}const xe=BigInt(0),Ke=BigInt(1);function Jn(e,t){const n=e%t;return n>=xe?n:t+n}function Vs(e,t,n){if(t<xe)throw new Error("invalid exponent, negatives unsupported");if(n<=xe)throw new Error("invalid modulus");if(n===Ke)return xe;let r=Ke;for(;t>xe;)t&Ke&&(r=r*e%n),e=e*e%n,t>>=Ke;return r}function G(e,t,n){let r=e;for(;t-- >xe;)r*=r,r%=n;return r}BigInt(0),BigInt(1),BigInt(0),BigInt(1),BigInt(2),BigInt(8);const Ae=BigInt(0),wt=BigInt(1);function Ds(e){return ks(e,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...e})}function Ms(e){const t=Ds(e),{P:n}=t,r=b=>Jn(b,n),o=t.montgomeryBits,s=Math.ceil(o/8),i=t.nByteLength,c=t.adjustScalarBytes||(b=>b),u=t.powPminus2||(b=>Vs(b,n-BigInt(2),n));function a(b,U,S){const V=r(b*(U-S));return U=r(U-V),S=r(S+V),[U,S]}const l=(t.a-BigInt(2))/BigInt(4);function f(b,U){Wn("u",b,Ae,n),Wn("scalar",U,Ae,n);const S=U,V=b;let E=wt,L=Ae,j=b,v=wt,A=Ae,w;for(let I=BigInt(o-1);I>=Ae;I--){const _=S>>I&wt;A^=_,w=a(A,E,j),E=w[0],j=w[1],w=a(A,L,v),L=w[0],v=w[1],A=_;const O=E+L,R=r(O*O),T=E-L,C=r(T*T),h=R-C,k=j+v,D=j-v,$=r(D*O),z=r(k*T),Y=$+z,X=$-z;j=r(Y*Y),v=r(V*r(X*X)),E=r(R*C),L=r(h*(R+r(l*h)))}w=a(A,E,j),E=w[0],j=w[1],w=a(A,L,v),L=w[0],v=w[1];const P=u(L);return r(E*P)}function d(b){return Ls(r(b),s)}function g(b){const U=Gn("u coordinate",b,s);return i===32&&(U[31]&=127),zn(U)}function y(b){const U=Gn("scalar",b),S=U.length;if(S!==s&&S!==i){let V=""+s+" or "+i;throw new Error("invalid scalar, expected "+V+" bytes, got "+S)}return zn(c(U))}function p(b,U){const S=g(U),V=y(b),E=f(S,V);if(E===Ae)throw new Error("invalid private or public key received");return d(E)}const m=d(t.Gu);function B(b){return p(b,m)}return{scalarMult:p,scalarMultBase:B,getSharedSecret:(b,U)=>p(b,U),getPublicKey:b=>B(b),utils:{randomPrivateKey:()=>t.randomBytes(t.nByteLength)},GuBytes:m}}const Et=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949");BigInt(0);const Fs=BigInt(1),Yn=BigInt(2),Hs=BigInt(3),Ks=BigInt(5);BigInt(8);function qs(e){const t=BigInt(10),n=BigInt(20),r=BigInt(40),o=BigInt(80),s=Et,c=e*e%s*e%s,u=G(c,Yn,s)*c%s,a=G(u,Fs,s)*e%s,l=G(a,Ks,s)*a%s,f=G(l,t,s)*l%s,d=G(f,n,s)*f%s,g=G(d,r,s)*d%s,y=G(g,o,s)*g%s,p=G(y,o,s)*g%s,m=G(p,t,s)*l%s;return{pow_p_5_8:G(m,Yn,s)*e%s,b2:c}}function zs(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}const vt=Ms({P:Et,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:e=>{const t=Et,{pow_p_5_8:n,b2:r}=qs(e);return Jn(G(n,Hs,t)*r,t)},adjustScalarBytes:zs,randomBytes:Re}),xt="base10",F="base16",At="base64pad",Gs="base64url",Se="utf8",St=0,Ne=1,Ue=2,Ws=0,Xn=1,_e=12,Nt=32;function Js(){const e=vt.utils.randomPrivateKey(),t=vt.getPublicKey(e);return{privateKey:N.toString(e,F),publicKey:N.toString(t,F)}}function Ys(){const e=Re(Nt);return N.toString(e,F)}function Xs(e,t){const n=vt.getSharedSecret(N.fromString(e,F),N.fromString(t,F)),r=Ss(He,n,void 0,void 0,Nt);return N.toString(r,F)}function Qs(e){const t=He(N.fromString(e,F));return N.toString(t,F)}function Zs(e){const t=He(N.fromString(e,Se));return N.toString(t,F)}function It(e){return N.fromString(`${e}`,xt)}function fe(e){return Number(N.toString(e,xt))}function ei(e){const t=It(typeof e.type<"u"?e.type:St);if(fe(t)===Ne&&typeof e.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const n=typeof e.senderPublicKey<"u"?N.fromString(e.senderPublicKey,F):void 0,r=typeof e.iv<"u"?N.fromString(e.iv,F):Re(_e),o=N.fromString(e.symKey,F),s=Vn(o,r).encrypt(N.fromString(e.message,Se));return Ot({type:t,sealed:s,iv:r,senderPublicKey:n,encoding:e.encoding})}function ti(e){const t=N.fromString(e.symKey,F),{sealed:n,iv:r}=qe(e),o=Vn(t,r).decrypt(n);if(o===null)throw new Error("Failed to decrypt");return N.toString(o,Se)}function ni(e,t){const n=It(Ue),r=Re(_e),o=N.fromString(e,Se);return Ot({type:n,sealed:o,iv:r,encoding:t})}function ri(e,t){const{sealed:n}=qe({encoded:e,encoding:t});return N.toString(n,Se)}function Ot(e){const{encoding:t=At}=e;if(fe(e.type)===Ue)return N.toString(N.concat([e.type,e.sealed]),t);if(fe(e.type)===Ne){if(typeof e.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return N.toString(N.concat([e.type,e.senderPublicKey,e.iv,e.sealed]),t)}return N.toString(N.concat([e.type,e.iv,e.sealed]),t)}function qe(e){const{encoded:t,encoding:n=At}=e,r=N.fromString(t,n),o=r.slice(Ws,Xn),s=Xn;if(fe(o)===Ne){const a=s+Nt,l=a+_e,f=r.slice(s,a),d=r.slice(a,l),g=r.slice(l);return{type:o,sealed:g,iv:d,senderPublicKey:f}}if(fe(o)===Ue){const a=r.slice(s),l=Re(_e);return{type:o,sealed:a,iv:l}}const i=s+_e,c=r.slice(s,i),u=r.slice(i);return{type:o,sealed:u,iv:c}}function oi(e,t){const n=qe({encoded:e,encoding:t?.encoding});return Qn({type:fe(n.type),senderPublicKey:typeof n.senderPublicKey<"u"?N.toString(n.senderPublicKey,F):void 0,receiverPublicKey:t?.receiverPublicKey})}function Qn(e){const t=e?.type||St;if(t===Ne){if(typeof e?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof e?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:t,senderPublicKey:e?.senderPublicKey,receiverPublicKey:e?.receiverPublicKey}}function si(e){return e.type===Ne&&typeof e.senderPublicKey=="string"&&typeof e.receiverPublicKey=="string"}function ii(e){return e.type===Ue}function Zn(e){return new Cr.ec("p256").keyFromPublic({x:Buffer.from(e.x,"base64").toString("hex"),y:Buffer.from(e.y,"base64").toString("hex")},"hex")}function ci(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");const n=t.length%4;return n>0&&(t+="=".repeat(4-n)),t}function ai(e){return Buffer.from(ci(e),"base64")}function ui(e,t){const[n,r,o]=e.split("."),s=ai(o);if(s.length!==64)throw new Error("Invalid signature length");const i=s.slice(0,32).toString("hex"),c=s.slice(32,64).toString("hex"),u=`${n}.${r}`,a=He(u),l=Zn(t),f=N.toString(a,F);if(!l.verify(f,{r:i,s:c}))throw new Error("Invalid signature");return _r.decodeJWT(e).payload}const er="irn";function fi(e){return e?.relay||{protocol:er}}function li(e){const t=Pr.RELAY_JSONRPC[e];if(typeof t>"u")throw new Error(`Relay Protocol not supported: ${e}`);return t}function tr(e,t="-"){const n={},r="relay"+t;return Object.keys(e).forEach(o=>{if(o.startsWith(r)){const s=o.replace(r,""),i=e[o];n[s]=i}}),n}function di(e){if(!e.includes("wc:")){const a=tt(e);a!=null&&a.includes("wc:")&&(e=a)}e=e.includes("wc://")?e.replace("wc://",""):e,e=e.includes("wc:")?e.replace("wc:",""):e;const t=e.indexOf(":"),n=e.indexOf("?")!==-1?e.indexOf("?"):void 0,r=e.substring(0,t),o=e.substring(t+1,n).split("@"),s=typeof n<"u"?e.substring(n):"",i=new URLSearchParams(s),c={};i.forEach((a,l)=>{c[l]=a});const u=typeof c.methods=="string"?c.methods.split(","):void 0;return{protocol:r,topic:nr(o[0]),version:parseInt(o[1],10),symKey:c.symKey,relay:tr(c),methods:u,expiryTimestamp:c.expiryTimestamp?parseInt(c.expiryTimestamp,10):void 0}}function nr(e){return e.startsWith("//")?e.substring(2):e}function rr(e,t="-"){const n="relay",r={};return Object.keys(e).forEach(o=>{const s=n+t+o;e[o]&&(r[s]=e[o])}),r}function pi(e){const t=new URLSearchParams,n=rr(e.relay);Object.keys(n).sort().forEach(o=>{t.set(o,n[o])}),t.set("symKey",e.symKey),e.expiryTimestamp&&t.set("expiryTimestamp",e.expiryTimestamp.toString()),e.methods&&t.set("methods",e.methods.join(","));const r=t.toString();return`${e.protocol}:${e.topic}@${e.version}?${r}`}function hi(e,t,n){return`${e}?wc_ev=${n}&topic=${t}`}var gi=Object.defineProperty,yi=Object.defineProperties,mi=Object.getOwnPropertyDescriptors,or=Object.getOwnPropertySymbols,bi=Object.prototype.hasOwnProperty,wi=Object.prototype.propertyIsEnumerable,sr=(e,t,n)=>t in e?gi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ei=(e,t)=>{for(var n in t||(t={}))bi.call(t,n)&&sr(e,n,t[n]);if(or)for(var n of or(t))wi.call(t,n)&&sr(e,n,t[n]);return e},vi=(e,t)=>yi(e,mi(t));function le(e){const t=[];return e.forEach(n=>{const[r,o]=n.split(":");t.push(`${r}:${o}`)}),t}function ir(e){const t=[];return Object.values(e).forEach(n=>{t.push(...le(n.accounts))}),t}function cr(e,t){const n=[];return Object.values(e).forEach(r=>{le(r.accounts).includes(t)&&n.push(...r.methods)}),n}function ar(e,t){const n=[];return Object.values(e).forEach(r=>{le(r.accounts).includes(t)&&n.push(...r.events)}),n}function xi(e,t){const n=wr(e,t);if(n)throw new Error(n.message);const r={};for(const[o,s]of Object.entries(e))r[o]={methods:s.methods,events:s.events,chains:s.accounts.map(i=>`${i.split(":")[0]}:${i.split(":")[1]}`)};return r}function Ai(e){const{proposal:{requiredNamespaces:t,optionalNamespaces:n={}},supportedNamespaces:r}=e,o=Tt(t),s=Tt(n),i={};Object.keys(r).forEach(a=>{const l=r[a].chains,f=r[a].methods,d=r[a].events,g=r[a].accounts;l.forEach(y=>{if(!g.some(p=>p.includes(y)))throw new Error(`No accounts provided for chain ${y} in namespace ${a}`)}),i[a]={chains:l,methods:f,events:d,accounts:g}});const c=vr(t,i,"approve()");if(c)throw new Error(c.message);const u={};return!Object.keys(t).length&&!Object.keys(n).length?i:(Object.keys(o).forEach(a=>{const l=r[a].chains.filter(y=>{var p,m;return(m=(p=o[a])==null?void 0:p.chains)==null?void 0:m.includes(y)}),f=r[a].methods.filter(y=>{var p,m;return(m=(p=o[a])==null?void 0:p.methods)==null?void 0:m.includes(y)}),d=r[a].events.filter(y=>{var p,m;return(m=(p=o[a])==null?void 0:p.events)==null?void 0:m.includes(y)}),g=l.map(y=>r[a].accounts.filter(p=>p.includes(`${y}:`))).flat();u[a]={chains:l,methods:f,events:d,accounts:g}}),Object.keys(s).forEach(a=>{var l,f,d,g,y,p;if(!r[a])return;const m=(f=(l=s[a])==null?void 0:l.chains)==null?void 0:f.filter(S=>r[a].chains.includes(S)),B=r[a].methods.filter(S=>{var V,E;return(E=(V=s[a])==null?void 0:V.methods)==null?void 0:E.includes(S)}),b=r[a].events.filter(S=>{var V,E;return(E=(V=s[a])==null?void 0:V.events)==null?void 0:E.includes(S)}),U=m?.map(S=>r[a].accounts.filter(V=>V.includes(`${S}:`))).flat();u[a]={chains:Q((d=u[a])==null?void 0:d.chains,m),methods:Q((g=u[a])==null?void 0:g.methods,B),events:Q((y=u[a])==null?void 0:y.events,b),accounts:Q((p=u[a])==null?void 0:p.accounts,U)}}),u)}function Rt(e){return e.includes(":")}function ur(e){return Rt(e)?e.split(":")[0]:e}function Tt(e){var t,n,r;const o={};if(!ze(e))return o;for(const[s,i]of Object.entries(e)){const c=Rt(s)?[s]:i.chains,u=i.methods||[],a=i.events||[],l=ur(s);o[l]=vi(Ei({},o[l]),{chains:Q(c,(t=o[l])==null?void 0:t.chains),methods:Q(u,(n=o[l])==null?void 0:n.methods),events:Q(a,(r=o[l])==null?void 0:r.events)})}return o}function fr(e){const t={};return e?.forEach(n=>{const[r,o]=n.split(":");t[r]||(t[r]={accounts:[],chains:[],events:[]}),t[r].accounts.push(n),t[r].chains.push(`${r}:${o}`)}),t}function Si(e,t){t=t.map(r=>r.replace("did:pkh:",""));const n=fr(t);for(const[r,o]of Object.entries(n))o.methods?o.methods=Q(o.methods,e):o.methods=e,o.events=["chainChanged","accountsChanged"];return n}const lr={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},dr={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function ee(e,t){const{message:n,code:r}=dr[e];return{message:t?`${n} ${t}`:n,code:r}}function de(e,t){const{message:n,code:r}=lr[e];return{message:t?`${n} ${t}`:n,code:r}}function Ce(e,t){return Array.isArray(e)?typeof t<"u"&&e.length?e.every(t):!0:!1}function ze(e){return Object.getPrototypeOf(e)===Object.prototype&&Object.keys(e).length}function ce(e){return typeof e>"u"}function q(e,t){return t&&ce(e)?!0:typeof e=="string"&&!!e.trim().length}function Ge(e,t){return t&&ce(e)?!0:typeof e=="number"&&!isNaN(e)}function Ni(e,t){const{requiredNamespaces:n}=t,r=Object.keys(e.namespaces),o=Object.keys(n);let s=!0;return ne(o,r)?(r.forEach(i=>{const{accounts:c,methods:u,events:a}=e.namespaces[i],l=le(c),f=n[i];(!ne(Le(i,f),l)||!ne(f.methods,u)||!ne(f.events,a))&&(s=!1)}),s):!1}function Pe(e){return q(e,!1)&&e.includes(":")?e.split(":").length===2:!1}function pr(e){if(q(e,!1)&&e.includes(":")){const t=e.split(":");if(t.length===3){const n=t[0]+":"+t[1];return!!t[2]&&Pe(n)}}return!1}function Ii(e){function t(n){try{return typeof new URL(n)<"u"}catch{return!1}}try{if(q(e,!1)){if(t(e))return!0;const n=tt(e);return t(n)}}catch{}return!1}function Oi(e){var t;return(t=e?.proposer)==null?void 0:t.publicKey}function Ri(e){return e?.topic}function Ti(e,t){let n=null;return q(e?.publicKey,!1)||(n=ee("MISSING_OR_INVALID",`${t} controller public key should be a string`)),n}function Ut(e){let t=!0;return Ce(e)?e.length&&(t=e.every(n=>q(n,!1))):t=!1,t}function hr(e,t,n){let r=null;return Ce(t)&&t.length?t.forEach(o=>{r||Pe(o)||(r=de("UNSUPPORTED_CHAINS",`${n}, chain ${o} should be a string and conform to "namespace:chainId" format`))}):Pe(e)||(r=de("UNSUPPORTED_CHAINS",`${n}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),r}function gr(e,t,n){let r=null;return Object.entries(e).forEach(([o,s])=>{if(r)return;const i=hr(o,Le(o,s),`${t} ${n}`);i&&(r=i)}),r}function yr(e,t){let n=null;return Ce(e)?e.forEach(r=>{n||pr(r)||(n=de("UNSUPPORTED_ACCOUNTS",`${t}, account ${r} should be a string and conform to "namespace:chainId:address" format`))}):n=de("UNSUPPORTED_ACCOUNTS",`${t}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),n}function mr(e,t){let n=null;return Object.values(e).forEach(r=>{if(n)return;const o=yr(r?.accounts,`${t} namespace`);o&&(n=o)}),n}function br(e,t){let n=null;return Ut(e?.methods)?Ut(e?.events)||(n=de("UNSUPPORTED_EVENTS",`${t}, events should be an array of strings or empty array for no events`)):n=de("UNSUPPORTED_METHODS",`${t}, methods should be an array of strings or empty array for no methods`),n}function _t(e,t){let n=null;return Object.values(e).forEach(r=>{if(n)return;const o=br(r,`${t}, namespace`);o&&(n=o)}),n}function Ui(e,t,n){let r=null;if(e&&ze(e)){const o=_t(e,t);o&&(r=o);const s=gr(e,t,n);s&&(r=s)}else r=ee("MISSING_OR_INVALID",`${t}, ${n} should be an object with data`);return r}function wr(e,t){let n=null;if(e&&ze(e)){const r=_t(e,t);r&&(n=r);const o=mr(e,t);o&&(n=o)}else n=ee("MISSING_OR_INVALID",`${t}, namespaces should be an object with data`);return n}function Er(e){return q(e.protocol,!0)}function _i(e,t){let n=!1;return t&&!e?n=!0:e&&Ce(e)&&e.length&&e.forEach(r=>{n=Er(r)}),n}function Ci(e){return typeof e=="number"}function Pi(e){return typeof e<"u"&&typeof e!==null}function $i(e){return!(!e||typeof e!="object"||!e.code||!Ge(e.code,!1)||!e.message||!q(e.message,!1))}function Li(e){return!(ce(e)||!q(e.method,!1))}function Bi(e){return!(ce(e)||ce(e.result)&&ce(e.error)||!Ge(e.id,!1)||!q(e.jsonrpc,!1))}function ji(e){return!(ce(e)||!q(e.name,!1))}function ki(e,t){return!(!Pe(t)||!ir(e).includes(t))}function Vi(e,t,n){return q(n,!1)?cr(e,t).includes(n):!1}function Di(e,t,n){return q(n,!1)?ar(e,t).includes(n):!1}function vr(e,t,n){let r=null;const o=Mi(e),s=Fi(t),i=Object.keys(o),c=Object.keys(s),u=xr(Object.keys(e)),a=xr(Object.keys(t)),l=u.filter(f=>!a.includes(f));return l.length&&(r=ee("NON_CONFORMING_NAMESPACES",`${n} namespaces keys don't satisfy requiredNamespaces.

@@ -1,3 +0,3 @@

import{detect as Pr}from"detect-browser";import{toMiliseconds as We,FIVE_MINUTES as jt,fromMiliseconds as Lr}from"@walletconnect/time";import{getDocument as ze,getNavigator as Ct,getLocation as kt}from"@walletconnect/window-getters";import{getWindowMetadata as Br}from"@walletconnect/window-metadata";import{recoverAddress as jr}from"viem";import{decodeJWT as Cr}from"@walletconnect/relay-auth";import{toString as K,fromString as W,concat as Je}from"uint8arrays";import{ec as kr}from"elliptic";import{RELAY_JSONRPC as Dr}from"@walletconnect/relay-api";const Pe=":";function Ye(e){const[t,n]=e.split(Pe);return{namespace:t,reference:n}}function Dt(e){const{namespace:t,reference:n}=e;return[t,n].join(Pe)}function Xe(e){const[t,n,r]=e.split(Pe);return{namespace:t,reference:n,address:r}}function Mt(e){const{namespace:t,reference:n,address:r}=e;return[t,n,r].join(Pe)}function Ze(e,t){const n=[];return e.forEach(r=>{const o=t(r);n.includes(o)||n.push(o)}),n}function Vt(e){const{address:t}=Xe(e);return t}function Ht(e){const{namespace:t,reference:n}=Xe(e);return Dt({namespace:t,reference:n})}function Mr(e,t){const{namespace:n,reference:r}=Ye(t);return Mt({namespace:n,reference:r,address:e})}function Vr(e){return Ze(e,Vt)}function Kt(e){return Ze(e,Ht)}function Hr(e,t=[]){const n=[];return Object.keys(e).forEach(r=>{if(t.length&&!t.includes(r))return;const o=e[r];n.push(...o.accounts)}),n}function Kr(e,t=[]){const n=[];return Object.keys(e).forEach(r=>{if(t.length&&!t.includes(r))return;const o=e[r];n.push(...Kt(o.accounts))}),n}function Fr(e,t=[]){const n=[];return Object.keys(e).forEach(r=>{if(t.length&&!t.includes(r))return;const o=e[r];n.push(...Le(r,o))}),n}function Le(e,t){return e.includes(":")?[e]:t.chains||[]}const Ft="ReactNative",H={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},Be=" ",qr=":",qt="/",Qe=2,Gr=1e3,Gt="js";function et(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function ne(){return!ze()&&!!Ct()&&navigator.product===Ft}function Wr(){return ne()&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"&&(global==null?void 0:global.Platform.OS)==="android"}function zr(){return ne()&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"&&(global==null?void 0:global.Platform.OS)==="ios"}function Ae(){return!et()&&!!Ct()&&!!ze()}function ue(){return ne()?H.reactNative:et()?H.node:Ae()?H.browser:H.unknown}function Jr(){var e;try{return ne()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(e=global.Application)==null?void 0:e.applicationId:void 0}catch{return}}function Wt(e,t){const n=new URLSearchParams(e);for(const r of Object.keys(t).sort())if(t.hasOwnProperty(r)){const o=t[r];o!==void 0&&n.set(r,o)}return n.toString()}function Yr(){return Br()||{name:"",description:"",url:"",icons:[""]}}function Xr(e,t){var n;const r=ue(),o={protocol:e,version:t,env:r};return r==="browser"&&(o.host=((n=kt())==null?void 0:n.host)||"unknown"),o}function zt(){if(ue()===H.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:n,Version:r}=global.Platform;return[n,r].join("-")}const e=Pr();if(e===null)return"unknown";const t=e.os?e.os.replace(" ","").toLowerCase():"unknown";return e.type==="browser"?[t,e.name,e.version].join("-"):[t,e.version].join("-")}function Jt(){var e;const t=ue();return t===H.browser?[t,((e=kt())==null?void 0:e.host)||"unknown"].join(":"):t}function Yt(e,t,n){const r=zt(),o=Jt();return[[e,t].join("-"),[Gt,n].join("-"),r,o].join("/")}function Zr({protocol:e,version:t,relayUrl:n,sdkVersion:r,auth:o,projectId:s,useOnCloseEvent:i,bundleId:c,packageName:u}){const a=n.split("?"),l=Yt(e,t,r),f={auth:o,ua:l,projectId:s,useOnCloseEvent:i||void 0,packageName:u||void 0,bundleId:c||void 0},d=Wt(a[1]||"",f);return a[0]+"?"+d}function Qr(e){let t=(e.match(/^[^:]+(?=:\/\/)/gi)||[])[0];const n=typeof t<"u"?e.split("://")[1]:e;return t=t==="wss"?"https":"http",[t,n].join("://")}function eo(e,t,n){if(!e[t]||typeof e[t]!==n)throw new Error(`Missing or invalid "${t}" param`)}function Xt(e,t=Qe){return Zt(e.split(qt),t)}function to(e){return Xt(e).join(Be)}function re(e,t){return e.filter(n=>t.includes(n)).length===e.length}function Zt(e,t=Qe){return e.slice(Math.max(e.length-t,0))}function no(e){return Object.fromEntries(e.entries())}function ro(e){return new Map(Object.entries(e))}function oo(e,t){const n={};return Object.keys(e).forEach(r=>{n[r]=t(e[r])}),n}const so=e=>e;function Qt(e){return e.trim().replace(/^\w/,t=>t.toUpperCase())}function io(e){return e.split(Be).map(t=>Qt(t)).join(Be)}function co(e=jt,t){const n=We(e||jt);let r,o,s,i;return{resolve:c=>{s&&r&&(clearTimeout(s),r(c),i=Promise.resolve(c))},reject:c=>{s&&o&&(clearTimeout(s),o(c))},done:()=>new Promise((c,u)=>{if(i)return c(i);s=setTimeout(()=>{const a=new Error(t);i=Promise.reject(a),u(a)},n),r=c,o=u})}}function ao(e,t,n){return new Promise(async(r,o)=>{const s=setTimeout(()=>o(new Error(n)),t);try{const i=await e;r(i)}catch(i){o(i)}clearTimeout(s)})}function tt(e,t){if(typeof t=="string"&&t.startsWith(`${e}:`))return t;if(e.toLowerCase()==="topic"){if(typeof t!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${t}`}else if(e.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: ${e}`)}function uo(e){return tt("topic",e)}function fo(e){return tt("id",e)}function lo(e){const[t,n]=e.split(":"),r={id:void 0,topic:void 0};if(t==="topic"&&typeof n=="string")r.topic=n;else if(t==="id"&&Number.isInteger(Number(n)))r.id=Number(n);else throw new Error(`Invalid target, expected id:number or topic:string, got ${t}:${n}`);return r}function ho(e,t){return Lr((t||Date.now())+We(e))}function po(e){return Date.now()>=We(e)}function go(e,t){return`${e}${t?`:${t}`:""}`}function Q(e=[],t=[]){return[...new Set([...e,...t])]}async function yo({id:e,topic:t,wcDeepLink:n}){var r;try{if(!n)return;const o=typeof n=="string"?JSON.parse(n):n,s=o?.href;if(typeof s!="string")return;const i=en(s,e,t),c=ue();if(c===H.browser){if(!((r=ze())!=null&&r.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}tn(i)}else c===H.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(i)}catch(o){console.error(o)}}function en(e,t,n){const r=`requestId=${t}&sessionTopic=${n}`;e.endsWith("/")&&(e=e.slice(0,-1));let o=`${e}`;if(e.startsWith("https://t.me")){const s=e.includes("?")?"&startapp=":"?startapp=";o=`${o}${s}${on(r,!0)}`}else o=`${o}/wc?${r}`;return o}function tn(e){let t="_self";rn()?t="_top":(nn()||e.startsWith("https://")||e.startsWith("http://"))&&(t="_blank"),window.open(e,t,"noreferrer noopener")}async function mo(e,t){let n="";try{if(Ae()&&(n=localStorage.getItem(t),n))return n;n=await e.getItem(t)}catch(r){console.error(r)}return n}function nt(e,t){return e.filter(n=>t.includes(n))}function bo(e,t){if(!e.includes(t))return null;const n=e.split(/([&,?,=])/),r=n.indexOf(t);return n[r+2]}function wo(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function Eo(){return typeof process<"u"&&process.env.IS_VITEST==="true"}function nn(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function rn(){try{return window.self!==window.top}catch{return!1}}function on(e,t=!1){const n=Buffer.from(e).toString("base64");return t?n.replace(/[=]/g,""):n}function rt(e){return Buffer.from(e,"base64").toString("utf-8")}function vo(e){return new Promise(t=>setTimeout(t,e))}function Ne(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function xo(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function je(e,...t){if(!xo(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function ot(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Ne(e.outputLen),Ne(e.blockLen)}function me(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function sn(e,t){je(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}const Ce=BigInt(2**32-1),cn=BigInt(32);function Oo(e,t=!1){return t?{h:Number(e&Ce),l:Number(e>>cn&Ce)}:{h:Number(e>>cn&Ce)|0,l:Number(e&Ce)|0}}function Io(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let o=0;o<e.length;o++){const{h:s,l:i}=Oo(e[o],t);[n[o],r[o]]=[s,i]}return[n,r]}const Ao=(e,t,n)=>e<<n|t>>>32-n,No=(e,t,n)=>t<<n|e>>>32-n,So=(e,t,n)=>t<<n-32|e>>>64-n,Uo=(e,t,n)=>e<<n-32|t>>>64-n,be=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function _o(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function st(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function J(e,t){return e<<32-t|e>>>t}const an=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function To(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function un(e){for(let t=0;t<e.length;t++)e[t]=To(e[t])}function $o(e){if(typeof e!="string")throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function we(e){return typeof e=="string"&&(e=$o(e)),je(e),e}class it{clone(){return this._cloneInto()}}function fn(e){const t=r=>e().update(we(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function Se(e=32){if(be&&typeof be.getRandomValues=="function")return be.getRandomValues(new Uint8Array(e));if(be&&typeof be.randomBytes=="function")return be.randomBytes(e);throw new Error("crypto.getRandomValues must be defined")}const ln=[],dn=[],hn=[],Ro=BigInt(0),Ue=BigInt(1),Po=BigInt(2),Lo=BigInt(7),Bo=BigInt(256),jo=BigInt(113);for(let e=0,t=Ue,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],ln.push(2*(5*r+n)),dn.push((e+1)*(e+2)/2%64);let o=Ro;for(let s=0;s<7;s++)t=(t<<Ue^(t>>Lo)*jo)%Bo,t&Po&&(o^=Ue<<(Ue<<BigInt(s))-Ue);hn.push(o)}const[Co,ko]=Io(hn,!0),pn=(e,t,n)=>n>32?So(e,t,n):Ao(e,t,n),gn=(e,t,n)=>n>32?Uo(e,t,n):No(e,t,n);function Do(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let i=0;i<10;i++)n[i]=e[i]^e[i+10]^e[i+20]^e[i+30]^e[i+40];for(let i=0;i<10;i+=2){const c=(i+8)%10,u=(i+2)%10,a=n[u],l=n[u+1],f=pn(a,l,1)^n[c],d=gn(a,l,1)^n[c+1];for(let g=0;g<50;g+=10)e[i+g]^=f,e[i+g+1]^=d}let o=e[2],s=e[3];for(let i=0;i<24;i++){const c=dn[i],u=pn(o,s,c),a=gn(o,s,c),l=ln[i];o=e[l],s=e[l+1],e[l]=u,e[l+1]=a}for(let i=0;i<50;i+=10){for(let c=0;c<10;c++)n[c]=e[i+c];for(let c=0;c<10;c++)e[i+c]^=~n[(c+2)%10]&n[(c+4)%10]}e[0]^=Co[r],e[1]^=ko[r]}n.fill(0)}class Bt extends it{constructor(t,n,r,o=!1,s=24){if(super(),this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=o,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Ne(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=_o(this.state)}keccak(){an||un(this.state32),Do(this.state32,this.rounds),an||un(this.state32),this.posOut=0,this.pos=0}update(t){me(this);const{blockLen:n,state:r}=this;t=we(t);const o=t.length;for(let s=0;s<o;){const i=Math.min(n-this.pos,o-s);for(let c=0;c<i;c++)r[this.pos++]^=t[s++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:r,blockLen:o}=this;t[r]^=n,(n&128)!==0&&r===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){me(this,!1),je(t),this.finish();const n=this.state,{blockLen:r}=this;for(let o=0,s=t.length;o<s;){this.posOut>=r&&this.keccak();const i=Math.min(r-this.posOut,s-o);t.set(n.subarray(this.posOut,this.posOut+i),o),this.posOut+=i,o+=i}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Ne(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(sn(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:o,rounds:s,enableXOF:i}=this;return t||(t=new Bt(n,r,o,i,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=r,t.outputLen=o,t.enableXOF=i,t.destroyed=this.destroyed,t}}const Mo=(e,t,n)=>fn(()=>new Bt(t,e,n)),Vo=Mo(1,136,256/8),Ho="https://rpc.walletconnect.org/v1";function ct(e){const t=`Ethereum Signed Message:
${e.length}`,n=new TextEncoder().encode(t+e);return"0x"+Buffer.from(Vo(n)).toString("hex")}async function yn(e,t,n,r,o,s){switch(n.t){case"eip191":return await mn(e,t,n.s);case"eip1271":return await bn(e,t,n.s,r,o,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${n.t}`)}}async function mn(e,t,n){const r=await jr({hash:ct(t),signature:n});return console.log("recoveredAddress: ",r),r.toLowerCase()===e.toLowerCase()}async function bn(e,t,n,r,o,s){const i=Ye(r);if(!i.namespace||!i.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${r}`);try{const c="0x1626ba7e",u="0000000000000000000000000000000000000000000000000000000000000040",a="0000000000000000000000000000000000000000000000000000000000000041",l=n.substring(2),f=ct(t).substring(2),d=c+f+u+a+l,g=await fetch(`${s||Ho}/?chainId=${r}&projectId=${o}`,{method:"POST",body:JSON.stringify({id:Ko(),jsonrpc:"2.0",method:"eth_call",params:[{to:e,data:d},"latest"]})}),{result:y}=await g.json();return y?y.slice(0,c.length).toLowerCase()===c.toLowerCase():!1}catch(c){return console.error("isValidEip1271Signature: ",c),!1}}function Ko(){return Date.now()+Math.floor(Math.random()*1e3)}var Fo=Object.defineProperty,qo=Object.defineProperties,Go=Object.getOwnPropertyDescriptors,wn=Object.getOwnPropertySymbols,Wo=Object.prototype.hasOwnProperty,zo=Object.prototype.propertyIsEnumerable,En=(e,t,n)=>t in e?Fo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,at=(e,t)=>{for(var n in t||(t={}))Wo.call(t,n)&&En(e,n,t[n]);if(wn)for(var n of wn(t))zo.call(t,n)&&En(e,n,t[n]);return e},vn=(e,t)=>qo(e,Go(t));const Jo="did:pkh:",ke=e=>e?.split(":"),xn=e=>{const t=e&&ke(e);if(t)return e.includes(Jo)?t[3]:t[1]},On=e=>{const t=e&&ke(e);if(t)return t[2]+":"+t[3]},ut=e=>{const t=e&&ke(e);if(t)return t.pop()};async function Yo(e){const{cacao:t,projectId:n}=e,{s:r,p:o}=t,s=In(o,o.iss),i=ut(o.iss);return await yn(i,s,r,On(o.iss),n)}const In=(e,t)=>{const n=`${e.domain} wants you to sign in with your Ethereum account:`,r=ut(t);if(!e.aud&&!e.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let o=e.statement||void 0;const s=`URI: ${e.aud||e.uri}`,i=`Version: ${e.version}`,c=`Chain ID: ${xn(t)}`,u=`Nonce: ${e.nonce}`,a=`Issued At: ${e.iat}`,l=e.exp?`Expiration Time: ${e.exp}`:void 0,f=e.nbf?`Not Before: ${e.nbf}`:void 0,d=e.requestId?`Request ID: ${e.requestId}`:void 0,g=e.resources?`Resources:${e.resources.map(h=>`
import{detect as Pr}from"detect-browser";import{toMiliseconds as We,FIVE_MINUTES as jt,fromMiliseconds as Lr}from"@walletconnect/time";import{getDocument as ze,getNavigator as Ct,getLocation as kt}from"@walletconnect/window-getters";import{getWindowMetadata as Br}from"@walletconnect/window-metadata";import{recoverAddress as jr}from"@ethersproject/transactions";import{decodeJWT as Cr}from"@walletconnect/relay-auth";import{toString as K,fromString as W,concat as Je}from"uint8arrays";import{ec as kr}from"elliptic";import{RELAY_JSONRPC as Dr}from"@walletconnect/relay-api";const Pe=":";function Ye(e){const[t,n]=e.split(Pe);return{namespace:t,reference:n}}function Dt(e){const{namespace:t,reference:n}=e;return[t,n].join(Pe)}function Xe(e){const[t,n,r]=e.split(Pe);return{namespace:t,reference:n,address:r}}function Mt(e){const{namespace:t,reference:n,address:r}=e;return[t,n,r].join(Pe)}function Ze(e,t){const n=[];return e.forEach(r=>{const o=t(r);n.includes(o)||n.push(o)}),n}function Vt(e){const{address:t}=Xe(e);return t}function Ht(e){const{namespace:t,reference:n}=Xe(e);return Dt({namespace:t,reference:n})}function Mr(e,t){const{namespace:n,reference:r}=Ye(t);return Mt({namespace:n,reference:r,address:e})}function Vr(e){return Ze(e,Vt)}function Kt(e){return Ze(e,Ht)}function Hr(e,t=[]){const n=[];return Object.keys(e).forEach(r=>{if(t.length&&!t.includes(r))return;const o=e[r];n.push(...o.accounts)}),n}function Kr(e,t=[]){const n=[];return Object.keys(e).forEach(r=>{if(t.length&&!t.includes(r))return;const o=e[r];n.push(...Kt(o.accounts))}),n}function Fr(e,t=[]){const n=[];return Object.keys(e).forEach(r=>{if(t.length&&!t.includes(r))return;const o=e[r];n.push(...Le(r,o))}),n}function Le(e,t){return e.includes(":")?[e]:t.chains||[]}const Ft="ReactNative",H={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},Be=" ",qr=":",qt="/",Qe=2,Gr=1e3,Gt="js";function et(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function ne(){return!ze()&&!!Ct()&&navigator.product===Ft}function Wr(){return ne()&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"&&(global==null?void 0:global.Platform.OS)==="android"}function zr(){return ne()&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"&&(global==null?void 0:global.Platform.OS)==="ios"}function Ae(){return!et()&&!!Ct()&&!!ze()}function ue(){return ne()?H.reactNative:et()?H.node:Ae()?H.browser:H.unknown}function Jr(){var e;try{return ne()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(e=global.Application)==null?void 0:e.applicationId:void 0}catch{return}}function Wt(e,t){const n=new URLSearchParams(e);for(const r of Object.keys(t).sort())if(t.hasOwnProperty(r)){const o=t[r];o!==void 0&&n.set(r,o)}return n.toString()}function Yr(){return Br()||{name:"",description:"",url:"",icons:[""]}}function Xr(e,t){var n;const r=ue(),o={protocol:e,version:t,env:r};return r==="browser"&&(o.host=((n=kt())==null?void 0:n.host)||"unknown"),o}function zt(){if(ue()===H.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:n,Version:r}=global.Platform;return[n,r].join("-")}const e=Pr();if(e===null)return"unknown";const t=e.os?e.os.replace(" ","").toLowerCase():"unknown";return e.type==="browser"?[t,e.name,e.version].join("-"):[t,e.version].join("-")}function Jt(){var e;const t=ue();return t===H.browser?[t,((e=kt())==null?void 0:e.host)||"unknown"].join(":"):t}function Yt(e,t,n){const r=zt(),o=Jt();return[[e,t].join("-"),[Gt,n].join("-"),r,o].join("/")}function Zr({protocol:e,version:t,relayUrl:n,sdkVersion:r,auth:o,projectId:s,useOnCloseEvent:i,bundleId:c,packageName:u}){const a=n.split("?"),l=Yt(e,t,r),f={auth:o,ua:l,projectId:s,useOnCloseEvent:i||void 0,packageName:u||void 0,bundleId:c||void 0},d=Wt(a[1]||"",f);return a[0]+"?"+d}function Qr(e){let t=(e.match(/^[^:]+(?=:\/\/)/gi)||[])[0];const n=typeof t<"u"?e.split("://")[1]:e;return t=t==="wss"?"https":"http",[t,n].join("://")}function eo(e,t,n){if(!e[t]||typeof e[t]!==n)throw new Error(`Missing or invalid "${t}" param`)}function Xt(e,t=Qe){return Zt(e.split(qt),t)}function to(e){return Xt(e).join(Be)}function re(e,t){return e.filter(n=>t.includes(n)).length===e.length}function Zt(e,t=Qe){return e.slice(Math.max(e.length-t,0))}function no(e){return Object.fromEntries(e.entries())}function ro(e){return new Map(Object.entries(e))}function oo(e,t){const n={};return Object.keys(e).forEach(r=>{n[r]=t(e[r])}),n}const so=e=>e;function Qt(e){return e.trim().replace(/^\w/,t=>t.toUpperCase())}function io(e){return e.split(Be).map(t=>Qt(t)).join(Be)}function co(e=jt,t){const n=We(e||jt);let r,o,s,i;return{resolve:c=>{s&&r&&(clearTimeout(s),r(c),i=Promise.resolve(c))},reject:c=>{s&&o&&(clearTimeout(s),o(c))},done:()=>new Promise((c,u)=>{if(i)return c(i);s=setTimeout(()=>{const a=new Error(t);i=Promise.reject(a),u(a)},n),r=c,o=u})}}function ao(e,t,n){return new Promise(async(r,o)=>{const s=setTimeout(()=>o(new Error(n)),t);try{const i=await e;r(i)}catch(i){o(i)}clearTimeout(s)})}function tt(e,t){if(typeof t=="string"&&t.startsWith(`${e}:`))return t;if(e.toLowerCase()==="topic"){if(typeof t!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${t}`}else if(e.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: ${e}`)}function uo(e){return tt("topic",e)}function fo(e){return tt("id",e)}function lo(e){const[t,n]=e.split(":"),r={id:void 0,topic:void 0};if(t==="topic"&&typeof n=="string")r.topic=n;else if(t==="id"&&Number.isInteger(Number(n)))r.id=Number(n);else throw new Error(`Invalid target, expected id:number or topic:string, got ${t}:${n}`);return r}function ho(e,t){return Lr((t||Date.now())+We(e))}function po(e){return Date.now()>=We(e)}function go(e,t){return`${e}${t?`:${t}`:""}`}function Q(e=[],t=[]){return[...new Set([...e,...t])]}async function yo({id:e,topic:t,wcDeepLink:n}){var r;try{if(!n)return;const o=typeof n=="string"?JSON.parse(n):n,s=o?.href;if(typeof s!="string")return;const i=en(s,e,t),c=ue();if(c===H.browser){if(!((r=ze())!=null&&r.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}tn(i)}else c===H.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(i)}catch(o){console.error(o)}}function en(e,t,n){const r=`requestId=${t}&sessionTopic=${n}`;e.endsWith("/")&&(e=e.slice(0,-1));let o=`${e}`;if(e.startsWith("https://t.me")){const s=e.includes("?")?"&startapp=":"?startapp=";o=`${o}${s}${on(r,!0)}`}else o=`${o}/wc?${r}`;return o}function tn(e){let t="_self";rn()?t="_top":(nn()||e.startsWith("https://")||e.startsWith("http://"))&&(t="_blank"),window.open(e,t,"noreferrer noopener")}async function mo(e,t){let n="";try{if(Ae()&&(n=localStorage.getItem(t),n))return n;n=await e.getItem(t)}catch(r){console.error(r)}return n}function nt(e,t){return e.filter(n=>t.includes(n))}function bo(e,t){if(!e.includes(t))return null;const n=e.split(/([&,?,=])/),r=n.indexOf(t);return n[r+2]}function wo(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function Eo(){return typeof process<"u"&&process.env.IS_VITEST==="true"}function nn(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function rn(){try{return window.self!==window.top}catch{return!1}}function on(e,t=!1){const n=Buffer.from(e).toString("base64");return t?n.replace(/[=]/g,""):n}function rt(e){return Buffer.from(e,"base64").toString("utf-8")}function vo(e){return new Promise(t=>setTimeout(t,e))}function Ne(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function xo(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function je(e,...t){if(!xo(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function ot(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Ne(e.outputLen),Ne(e.blockLen)}function me(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function sn(e,t){je(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}const Ce=BigInt(2**32-1),cn=BigInt(32);function Oo(e,t=!1){return t?{h:Number(e&Ce),l:Number(e>>cn&Ce)}:{h:Number(e>>cn&Ce)|0,l:Number(e&Ce)|0}}function Io(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let o=0;o<e.length;o++){const{h:s,l:i}=Oo(e[o],t);[n[o],r[o]]=[s,i]}return[n,r]}const Ao=(e,t,n)=>e<<n|t>>>32-n,No=(e,t,n)=>t<<n|e>>>32-n,So=(e,t,n)=>t<<n-32|e>>>64-n,Uo=(e,t,n)=>e<<n-32|t>>>64-n,be=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function _o(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function st(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function J(e,t){return e<<32-t|e>>>t}const an=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function To(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function un(e){for(let t=0;t<e.length;t++)e[t]=To(e[t])}function $o(e){if(typeof e!="string")throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function we(e){return typeof e=="string"&&(e=$o(e)),je(e),e}class it{clone(){return this._cloneInto()}}function fn(e){const t=r=>e().update(we(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function Se(e=32){if(be&&typeof be.getRandomValues=="function")return be.getRandomValues(new Uint8Array(e));if(be&&typeof be.randomBytes=="function")return be.randomBytes(e);throw new Error("crypto.getRandomValues must be defined")}const ln=[],dn=[],hn=[],Ro=BigInt(0),Ue=BigInt(1),Po=BigInt(2),Lo=BigInt(7),Bo=BigInt(256),jo=BigInt(113);for(let e=0,t=Ue,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],ln.push(2*(5*r+n)),dn.push((e+1)*(e+2)/2%64);let o=Ro;for(let s=0;s<7;s++)t=(t<<Ue^(t>>Lo)*jo)%Bo,t&Po&&(o^=Ue<<(Ue<<BigInt(s))-Ue);hn.push(o)}const[Co,ko]=Io(hn,!0),pn=(e,t,n)=>n>32?So(e,t,n):Ao(e,t,n),gn=(e,t,n)=>n>32?Uo(e,t,n):No(e,t,n);function Do(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let i=0;i<10;i++)n[i]=e[i]^e[i+10]^e[i+20]^e[i+30]^e[i+40];for(let i=0;i<10;i+=2){const c=(i+8)%10,u=(i+2)%10,a=n[u],l=n[u+1],f=pn(a,l,1)^n[c],d=gn(a,l,1)^n[c+1];for(let g=0;g<50;g+=10)e[i+g]^=f,e[i+g+1]^=d}let o=e[2],s=e[3];for(let i=0;i<24;i++){const c=dn[i],u=pn(o,s,c),a=gn(o,s,c),l=ln[i];o=e[l],s=e[l+1],e[l]=u,e[l+1]=a}for(let i=0;i<50;i+=10){for(let c=0;c<10;c++)n[c]=e[i+c];for(let c=0;c<10;c++)e[i+c]^=~n[(c+2)%10]&n[(c+4)%10]}e[0]^=Co[r],e[1]^=ko[r]}n.fill(0)}class Bt extends it{constructor(t,n,r,o=!1,s=24){if(super(),this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=o,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Ne(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=_o(this.state)}keccak(){an||un(this.state32),Do(this.state32,this.rounds),an||un(this.state32),this.posOut=0,this.pos=0}update(t){me(this);const{blockLen:n,state:r}=this;t=we(t);const o=t.length;for(let s=0;s<o;){const i=Math.min(n-this.pos,o-s);for(let c=0;c<i;c++)r[this.pos++]^=t[s++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:r,blockLen:o}=this;t[r]^=n,(n&128)!==0&&r===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){me(this,!1),je(t),this.finish();const n=this.state,{blockLen:r}=this;for(let o=0,s=t.length;o<s;){this.posOut>=r&&this.keccak();const i=Math.min(r-this.posOut,s-o);t.set(n.subarray(this.posOut,this.posOut+i),o),this.posOut+=i,o+=i}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Ne(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(sn(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:o,rounds:s,enableXOF:i}=this;return t||(t=new Bt(n,r,o,i,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=r,t.outputLen=o,t.enableXOF=i,t.destroyed=this.destroyed,t}}const Mo=(e,t,n)=>fn(()=>new Bt(t,e,n)),Vo=Mo(1,136,256/8),Ho="https://rpc.walletconnect.org/v1";function ct(e){const t=`Ethereum Signed Message:
${e.length}`,n=new TextEncoder().encode(t+e);return"0x"+Buffer.from(Vo(n)).toString("hex")}async function yn(e,t,n,r,o,s){switch(n.t){case"eip191":return mn(e,t,n.s);case"eip1271":return await bn(e,t,n.s,r,o,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${n.t}`)}}function mn(e,t,n){return jr(ct(t),n).toLowerCase()===e.toLowerCase()}async function bn(e,t,n,r,o,s){const i=Ye(r);if(!i.namespace||!i.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${r}`);try{const c="0x1626ba7e",u="0000000000000000000000000000000000000000000000000000000000000040",a="0000000000000000000000000000000000000000000000000000000000000041",l=n.substring(2),f=ct(t).substring(2),d=c+f+u+a+l,g=await fetch(`${s||Ho}/?chainId=${r}&projectId=${o}`,{method:"POST",body:JSON.stringify({id:Ko(),jsonrpc:"2.0",method:"eth_call",params:[{to:e,data:d},"latest"]})}),{result:y}=await g.json();return y?y.slice(0,c.length).toLowerCase()===c.toLowerCase():!1}catch(c){return console.error("isValidEip1271Signature: ",c),!1}}function Ko(){return Date.now()+Math.floor(Math.random()*1e3)}var Fo=Object.defineProperty,qo=Object.defineProperties,Go=Object.getOwnPropertyDescriptors,wn=Object.getOwnPropertySymbols,Wo=Object.prototype.hasOwnProperty,zo=Object.prototype.propertyIsEnumerable,En=(e,t,n)=>t in e?Fo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,at=(e,t)=>{for(var n in t||(t={}))Wo.call(t,n)&&En(e,n,t[n]);if(wn)for(var n of wn(t))zo.call(t,n)&&En(e,n,t[n]);return e},vn=(e,t)=>qo(e,Go(t));const Jo="did:pkh:",ke=e=>e?.split(":"),xn=e=>{const t=e&&ke(e);if(t)return e.includes(Jo)?t[3]:t[1]},On=e=>{const t=e&&ke(e);if(t)return t[2]+":"+t[3]},ut=e=>{const t=e&&ke(e);if(t)return t.pop()};async function Yo(e){const{cacao:t,projectId:n}=e,{s:r,p:o}=t,s=In(o,o.iss),i=ut(o.iss);return await yn(i,s,r,On(o.iss),n)}const In=(e,t)=>{const n=`${e.domain} wants you to sign in with your Ethereum account:`,r=ut(t);if(!e.aud&&!e.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let o=e.statement||void 0;const s=`URI: ${e.aud||e.uri}`,i=`Version: ${e.version}`,c=`Chain ID: ${xn(t)}`,u=`Nonce: ${e.nonce}`,a=`Issued At: ${e.iat}`,l=e.exp?`Expiration Time: ${e.exp}`:void 0,f=e.nbf?`Not Before: ${e.nbf}`:void 0,d=e.requestId?`Request ID: ${e.requestId}`:void 0,g=e.resources?`Resources:${e.resources.map(h=>`
- ${h}`).join("")}`:void 0,y=Me(e.resources);if(y){const h=oe(y);o=dt(o,h)}return[n,r,"",o,"",s,i,c,u,a,l,f,d,g].filter(h=>h!=null).join(`

@@ -4,0 +4,0 @@ `)};function Xo(e,t,n){return n.includes("did:pkh:")||(n=`did:pkh:${n}`),{h:{t:"caip122"},p:{iss:n,domain:e.domain,aud:e.aud,version:e.version,nonce:e.nonce,iat:e.iat,statement:e.statement,requestId:e.requestId,resources:e.resources,nbf:e.nbf,exp:e.exp},s:t}}function Zo(e){var t;const{authPayload:n,chains:r,methods:o}=e,s=n.statement||"";if(!(r!=null&&r.length))return n;const i=n.chains,c=nt(i,r);if(!(c!=null&&c.length))throw new Error("No supported chains");const u=An(n.resources);if(!u)return n;Y(u);const a=Nn(u,"eip155");let l=n?.resources||[];if(a!=null&&a.length){const f=Sn(a),d=nt(f,o);if(!(d!=null&&d.length))throw new Error(`Supported methods don't satisfy the requested: ${JSON.stringify(f)}, supported: ${JSON.stringify(o)}`);const g=ft("request",d,{chains:c}),y=$n(u,"eip155",g);l=((t=n?.resources)==null?void 0:t.slice(0,-1))||[],l.push(De(y))}return vn(at({},n),{statement:Pn(s,Me(l)),chains:c,resources:n!=null&&n.resources||l.length>0?l:void 0})}function An(e){const t=Me(e);if(t&&lt(t))return oe(t)}function Qo(e,t){var n;return(n=e?.att)==null?void 0:n.hasOwnProperty(t)}function Nn(e,t){var n,r;return(n=e?.att)!=null&&n[t]?Object.keys((r=e?.att)==null?void 0:r[t]):[]}function es(e){return e?.map(t=>Object.keys(t))||[]}function Sn(e){return e?.map(t=>{var n;return(n=t.split("/"))==null?void 0:n[1]})||[]}function Un(e){return Buffer.from(JSON.stringify(e)).toString("base64")}function _n(e){return JSON.parse(Buffer.from(e,"base64").toString("utf-8"))}function Y(e){if(!e)throw new Error("No recap provided, value is undefined");if(!e.att)throw new Error("No `att` property found");const t=Object.keys(e.att);if(!(t!=null&&t.length))throw new Error("No resources found in `att` property");t.forEach(n=>{const r=e.att[n];if(Array.isArray(r))throw new Error(`Resource must be an object: ${n}`);if(typeof r!="object")throw new Error(`Resource must be an object: ${n}`);if(!Object.keys(r).length)throw new Error(`Resource object is empty: ${n}`);Object.keys(r).forEach(o=>{const s=r[o];if(!Array.isArray(s))throw new Error(`Ability limits ${o} must be an array of objects, found: ${s}`);if(!s.length)throw new Error(`Value of ${o} is empty array, must be an array with objects`);s.forEach(i=>{if(typeof i!="object")throw new Error(`Ability limits (${o}) must be an array of objects, found: ${i}`)})})})}function Tn(e,t,n,r={}){return n?.sort((o,s)=>o.localeCompare(s)),{att:{[e]:ft(t,n,r)}}}function $n(e,t,n){var r;return e.att[t]=at({},n),((r=Object.keys(e.att))==null?void 0:r.sort((o,s)=>o.localeCompare(s))).reduce((o,s)=>(o.att[s]=e.att[s],o),{att:{}})}function ft(e,t,n={}){t=t?.sort((o,s)=>o.localeCompare(s));const r=t.map(o=>({[`${e}/${o}`]:[n]}));return Object.assign({},...r)}function De(e){return Y(e),`urn:recap:${Un(e).replace(/=/g,"")}`}function oe(e){const t=_n(e.replace("urn:recap:",""));return Y(t),t}function ts(e,t,n){const r=Tn(e,t,n);return De(r)}function lt(e){return e&&e.includes("urn:recap:")}function ns(e,t){const n=oe(e),r=oe(t),o=Rn(n,r);return De(o)}function Rn(e,t){Y(e),Y(t);const n=Object.keys(e.att).concat(Object.keys(t.att)).sort((o,s)=>o.localeCompare(s)),r={att:{}};return n.forEach(o=>{var s,i;Object.keys(((s=e.att)==null?void 0:s[o])||{}).concat(Object.keys(((i=t.att)==null?void 0:i[o])||{})).sort((c,u)=>c.localeCompare(u)).forEach(c=>{var u,a;r.att[o]=vn(at({},r.att[o]),{[c]:((u=e.att[o])==null?void 0:u[c])||((a=t.att[o])==null?void 0:a[c])})})}),r}function dt(e="",t){Y(t);const n="I further authorize the stated URI to perform the following actions on my behalf: ";if(e.includes(n))return e;const r=[];let o=0;Object.keys(t.att).forEach(c=>{const u=Object.keys(t.att[c]).map(f=>({ability:f.split("/")[0],action:f.split("/")[1]}));u.sort((f,d)=>f.action.localeCompare(d.action));const a={};u.forEach(f=>{a[f.ability]||(a[f.ability]=[]),a[f.ability].push(f.action)});const l=Object.keys(a).map(f=>(o++,`(${o}) '${f}': '${a[f].join("', '")}' for '${c}'.`));r.push(l.join(", ").replace(".,","."))});const s=r.join(" "),i=`${n}${s}`;return`${e?e+" ":""}${i}`}function rs(e){var t;const n=oe(e);Y(n);const r=(t=n.att)==null?void 0:t.eip155;return r?Object.keys(r).map(o=>o.split("/")[1]):[]}function os(e){const t=oe(e);Y(t);const n=[];return Object.values(t.att).forEach(r=>{Object.values(r).forEach(o=>{var s;(s=o?.[0])!=null&&s.chains&&n.push(o[0].chains)})}),[...new Set(n.flat())]}function Pn(e,t){if(!t)return e;const n=oe(t);return Y(n),dt(e,n)}function Me(e){if(!e)return;const t=e?.[e.length-1];return lt(t)?t:void 0}function ht(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Ln(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function F(e,...t){if(!Ln(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function Bn(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function ss(e,t){F(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function jn(e){if(typeof e!="boolean")throw new Error(`boolean expected, not ${e}`)}const se=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),is=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),cs=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!cs)throw new Error("Non little-endian hardware is not supported");function as(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function pt(e){if(typeof e=="string")e=as(e);else if(Ln(e))e=gt(e);else throw new Error("Uint8Array expected, got "+typeof e);return e}function us(e,t){if(t==null||typeof t!="object")throw new Error("options must be defined");return Object.assign(e,t)}function fs(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}const ls=(e,t)=>{function n(r,...o){if(F(r),e.nonceLength!==void 0){const l=o[0];if(!l)throw new Error("nonce / iv required");e.varSizeNonce?F(l):F(l,e.nonceLength)}const s=e.tagLength;s&&o[1]!==void 0&&F(o[1]);const i=t(r,...o),c=(l,f)=>{if(f!==void 0){if(l!==2)throw new Error("cipher output not supported");F(f)}};let u=!1;return{encrypt(l,f){if(u)throw new Error("cannot encrypt() twice with same key + nonce");return u=!0,F(l),c(i.encrypt.length,f),i.encrypt(l,f)},decrypt(l,f){if(F(l),s&&l.length<s)throw new Error("invalid ciphertext length: smaller than tagLength="+s);return c(i.decrypt.length,f),i.decrypt(l,f)}}}return Object.assign(n,e),n};function Cn(e,t,n=!0){if(t===void 0)return new Uint8Array(e);if(t.length!==e)throw new Error("invalid output length, expected "+e+", got: "+t.length);if(n&&!ds(t))throw new Error("invalid output, must be aligned");return t}function kn(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const o=BigInt(32),s=BigInt(4294967295),i=Number(n>>o&s),c=Number(n&s),u=r?4:0,a=r?0:4;e.setUint32(t+u,i,r),e.setUint32(t+a,c,r)}function ds(e){return e.byteOffset%4===0}function gt(e){return Uint8Array.from(e)}function Ee(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}const Dn=e=>Uint8Array.from(e.split("").map(t=>t.charCodeAt(0))),hs=Dn("expand 16-byte k"),ps=Dn("expand 32-byte k"),gs=se(hs),ys=se(ps);function x(e,t){return e<<t|e>>>32-t}function yt(e){return e.byteOffset%4===0}const Ve=64,ms=16,Mn=2**32-1,Vn=new Uint32Array;function bs(e,t,n,r,o,s,i,c){const u=o.length,a=new Uint8Array(Ve),l=se(a),f=yt(o)&&yt(s),d=f?se(o):Vn,g=f?se(s):Vn;for(let y=0;y<u;i++){if(e(t,n,r,l,i,c),i>=Mn)throw new Error("arx: counter overflow");const h=Math.min(Ve,u-y);if(f&&h===Ve){const m=y/4;if(y%4!==0)throw new Error("arx: invalid block position");for(let B=0,b;B<ms;B++)b=m+B,g[b]=d[b]^l[B];y+=Ve;continue}for(let m=0,B;m<h;m++)B=y+m,s[B]=o[B]^a[m];y+=h}}function ws(e,t){const{allowShortKeys:n,extendNonceFn:r,counterLength:o,counterRight:s,rounds:i}=us({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if(typeof e!="function")throw new Error("core must be a function");return ht(o),ht(i),jn(s),jn(n),(c,u,a,l,f=0)=>{F(c),F(u),F(a);const d=a.length;if(l===void 0&&(l=new Uint8Array(d)),F(l),ht(f),f<0||f>=Mn)throw new Error("arx: counter overflow");if(l.length<d)throw new Error(`arx: output (${l.length}) is shorter than data (${d})`);const g=[];let y=c.length,h,m;if(y===32)g.push(h=gt(c)),m=ys;else if(y===16&&n)h=new Uint8Array(32),h.set(c),h.set(c,16),m=gs,g.push(h);else throw new Error(`arx: invalid 32-byte key, got length=${y}`);yt(u)||g.push(u=gt(u));const B=se(h);if(r){if(u.length!==24)throw new Error("arx: extended nonce must be 24 bytes");r(m,B,se(u.subarray(0,16)),B),u=u.subarray(16)}const b=16-o;if(b!==u.length)throw new Error(`arx: nonce must be ${b} or 16 bytes`);if(b!==12){const I=new Uint8Array(12);I.set(u,s?0:12-u.length),u=I,g.push(u)}const _=se(u);return bs(e,m,B,_,a,l,f,i),Ee(...g),l}}const M=(e,t)=>e[t++]&255|(e[t++]&255)<<8;class Es{constructor(t){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,t=pt(t),F(t,32);const n=M(t,0),r=M(t,2),o=M(t,4),s=M(t,6),i=M(t,8),c=M(t,10),u=M(t,12),a=M(t,14);this.r[0]=n&8191,this.r[1]=(n>>>13|r<<3)&8191,this.r[2]=(r>>>10|o<<6)&7939,this.r[3]=(o>>>7|s<<9)&8191,this.r[4]=(s>>>4|i<<12)&255,this.r[5]=i>>>1&8190,this.r[6]=(i>>>14|c<<2)&8191,this.r[7]=(c>>>11|u<<5)&8065,this.r[8]=(u>>>8|a<<8)&8191,this.r[9]=a>>>5&127;for(let l=0;l<8;l++)this.pad[l]=M(t,16+2*l)}process(t,n,r=!1){const o=r?0:2048,{h:s,r:i}=this,c=i[0],u=i[1],a=i[2],l=i[3],f=i[4],d=i[5],g=i[6],y=i[7],h=i[8],m=i[9],B=M(t,n+0),b=M(t,n+2),_=M(t,n+4),I=M(t,n+6),k=M(t,n+8),E=M(t,n+10),L=M(t,n+12),j=M(t,n+14);let v=s[0]+(B&8191),O=s[1]+((B>>>13|b<<3)&8191),w=s[2]+((b>>>10|_<<6)&8191),R=s[3]+((_>>>7|I<<9)&8191),A=s[4]+((I>>>4|k<<12)&8191),T=s[5]+(k>>>1&8191),N=s[6]+((k>>>14|E<<2)&8191),S=s[7]+((E>>>11|L<<5)&8191),U=s[8]+((L>>>8|j<<8)&8191),$=s[9]+(j>>>5|o),p=0,C=p+v*c+O*(5*m)+w*(5*h)+R*(5*y)+A*(5*g);p=C>>>13,C&=8191,C+=T*(5*d)+N*(5*f)+S*(5*l)+U*(5*a)+$*(5*u),p+=C>>>13,C&=8191;let D=p+v*u+O*c+w*(5*m)+R*(5*h)+A*(5*y);p=D>>>13,D&=8191,D+=T*(5*g)+N*(5*d)+S*(5*f)+U*(5*l)+$*(5*a),p+=D>>>13,D&=8191;let P=p+v*a+O*u+w*c+R*(5*m)+A*(5*h);p=P>>>13,P&=8191,P+=T*(5*y)+N*(5*g)+S*(5*d)+U*(5*f)+$*(5*l),p+=P>>>13,P&=8191;let G=p+v*l+O*a+w*u+R*c+A*(5*m);p=G>>>13,G&=8191,G+=T*(5*h)+N*(5*y)+S*(5*g)+U*(5*d)+$*(5*f),p+=G>>>13,G&=8191;let X=p+v*f+O*l+w*a+R*u+A*c;p=X>>>13,X&=8191,X+=T*(5*m)+N*(5*h)+S*(5*y)+U*(5*g)+$*(5*d),p+=X>>>13,X&=8191;let Z=p+v*d+O*f+w*l+R*a+A*u;p=Z>>>13,Z&=8191,Z+=T*c+N*(5*m)+S*(5*h)+U*(5*y)+$*(5*g),p+=Z>>>13,Z&=8191;let he=p+v*g+O*d+w*f+R*l+A*a;p=he>>>13,he&=8191,he+=T*u+N*c+S*(5*m)+U*(5*h)+$*(5*y),p+=he>>>13,he&=8191;let pe=p+v*y+O*g+w*d+R*f+A*l;p=pe>>>13,pe&=8191,pe+=T*a+N*u+S*c+U*(5*m)+$*(5*h),p+=pe>>>13,pe&=8191;let ge=p+v*h+O*y+w*g+R*d+A*f;p=ge>>>13,ge&=8191,ge+=T*l+N*a+S*u+U*c+$*(5*m),p+=ge>>>13,ge&=8191;let ye=p+v*m+O*h+w*y+R*g+A*d;p=ye>>>13,ye&=8191,ye+=T*f+N*l+S*a+U*u+$*c,p+=ye>>>13,ye&=8191,p=(p<<2)+p|0,p=p+C|0,C=p&8191,p=p>>>13,D+=p,s[0]=C,s[1]=D,s[2]=P,s[3]=G,s[4]=X,s[5]=Z,s[6]=he,s[7]=pe,s[8]=ge,s[9]=ye}finalize(){const{h:t,pad:n}=this,r=new Uint16Array(10);let o=t[1]>>>13;t[1]&=8191;for(let c=2;c<10;c++)t[c]+=o,o=t[c]>>>13,t[c]&=8191;t[0]+=o*5,o=t[0]>>>13,t[0]&=8191,t[1]+=o,o=t[1]>>>13,t[1]&=8191,t[2]+=o,r[0]=t[0]+5,o=r[0]>>>13,r[0]&=8191;for(let c=1;c<10;c++)r[c]=t[c]+o,o=r[c]>>>13,r[c]&=8191;r[9]-=8192;let s=(o^1)-1;for(let c=0;c<10;c++)r[c]&=s;s=~s;for(let c=0;c<10;c++)t[c]=t[c]&s|r[c];t[0]=(t[0]|t[1]<<13)&65535,t[1]=(t[1]>>>3|t[2]<<10)&65535,t[2]=(t[2]>>>6|t[3]<<7)&65535,t[3]=(t[3]>>>9|t[4]<<4)&65535,t[4]=(t[4]>>>12|t[5]<<1|t[6]<<14)&65535,t[5]=(t[6]>>>2|t[7]<<11)&65535,t[6]=(t[7]>>>5|t[8]<<8)&65535,t[7]=(t[8]>>>8|t[9]<<5)&65535;let i=t[0]+n[0];t[0]=i&65535;for(let c=1;c<8;c++)i=(t[c]+n[c]|0)+(i>>>16)|0,t[c]=i&65535;Ee(r)}update(t){Bn(this);const{buffer:n,blockLen:r}=this;t=pt(t);const o=t.length;for(let s=0;s<o;){const i=Math.min(r-this.pos,o-s);if(i===r){for(;r<=o-s;s+=r)this.process(t,s);continue}n.set(t.subarray(s,s+i),this.pos),this.pos+=i,s+=i,this.pos===r&&(this.process(n,0,!1),this.pos=0)}return this}destroy(){Ee(this.h,this.r,this.buffer,this.pad)}digestInto(t){Bn(this),ss(t,this),this.finished=!0;const{buffer:n,h:r}=this;let{pos:o}=this;if(o){for(n[o++]=1;o<16;o++)n[o]=0;this.process(n,0,!0)}this.finalize();let s=0;for(let i=0;i<8;i++)t[s++]=r[i]>>>0,t[s++]=r[i]>>>8;return t}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}}function vs(e){const t=(r,o)=>e(o).update(pt(r)).digest(),n=e(new Uint8Array(32));return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=r=>e(r),t}const xs=vs(e=>new Es(e));function Os(e,t,n,r,o,s=20){let i=e[0],c=e[1],u=e[2],a=e[3],l=t[0],f=t[1],d=t[2],g=t[3],y=t[4],h=t[5],m=t[6],B=t[7],b=o,_=n[0],I=n[1],k=n[2],E=i,L=c,j=u,v=a,O=l,w=f,R=d,A=g,T=y,N=h,S=m,U=B,$=b,p=_,C=I,D=k;for(let G=0;G<s;G+=2)E=E+O|0,$=x($^E,16),T=T+$|0,O=x(O^T,12),E=E+O|0,$=x($^E,8),T=T+$|0,O=x(O^T,7),L=L+w|0,p=x(p^L,16),N=N+p|0,w=x(w^N,12),L=L+w|0,p=x(p^L,8),N=N+p|0,w=x(w^N,7),j=j+R|0,C=x(C^j,16),S=S+C|0,R=x(R^S,12),j=j+R|0,C=x(C^j,8),S=S+C|0,R=x(R^S,7),v=v+A|0,D=x(D^v,16),U=U+D|0,A=x(A^U,12),v=v+A|0,D=x(D^v,8),U=U+D|0,A=x(A^U,7),E=E+w|0,D=x(D^E,16),S=S+D|0,w=x(w^S,12),E=E+w|0,D=x(D^E,8),S=S+D|0,w=x(w^S,7),L=L+R|0,$=x($^L,16),U=U+$|0,R=x(R^U,12),L=L+R|0,$=x($^L,8),U=U+$|0,R=x(R^U,7),j=j+A|0,p=x(p^j,16),T=T+p|0,A=x(A^T,12),j=j+A|0,p=x(p^j,8),T=T+p|0,A=x(A^T,7),v=v+O|0,C=x(C^v,16),N=N+C|0,O=x(O^N,12),v=v+O|0,C=x(C^v,8),N=N+C|0,O=x(O^N,7);let P=0;r[P++]=i+E|0,r[P++]=c+L|0,r[P++]=u+j|0,r[P++]=a+v|0,r[P++]=l+O|0,r[P++]=f+w|0,r[P++]=d+R|0,r[P++]=g+A|0,r[P++]=y+T|0,r[P++]=h+N|0,r[P++]=m+S|0,r[P++]=B+U|0,r[P++]=b+$|0,r[P++]=_+p|0,r[P++]=I+C|0,r[P++]=k+D|0}const Is=ws(Os,{counterRight:!1,counterLength:4,allowShortKeys:!1}),As=new Uint8Array(16),Hn=(e,t)=>{e.update(t);const n=t.length%16;n&&e.update(As.subarray(n))},Ns=new Uint8Array(32);function Kn(e,t,n,r,o){const s=e(t,n,Ns),i=xs.create(s);o&&Hn(i,o),Hn(i,r);const c=new Uint8Array(16),u=is(c);kn(u,0,BigInt(o?o.length:0),!0),kn(u,8,BigInt(r.length),!0),i.update(c);const a=i.digest();return Ee(s,c),a}const Ss=e=>(t,n,r)=>({encrypt(s,i){const c=s.length;i=Cn(c+16,i,!1),i.set(s);const u=i.subarray(0,-16);e(t,n,u,u,1);const a=Kn(e,t,n,u,r);return i.set(a,c),Ee(a),i},decrypt(s,i){i=Cn(s.length-16,i,!1);const c=s.subarray(0,-16),u=s.subarray(-16),a=Kn(e,t,n,c,r);if(!fs(u,a))throw new Error("invalid tag");return i.set(s.subarray(0,-16)),e(t,n,i,i,1),Ee(a),i}}),Fn=ls({blockSize:64,nonceLength:12,tagLength:16},Ss(Is));class qn extends it{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,ot(t);const r=we(n);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const o=this.blockLen,s=new Uint8Array(o);s.set(r.length>o?t.create().update(r).digest():r);for(let i=0;i<s.length;i++)s[i]^=54;this.iHash.update(s),this.oHash=t.create();for(let i=0;i<s.length;i++)s[i]^=106;this.oHash.update(s),s.fill(0)}update(t){return me(this),this.iHash.update(t),this}digestInto(t){me(this),je(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:r,finished:o,destroyed:s,blockLen:i,outputLen:c}=this;return t=t,t.finished=o,t.destroyed=s,t.blockLen=i,t.outputLen=c,t.oHash=n._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const mt=(e,t,n)=>new qn(e,t).update(n).digest();mt.create=(e,t)=>new qn(e,t);function Us(e,t,n){return ot(e),n===void 0&&(n=new Uint8Array(e.outputLen)),mt(e,we(n),we(t))}const bt=new Uint8Array([0]),Gn=new Uint8Array;function _s(e,t,n,r=32){if(ot(e),Ne(r),r>255*e.outputLen)throw new Error("Length should be <= 255*HashLen");const o=Math.ceil(r/e.outputLen);n===void 0&&(n=Gn);const s=new Uint8Array(o*e.outputLen),i=mt.create(e,t),c=i._cloneInto(),u=new Uint8Array(i.outputLen);for(let a=0;a<o;a++)bt[0]=a+1,c.update(a===0?Gn:u).update(n).update(bt).digestInto(u),s.set(u,e.outputLen*a),i._cloneInto(c);return i.destroy(),c.destroy(),u.fill(0),bt.fill(0),s.slice(0,r)}const Ts=(e,t,n,r,o)=>_s(e,Us(e,t,n),r,o);function $s(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const o=BigInt(32),s=BigInt(4294967295),i=Number(n>>o&s),c=Number(n&s),u=r?4:0,a=r?0:4;e.setUint32(t+u,i,r),e.setUint32(t+a,c,r)}function Rs(e,t,n){return e&t^~e&n}function Ps(e,t,n){return e&t^e&n^t&n}class Ls extends it{constructor(t,n,r,o){super(),this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=st(this.buffer)}update(t){me(this);const{view:n,buffer:r,blockLen:o}=this;t=we(t);const s=t.length;for(let i=0;i<s;){const c=Math.min(o-this.pos,s-i);if(c===o){const u=st(t);for(;o<=s-i;i+=o)this.process(u,i);continue}r.set(t.subarray(i,i+c),this.pos),this.pos+=c,i+=c,this.pos===o&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){me(this),sn(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:o,isLE:s}=this;let{pos:i}=this;n[i++]=128,this.buffer.subarray(i).fill(0),this.padOffset>o-i&&(this.process(r,0),i=0);for(let f=i;f<o;f++)n[f]=0;$s(r,o-8,BigInt(this.length*8),s),this.process(r,0);const c=st(t),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const a=u/4,l=this.get();if(a>l.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<a;f++)c.setUint32(4*f,l[f],s)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:r,length:o,finished:s,destroyed:i,pos:c}=this;return t.length=o,t.pos=c,t.finished=s,t.destroyed=i,o%n&&t.buffer.set(r),t}}const Bs=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),ie=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),ce=new Uint32Array(64);class js extends Ls{constructor(){super(64,32,8,!1),this.A=ie[0]|0,this.B=ie[1]|0,this.C=ie[2]|0,this.D=ie[3]|0,this.E=ie[4]|0,this.F=ie[5]|0,this.G=ie[6]|0,this.H=ie[7]|0}get(){const{A:t,B:n,C:r,D:o,E:s,F:i,G:c,H:u}=this;return[t,n,r,o,s,i,c,u]}set(t,n,r,o,s,i,c,u){this.A=t|0,this.B=n|0,this.C=r|0,this.D=o|0,this.E=s|0,this.F=i|0,this.G=c|0,this.H=u|0}process(t,n){for(let f=0;f<16;f++,n+=4)ce[f]=t.getUint32(n,!1);for(let f=16;f<64;f++){const d=ce[f-15],g=ce[f-2],y=J(d,7)^J(d,18)^d>>>3,h=J(g,17)^J(g,19)^g>>>10;ce[f]=h+ce[f-7]+y+ce[f-16]|0}let{A:r,B:o,C:s,D:i,E:c,F:u,G:a,H:l}=this;for(let f=0;f<64;f++){const d=J(c,6)^J(c,11)^J(c,25),g=l+d+Rs(c,u,a)+Bs[f]+ce[f]|0,h=(J(r,2)^J(r,13)^J(r,22))+Ps(r,o,s)|0;l=a,a=u,u=c,c=i+g|0,i=s,s=o,o=r,r=g+h|0}r=r+this.A|0,o=o+this.B|0,s=s+this.C|0,i=i+this.D|0,c=c+this.E|0,u=u+this.F|0,a=a+this.G|0,l=l+this.H|0,this.set(r,o,s,i,c,u,a,l)}roundClean(){ce.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const He=fn(()=>new js);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Wn=BigInt(0);function wt(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function zn(e){if(!wt(e))throw new Error("Uint8Array expected")}const Cs=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function ks(e){zn(e);let t="";for(let n=0;n<e.length;n++)t+=Cs[e[n]];return t}function Ds(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?Wn:BigInt("0x"+e)}const ee={_0:48,_9:57,A:65,F:70,a:97,f:102};function Jn(e){if(e>=ee._0&&e<=ee._9)return e-ee._0;if(e>=ee.A&&e<=ee.F)return e-(ee.A-10);if(e>=ee.a&&e<=ee.f)return e-(ee.a-10)}function Yn(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);const t=e.length,n=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let o=0,s=0;o<n;o++,s+=2){const i=Jn(e.charCodeAt(s)),c=Jn(e.charCodeAt(s+1));if(i===void 0||c===void 0){const u=e[s]+e[s+1];throw new Error('hex string expected, got non-hex character "'+u+'" at index '+s)}r[o]=i*16+c}return r}function Xn(e){return zn(e),Ds(ks(Uint8Array.from(e).reverse()))}function Ms(e,t){return Yn(e.toString(16).padStart(t*2,"0"))}function Vs(e,t){return Ms(e,t).reverse()}function Zn(e,t,n){let r;if(typeof t=="string")try{r=Yn(t)}catch(s){throw new Error(e+" must be hex string or Uint8Array, cause: "+s)}else if(wt(t))r=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");const o=r.length;if(typeof n=="number"&&o!==n)throw new Error(e+" of length "+n+" expected, got "+o);return r}const Et=e=>typeof e=="bigint"&&Wn<=e;function Hs(e,t,n){return Et(e)&&Et(t)&&Et(n)&&t<=e&&e<n}function Qn(e,t,n,r){if(!Hs(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}const Ks={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||wt(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function Fs(e,t,n={}){const r=(o,s,i)=>{const c=Ks[s];if(typeof c!="function")throw new Error("invalid validator function");const u=e[o];if(!(i&&u===void 0)&&!c(u,e))throw new Error("param "+String(o)+" is invalid. Expected "+s+", got "+u)};for(const[o,s]of Object.entries(t))r(o,s,!1);for(const[o,s]of Object.entries(n))r(o,s,!0);return e}const ve=BigInt(0),Ke=BigInt(1);function er(e,t){const n=e%t;return n>=ve?n:t+n}function qs(e,t,n){if(t<ve)throw new Error("invalid exponent, negatives unsupported");if(n<=ve)throw new Error("invalid modulus");if(n===Ke)return ve;let r=Ke;for(;t>ve;)t&Ke&&(r=r*e%n),e=e*e%n,t>>=Ke;return r}function z(e,t,n){let r=e;for(;t-- >ve;)r*=r,r%=n;return r}BigInt(0),BigInt(1),BigInt(0),BigInt(1),BigInt(2),BigInt(8);const xe=BigInt(0),vt=BigInt(1);function Gs(e){return Fs(e,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...e})}function Ws(e){const t=Gs(e),{P:n}=t,r=b=>er(b,n),o=t.montgomeryBits,s=Math.ceil(o/8),i=t.nByteLength,c=t.adjustScalarBytes||(b=>b),u=t.powPminus2||(b=>qs(b,n-BigInt(2),n));function a(b,_,I){const k=r(b*(_-I));return _=r(_-k),I=r(I+k),[_,I]}const l=(t.a-BigInt(2))/BigInt(4);function f(b,_){Qn("u",b,xe,n),Qn("scalar",_,xe,n);const I=_,k=b;let E=vt,L=xe,j=b,v=vt,O=xe,w;for(let A=BigInt(o-1);A>=xe;A--){const T=I>>A&vt;O^=T,w=a(O,E,j),E=w[0],j=w[1],w=a(O,L,v),L=w[0],v=w[1],O=T;const N=E+L,S=r(N*N),U=E-L,$=r(U*U),p=S-$,C=j+v,D=j-v,P=r(D*N),G=r(C*U),X=P+G,Z=P-G;j=r(X*X),v=r(k*r(Z*Z)),E=r(S*$),L=r(p*(S+r(l*p)))}w=a(O,E,j),E=w[0],j=w[1],w=a(O,L,v),L=w[0],v=w[1];const R=u(L);return r(E*R)}function d(b){return Vs(r(b),s)}function g(b){const _=Zn("u coordinate",b,s);return i===32&&(_[31]&=127),Xn(_)}function y(b){const _=Zn("scalar",b),I=_.length;if(I!==s&&I!==i){let k=""+s+" or "+i;throw new Error("invalid scalar, expected "+k+" bytes, got "+I)}return Xn(c(_))}function h(b,_){const I=g(_),k=y(b),E=f(I,k);if(E===xe)throw new Error("invalid private or public key received");return d(E)}const m=d(t.Gu);function B(b){return h(b,m)}return{scalarMult:h,scalarMultBase:B,getSharedSecret:(b,_)=>h(b,_),getPublicKey:b=>B(b),utils:{randomPrivateKey:()=>t.randomBytes(t.nByteLength)},GuBytes:m}}const xt=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949");BigInt(0);const zs=BigInt(1),tr=BigInt(2),Js=BigInt(3),Ys=BigInt(5);BigInt(8);function Xs(e){const t=BigInt(10),n=BigInt(20),r=BigInt(40),o=BigInt(80),s=xt,c=e*e%s*e%s,u=z(c,tr,s)*c%s,a=z(u,zs,s)*e%s,l=z(a,Ys,s)*a%s,f=z(l,t,s)*l%s,d=z(f,n,s)*f%s,g=z(d,r,s)*d%s,y=z(g,o,s)*g%s,h=z(y,o,s)*g%s,m=z(h,t,s)*l%s;return{pow_p_5_8:z(m,tr,s)*e%s,b2:c}}function Zs(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}const Ot=Ws({P:xt,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:e=>{const t=xt,{pow_p_5_8:n,b2:r}=Xs(e);return er(z(n,Js,t)*r,t)},adjustScalarBytes:Zs,randomBytes:Se}),It="base10",V="base16",At="base64pad",Qs="base64url",Oe="utf8",Nt=0,Ie=1,_e=2,ei=0,nr=1,Te=12,St=32;function ti(){const e=Ot.utils.randomPrivateKey(),t=Ot.getPublicKey(e);return{privateKey:K(e,V),publicKey:K(t,V)}}function ni(){const e=Se(St);return K(e,V)}function ri(e,t){const n=Ot.getSharedSecret(W(e,V),W(t,V)),r=Ts(He,n,void 0,void 0,St);return K(r,V)}function oi(e){const t=He(W(e,V));return K(t,V)}function si(e){const t=He(W(e,Oe));return K(t,V)}function Ut(e){return W(`${e}`,It)}function fe(e){return Number(K(e,It))}function ii(e){const t=Ut(typeof e.type<"u"?e.type:Nt);if(fe(t)===Ie&&typeof e.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const n=typeof e.senderPublicKey<"u"?W(e.senderPublicKey,V):void 0,r=typeof e.iv<"u"?W(e.iv,V):Se(Te),o=W(e.symKey,V),s=Fn(o,r).encrypt(W(e.message,Oe));return _t({type:t,sealed:s,iv:r,senderPublicKey:n,encoding:e.encoding})}function ci(e){const t=W(e.symKey,V),{sealed:n,iv:r}=Fe(e),o=Fn(t,r).decrypt(n);if(o===null)throw new Error("Failed to decrypt");return K(o,Oe)}function ai(e,t){const n=Ut(_e),r=Se(Te),o=W(e,Oe);return _t({type:n,sealed:o,iv:r,encoding:t})}function ui(e,t){const{sealed:n}=Fe({encoded:e,encoding:t});return K(n,Oe)}function _t(e){const{encoding:t=At}=e;if(fe(e.type)===_e)return K(Je([e.type,e.sealed]),t);if(fe(e.type)===Ie){if(typeof e.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return K(Je([e.type,e.senderPublicKey,e.iv,e.sealed]),t)}return K(Je([e.type,e.iv,e.sealed]),t)}function Fe(e){const{encoded:t,encoding:n=At}=e,r=W(t,n),o=r.slice(ei,nr),s=nr;if(fe(o)===Ie){const a=s+St,l=a+Te,f=r.slice(s,a),d=r.slice(a,l),g=r.slice(l);return{type:o,sealed:g,iv:d,senderPublicKey:f}}if(fe(o)===_e){const a=r.slice(s),l=Se(Te);return{type:o,sealed:a,iv:l}}const i=s+Te,c=r.slice(s,i),u=r.slice(i);return{type:o,sealed:u,iv:c}}function fi(e,t){const n=Fe({encoded:e,encoding:t?.encoding});return rr({type:fe(n.type),senderPublicKey:typeof n.senderPublicKey<"u"?K(n.senderPublicKey,V):void 0,receiverPublicKey:t?.receiverPublicKey})}function rr(e){const t=e?.type||Nt;if(t===Ie){if(typeof e?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof e?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:t,senderPublicKey:e?.senderPublicKey,receiverPublicKey:e?.receiverPublicKey}}function li(e){return e.type===Ie&&typeof e.senderPublicKey=="string"&&typeof e.receiverPublicKey=="string"}function di(e){return e.type===_e}function or(e){return new kr("p256").keyFromPublic({x:Buffer.from(e.x,"base64").toString("hex"),y:Buffer.from(e.y,"base64").toString("hex")},"hex")}function hi(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");const n=t.length%4;return n>0&&(t+="=".repeat(4-n)),t}function pi(e){return Buffer.from(hi(e),"base64")}function gi(e,t){const[n,r,o]=e.split("."),s=pi(o);if(s.length!==64)throw new Error("Invalid signature length");const i=s.slice(0,32).toString("hex"),c=s.slice(32,64).toString("hex"),u=`${n}.${r}`,a=He(u),l=or(t),f=K(a,V);if(!l.verify(f,{r:i,s:c}))throw new Error("Invalid signature");return Cr(e).payload}const sr="irn";function yi(e){return e?.relay||{protocol:sr}}function mi(e){const t=Dr[e];if(typeof t>"u")throw new Error(`Relay Protocol not supported: ${e}`);return t}function ir(e,t="-"){const n={},r="relay"+t;return Object.keys(e).forEach(o=>{if(o.startsWith(r)){const s=o.replace(r,""),i=e[o];n[s]=i}}),n}function bi(e){if(!e.includes("wc:")){const a=rt(e);a!=null&&a.includes("wc:")&&(e=a)}e=e.includes("wc://")?e.replace("wc://",""):e,e=e.includes("wc:")?e.replace("wc:",""):e;const t=e.indexOf(":"),n=e.indexOf("?")!==-1?e.indexOf("?"):void 0,r=e.substring(0,t),o=e.substring(t+1,n).split("@"),s=typeof n<"u"?e.substring(n):"",i=new URLSearchParams(s),c={};i.forEach((a,l)=>{c[l]=a});const u=typeof c.methods=="string"?c.methods.split(","):void 0;return{protocol:r,topic:cr(o[0]),version:parseInt(o[1],10),symKey:c.symKey,relay:ir(c),methods:u,expiryTimestamp:c.expiryTimestamp?parseInt(c.expiryTimestamp,10):void 0}}function cr(e){return e.startsWith("//")?e.substring(2):e}function ar(e,t="-"){const n="relay",r={};return Object.keys(e).forEach(o=>{const s=n+t+o;e[o]&&(r[s]=e[o])}),r}function wi(e){const t=new URLSearchParams,n=ar(e.relay);Object.keys(n).sort().forEach(o=>{t.set(o,n[o])}),t.set("symKey",e.symKey),e.expiryTimestamp&&t.set("expiryTimestamp",e.expiryTimestamp.toString()),e.methods&&t.set("methods",e.methods.join(","));const r=t.toString();return`${e.protocol}:${e.topic}@${e.version}?${r}`}function Ei(e,t,n){return`${e}?wc_ev=${n}&topic=${t}`}var vi=Object.defineProperty,xi=Object.defineProperties,Oi=Object.getOwnPropertyDescriptors,ur=Object.getOwnPropertySymbols,Ii=Object.prototype.hasOwnProperty,Ai=Object.prototype.propertyIsEnumerable,fr=(e,t,n)=>t in e?vi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ni=(e,t)=>{for(var n in t||(t={}))Ii.call(t,n)&&fr(e,n,t[n]);if(ur)for(var n of ur(t))Ai.call(t,n)&&fr(e,n,t[n]);return e},Si=(e,t)=>xi(e,Oi(t));function le(e){const t=[];return e.forEach(n=>{const[r,o]=n.split(":");t.push(`${r}:${o}`)}),t}function lr(e){const t=[];return Object.values(e).forEach(n=>{t.push(...le(n.accounts))}),t}function dr(e,t){const n=[];return Object.values(e).forEach(r=>{le(r.accounts).includes(t)&&n.push(...r.methods)}),n}function hr(e,t){const n=[];return Object.values(e).forEach(r=>{le(r.accounts).includes(t)&&n.push(...r.events)}),n}function Ui(e,t){const n=Ir(e,t);if(n)throw new Error(n.message);const r={};for(const[o,s]of Object.entries(e))r[o]={methods:s.methods,events:s.events,chains:s.accounts.map(i=>`${i.split(":")[0]}:${i.split(":")[1]}`)};return r}function _i(e){const{proposal:{requiredNamespaces:t,optionalNamespaces:n={}},supportedNamespaces:r}=e,o=$t(t),s=$t(n),i={};Object.keys(r).forEach(a=>{const l=r[a].chains,f=r[a].methods,d=r[a].events,g=r[a].accounts;l.forEach(y=>{if(!g.some(h=>h.includes(y)))throw new Error(`No accounts provided for chain ${y} in namespace ${a}`)}),i[a]={chains:l,methods:f,events:d,accounts:g}});const c=Nr(t,i,"approve()");if(c)throw new Error(c.message);const u={};return!Object.keys(t).length&&!Object.keys(n).length?i:(Object.keys(o).forEach(a=>{const l=r[a].chains.filter(y=>{var h,m;return(m=(h=o[a])==null?void 0:h.chains)==null?void 0:m.includes(y)}),f=r[a].methods.filter(y=>{var h,m;return(m=(h=o[a])==null?void 0:h.methods)==null?void 0:m.includes(y)}),d=r[a].events.filter(y=>{var h,m;return(m=(h=o[a])==null?void 0:h.events)==null?void 0:m.includes(y)}),g=l.map(y=>r[a].accounts.filter(h=>h.includes(`${y}:`))).flat();u[a]={chains:l,methods:f,events:d,accounts:g}}),Object.keys(s).forEach(a=>{var l,f,d,g,y,h;if(!r[a])return;const m=(f=(l=s[a])==null?void 0:l.chains)==null?void 0:f.filter(I=>r[a].chains.includes(I)),B=r[a].methods.filter(I=>{var k,E;return(E=(k=s[a])==null?void 0:k.methods)==null?void 0:E.includes(I)}),b=r[a].events.filter(I=>{var k,E;return(E=(k=s[a])==null?void 0:k.events)==null?void 0:E.includes(I)}),_=m?.map(I=>r[a].accounts.filter(k=>k.includes(`${I}:`))).flat();u[a]={chains:Q((d=u[a])==null?void 0:d.chains,m),methods:Q((g=u[a])==null?void 0:g.methods,B),events:Q((y=u[a])==null?void 0:y.events,b),accounts:Q((h=u[a])==null?void 0:h.accounts,_)}}),u)}function Tt(e){return e.includes(":")}function pr(e){return Tt(e)?e.split(":")[0]:e}function $t(e){var t,n,r;const o={};if(!qe(e))return o;for(const[s,i]of Object.entries(e)){const c=Tt(s)?[s]:i.chains,u=i.methods||[],a=i.events||[],l=pr(s);o[l]=Si(Ni({},o[l]),{chains:Q(c,(t=o[l])==null?void 0:t.chains),methods:Q(u,(n=o[l])==null?void 0:n.methods),events:Q(a,(r=o[l])==null?void 0:r.events)})}return o}function gr(e){const t={};return e?.forEach(n=>{const[r,o]=n.split(":");t[r]||(t[r]={accounts:[],chains:[],events:[]}),t[r].accounts.push(n),t[r].chains.push(`${r}:${o}`)}),t}function Ti(e,t){t=t.map(r=>r.replace("did:pkh:",""));const n=gr(t);for(const[r,o]of Object.entries(n))o.methods?o.methods=Q(o.methods,e):o.methods=e,o.events=["chainChanged","accountsChanged"];return n}const yr={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},mr={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function te(e,t){const{message:n,code:r}=mr[e];return{message:t?`${n} ${t}`:n,code:r}}function de(e,t){const{message:n,code:r}=yr[e];return{message:t?`${n} ${t}`:n,code:r}}function $e(e,t){return Array.isArray(e)?typeof t<"u"&&e.length?e.every(t):!0:!1}function qe(e){return Object.getPrototypeOf(e)===Object.prototype&&Object.keys(e).length}function ae(e){return typeof e>"u"}function q(e,t){return t&&ae(e)?!0:typeof e=="string"&&!!e.trim().length}function Ge(e,t){return t&&ae(e)?!0:typeof e=="number"&&!isNaN(e)}function $i(e,t){const{requiredNamespaces:n}=t,r=Object.keys(e.namespaces),o=Object.keys(n);let s=!0;return re(o,r)?(r.forEach(i=>{const{accounts:c,methods:u,events:a}=e.namespaces[i],l=le(c),f=n[i];(!re(Le(i,f),l)||!re(f.methods,u)||!re(f.events,a))&&(s=!1)}),s):!1}function Re(e){return q(e,!1)&&e.includes(":")?e.split(":").length===2:!1}function br(e){if(q(e,!1)&&e.includes(":")){const t=e.split(":");if(t.length===3){const n=t[0]+":"+t[1];return!!t[2]&&Re(n)}}return!1}function Ri(e){function t(n){try{return typeof new URL(n)<"u"}catch{return!1}}try{if(q(e,!1)){if(t(e))return!0;const n=rt(e);return t(n)}}catch{}return!1}function Pi(e){var t;return(t=e?.proposer)==null?void 0:t.publicKey}function Li(e){return e?.topic}function Bi(e,t){let n=null;return q(e?.publicKey,!1)||(n=te("MISSING_OR_INVALID",`${t} controller public key should be a string`)),n}function Rt(e){let t=!0;return $e(e)?e.length&&(t=e.every(n=>q(n,!1))):t=!1,t}function wr(e,t,n){let r=null;return $e(t)&&t.length?t.forEach(o=>{r||Re(o)||(r=de("UNSUPPORTED_CHAINS",`${n}, chain ${o} should be a string and conform to "namespace:chainId" format`))}):Re(e)||(r=de("UNSUPPORTED_CHAINS",`${n}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),r}function Er(e,t,n){let r=null;return Object.entries(e).forEach(([o,s])=>{if(r)return;const i=wr(o,Le(o,s),`${t} ${n}`);i&&(r=i)}),r}function vr(e,t){let n=null;return $e(e)?e.forEach(r=>{n||br(r)||(n=de("UNSUPPORTED_ACCOUNTS",`${t}, account ${r} should be a string and conform to "namespace:chainId:address" format`))}):n=de("UNSUPPORTED_ACCOUNTS",`${t}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),n}function xr(e,t){let n=null;return Object.values(e).forEach(r=>{if(n)return;const o=vr(r?.accounts,`${t} namespace`);o&&(n=o)}),n}function Or(e,t){let n=null;return Rt(e?.methods)?Rt(e?.events)||(n=de("UNSUPPORTED_EVENTS",`${t}, events should be an array of strings or empty array for no events`)):n=de("UNSUPPORTED_METHODS",`${t}, methods should be an array of strings or empty array for no methods`),n}function Pt(e,t){let n=null;return Object.values(e).forEach(r=>{if(n)return;const o=Or(r,`${t}, namespace`);o&&(n=o)}),n}function ji(e,t,n){let r=null;if(e&&qe(e)){const o=Pt(e,t);o&&(r=o);const s=Er(e,t,n);s&&(r=s)}else r=te("MISSING_OR_INVALID",`${t}, ${n} should be an object with data`);return r}function Ir(e,t){let n=null;if(e&&qe(e)){const r=Pt(e,t);r&&(n=r);const o=xr(e,t);o&&(n=o)}else n=te("MISSING_OR_INVALID",`${t}, namespaces should be an object with data`);return n}function Ar(e){return q(e.protocol,!0)}function Ci(e,t){let n=!1;return t&&!e?n=!0:e&&$e(e)&&e.length&&e.forEach(r=>{n=Ar(r)}),n}function ki(e){return typeof e=="number"}function Di(e){return typeof e<"u"&&typeof e!==null}function Mi(e){return!(!e||typeof e!="object"||!e.code||!Ge(e.code,!1)||!e.message||!q(e.message,!1))}function Vi(e){return!(ae(e)||!q(e.method,!1))}function Hi(e){return!(ae(e)||ae(e.result)&&ae(e.error)||!Ge(e.id,!1)||!q(e.jsonrpc,!1))}function Ki(e){return!(ae(e)||!q(e.name,!1))}function Fi(e,t){return!(!Re(t)||!lr(e).includes(t))}function qi(e,t,n){return q(n,!1)?dr(e,t).includes(n):!1}function Gi(e,t,n){return q(n,!1)?hr(e,t).includes(n):!1}function Nr(e,t,n){let r=null;const o=Wi(e),s=zi(t),i=Object.keys(o),c=Object.keys(s),u=Sr(Object.keys(e)),a=Sr(Object.keys(t)),l=u.filter(f=>!a.includes(f));return l.length&&(r=te("NON_CONFORMING_NAMESPACES",`${n} namespaces keys don't satisfy requiredNamespaces.

@@ -12,3 +12,3 @@ import { AuthTypes } from "@walletconnect/types";

export declare function buildAuthObject(requestPayload: AuthTypes.PayloadParams, signature: AuthTypes.CacaoSignature, iss: string): AuthTypes.Cacao;
type PopulateAuthPayloadParams = {
declare type PopulateAuthPayloadParams = {
authPayload: AuthTypes.PayloadParams;

@@ -32,3 +32,3 @@ chains: string[];

};
type RecapType = {
declare type RecapType = {
att: {

@@ -35,0 +35,0 @@ [key: string]: Record<string, unknown>;

@@ -11,3 +11,3 @@ import { CryptoTypes } from "@walletconnect/types";

export declare const TYPE_2 = 2;
export type P256KeyDataType = {
export declare type P256KeyDataType = {
crv: "P-256" | string;

@@ -14,0 +14,0 @@ ext: true | boolean;

@@ -1,3 +0,3 @@

export type SdkErrorKey = keyof typeof SDK_ERRORS;
export type InternalErrorKey = keyof typeof INTERNAL_ERRORS;
export declare type SdkErrorKey = keyof typeof SDK_ERRORS;
export declare type InternalErrorKey = keyof typeof INTERNAL_ERRORS;
export declare const SDK_ERRORS: {

@@ -4,0 +4,0 @@ INVALID_METHOD: {

@@ -55,4 +55,4 @@ import { SignClientTypes, RelayerClientMetadata, EngineTypes, RelayerTypes } from "@walletconnect/types";

export declare function parseExpirerTarget(target: string): {
id?: number;
topic?: string;
id?: number | undefined;
topic?: string | undefined;
};

@@ -59,0 +59,0 @@ export declare function calcExpiry(ttl: number, now?: number): number;

@@ -7,3 +7,3 @@ import { ProposalTypes, SessionTypes } from "@walletconnect/types";

export declare function getRequiredNamespacesFromNamespaces(namespaces: SessionTypes.Namespaces, caller: string): ProposalTypes.RequiredNamespaces;
export type BuildApprovedNamespacesParams = {
export declare type BuildApprovedNamespacesParams = {
proposal: ProposalTypes.Struct;

@@ -10,0 +10,0 @@ supportedNamespaces: Record<string, {

import { AuthTypes } from "@walletconnect/types";
export declare function hashEthereumMessage(message: string): string;
export declare function verifySignature(address: string, reconstructedMessage: string, cacaoSignature: AuthTypes.CacaoSignature, chainId: string, projectId: string, baseRpcUrl?: string): Promise<boolean>;
export declare function isValidEip191Signature(address: string, message: string, signature: string): Promise<boolean>;
export declare function isValidEip191Signature(address: string, message: string, signature: string): boolean;
export declare function isValidEip1271Signature(address: string, reconstructedMessage: string, signature: string, chainId: string, projectId: string, baseRpcUrl?: string): Promise<boolean>;
//# sourceMappingURL=signatures.d.ts.map
import { SessionTypes, ProposalTypes, RelayerTypes, EngineTypes } from "@walletconnect/types";
import { ErrorResponse } from "@walletconnect/jsonrpc-types";
export type ErrorObject = {
export declare type ErrorObject = {
message: string;

@@ -30,3 +30,3 @@ code: number;

export declare function isValidRelays(input: any, optional: boolean): input is RelayerTypes.ProtocolOptions[];
export declare function isValidId(input: any): input is number;
export declare function isValidId(input: any): boolean;
export declare function isValidParams(input: any): boolean;

@@ -33,0 +33,0 @@ export declare function isValidErrorReason(input: any): input is ErrorResponse;

{
"name": "@walletconnect/utils",
"description": "Utilities for WalletConnect Protocol",
"version": "2.18.1-canary-viem-1",
"version": "2.18.1-canary-ws-1",
"author": "WalletConnect, Inc. <walletconnect.com>",

@@ -34,2 +34,3 @@ "homepage": "https://github.com/walletconnect/walletconnect-monorepo/",

"dependencies": {
"@ethersproject/transactions": "5.7.0",
"@noble/ciphers": "1.2.1",

@@ -44,3 +45,3 @@ "@noble/curves": "1.8.1",

"@walletconnect/time": "1.0.2",
"@walletconnect/types": "2.18.1",
"@walletconnect/types": "2.18.1-canary-ws-1",
"@walletconnect/window-getters": "1.0.1",

@@ -51,4 +52,3 @@ "@walletconnect/window-metadata": "1.0.1",

"query-string": "7.1.3",
"uint8arrays": "3.1.0",
"viem": "^2.23.2"
"uint8arrays": "3.1.0"
},

@@ -55,0 +55,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc