1"use strict";(()=>{var Du=Object.defineProperty;var s=(ln,Q)=>Du(ln,"name",{value:Q,configurable:!0});(self.webpackChunk=self.webpackChunk||[]).push([[2701],{26691(ln,Q){Object.defineProperty(Q,"__esModule",{value:!0}),Q.getLocalStorage=Q.getLocalStorageOrThrow=Q.getCrypto=Q.getCryptoOrThrow=Q.getLocation=Q.getLocationOrThrow=Q.getNavigator=Q.getNavigatorOrThrow=Q.getDocument=Q.getDocumentOrThrow=Q.getFromWindowOrThrow=Q.getFromWindow=void 0;function k(q){let ke;return typeof window<"u"&&typeof window[q]<"u"&&(ke=window[q]),ke}s(k,"getFromWindow"),Q.getFromWindow=k;function _e(q){const ke=k(q);if(!ke)throw new Error(`${q} is not defined in Window`);return ke}s(_e,"getFromWindowOrThrow"),Q.getFromWindowOrThrow=_e;function z(){return _e("document")}s(z,"getDocumentOrThrow"),Q.getDocumentOrThrow=z;function Ce(){return k("document")}s(Ce,"getDocument"),Q.getDocument=Ce;function ge(){return _e("navigator")}s(ge,"getNavigatorOrThrow"),Q.getNavigatorOrThrow=ge;function Te(){return k("navigator")}s(Te,"getNavigator"),Q.getNavigator=Te;function Ut(){return _e("location")}s(Ut,"getLocationOrThrow"),Q.getLocationOrThrow=Ut;function ze(){return k("location")}s(ze,"getLocation"),Q.getLocation=ze;function Nt(){return _e("crypto")}s(Nt,"getCryptoOrThrow"),Q.getCryptoOrThrow=Nt;function Ct(){return k("crypto")}s(Ct,"getCrypto"),Q.getCrypto=Ct;function qe(){return _e("localStorage")}s(qe,"getLocalStorageOrThrow"),Q.getLocalStorageOrThrow=qe;function at(){return k("localStorage")}s(at,"getLocalStorage"),Q.getLocalStorage=at},35641(ln,Q,k){var _e;_e={value:!0},Q.g=void 0;const z=k(26691);function Ce(){let ge,Te;try{ge=z.getDocumentOrThrow(),Te=z.getLocationOrThrow()}catch{return null}function Ut(){const Ae=ge.getElementsByTagName("link"),ve=[];for(let Z=0;Z<Ae.length;Z++){const Fe=Ae[Z],Ye=Fe.getAttribute("rel");if(Ye&&Ye.toLowerCase().indexOf("icon")>-1){const he=Fe.getAttribute("href");if(he)if(he.toLowerCase().indexOf("https:")===-1&&he.toLowerCase().indexOf("http:")===-1&&he.indexOf("//")!==0){let nt=Te.protocol+"//"+Te.host;if(he.indexOf("/")===0)nt+=he;else{const Vt=Te.pathname.split("/");Vt.pop();const _t=Vt.join("/");nt+=_t+"/"+he}ve.push(nt)}else if(he.indexOf("//")===0){const nt=Te.protocol+he;ve.push(nt)}else ve.push(he)}}return ve}s(Ut,"getIcons");function ze(...Ae){const ve=ge.getElementsByTagName("meta");for(let Z=0;Z<ve.length;Z++){const Fe=ve[Z],Ye=["itemprop","property","name"].map(he=>Fe.getAttribute(he)).filter(he=>he?Ae.includes(he):!1);if(Ye.length&&Ye){const he=Fe.getAttribute("content");if(he)return he}}return""}s(ze,"getWindowMetadataOfAny");function Nt(){let Ae=ze("name","og:site_name","og:title","twitter:title");return Ae||(Ae=ge.title),Ae}s(Nt,"getName");function Ct(){return ze("description","og:description","twitter:description","keywords")}s(Ct,"getDescription");const qe=Nt(),at=Ct(),q=Te.origin,ke=Ut();return{description:at,url:q,icons:ke,name:qe}}s(Ce,"getWindowMetadata"),Q.g=Ce},72701(ln,Q,k){k.d(Q,{A:s(()=>Ze,"A")});var _e=k(41563),z=k(1893),Ce=k(58161),ge=k(53314),Te=k(64023),Ut=k(68486),ze=k(43544).hp;function Nt(u){return Number.isSafeInteger(u)&&u>=0}s(Nt,"Le");function Ct(u){return u!=null&&typeof u!="function"&&Nt(u.length)}s(Ct,"Me");function qe(u){return u==="__proto__"}s(qe,"ze");function at(u){return u==null||typeof u!="object"&&typeof u!="function"}s(at,"x");function q(u){return Object.getOwnPropertySymbols(u).filter(a=>Object.prototype.propertyIsEnumerable.call(u,a))}s(q,"ie");function ke(u){return u==null?u===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(u)}s(ke,"F");const _n="[object RegExp]",Ae="[object String]",ve="[object Number]",Z="[object Boolean]",Fe="[object Arguments]",Ye="[object Symbol]",he="[object Date]",nt="[object Map]",Vt="[object Set]",_t="[object Array]",Cr="[object ArrayBuffer]",qn="[object Object]",gi="[object DataView]",yi="[object Uint8Array]",Dr="[object Uint8ClampedArray]",mi="[object Uint16Array]",wi="[object Uint32Array]",bi="[object Int8Array]",hn="[object Int16Array]",Rr="[object Int32Array]",$r="[object Float32Array]",We="[object Float64Array
1]";function Xe(u){return ArrayBuffer.isView(u)&&!(u instanceof DataView)}s(Xe,"U");function Lr(u,a){return gt(u,void 0,u,new Map,a)}s(Lr,"at");function gt(u,a,l,y=new Map,I=void 0){const B=I?.(u,a,l,y);if(B!==void 0)return B;if(at(u))return u;if(y.has(u))return y.get(u);if(Array.isArray(u)){const b=new Array(u.length);y.set(u,b);for(let U=0;U<u.length;U++)b[U]=gt(u[U],U,l,y,I);return Object.hasOwn(u,"index")&&(b.index=u.index),Object.hasOwn(u,"input")&&(b.input=u.input),b}if(u instanceof Date)return new Date(u.getTime());if(u instanceof RegExp){const b=new RegExp(u.source,u.flags);return b.lastIndex=u.lastIndex,b}if(u instanceof Map){const b=new Map;y.set(u,b);for(const[U,F]of u)b.set(U,gt(F,U,l,y,I));return b}if(u instanceof Set){const b=new Set;y.set(u,b);for(const U of u)b.add(gt(U,void 0,l,y,I));return b}if(typeof ze<"u"&&ze.isBuffer(u))return u.subarray();if(Xe(u)){const b=new(Object.getPrototypeOf(u)).constructor(u.length);y.set(u,b);for(let U=0;U<u.length;U++)b[U]=gt(u[U],U,l,y,I);return b}if(u instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&u instanceof SharedArrayBuffer)return u.slice(0);if(u instanceof DataView){const b=new DataView(u.buffer.slice(0),u.byteOffset,u.byteLength);return y.set(u,b),He(b,u,l,y,I),b}if(typeof File<"u"&&u instanceof File){const b=new File([u],u.name,{type:u.type});return y.set(u,b),He(b,u,l,y,I),b}if(typeof Blob<"u"&&u instanceof Blob){const b=new Blob([u],{type:u.type});return y.set(u,b),He(b,u,l,y,I),b}if(u instanceof Error){const b=new u.constructor;return y.set(u,b),b.message=u.message,b.name=u.name,b.stack=u.stack,b.cause=u.cause,He(b,u,l,y,I),b}if(u instanceof Boolean){const b=new Boolean(u.valueOf());return y.set(u,b),He(b,u,l,y,I),b}if(u instanceof Number){const b=new Number(u.valueOf());return y.set(u,b),He(b,u,l,y,I),b}if(u instanceof String){const b=new String(u.valueOf());return y.set(u,b),He(b,u,l,y,I),b}if(typeof u=="object"&&Wn(u)){const b=Object.create(Object.getPrototypeOf(u));return y.set(u,b),He(b,u,l,y,I),b}return u}s(gt,"y");function He(u,a,l=u,y,I){const B=[...Object.keys(a),...q(a)];for(let b=0;b<B.length;b++){const U=B[b],F=Object.getOwnPropertyDescriptor(u,U);(F==null||F.writable)&&(u[U]=gt(a[U],U,l,y,I))}}s(He,"f");function Wn(u){switch(ke(u)){case Fe:case _t:case Cr:case gi:case Z:case he:case $r:case We:case bi:case hn:case Rr:case nt:case ve:case qn:case _n:case Vt:case Ae:case Ye:case yi:case Dr:case mi:case wi:return!0;default:return!1}}s(Wn,"ct");function Tr(u,a){return Lr(u,(l,y,I,B)=>{const b=a?.(l,y,I,B);if(b!==void 0)return b;if(typeof u=="object"){if(ke(u)===qn&&typeof u.constructor!="function"){const U={};return B.set(u,U),He(U,u,I,B),U}switch(Object.prototype.toString.call(u)){case ve:case Ae:case Z:{const U=new u.constructor(u?.valueOf());return He(U,u),U}case Fe:{const U={};return He(U,u),U.length=u.length,U[Symbol.iterator]=u[Symbol.iterator],U}default:return}}})}s(Tr,"ot");function Gn(u){return Tr(u)}s(Gn,"he");function qt(u){return u!==null&&typeof u=="object"&&ke(u)==="[object Arguments]"}s(qt,"pe");function Wt(u){return typeof u=="object"&&u!==null}s(Wt,"H");function kr(u){return Wt(u)&&Ct(u)}s(kr,"ht");function Zn(){}s(Zn,"pt");function dn(u){return Xe(u)}s(dn,"B");function ye(u){if(typeof u!="object"||u==null)return!1;if(Object.getPrototypeOf(u)===null)return!0;if(Object.prototype.toString.call(u)!=="[object Object]"){const l=u[Symbol.toStringTag];return l==null||!Object.getOwnPropertyDescriptor(u,Symbol.toStringTag)?.writable?!1:u.toString()===`[object ${l}]`}let a=u;for(;Object.getPrototypeOf(a)!==null;)a=Object.getPrototypeOf(a);return Object.getPrototypeOf(u)===a}s(ye,"L");function pn(u){if(at(u))return u;if(Array.isArray(u)||Xe(u)||u instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&u instanceof SharedArrayBuffer)return u.slice(0);const a=Object.getPrototypeOf(u);if(a==null)return Object.assign(Object.create(a),u);const l=a.constructor;if(u instanceof Date||u instanceof Map||u instanceof Set)return new l(u);if(u instanceof RegExp){const y=new l(u);return y.lastIndex=u.lastIndex,y}if(u instanceof DataView)return new l(u.buffer.slice(0));if(u instanceof Error){let y;return u instanceof AggregateError?y=new l(u.errors,u.message,{cause:u.cause}):y=new l(u.message,{cause:u.cause}),y.stack=u.stack,Object.assign(y,u),y}if(typeof File<"u"&&u instanceof File)return new l([u],u.name,{type:u.type,lastModified:u.lastModified});if(typeof u=="object"){const y=Object.create(a);return Object.assign(y,u)}return u}s(pn,"lt");function vi(u,...a){const l=a.slice(0,-1),y=a[a.length-1];let I=u;for(let B=0;B<l.length;B++){const b=l[B];I=gn(I,b,y,new Map)}return I}s(vi,"ut");function gn(u,a,l,y){if(at(u)&&(u=Object(u)),a==null||typeof a!="object")return u;if(y.has(a))return pn(y.get(a));if(y.set(a,u),Array.isArray(a)){a=a.slice();for(let B=0;B<a.length;B++)a[B]=a[B]??void 0}const I=[...Object.keys(a),...q(a)];for(let B=0;B<I.length;B++){const b=I[B];if(qe(b))continue;let U=a[b],F=u[b];if(qt(U)&&(U={...U}),qt(F)&&(F={...F}),typeof ze<"u"&&ze.isBuffer(U)&&(U=Gn(U)),Array.isArray(U))if(Array.isArray(F)){const ue=[],te=Reflect.ownKeys(F);for(let et=0;et<te.length;et++){const Ee=te[et];ue[Ee]=F[Ee]}F=ue}else if(kr(F)){const ue=[];for(let te=0;te<F.length;te++)ue[te]=F[te];F=ue}else F=[];const ie=l(F,U,b,u,a,y);ie!==void 0?u[b]=ie:Array.isArray(U)||Wt(F)&&Wt(U)&&(ye(F)||ye(U)||dn(F)||dn(U))?u[b]=gn(F,U,l,y):F==null&&ye(U)?u[b]=gn({},U,l,y):F==null&&dn(U)?u[b]=Gn(U):(F===void 0||U!==void 0)&&(u[b]=U)}return u}s(gn,"$");function zn(u,...a){return vi(u,...a,Zn)}s(zn,"dt");const Fr="error",Hr="wss://relay.walletconnect.org",yn="wc",Je="universal_provider",Gt=`${yn}@2:${Je}:`,Yn="https://rpc.walletconnect.org/v1/",ft="generic",yt=`${Yn}bundler`,mt="call_status",Mr=86400,mn={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var Xn=Object.defineProperty,Ei=Object.defineProperties,Kr=Object.getOwnPropertyDescriptors,Jn=Object.getOwnPropertySymbols,Qn=Object.prototype.hasOwnProperty,Vr=Object.prototype.propertyIsEnumerable,_r=s((u,a,l)=>a in u?Xn(u,a,{enumerable:!0,configurable:!0,writable:!0,value:l}):u[a]=l,"ge"),wn=s((u,a)=>{for(var l in a||(a={}))Qn.call(a,l)&&_r(u,l,a[l]);if(Jn)for(var l of Jn(a))Vr.call(a,l)&&_r(u,l,a[l]);return u},"E"),qr=s((u,a)=>Ei(u,Kr(a)),"It");function Wr(u,a,l){var y;const I=(0,z._Yb)(u);return((y=a.rpcMap)==null?void 0:y[I.reference])||`${Yn}?chainId=${I.namespace}:${I.reference}&projectId=${l}`}s(Wr,"ye");function ut(u){return u.includes(":")?u.split(":")[1]:u}s(ut,"St");function er(u){return u.map(a=>`${a.split(":")[0]}:${a.split(":")[1]}`)}s(er,"we");function Gr(u,a){const l=Object.keys(a.namespaces).filter(I=>I.includes(u));if(!l.length)return[];const y=[];return l.forEach(I=>{const B=a.namespaces[I].accounts;y.push(...B)}),y}s(Gr,"$t");function tr(u){return Object.fromEntries(Object.entries(u).filter(([a,l])=>{var y,I;return((y=l?.chains)==null?void 0:y.length)&&((I=l?.chains)==null?void 0:I.length)>0}))}s(tr,"ve");function bn(u={},a={}){const l=tr(Zr(u)),y=tr(Zr(a));return zn(l,y)}s(bn,"N");function Zr(u){var a,l,y,I,B;const b={};if(!(0,z.aF0)(u))return b;for(const[U,F]of Object.entries(u)){const ie=(0,z.nWe)(U)?[U]:F.chains,ue=F.methods||[],te=F.events||[],et=F.rpcMap||{},Ee=(0,z.kob)(U);b[Ee]=qr(wn(wn({},b[Ee]),F),{chains:(0,z.TRk)(ie,(a=b[Ee])==null?void 0:a.chains),methods:(0,z.TRk)(ue,(l=b[Ee])==null?void 0:l.methods),events:(0,z.TRk)(te,(y=b[Ee])==null?void 0:y.events)}),((0,z.aF0)(et)||(0,z.aF0)(((I=b[Ee])==null?void 0:I.rpcMap)||{}))&&(b[Ee].rpcMap=wn(wn({},et),(B=b[Ee])==null?void 0:B.rpcMap))}return b}s(Zr,"Pe");function nr(u){return u.includes(":")?u.split(":")[2]:u}s(nr,"be");function zr(u){const a={};for(const[l,y]of Object.entries(u)){const I=y.methods||[],B=y.events||[],b=y.accounts||[],U=(0,z.nWe)(l)?[l]:y.chains?y.chains:er(y.accounts);a[l]={chains:U,methods:I,events:B,accounts:b}}return a}s(zr,"Oe");function vn(u){return typeof u=="number"?u:u.includes("0x")?parseInt(u,16):(u=u.includes(":")?u.split(":")[1]:u,isNaN(Number(u))?u:Number(u))}s(vn,"z");function Yr(u){try{const a=JSON.parse(u);return typeof a=="object"&&a!==null&&!Array.isArray(a)}catch{return!1}}s(Yr,"At");const En={},wt=s(u=>En[u],"v"),On=s((u,a)=>{En[u]=a},"G");var Xr=Object.defineProperty,rr=Object.getOwnPropertySymbols,Jr=Object.prototype.hasOwnProperty,Qr=Object.prototype.propertyIsEnumerable,Be=s((u,a,l)=>a in u?Xr(u,a,{enumerable:!0,configurable:!0,writable:!0,value:l}):u[a]=l,"$e"),sr=s((u,a)=>{for(var l in a||(a={}))Jr.call(a,l)&&Be(u,l,a[l]);if(rr)for(var l of rr(a))Qr.call(a,l)&&Be(u,l,a[l]);return u},"Ae");const ir="eip155",es=["atomic","flow-control","paymasterService","sessionKeys","auxiliaryFunds"],ts=s(u=>u&&u.startsWith("0x")?BigInt(u).toString(10):u,"_t"),Zt=s(u=>u&&u.startsWith("0x")?u:`0x${BigInt(u).toString(16)}`,"W"),or=s(u=>Object.keys(u).filter(a=>es.includes(a)).reduce((a,l)=>(a[l]=ns(u[l]),a),{}),"Ne"),ns=s(u=>typeof u=="string"&&Yr(u)?JSON.parse(u):u,"Dt"),rs=s((u,a,l)=>{const{sessionProperties:y={},scopedProperties:I={}}=u,B={};if(!(0,z.aF0)(I)&&!(0,z.aF0)(y))return;const b=or(y);for(const U of l){const F=ts(U);if(!F)continue;B[Zt(F)]=b;const ie=I?.[`${ir}:${F}`];if(ie){const ue=ie?.[`${ir}:${F}:${a}`];B[Zt(F)]=sr(sr({},B[Zt(F)]),or(ue||ie))}}for(const[U,F]of Object.entries(B))Object.keys(F).length===0&&delete B[U];return Object.keys(B).length>0?B:void 0},"qt");var ss=Object.defineProperty,is=s((u,a,l)=>a in u?ss(u,a,{enumerable:!0,configurable:!0,writable:!0,value:l}):u[a]=l,"xt"),os=s((u,a,l)=>is(u,typeof a!="symbol"?a+"":a,l),"Ft");let zt;const Qt=class Qt{constructor(a){os(this,"storage"),this.storage=a}async getItem(a){return await this.storage.getItem(a)}async setItem(a,l){return await this.storage.setItem(a,l)}async removeItem(a){return await this.storage.removeItem(a)}static getStorage(a){return zt||(zt=new Qt(a)),zt}};s(Qt,"Q");let In=Qt;var xn=Object.defineProperty,Yt=Object.defineProperties,cr=Object.getOwnPropertyDescriptors,Pn=Object.getOwnPropertySymbols,ar=Object.prototype.hasOwnProperty,fr=Object.prototype.propertyIsEnumerable,An=s((u,a,l)=>a in u?xn(u,a,{enumerable:!0,configurable:!0,writable:!0,value:l}):u[a]=l,"Ce"),rt=s((u,a)=>{for(var l in a||(a={}))ar.call(a,l)&&An(u,l,a[l]);if(Pn)for(var l of Pn(a))fr.call(a,l)&&An(u,l,a[l]);return u},"zt"),st=s((u,a)=>Yt(u,cr(a)),"Gt");async function Dt(u,a){const l=(0,z._Yb)(u.result.capabilities.caip345.caip2),y=u.result.capabilities.caip345.transactionHashes,I=await Promise.allSettled(y.map(te=>Rt(l.reference,te,a))),B=I.filter(te=>te.status==="fulfilled").map(te=>te.value).filter(te=>te);I.filter(te=>te.status==="rejected").forEach(te=>console.warn("Failed to fetch transaction receipt:",te.reason));const b=!B.length||B.some(te=>!te),U=B.every(te=>te?.status==="0x1"),F=B.every(te=>te?.status==="0x0"),ie=B.some(te=>te?.status==="0x0");let ue;return b?ue=100:U?ue=200:F?ue=500:ie&&(ue=600),{id:u.result.id,version:u.request.version,atomic:u.request.atomicRequired,chainId:u.request.chainId,capabilities:u.result.capabilities,receipts:B,status:ue}}s(Dt,"Wt");async function Rt(u,a,l){return await l(parseInt(u)).request((0,Ce.formatJsonRpcRequest)("eth_getTransactionReceipt",[a]))}s(Rt,"Jt");async function cs({sendCalls:u,storage:a}){const l=await a.getItem(mt);await a.setItem(mt,st(rt({},l),{[u.result.id]:{request:u.request,result:u.result,expiry:(0,z.Xw0)(Mr)}}
1))}s(cs,"Kt");async function as({resultId:u,storage:a}){const l=await a.getItem(mt);if(l){delete l[u],await a.setItem(mt,l);for(const y in l)(0,z._dF)(l[y].expiry)&&delete l[y];await a.setItem(mt,l)}}s(as,"Vt");async function fs({resultId:u,storage:a}){const l=await a.getItem(mt),y=l?.[u];if(y&&!(0,z._dF)(y.expiry))return y;await as({resultId:u,storage:a})}s(fs,"Yt");var us=Object.defineProperty,ls=Object.defineProperties,hs=Object.getOwnPropertyDescriptors,De=Object.getOwnPropertySymbols,Bn=Object.prototype.hasOwnProperty,Sn=Object.prototype.propertyIsEnumerable,jn=s((u,a,l)=>a in u?us(u,a,{enumerable:!0,configurable:!0,writable:!0,value:l}):u[a]=l,"K"),Un=s((u,a)=>{for(var l in a||(a={}))Bn.call(a,l)&&jn(u,l,a[l]);if(De)for(var l of De(a))Sn.call(a,l)&&jn(u,l,a[l]);return u},"V"),Nn=s((u,a)=>ls(u,hs(a)),"Y"),lt=s((u,a,l)=>jn(u,typeof a!="symbol"?a+"":a,l),"g");const ct=class ct{constructor(a){lt(this,"name","eip155"),lt(this,"client"),lt(this,"chainId"),lt(this,"namespace"),lt(this,"httpProviders"),lt(this,"events"),lt(this,"storage"),this.namespace=a.namespace,this.events=wt("events"),this.client=wt("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain()),this.storage=In.getStorage(this.client.core.storage)}async request(a){switch(a.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(a);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(a);case"wallet_getCallsStatus":return await this.getCallStatus(a);case"wallet_sendCalls":return await this.sendCalls(a)}return this.namespace.methods.includes(a.request.method)?await this.client.request(a):this.getHttpProvider().request(a.request)}updateNamespace(a){this.namespace=Object.assign(this.namespace,a)}setDefaultChain(a,l){this.httpProviders[a]||this.setHttpProvider(parseInt(a),l);const y=this.chainId;this.chainId=parseInt(a),this.events.emit(mn.DEFAULT_CHAIN_CHANGED,{currentCaipChainId:`${this.name}:${a}`,previousCaipChainId:`${this.name}:${y}`})}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const a=this.namespace.chains[0];if(!a)throw new Error("ChainId not found");return a.split(":")[1]}createHttpProvider(a,l){const y=l||Wr(`${this.name}:${a}`,this.namespace,this.client.core.projectId);if(!y)throw new Error(`No RPC url provided for chainId: ${a}`);return new ge.F(new Te.V(y,wt("disableProviderPing")))}setHttpProvider(a,l){const y=this.createHttpProvider(a,l);y&&(this.httpProviders[a]=y)}createHttpProviders(){const a={};return this.namespace.chains.forEach(l=>{var y;const I=parseInt(ut(l));a[I]=this.createHttpProvider(I,(y=this.namespace.rpcMap)==null?void 0:y[l])}),a}getAccounts(){const a=this.namespace.accounts;return a?[...new Set(a.filter(l=>l.split(":")[1]===this.chainId.toString()).map(l=>l.split(":")[2]))]:[]}getHttpProvider(a){const l=a||this.chainId;return this.httpProviders[l]||(this.httpProviders=Nn(Un({},this.httpProviders),{[l]:this.createHttpProvider(l)}),this.httpProviders[l])}async handleSwitchChain(a){var l,y;let I=a.request.params?(l=a.request.params[0])==null?void 0:l.chainId:"0x0";I=I.startsWith("0x")?I:`0x${I}`;const B=parseInt(I,16);if(this.isChainApproved(B))this.setDefaultChain(`${B}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:a.topic,request:{method:a.request.method,params:[{chainId:I}]},chainId:(y=this.namespace.chains)==null?void 0:y[0]}),this.setDefaultChain(`${B}`);else throw new Error(`Failed to switch to chain 'eip155:${B}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(a){return this.namespace.chains.includes(`${this.name}:${a}`)}async getCapabilities(a){var l,y,I,B,b;const U=(y=(l=a.request)==null?void 0:l.params)==null?void 0:y[0],F=((B=(I=a.request)==null?void 0:I.params)==null?void 0:B[1])||[];if(!U)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const ie=this.client.session.get(a.topic),ue=((b=ie?.sessionProperties)==null?void 0:b.capabilities)||{},te=F.length>0?F.join(","):`0x${this.chainId.toString(16)}`,et=`${U}${te}`,Ee=ue?.[et];if(Ee)return Ee;let en;try{en=rs(ie,U,F)}catch(tn){console.warn("Failed to extract capabilities from session",tn)}
1if(en)return en;const Rn=await this.client.request(a);try{await this.client.session.update(a.topic,{sessionProperties:Nn(Un({},ie.sessionProperties||{}),{capabilities:Nn(Un({},ue||{}),{[et]:Rn})})})}catch(tn){console.warn("Failed to update session with capabilities",tn)}return Rn}async getCallStatus(a){var l,y,I;const B=this.client.session.get(a.topic),b=(l=B.sessionProperties)==null?void 0:l.bundler_name;if(b){const ie=this.getBundlerUrl(a.chainId,b);try{return await this.getUserOperationReceipt(ie,a)}catch(ue){console.warn("Failed to fetch call status from bundler",ue,ie)}}const U=(y=B.sessionProperties)==null?void 0:y.bundler_url;if(U)try{return await this.getUserOperationReceipt(U,a)}catch(ie){console.warn("Failed to fetch call status from custom bundler",ie,U)}const F=await fs({resultId:(I=a.request.params)==null?void 0:I[0],storage:this.storage});if(F)try{return await Dt(F,this.getHttpProvider.bind(this))}catch(ie){console.warn("Failed to fetch call status from stored send calls",ie,F)}if(this.namespace.methods.includes(a.request.method))return await this.client.request(a);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(a,l){var y;const I=new URL(a),B=await fetch(I,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify((0,Ce.formatJsonRpcRequest)("eth_getUserOperationReceipt",[(y=l.request.params)==null?void 0:y[0]]))});if(!B.ok)throw new Error(`Failed to fetch user operation receipt - ${B.status}`);return await B.json()}getBundlerUrl(a,l){return`${yt}?projectId=${this.client.core.projectId}&chainId=${a}&bundler=${l}`}async sendCalls(a){var l,y,I;const B=await this.client.request(a),b=(l=a.request.params)==null?void 0:l[0],U=B?.id,F=B?.capabilities||{},ie=(y=F?.caip345)==null?void 0:y.caip2,ue=(I=F?.caip345)==null?void 0:I.transactionHashes;return!U||!ie||!(ue!=null&&ue.length)||await cs({sendCalls:{request:b,result:B},storage:this.storage}),B}};s(ct,"es");let it=ct;var Xt=Object.defineProperty,Qe=s((u,a,l)=>a in u?Xt(u,a,{enumerable:!0,configurable:!0,writable:!0,value:l}):u[a]=l,"ss"),me=s((u,a,l)=>Qe(u,typeof a!="symbol"?a+"":a,l),"P");const Me=class Me{constructor(a){me(this,"name",ft),me(this,"client"),me(this,"httpProviders"),me(this,"events"),me(this,"namespace"),me(this,"chainId"),this.namespace=a.namespace,this.events=wt("events"),this.client=wt("client"),this.chainId=this.getDefaultChain(),this.name=this.getNamespaceName(),this.httpProviders=this.createHttpProviders()}updateNamespace(a){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(a.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(a.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(a.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(a.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(a){return this.namespace.methods.includes(a.request.method)?this.client.request(a):this.getHttpProvider(a.chainId).request(a.request)}setDefaultChain(a,l){this.httpProviders[a]||this.setHttpProvider(a,l);const y=this.chainId;this.chainId=a,this.events.emit(mn.DEFAULT_CHAIN_CHANGED,{currentCaipChainId:`${this.name}:${a}`,previousCaipChainId:`${this.name}:${y}`})}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const a=this.namespace.chains[0];if(!a)throw new Error("ChainId not found");return a.split(":")[1]}getNamespaceName(){const a=this.namespace.chains[0];if(!a)throw new Error("ChainId not found");return(0,z._Yb)(a).namespace}getAccounts(){const a=this.namespace.accounts;return a?[...new Set(a.filter(l=>l.split(":")[1]===this.chainId.toString()).map(l=>l.split(":")[2]))]:[]}createHttpProviders(){var a,l;const y={};return(l=(a=this.namespace)==null?void 0:a.accounts)==null||l.forEach(I=>{var B,b;const U=(0,z._Yb)(I),F=(b=(B=this.namespace)==null?void 0:B.rpcMap)==null?void 0:b[`${U.namespace}:${U.reference}`];y[U.reference]=this.createHttpProvider(I,F)}),y}getHttpProvider(a){const l=(0,z._Yb)(a).reference,y=this.httpProviders[l];if(typeof y>"u")throw new Error(`JSON-RPC provider for ${a} not found`);return y}setHttpProvider(a,l){const y=this.createHttpProvider(a,l);y&&(this.httpProviders[a]=y)}createHttpProvider(a,l){const y=l||Wr(a,this.namespace,this.client.core.projectId);if(!y)throw new Error(`No RPC url provided for chainId: ${a}`);return new ge.F(new Te.A(y,wt("disableProviderPing")))}};s(Me,"is");let bt=Me;var ot=Object.defineProperty,Cn=Object.defineProperties,$t=Object.getOwnPropertyDescriptors,Se=Object.getOwnPropertySymbols,Dn=Object.prototype.hasOwnProperty,Ge=Object.prototype.propertyIsEnumerable,Jt=s((u,a,l)=>a in u?ot(u,a,{enumerable:!0,configurable:!0,writable:!0,value:l}):u[a]=l,"X"),vt=s((u,a)=>{for(var l in a||(a={}))Dn.call(a,l)&&Jt(u,l,a[l]);if(Se)for(var l of Se(a))Ge.call(a,l)&&Jt(u,l,a[l]);return u},"S"),Re=s((u,a)=>Cn(u,$t(a)),"j"),je=s((u,a,l)=>Jt(u,typeof a!="symbol"?a+"":a,l),"d");const Lt=class Lt{constructor(a){je(this,"client"),je(this,"namespaces"),je(this,"optionalNamespaces"),je(this,"sessionProperties"),je(this,"scopedProperties"),je(this,"events",new Ut),je(this,"rpcProviders",{}),je(this,"session"),je(this,"providerOpts"),je(this,"logger"),je(this,"uri"),je(this,"disableProviderPing",!1),je(this,"connectParam
1s");var l,y;this.providerOpts=a,this.logger=(0,z.haE)({logger:(l=a.logger)!=null?l:Fr,name:(y=this.providerOpts.name)!=null?y:Je}),this.disableProviderPing=a?.disableProviderPing||!1}static async init(a){const l=new Lt(a);return await l.initialize(),l}async request(a,l,y){const[I,B]=this.validateChain(l);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(I).request({request:vt({},a),chainId:`${I}:${B}`,topic:this.session.topic,expiry:y})}sendAsync(a,l,y,I){const B=new Date().getTime();this.request(a,y,I).then(b=>l(null,(0,Ce.formatJsonRpcResult)(B,b))).catch(b=>l(b,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties,scopedProperties:this.scopedProperties}),await this.requestAccounts()}async disconnect(){var a;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(a=this.session)==null?void 0:a.topic,reason:(0,z.Hjj)("USER_DISCONNECTED")}),await this.cleanup()}async connect(a){if(!this.client)throw new Error("Sign Client not initialized");if(this.connectParams=a,this.setNamespaces(a),this.cleanupPendingPairings(),!a.skipPairing)return await this.pair(a.pairingTopic)}async authenticate(a,l){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(a),await this.cleanupPendingPairings();const{uri:y,response:I}=await this.client.authenticate(a,l);y&&(this.uri=y,this.events.emit("display_uri",y));const B=await I();if(this.session=B.session,this.session){const b=zr(this.session.namespaces);this.namespaces=bn(this.namespaces,b),await this.persist("namespaces",this.namespaces),this.onConnect()}return B}on(a,l){this.events.on(a,l)}once(a,l){this.events.once(a,l)}removeListener(a,l){this.events.removeListener(a,l)}off(a,l){this.events.off(a,l)}get isWalletConnect(){return!0}async pair(a){var l,y;const{uri:I,approval:B}=await this.client.connect({pairingTopic:a,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties,scopedProperties:this.scopedProperties,authentication:(l=this.connectParams)==null?void 0:l.authentication,walletPay:(y=this.connectParams)==null?void 0:y.walletPay});I&&(this.uri=I,this.events.emit("display_uri",I));const b=await B();this.session=b;const U=zr(b.namespaces);return this.namespaces=bn(this.namespaces,U),await this.persist("namespaces",this.namespaces),await this.persist("optionalNamespaces",this.optionalNamespaces),this.onConnect(),this.session}setDefaultChain(a,l){try{if(!this.session)return;const[y,I]=this.validateChain(a),B=this.getProvider(y);B?B.setDefaultChain(I,l):this.session&&this.logger.warn(`Provider for namespace '${y}' not found in setDefaultChain`)}catch(y){if(!/Please call connect/.test(y.message))throw y}}async cleanupPendingPairings(a={}){try{this.logger.info("Cleaning up inactive pairings...");const l=this.client.pairing.getAll();if(!(0,z.OP1)(l))return;for(const y of l)a.deletePairings?this.client.core.expirer.set(y.topic,0):await this.client.core.relayer.subscriber.unsubscribe(y.topic);this.logger.info(`Inactive pairings cleared: ${l.length}`)}catch(l){this.logger.warn(l,"Failed to cleanup pending pairings")}}abortPairingAttempt(){this.logger.warn("abortPairingAttempt is deprecated. This is now a no-op.")}async checkStorage(){this.namespaces=await this.getFromStore("namespaces")||{},this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.session&&this.createProviders()}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){var a,l;if(this.client=this.providerOpts.client||await _e.VF.init({core:this.providerOpts.core,logger:this.providerOpts.logger||Fr,relayUrl:this.providerOpts.relayUrl||Hr,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.providerOpts.session)try{this.session=this.client.session.get(this.providerOpts.session.topic)}catch(y){throw this.logger.error(y,"Failed to get session"),new Error(`The provided session: ${(l=(a=this.providerOpts)==null?void 0:a.session)==null?void 0:l.topic} doesn't exist in the Sign client`)}else{const y=this.client.session.getAll();this.session=y[0]}this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const a=[...new Set(Object.keys(this.session.namespaces).map(l=>(0,z.kob)(l)))];On("client",this.client),On("events",this.events),On("disableProviderPing",this.disableProviderPing),a.forEach(l=>{if(!this.session)return;const y=Gr(l,this.session);if(y?.length===0)return;const I=er(y),B=bn(this.namespaces,this.optionalNamespaces),b=Re(vt({},B[l]),{accounts:y,chains:I});switch(l){case"eip155":this.rpcProviders[l]=new it({namespace:b});break;default:this.rpcProviders[l]=new bt({namespace:b})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",a=>{var l;const{topic:y}=a;y===((l=this.session)==null?void 0:l.topic)&&this.events.emit("session_ping",a)}),this.client.on("session_event",a=>{var l;const{params:y,topic:I}=a;if(I!==((l=this.session)==null?void 0:l.topic))return;const{event:B}=y;if(B.name==="accountsChanged"){const b=B.data;b&&(0,z.OP1)(b)&&this.events.emit("accountsChanged",b.map(nr))}else if(B.name==="chainChanged"){const b=y.chainId,U=y.event.data,F=(0,z.kob)(b),ie=vn(b)!==vn(U)?`${F}:${vn(U)}`:b;this.onChainChanged({currentCaipChainId:ie})}else this.events.emit(B.name,B.data);this.events.emit("session_event",a)}),this.client.on("session_update",({topic:a,params:l})=>{var y,I;if(a!==((y=this.session)==null?void 0:y.topic))return;const{namespaces:B}=l,b=(I=this.client)==null?void 0:I.session.get(a);this.session=Re(vt({},b),{namespaces:B}),this.onSessionUpdate(),this.events.emit("session_update",{topic:a,params:l})}),this.client.on("session_delete",async a=>{var l;a.topic===((l=this.session)==null?void 0:l.topic)&&(await this.cleanup(),this.events.emit("session_delete",a),this.events.emit("disconnect",Re(vt({},(0,z.Hjj)("USER_DISCONNECTED")),{data:a.topic})))}),this.on(mn.DEFAULT_CHAIN_CHANGED,a=>{this.onChainChanged(Re(vt({},a),{internal:!0}))})}getProvider(a){return this.rpcProviders[a]||this.rpcProviders[ft]}
1onSessionUpdate(){Object.keys(this.rpcProviders).forEach(a=>{var l;this.getProvider(a).updateNamespace((l=this.session)==null?void 0:l.namespaces[a])})}setNamespaces(a){const{namespaces:l={},optionalNamespaces:y={},sessionProperties:I,scopedProperties:B}=a;this.optionalNamespaces=bn(l,y),this.sessionProperties=I,this.scopedProperties=B}validateChain(a){const[l,y]=a?.split(":")||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[l,y];if(l&&!Object.keys(this.namespaces||{}).map(b=>(0,z.kob)(b)).includes(l))throw new Error(`Namespace '${l}' is not configured. Please call connect() first with namespace config.`);if(l&&y)return[l,y];const I=(0,z.kob)(Object.keys(this.namespaces)[0]),B=this.rpcProviders[I].getDefaultChain();return[I,B]}async requestAccounts(){const[a]=this.validateChain();return await this.getProvider(a).requestAccounts()}async onChainChanged({currentCaipChainId:a,previousCaipChainId:l,internal:y=!1}){if(!this.namespaces)return;const[I,B]=this.validateChain(a);if(B){if(this.updateNamespaceChain(I,B),y)this.events.emit("chainChanged",B),this.emitAccountsChangedOnChainChange({namespace:I,currentCaipChainId:a,previousCaipChainId:l});else{const b=this.getProvider(I);b?b.setDefaultChain(B):this.session&&this.logger.warn(`Provider for namespace '${I}' not found during chain change`)}await this.persist("namespaces",this.namespaces)}}emitAccountsChangedOnChainChange({namespace:a,currentCaipChainId:l,previousCaipChainId:y}){var I,B;try{if(y===l)return;const b=(B=(I=this.session)==null?void 0:I.namespaces[a])==null?void 0:B.accounts;if(!b)return;const U=b.filter(F=>F.includes(`${l}:`)).map(nr);if(!(0,z.OP1)(U))return;this.events.emit("accountsChanged",U)}catch(b){this.logger.warn(b,"Failed to emit accountsChanged on chain change")}}updateNamespaceChain(a,l){if(!this.namespaces)return;const y=this.namespaces[a]?a:`${a}:${l}`,I={chains:[],methods:[],events:[],defaultChain:l};this.namespaces[y]?this.namespaces[y]&&(this.namespaces[y].defaultChain=l):this.namespaces[y]=I}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.connectParams=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,await this.deleteFromStore("namespaces"),await this.deleteFromStore("optionalNamespaces"),await this.deleteFromStore("sessionProperties"),this.session=void 0,this.cleanupPendingPairings({deletePairings:!0}),await this.cleanupStorage()}async persist(a,l){var y;const I=((y=this.session)==null?void 0:y.topic)||"";await this.client.core.storage.setItem(`${Gt}/${a}${I}`,l)}async getFromStore(a){var l;const y=((l=this.session)==null?void 0:l.topic)||"";return await this.client.core.storage.getItem(`${Gt}/${a}${y}`)}async deleteFromStore(a){var l;const y=((l=this.session)==null?void 0:l.topic)||"";await this.client.core.storage.removeItem(`${Gt}/${a}${y}`)}async cleanupStorage(){var a;try{if(((a=this.client)==null?void 0:a.session.length)>0)return;const l=await this.client.core.storage.getKeys();for(const y of l)y.startsWith(Gt)&&await this.client.core.storage.removeItem(y)}catch(l){this.logger.warn(l,"Failed to cleanup storage")}}};s(Lt,"C");let Ze=Lt;const ds=null},1893(ln,Q,k){k.d(Q,{$Bq:s(()=>Uf,"$Bq"),$hI:s(()=>or,"$hI"),ADD:s(()=>wt,"ADD"),ALl:s(()=>of,"ALl"),AYU:s(()=>Gf,"AYU"),Alu:s(()=>su,"Alu"),AwN:s(()=>No,"AwN"),BdH:s(()=>ft,"BdH"),C5G:s(()=>lf,"C5G"),CTo:s(()=>Zf,"CTo"),Ds_:s(()=>mn,"Ds_"),EHS:s(()=>Fn,"EHS"),EN$:s(()=>sf,"EN$"),EWt:s(()=>an,"EWt"),F$L:s(()=>uf,"F$L"),FR8:s(()=>fu,"FR8"),FiO:s(()=>Ho,"FiO"),GuA:s(()=>We,"GuA"),HNf:s(()=>qf,"HNf"),Hbs:s(()=>gu,"Hbs"),Hjj:s(()=>Xe,"Hjj"),IjX:s(()=>Sc,"IjX"),K3g:s(()=>Yr,"K3g"),KLX:s(()=>pc,"KLX"),Lln:s(()=>yn,"Lln"),Lp_:s(()=>fn,"Lp_"),M8n:s(()=>au,"M8n"),OP1:s(()=>Mn,"OP1"),PAk:s(()=>hc,"PAk"),PUk:s(()=>tr,"PUk"),Pa8:s(()=>Ar,"Pa8"),QJh:s(()=>jf,"QJh"),QV1:s(()=>yc,"QV1"),Qhg:s(()=>Ve,"Qhg"),R7U:s(()=>mt,"R7U"),TRk:s(()=>Be,"TRk"),TZl:s(()=>tf,"TZl"),TeY:s(()=>iu,"TeY"),Tw2:s(()=>ff,"Tw2"),U0i:s(()=>gf,"U0i"),V7m:s(()=>hf,"V7m"),V7u:s(()=>kf,"V7u"),V9G:s(()=>ru,"V9G"),VBM:s(()=>dr,"VBM"),Van:s(()=>Vf,"Van"),WWN:s(()=>Hc,"WWN"),Wx8:s(()=>vn,"Wx8"),X3c:s(()=>ou,"X3c"),XEe:s(()=>_f,"XEe"),XqR:s(()=>Ko,"XqR"),Xw0:s(()=>rr,"Xw0"),YcA:s(()=>af,"YcA"),ZbZ:s(()=>xn,"ZbZ"),_Yb:s(()=>Ye,"_Yb"),_dF:s(()=>Jr,"_dF"),aF0:s(()=>jr,"aF0"),aRZ:s(()=>Yn,"aRZ"),aa1:s(()=>wf,"aa1"),b07:s(()=>jt,"b07"),bEt:s(()=>Ne,"bEt"),c82:s(()=>Xr,"c82"),e8_:s(()=>Lc,"e8_"),esh:s(()=>nu,"esh"),fXy:s(()=>Lo,"fXy"),gOF:s(()=>On,"gOF"),gZm:s(()=>ns,"gZm"),g_l:s(()=>Ff,"g_l"),h0Y:s(()=>Gr,"h0Y"),hEn:s(()=>Qr,"hEn"),hVC:s(()=>Tc,"hVC"),haE:s(()=>Cu,"haE"),hwK:s(()=>Ci,"hwK"),iV1:s(()=>cu,"iV1"),iui:s(()=>Br,"iui"),jTh:s(()=>ts,"jTh"),jUZ:s(()=>Vr,"jUZ"),kob:s(()=>To,"kob"),kuU:s(()=>Mo,"kuU"),lFF:s(()=>Xn,"lFF"),lVv:s(()=>Je,"lVv"),m01:s(()=>Gt,"m01"),mXn:s(()=>dc,"mXn"),mr0:s(()=>zf,"mr0"),muJ:s(()=>Nu,"muJ"),n3s:s(()=>sr,"n3s"),n6V:s(()=>mf,"n6V"),nWe:s(()=>Ys,"nWe"),nYL:s(()=>mc,"nYL"),nyL:s(()=>Qs,"nyL"),oKp:s(()=>lu,"oKp"),ojD:s(()=>Qn,"ojD"),ovp:s(()=>rf,"ovp"),ps1:s(()=>df,"ps1"),psp:s(()=>wc,"psp"),q_h:s(()=>Os,"q_h"),sKr:s(()=>Iu,"sKr"),sc7:s(()=>yu,"sc7"),sc_:s(()=>Fc,"sc_"),tLy:s(()=>uu,"tLy"),tk0:s(()=>Yf,"tk0"),two:s(()=>nf,"two"),uym:s(()=>vu,"uym"),w8K:s(()=>rs,"w8K"),wYp:s(()=>Af,"wYp"),wa2:s(()=>cf,"wa2"),x0t:s(()=>Mt,"x0t"),xkc:s(()=>Ni,"xkc"),yy4:s(()=>In,"yy4"),z2N:s(()=>hu,"z2N")});var _e,z=k(95142),Ce=k(93114),ge=k(26691),Te=k(35641),Ut=k(34472),ze=k(5770),Nt=k(8079),Ct=k(3878),qe=k(83357),at=k(13708),q=k(6420),ke=k(96661),_n=k(6969),Ae=k(59497),ve=k(26748),Z=k(43544).hp;const Fe=":";function Ye(e){const[t,n]=e.split(Fe);return{namespace:t,reference:n}}s(Ye,"Je");function he(e){const{namespace:t,reference:n}=e;return[t,n].join(Fe)}s(he,"or");function nt(e){const[t,n,r]=e.split(Fe);return{namespace:t,reference:n,address:r}}s(nt,"Qe");function Vt(e){const{namespace:t,reference:n,address:r}=e;return[t,n,r].join(Fe)}s(Vt,"sr");function _t(e,t){const n=[];return e.forEach(r=>{const i=t(r);n.includes(i)||n.push(i)}),n}s(_t,"tn");function Cr(e){const{address:t}=nt(e);return t}s(Cr,"ir");function qn(e){const{namespace:t,reference:n}=nt(e);return he({namespace:t,reference:n})}s(qn,"cr");function gi(e,t){const{namespace:n,reference:r}=Ye(t);return Vt({namespace:n,reference:r,address:e})}s(gi,"Js");function yi(e){return _t(e,Cr)}s(yi,"Qs");function Dr(e){return _t(e,qn)}s(Dr,"fr");function mi(e,t=[]){const n=[];return Object.keys(e).forEach(r=>{if(t.length&&!t.includes(r))return;const i=e[r];n.push(...i.accounts)}),n}s(mi,"ti");function wi(e,t=[]){const n=[];return Object.keys(e).forEach(r=>{if(t.length&&!t.includes(r))return;const i=e[r];n.push(...Dr(i.accounts))}),n}s(wi,"ei");function bi(e,t=[]){const n=[];return Object.keys(e).forEach(r=>{if(t.length&&!t.includes(r))return;const i=e[r];n.push(...hn(r,i))}),n}s(bi,"ni");function hn(e,t){return e.includes(":")?[e]:t.chains||[]}s(hn,"Se");const Rr={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}},$r={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}};
1function We(e,t){const{message:n,code:r}=$r[e];return{message:t?`${n} ${t}`:n,code:r}}s(We,"bt");function Xe(e,t){const{message:n,code:r}=Rr[e];return{message:t?`${n} ${t}`:n,code:r}}s(Xe,"Vt");var Lr=Object.defineProperty,gt=Object.defineProperties,He=Object.getOwnPropertyDescriptors,Wn=Object.getOwnPropertySymbols,Tr=Object.prototype.hasOwnProperty,Gn=Object.prototype.propertyIsEnumerable,qt=s((e,t,n)=>t in e?Lr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,"en"),Wt=s((e,t)=>{for(var n in t||(t={}))Tr.call(t,n)&&qt(e,n,t[n]);if(Wn)for(var n of Wn(t))Gn.call(t,n)&&qt(e,n,t[n]);return e},"dr"),kr=s((e,t)=>gt(e,He(t)),"fi"),Zn=s((e,t,n)=>qt(e,typeof t!="symbol"?t+"":t,n),"hr");const dn="ReactNative",ye={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},pn=" ",vi=":",gn="/",zn=2,Fr=1e3,Hr="js";function yn(){return typeof ve<"u"&&typeof ve.versions<"u"&&typeof ve.versions.node<"u"}s(yn,"rn");function Je(){return!(0,ge.getDocument)()&&!!(0,ge.getNavigator)()&&navigator.product===dn}s(Je,"It");function Gt(){return Je()&&typeof k.g<"u"&&typeof(k.g==null?void 0:k.g.Platform)<"u"&&(k.g==null?void 0:k.g.Platform.OS)==="android"}s(Gt,"li");function Yn(){return Je()&&typeof k.g<"u"&&typeof(k.g==null?void 0:k.g.Platform)<"u"&&(k.g==null?void 0:k.g.Platform.OS)==="ios"}s(Yn,"di");function ft(){return!yn()&&!!(0,ge.getNavigator)()&&!!(0,ge.getDocument)()}s(ft,"Xt");function yt(){return Je()?ye.reactNative:yn()?ye.node:ft()?ye.browser:ye.unknown}s(yt,"Mt");function mt(){var e;try{return Je()&&typeof k.g<"u"&&typeof(k.g==null?void 0:k.g.Application)<"u"?(e=k.g.Application)==null?void 0:e.applicationId:void 0}catch{return}}s(mt,"hi");function Mr(e,t){const n=new URLSearchParams(e);return Object.entries(t).sort(([r],[i])=>r.localeCompare(i)).forEach(([r,i])=>{i!=null&&n.set(r,String(i))}),n.toString()}s(Mr,"yr");function mn(e){var t,n;const r=Xn();try{return e!=null&&e.url&&r.url&&new URL(e.url).host!==new URL(r.url).host&&(console.warn(`The configured WalletConnect 'metadata.url':${e.url} differs from the actual page url:${r.url}. This is probably unintended and can lead to issues.`),e.url=r.url),(t=e?.icons)!=null&&t.length&&e.icons.length>0&&(e.icons=e.icons.filter(i=>i!=="")),kr(Wt(Wt({},r),e),{url:e?.url||r.url,name:e?.name||r.name,description:e?.description||r.description,icons:(n=e?.icons)!=null&&n.length&&e.icons.length>0?e.icons:r.icons})}catch(i){return console.warn("Error populating app metadata",i),e||r}}s(mn,"pi");function Xn(){return(0,Te.g)()||{name:"",description:"",url:"",icons:[""]}}s(Xn,"mr");function Ei(e,t){var n;const r=yt(),i={protocol:e,version:t,env:r};return r==="browser"&&(i.host=((n=_e())==null?void 0:n.host)||"unknown"),i}s(Ei,"gi");function Kr(){if(yt()===ye.reactNative&&typeof k.g<"u"&&typeof(k.g==null?void 0:k.g.Platform)<"u"){const{OS:n,Version:r}=k.g.Platform;return[n,r].join("-")}const e=(0,z.o0)();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("-")}s(Kr,"wr");function Jn(){var e;const t=yt();return t===ye.browser?[t,((e=(0,ge.getLocation)())==null?void 0:e.host)||"unknown"].join(":"):t}s(Jn,"vr");function Qn(e,t,n){const r=Kr(),i=Jn();return[[e,t].join("-"),[Hr,n].join("-"),r,i].join("/")}s(Qn,"xr");function Vr({protocol:e,version:t,relayUrl:n,sdkVersion:r,auth:i,projectId:o,useOnCloseEvent:c,bundleId:f,packageName:h}){const g=n.split("?"),p=Qn(e,t,r),m={auth:i,ua:p,projectId:o,useOnCloseEvent:c||void 0,packageName:h||void 0,bundleId:f||void 0},d=Mr(g[1]||"",m);return g[0]+"?"+d}s(Vr,"bi");function _r(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("://")}s(_r,"yi");function wn(e,t,n){if(!e[t]||typeof e[t]!==n)throw new Error(`Missing or invalid "${t}" param`)}s(wn,"mi");function qr(e,t=zn){return er(e.split(gn),t)}s(qr,"Er");function Wr(e){return qr(e).join(pn)}s(Wr,"wi");function ut(e,t){return e.filter(n=>t.includes(n)).length===e.length}s(ut,"At");function er(e,t=zn){return e.slice(Math.max(e.length-t,0))}s(er,"Br");function Gr(e){return Object.fromEntries(e.entries())}s(Gr,"vi");function tr(e){return new Map(Object.entries(e))}s(tr,"xi");function bn(e,t){const n={};return Object.keys(e).forEach(r=>{n[r]=t(e[r])}),n}s(bn,"Ei");const Zr=s(e=>e,"Bi");function nr(e){return e.trim().replace(/^\w/,t=>t.toUpperCase())}s(nr,"Ir");function zr(e){return e.split(pn).map(t=>nr(t)).join(pn)}s(zr,"Ii");function vn(e=Ce.FIVE_MINUTES,t){const n=(0,Ce.toMiliseconds)(e||Ce.FIVE_MINUTES);let r,i,o,c;return{resolve:s(f=>{o&&r&&(clearTimeout(o),r(f),c=Promise.resolve(f))},"resolve"),reject:s(f=>{o&&i&&(clearTimeout(o),i(f))},"reject"),done:s(()=>new Promise((f,h)=>
1{if(c)return f(c);o=setTimeout(()=>{const g=We("EXPIRED"),p=new Error(t||g.message);p.code=g.code,h(p)},n),r=f,i=h}),"done")}}s(vn,"Ai");function Yr(e,t,n){return new Promise(async(r,i)=>{const o=setTimeout(()=>i(new Error(n)),t);try{const c=await e;r(c)}catch(c){i(c)}clearTimeout(o)})}s(Yr,"Si");function En(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}`)}s(En,"on");function wt(e){return En("topic",e)}s(wt,"Oi");function On(e){return En("id",e)}s(On,"Ni");function Xr(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}s(Xr,"Ui");function rr(e,t){return(0,Ce.fromMiliseconds)((t||Date.now())+(0,Ce.toMiliseconds)(e))}s(rr,"_i");function Jr(e){return Date.now()>=(0,Ce.toMiliseconds)(e)}s(Jr,"Ri");function Qr(e,t){return`${e}${t?`:${t}`:""}`}s(Qr,"$i");function Be(e=[],t=[]){return[...new Set([...e,...t])]}s(Be,"ut");async function sr({id:e,topic:t,wcDeepLink:n}){var r;try{if(!n)return;const i=typeof n=="string"?JSON.parse(n):n,o=i?.href;if(typeof o!="string")return;const c=ir(o,e,t),f=yt();if(f===ye.browser){if(!((r=(0,ge.getDocument)())!=null&&r.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}es(c)}else f===ye.reactNative&&typeof(k.g==null?void 0:k.g.Linking)<"u"&&await k.g.Linking.openURL(c)}catch(i){console.error(i)}}s(sr,"Ti");function ir(e,t,n){const r=`requestId=${t}&sessionTopic=${n}`;e.endsWith("/")&&(e=e.slice(0,-1));let i=`${e}`;if(e.startsWith("https://t.me")){const o=e.includes("?")?"&startapp=":"?startapp=";i=`${i}${o}${os(r,!0)}`}else i=`${i}/wc?${r}`;return i}s(ir,"Ar");function es(e){let t="_self";is()?t="_top":(ss()||e.startsWith("https://")||e.startsWith("http://"))&&(t="_blank"),window.open(e,t,"noreferrer noopener")}s(es,"Sr");async function ts(e,t){let n="";try{if(ft()&&(n=localStorage.getItem(t),n))return n;n=await e.getItem(t)}catch(r){console.error(r)}return n}s(ts,"Ci");function Zt(e,t){return e.filter(n=>t.includes(n))}s(Zt,"sn");function or(e,t){if(!e.includes(t))return null;const n=e.split(/([&,?,=])/),r=n.indexOf(t);return n[r+2]}s(or,"ji");function ns(){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)})}s(ns,"Li");function rs(){return typeof ve<"u"&&ve.env.IS_VITEST==="true"}s(rs,"ki");function ss(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}s(ss,"Or");function is(){try{return window.self!==window.top}catch{return!1}}s(is,"Nr");function os(e,t=!1){const n=Z.from(e).toString("base64");return t?n.replace(/[=]/g,""):n}s(os,"Ur");function zt(e){return Z.from(e,"base64").toString("utf-8")}s(zt,"cn");function In(e){return new Promise(t=>setTimeout(t,e))}s(In,"Pi");const ti=class ti{constructor({limit:t}){Zn(this,"limit"),Zn(this,"set"),this.limit=t,this.set=new Set}add(t){if(!this.set.has(t)){if(this.set.size>=this.limit){const n=this.set.values().next().value;n&&this.set.delete(n)}this.set.add(t)}}has(t){return this.set.has(t)}};s(ti,"Hi");let xn=ti;const Yt=BigInt(2**32-1),cr=BigInt(32);function Pn(e,t=!1){return t?{h:Number(e&Yt),l:Number(e>>cr&Yt)}:{h:Number(e>>cr&Yt)|0,l:Number(e&Yt)|0}}s(Pn,"Rr");function ar(e,t=!1){const n=e.length;let r=new Uint32Array(n),i=new Uint32Array(n);for(let o=0;o<n;o++){const{h:c,l:f}=Pn(e[o],t);[r[o],i[o]]=[c,f]}return[r,i]}s(ar,"$r");const fr=s((e,t,n)=>e>>>n,"Tr"),An=s((e,t,n)=>e<<32-n|t>>>n,"Cr"),rt=s((e,t,n)=>e>>>n|t<<32-n,"St"),st=s((e,t,n)=>e<<32-n|t>>>n,"Ot"),Dt=s((e,t,n)=>e<<64-n|t>>>n-32,"de"),Rt=s((e,t,n)=>e>>>n-32|t<<64-n,"he"),cs=s((e,t)=>t,"Di"),as=s((e,t)=>e,"Vi"),fs=s((e,t,n)=>e<<n|t>>>32-n,"Mi"),us=s((e,t,n)=>t<<n|e>>>32-n,"Ki"),ls=s((e,t,n)=>t<<n-32|e>>>64-n,"qi"),hs=s((e,t,n)=>e<<n-32|t>>>64-n,"Fi");function De(e,t,n,r){const i=(t>>>0)+(r>>>0);return{h:e+n+(i/2**32|0)|0,l:i|0}}s(De,"dt");const Bn=s((e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),"fn"),Sn=s((e,t,n,r)=>t+n+r+(e/2**32|0)|0,"an"),jn=s((e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0),"Zi"),Un=s((e,t,n,r,i)=>t+n+r+i+(e/2**32|0)|0,"Gi"),Nn=s((e,t,n,r,i)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(i>>>0),"zi"),lt=s((e,t,n,r,i,o)=>t+n+r+i+o+(e/2**32|0)|0,"Yi"),it=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function Xt(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}s(Xt,"Ue");function Qe(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}s(Qe,"wt");function me(e,...t){if(!Xt(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)}s(me,"ht");function bt(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Qe(e.outputLen),Qe(e.blockLen)}s(bt,"_e");function ot(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")}s(ot,"Nt");function Cn(e,t){me(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}s(Cn,"un");function $t(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}s($t,"pe");function Se(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}s(Se,"lt");function Dn(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}s(Dn,"ln");function Ge(e,t){return e<<32-t|e>>>t}s(Ge,"yt");const Jt=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function vt(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}s(vt,"Lr");const Re=Jt?e=>e:e=>vt(e);function je(e){for(let t=0;t<e.length;t++)e[t]=vt(e[t]);return e}s(je,"Xi");const Ze=Jt?e=>e:je,ds=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Qt=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function ct(e){if(me(e),ds)return e.toHex();let t="";for(let n=0;n<e.length;
1n++)t+=Qt[e[n]];return t}s(ct,"Jt");const Me={_0:48,_9:57,A:65,F:70,a:97,f:102};function Lt(e){if(e>=Me._0&&e<=Me._9)return e-Me._0;if(e>=Me.A&&e<=Me.F)return e-(Me.A-10);if(e>=Me.a&&e<=Me.f)return e-(Me.a-10)}s(Lt,"Pr");function u(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(ds)return Uint8Array.fromHex(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 i=0,o=0;i<n;i++,o+=2){const c=Lt(e.charCodeAt(o)),f=Lt(e.charCodeAt(o+1));if(c===void 0||f===void 0){const h=e[o]+e[o+1];throw new Error('hex string expected, got non-hex character "'+h+'" at index '+o)}r[i]=c*16+f}return r}s(u,"Re");function a(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}s(a,"Hr");function l(e){return typeof e=="string"&&(e=a(e)),me(e),e}s(l,"pt");function y(...e){let t=0;for(let r=0;r<e.length;r++){const i=e[r];me(i),t+=i.length}const n=new Uint8Array(t);for(let r=0,i=0;r<e.length;r++){const o=e[r];n.set(o,i),i+=o.length}return n}s(y,"_t");const ni=class ni{};s(ni,"$e");let I=ni;function B(e){const t=s(r=>e().update(l(r)).digest(),"e"),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}s(B,"ge");function b(e){const t=s((r,i)=>e(i).update(l(r)).digest(),"e"),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=r=>e(r),t}s(b,"Ji");function U(e=32){if(it&&typeof it.getRandomValues=="function")return it.getRandomValues(new Uint8Array(e));if(it&&typeof it.randomBytes=="function")return Uint8Array.from(it.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}s(U,"Kt");const F=BigInt(0),ie=BigInt(1),ue=BigInt(2),te=BigInt(7),et=BigInt(256),Ee=BigInt(113),en=[],Rn=[],tn=[];for(let e=0,t=ie,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],en.push(2*(5*r+n)),Rn.push((e+1)*(e+2)/2%64);let i=F;for(let o=0;o<7;o++)t=(t<<ie^(t>>te)*Ee)%et,t&ue&&(i^=ie<<(ie<<BigInt(o))-ie);tn.push(i)}const Oi=ar(tn,!0),_o=Oi[0],qo=Oi[1],Ii=s((e,t,n)=>n>32?ls(e,t,n):fs(e,t,n),"qr"),xi=s((e,t,n)=>n>32?hs(e,t,n):us(e,t,n),"Fr");function Wo(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let c=0;c<10;c++)n[c]=e[c]^e[c+10]^e[c+20]^e[c+30]^e[c+40];for(let c=0;c<10;c+=2){const f=(c+8)%10,h=(c+2)%10,g=n[h],p=n[h+1],m=Ii(g,p,1)^n[f],d=xi(g,p,1)^n[f+1];for(let w=0;w<50;w+=10)e[c+w]^=m,e[c+w+1]^=d}let i=e[2],o=e[3];for(let c=0;c<24;c++){const f=Rn[c],h=Ii(i,o,f),g=xi(i,o,f),p=en[c];i=e[p],o=e[p+1],e[p]=h,e[p+1]=g}for(let c=0;c<50;c+=10){for(let f=0;f<10;f++)n[f]=e[c+f];for(let f=0;f<10;f++)e[c+f]^=~n[(f+2)%10]&n[(f+4)%10]}e[0]^=_o[r],e[1]^=qo[r]}Se(n)}s(Wo,"ic");const Nr=class Nr extends I{constructor(t,n,r,i=!1,o=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=i,this.rounds=o,Qe(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=$t(this.state)}clone(){return this._cloneInto()}keccak(){Ze(this.state32),Wo(this.state32,this.rounds),Ze(this.state32),this.posOut=0,this.pos=0}update(t){ot(this),t=l(t),me(t);const{blockLen:n,state:r}=this,i=t.length;for(let o=0;o<i;){const c=Math.min(n-this.pos,i-o);for(let f=0;f<c;f++)r[this.pos++]^=t[o++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:r,blockLen:i}=this;t[r]^=n,n&128&&r===i-1&&this.keccak(),t[i-1]^=128,this.keccak()}writeInto(t){ot(this,!1),me(t),this.finish();const n=this.state,{blockLen:r}=this;for(let i=0,o=t.length;i<o;){this.posOut>=r&&this.keccak();const c=Math.min(r-this.posOut,o-i);t.set(n.subarray(this.posOut,this.posOut+c),i),this.posOut+=c,i+=c}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Qe(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Cn(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,Se(this.state)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:i,rounds:o,enableXOF:c}=this;return t||(t=new Nr(n,r,i,c,o)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=o,t.suffix=r,t.outputLen=i,t.enableXOF=c,t.destroyed=this.destroyed,t}};s(Nr,"Jn");let ps=Nr;const Go=s((e,t,n)=>B(()=>new ps(t,e,n)),"cc"),Zo=Go(1,136,256/8);function zo(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const i=BigInt(32),o=BigInt(4294967295),c=Number(n>>i&o),f=Number(n&o),h=r?4:0,g=r?0:4;e.setUint32(t+h,c,r),e.setUint32(t+g,f,r)}s(zo,"ac");function Yo(e,t,n){return e&t^~e&n}s(Yo,"uc");function Xo(e,t,n){return e&t^e&n^t&n}s(Xo,"lc");const ri=class ri extends I{constructor(t,n,r,i){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=i,this.buffer=new Uint8Array(t),this.view=Dn(this.buffer)}update(t){ot(this),t=l(t),me(t);const{view:n,buffer:r,blockLen:i}=this,o=t.length;for(let c=0;c<o;){const f=Math.min(i-this.pos,o-c);if(f===i){const h=Dn(t);for(;i<=o-c;c+=i)this.process(h,c);continue}r.set(t.subarray(c,c+f),this.pos),this.pos+=f,c+=f,this.pos===i&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){ot(this),Cn(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:i,isLE:o}=this;let{pos:c}=this;n[c++]=128,Se(this.buffer.subarray(c)),this.padOffset>i-c&&(this.process(r,0),c=0);for(let m=c;m<i;m++)n[m]=0;zo(r,i-8,BigInt(this.length*8),o),this.process(r,0);const f=Dn(t),h=this.outputLen;if(h%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const g=h/4,p=this.get();if(g>p.length)throw new Error("_sha2: outputLen bigger than state");for(let m=0;m<g;m++)f.setUint32(4*m,p[m],o)}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:i,finished:o,destroyed:c,pos:f}=this;return t.destroyed=c,t.finished=o,t.length=i,t.pos=f,i%n&&t.buffer.set(r),t}clone(){return this._cloneInto()}};s(ri,"Zr");let ur=ri;const Et=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Oe=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),Ie=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),Jo=Uint32Array.from([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,2756
vendor: 2,034 bytes, line 1
1734187,3204031479,3329325298]),Ot=new Uint32Array(64),si=class si extends ur{constructor(t=32){super(64,t,8,!1),this.A=Et[0]|0,this.B=Et[1]|0,this.C=Et[2]|0,this.D=Et[3]|0,this.E=Et[4]|0,this.F=Et[5]|0,this.G=Et[6]|0,this.H=Et[7]|0}get(){const{A:t,B:n,C:r,D:i,E:o,F:c,G:f,H:h}=this;return[t,n,r,i,o,c,f,h]}set(t,n,r,i,o,c,f,h){this.A=t|0,this.B=n|0,this.C=r|0,this.D=i|0,this.E=o|0,this.F=c|0,this.G=f|0,this.H=h|0}process(t,n){for(let m=0;m<16;m++,n+=4)Ot[m]=t.getUint32(n,!1);for(let m=16;m<64;m++){const d=Ot[m-15],w=Ot[m-2],x=Ge(d,7)^Ge(d,18)^d>>>3,P=Ge(w,17)^Ge(w,19)^w>>>10;Ot[m]=P+Ot[m-7]+x+Ot[m-16]|0}let{A:r,B:i,C:o,D:c,E:f,F:h,G:g,H:p}=this;for(let m=0;m<64;m++){const d=Ge(f,6)^Ge(f,11)^Ge(f,25),w=p+d+Yo(f,h,g)+Jo[m]+Ot[m]|0,x=(Ge(r,2)^Ge(r,13)^Ge(r,22))+Xo(r,i,o)|0;p=g,g=h,h=f,f=c+w|0,c=o,o=i,i=r,r=w+x|0}r=r+this.A|0,i=i+this.B|0,o=o+this.C|0,c=c+this.D|0,f=f+this.E|0,h=h+this.F|0,g=g+this.G|0,p=p+this.H|0,this.set(r,i,o,c,f,h,g,p)}roundClean(){Se(Ot)}destroy(){this.set(0,0,0,0,0,0,0,0),Se(this.buffer)}};s(si,"hc");let gs=si;const Pi=ar(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e3585
15771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))),Qo=Pi[0],ec=Pi[1],It=new Uint32Array(80),xt=new Uint32Array(80),ii=class ii extends ur{constructor(t=64){super(128,t,16,!1),this.Ah=Ie[0]|0,this.Al=Ie[1]|0,this.Bh=Ie[2]|0,this.Bl=Ie[3]|0,this.Ch=Ie[4]|0,this.Cl=Ie[5]|0,this.Dh=Ie[6]|0,this.Dl=Ie[7]|0,this.Eh=Ie[8]|0,this.El=Ie[9]|0,this.Fh=Ie[10]|0,this.Fl=Ie[11]|0,this.Gh=Ie[12]|0,this.Gl=Ie[13]|0,this.Hh=Ie[14]|0,this.Hl=Ie[15]|0}get(){const{Ah:t,Al:n,Bh:r,Bl:i,Ch:o,Cl:c,Dh:f,Dl:h,Eh:g,El:p,Fh:m,Fl:d,Gh:w,Gl:x,Hh:P,Hl:A}=this;return[t,n,r,i,o,c,f,h,g,p,m,d,w,x,P,A]}set(t,n,r,i,o,c,f,h,g,p,m,d,w,x,P,A){this.Ah=t|0,this.Al=n|0,this.Bh=r|0,this.Bl=i|0,this.Ch=o|0,this.Cl=c|0,this.Dh=f|0,this.Dl=h|0,this.Eh=g|0,this.El=p|0,this.Fh=m|0,this.Fl=d|0,this.Gh=w|0,this.Gl=x|0,this.Hh=P|0,this.Hl=A|0}process(t,n){for(let K=0;K<16;K++,n+=4)It[K]=t.getUint32(n),xt[K]=t.getUint32(n+=4);for(let K=16;K<80;K++){const fe=It[K-15]|0,ee=xt[K-15]|0,Y=rt(fe,ee,1)^rt(fe,ee,8)^fr(fe,ee,7),X=st(fe,ee,1)^st(fe,ee,8)^An(fe,ee,7),J=It[K-2]|0,H=xt[K-2]|0,W=rt(J,H,19)^Dt(J,H,61)^fr(J,H,6),G=st(J,H,19)^Rt(J,H,61)^An(J,H,6),C=jn(X,G,xt[K-7],xt[K-16]),$=Un(C,Y,W,It[K-7],It[K-16]);It[K]=$|0,xt[K]=C|0}let{Ah:r,Al:i,Bh:o,Bl:c,Ch:f,Cl:h,Dh:g,Dl:p,Eh:m,El:d,Fh:w,Fl:x,Gh:P,Gl:A,Hh:V,Hl:ae}=this;for(let K=0;K<80;K++){const fe=rt(m,d,14)^rt(m,d,18)^Dt(m,d,41),ee=st(m,d,14)^st(m,d,18)^Rt(m,d,41),Y=m&w^~m&P,X=d&x^~d&A,J=Nn(ae,ee,X,ec[K],xt[K]),H=lt(J,V,fe,Y,Qo[K],It[K]),W=J|0,G=rt(r,i,28)^Dt(r,i,34)^Dt(r,i,39),C=st(r,i,28)^Rt(r,i,34)^Rt(r,i,39),$=r&o^r&f^o&f,v=i&c^i&h^c&h;V=P|0,ae=A|0,P=w|0,A=x|0,w=m|0,x=d|0,{h:m,l:d}=De(g|0,p|0,H|0,W|0),g=f|0,p=h|0,f=o|0,h=c|0,o=r|0,c=i|0;const O=Bn(W,C,v);r=Sn(O,H,G,$),i=O|0}({h:r,l:i}=De(this.Ah|0,this.Al|0,r|0,i|0)),{h:o,l:c}=De(this.Bh|0,this.Bl|0,o|0,c|0),{h:f,l:h}=De(this.Ch|0,this.Cl|0,f|0,h|0),{h:g,l:p}=De(this.Dh|0,this.Dl|0,g|0,p|0),{h:m,l:d}=De(this.Eh|0,this.El|0,m|0,d|0),{h:w,l:x}=De(this.Fh|0,this.Fl|0,w|0,x|0),{h:P,l:A}=De(this.Gh|0,this.Gl|0,P|0,A|0),{h:V,l:ae}=De(this.Hh|0,this.Hl|0,V|0,ae|0),this.set(r,i,o,c,f,h,g,p,m,d,w,x,P,A,V,ae)}roundClean(){Se(It,xt)}destroy(){Se(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};s(ii,"dn");let $n=ii;const oi=class oi extends $n{constructor(){super(48),this.Ah=Oe[0]|0,this.Al=Oe[1]|0,this.Bh=Oe[2]|0,this.Bl=Oe[3]|0,this.Ch=Oe[4]|0,this.Cl=Oe[5]|0,this.Dh=Oe[6]|0,this.Dl=Oe[7]|0,this.Eh=Oe[8]|0,this.El=Oe[9]|0,this.Fh=Oe[10]|0,this.Fl=Oe[11]|0,this.Gh=Oe[12]|0,this.Gl=Oe[13]|0,this.Hh=Oe[14]|0,this.Hl=Oe[15]|0}};s(oi,"bc");let ys=oi;const xe=Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]),ci=class ci extends $n{constructor(){super(32),this.Ah=xe[0]|0,this.Al=xe[1]|0,this.Bh=xe[2]|0,this.Bl=xe[3]|0,this.Ch=xe[4]|0,this.Cl=xe[5]|0,this.Dh=xe[6]|0,this.Dl=xe[7]|0,this.Eh=xe[8]|0,this.El=xe[9]|0,this.Fh=xe[10]|0,this.Fl=xe[11]|0,this.Gh=xe[12]|0,this.Gl=xe[13]|0,this.Hh=xe[14]|0,this.Hl=xe[15]|0}};s(ci,"yc");let ms=ci;const lr=B(()=>new gs),tc=B(()=>new $n),nc=B(()=>new ys),rc=B(()=>new ms),sc=Uint8Array.from([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9]),de=Uint32Array.from([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),L=new Uint32Array(32);function Pt(e,t,n,r,i,o){const c=i[o],f=i[o+1];let h=L[2*e],g=L[2*e+1],p=L[2*t],m=L[2*t+1],d=L[2*n],w=L[2*n+1],x=L[2*r],P=L[2*r+1],A=Bn(h,p,c);
vendor: 5,111 bytes, lines 1-2
1g=Sn(A,g,m,f),h=A|0,{Dh:P,Dl:x}={Dh:P^g,Dl:x^h},{Dh:P,Dl:x}={Dh:cs(P,x),Dl:as(P)},{h:w,l:d}=De(w,d,P,x),{Bh:m,Bl:p}={Bh:m^w,Bl:p^d},{Bh:m,Bl:p}={Bh:rt(m,p,24),Bl:st(m,p,24)},L[2*e]=h,L[2*e+1]=g,L[2*t]=p,L[2*t+1]=m,L[2*n]=d,L[2*n+1]=w,L[2*r]=x,L[2*r+1]=P}s(Pt,"jt");function At(e,t,n,r,i,o){const c=i[o],f=i[o+1];let h=L[2*e],g=L[2*e+1],p=L[2*t],m=L[2*t+1],d=L[2*n],w=L[2*n+1],x=L[2*r],P=L[2*r+1],A=Bn(h,p,c);g=Sn(A,g,m,f),h=A|0,{Dh:P,Dl:x}={Dh:P^g,Dl:x^h},{Dh:P,Dl:x}={Dh:rt(P,x,16),Dl:st(P,x,16)},{h:w,l:d}=De(w,d,P,x),{Bh:m,Bl:p}={Bh:m^w,Bl:p^d},{Bh:m,Bl:p}={Bh:Dt(m,p,63),Bl:Rt(m,p,63)},L[2*e]=h,L[2*e+1]=g,L[2*t]=p,L[2*t+1]=m,L[2*n]=d,L[2*n+1]=w,L[2*r]=x,L[2*r+1]=P}s(At,"Lt");function ic(e,t={},n,r,i){if(Qe(n),e<0||e>n)throw new Error("outputLen bigger than keyLen");const{key:o,salt:c,personalization:f}=t;if(o!==void 0&&(o.length<1||o.length>n))throw new Error("key length must be undefined or 1.."+n);if(c!==void 0&&c.length!==r)throw new Error("salt must be undefined or "+r);if(f!==void 0&&f.length!==i)throw new Error("personalization must be undefined or "+i)}s(ic,"Ec");const ai=class ai extends I{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,this.length=0,this.pos=0,Qe(t),Qe(n),this.blockLen=t,this.outputLen=n,this.buffer=new Uint8Array(t),this.buffer32=$t(this.buffer)}update(t){ot(this),t=l(t),me(t);const{blockLen:n,buffer:r,buffer32:i}=this,o=t.length,c=t.byteOffset,f=t.buffer;for(let h=0;h<o;){this.pos===n&&(Ze(i),this.compress(i,0,!1),Ze(i),this.pos=0);const g=Math.min(n-this.pos,o-h),p=c+h;if(g===n&&!(p%4)&&h+g<o){const m=new Uint32Array(f,p,Math.floor((o-h)/4));Ze(m);for(let d=0;h+n<o;d+=i.length,h+=n)this.length+=n,this.compress(m,d,!1);Ze(m);continue}r.set(t.subarray(h,h+g),this.pos),this.pos+=g,this.length+=g,h+=g}return this}digestInto(t){ot(this),Cn(t,this);const{pos:n,buffer32:r}=this;this.finished=!0,Se(this.buffer.subarray(n)),Ze(r),this.compress(r,0,!0),Ze(r);const i=$t(t);this.get().forEach((o,c)=>i[c]=Re(o))}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){const{buffer:n,length:r,finished:i,destroyed:o,outputLen:c,pos:f}=this;return t||(t=new this.constructor({dkLen:c})),t.set(...this.get()),t.buffer.set(n),t.destroyed=o,t.finished=i,t.length=r,t.pos=f,t.outputLen=c,t}clone(){return this._cloneInto()}};s(ai,"Bc");let ws=ai;const fi=class fi extends ws{constructor(t={}){const n=t.dkLen===void 0?64:t.dkLen;super(128,n),this.v0l=de[0]|0,this.v0h=de[1]|0,this.v1l=de[2]|0,this.v1h=de[3]|0,this.v2l=de[4]|0,this.v2h=de[5]|0,this.v3l=de[6]|0,this.v3h=de[7]|0,this.v4l=de[8]|0,this.v4h=de[9]|0,this.v5l=de[10]|0,this.v5h=de[11]|0,this.v6l=de[12]|0,this.v6h=de[13]|0,this.v7l=de[14]|0,this.v7h=de[15]|0,ic(n,t,64,16,16);let{key:r,personalization:i,salt:o}=t,c=0;if(r!==void 0&&(r=l(r),c=r.length),this.v0l^=this.outputLen|c<<8|65536|1<<24,o!==void 0){o=l(o);const f=$t(o);this.v4l^=Re(f[0]),this.v4h^=Re(f[1]),this.v5l^=Re(f[2]),this.v5h^=Re(f[3])}if(i!==void 0){i=l(i);const f=$t(i);this.v6l^=Re(f[0]),this.v6h^=Re(f[1]),this.v7l^=Re(f[2]),this.v7h^=Re(f[3])}if(r!==void 0){const f=new Uint8Array(this.blockLen);f.set(r),this.update(f)}}get(){let{v0l:t,v0h:n,v1l:r,v1h:i,v2l:o,v2h:c,v3l:f,v3h:h,v4l:g,v4h:p,v5l:m,v5h:d,v6l:w,v6h:x,v7l:P,v7h:A}=this;return[t,n,r,i,o,c,f,h,g,p,m,d,w,x,P,A]}set(t,n,r,i,o,c,f,h,g,p,m,d,w,x,P,A){this.v0l=t|0,this.v0h=n|0,this.v1l=r|0,this.v1h=i|0,this.v2l=o|0,this.v2h=c|0,this.v3l=f|0,this.v3h=h|0,this.v4l=g|0,this.v4h=p|0,this.v5l=m|0,this.v5h=d|0,this.v6l=w|0,this.v6h=x|0,this.v7l=P|0,this.v7h=A|0}compress(t,n,r){this.get().forEach((h,g)=>L[g]=h),L.set(de,16);let{h:i,l:o}=Pn(BigInt(this.length));L[24]=de[8]^o,L[25]=de[9]^i,r&&(L[28]=~L[28],L[29]=~L[29]);let c=0;const f=sc;for(let h=0;h<12;h++)Pt(0,4,8,12,t,n+2*f[c++]),At(0,4,8,12,t,n+2*f[c++]),Pt(1,5,9,13,t,n+2*f[c++]),At(1,5,9,13,t,n+2*f[c++]),Pt(2,6,10,14,t,n+2*f[c++]),At(2,6,10,14,t,n+2*f[c++]),Pt(3,7,11,15,t,n+2*f[c++]),At(3,7,11,15,t,n+2*f[c++]),Pt(0,5,10,15,t,n+2*f[c++]),At(0,5,10,15,t,n+2*f[c++]),Pt(1,6,11,12,t,n+2*f[c++]),At(1,6,11,12,t,n+2*f[c++]),Pt(2,7,8,13,t,n+2*f[c++]),At(2,7,8,13,t,n+2*f[c++]),Pt(3,4,9,14,t,n+2*f[c++]),At(3,4,9,14,t,n+2*f[c++]);this.v0l^=L[0]^L[16],this.v0h^=L[1]^L[17],this.v1l^=L[2]^L[18],this.v1h^=L[3]^L[19],this.v2l^=L[4]^L[20],this.v2h^=L[5]^L[21],this.v3l^=L[6]^L[22],this.v3h^=L[7]^L[23],this.v4l^=L[8]^L[24],this.v4h^=L[9]^L[25],this.v5l^=L[10]^L[26],this.v5h^=L[11]^L[27],this.v6l^=L[12]^L[28],this.v6h^=L[13]^L[29],this.v7l^=L[14]^L[30],this.v7h^=L[15]^L[31],Se(L)}destroy(){this.destroyed=!0,Se(this.buffer32),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};s(fi,"Ic");let bs=fi;const oc=b(e=>new bs(e)),cc="https://rpc.walletconnect.org/v1";function Ai(e){const t=`�Ethereum Signed Message: 2${e.length}`,n=new TextEncoder().encode(t+e);return"0x"+Z.from(Zo(n)).toString("hex")}s(Ai,"hn");async function ac(e,t,n,r,i,o){switch(n.t){case"eip191":return await fc(e,t,n.s);case"eip1271":return await uc(e,t,n.s,r,i,o);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${n.t}`)}}s(ac,"zr");
2function fc(e,t,n){const r=ze.aD(n);return Ut.x_({payload:Ai(t),signature:r}).toLowerCase()===e.toLowerCase()}s(fc,"Yr");async function uc(e,t,n,r,i,o){const c=Ye(r);if(!c.namespace||!c.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${r}`);try{const f="0x1626ba7e",h="0000000000000000000000000000000000000000000000000000000000000040",g=n.substring(2),p=(g.length/2).toString(16).padStart(64,"0"),m=(t.startsWith("0x")?t:Ai(t)).substring(2),d=f+m+h+p+g,w=await fetch(`${o||cc}/?chainId=${r}&projectId=${i}`,{headers:{"Content-Type":"application/json"},method:"POST",body:JSON.stringify({id:lc(),jsonrpc:"2.0",method:"eth_call",params:[{to:e,data:d},"latest"]})}),{result:x}=await w.json();return x?x.slice(0,f.length).toLowerCase()===f.toLowerCase():!1}catch(f){return console.error("isValidEip1271Signature: ",f),!1}}s(uc,"Xr");function lc(){return Date.now()+Math.floor(Math.random()*1e3)}s(lc,"Oc");function hc(e){const t=atob(e),n=new Uint8Array(t.length);for(let c=0;c<t.length;c++)n[c]=t.charCodeAt(c);const r=n[0];if(r===0)throw new Error("No signatures found");const i=1+r*64;if(n.length<i)throw new Error("Transaction data too short for claimed signature count");if(n.length<100)throw new Error("Transaction too short");const o=Z.from(e,"base64").slice(1,65);return qe.tw.encode(o)}s(hc,"Nc");function dc(e){const t=new Uint8Array(Z.from(e,"base64")),n=Array.from("TransactionData::").map(o=>o.charCodeAt(0)),r=new Uint8Array(n.length+t.length);r.set(n),r.set(t,n.length);const i=oc(r,{dkLen:32});return qe.tw.encode(i)}s(dc,"Uc");function pc(e){const t=new Uint8Array(lr(gc(e)));return qe.tw.encode(t)}s(pc,"_c");function gc(e){if(e instanceof Uint8Array)return e;if(Array.isArray(e))return new Uint8Array(e);if(typeof e=="object"&&e!=null&&e.data)return new Uint8Array(Object.values(e.data));if(typeof e=="object"&&e)return new Uint8Array(Object.values(e));throw new Error("getNearUint8ArrayFromBytes: Unexpected result type from bytes array")}s(gc,"Wr");function yc(e){const t=Z.from(e,"base64"),n=(0,Ct.D)(t).txn;if(!n)throw new Error("Invalid signed transaction: missing 'txn' field");const r=(0,Nt.l)(n),i=Z.from("TX"),o=Z.concat([i,Z.from(r)]),c=rc(o);return qe.RG.encode(c).replace(/=+$/,"")}s(yc,"Rc");function vs(e){const t=[];let n=BigInt(e);for(;n>=BigInt(128);)t.push(Number(n&BigInt(127)|BigInt(128))),n>>=BigInt(7);return t.push(Number(n)),Z.from(t)}s(vs,"pn");function mc(e){const t=Z.from(e.signed.bodyBytes,"base64"),n=Z.from(e.signed.authInfoBytes,"base64"),r=Z.from(e.signature.signature,"base64"),i=[];i.push(Z.from([10])),i.push(vs(t.length)),i.push(t),i.push(Z.from([18])),i.push(vs(n.length)),i.push(n),i.push(Z.from([26])),i.push(vs(r.length)),i.push(r);const o=Z.concat(i),c=lr(o);return Z.from(c).toString("hex").toUpperCase()}s(mc,"$c");function wc(e){var t,n;const r=[];try{if(typeof e=="string")return r.push(e),r;if(typeof e!="object")return r;e!=null&&e.id&&r.push(e.id);const i=(n=(t=e?.capabilities)==null?void 0:t.caip345)==null?void 0:n.transactionHashes;i&&r.push(...i)}catch(i){console.warn("getWalletSendCallsHashes failed: ",i)}return r}s(wc,"Tc");var bc=Object.defineProperty,vc=Object.defineProperties,Ec=Object.getOwnPropertyDescriptors,Bi=Object.getOwnPropertySymbols,Oc=Object.prototype.hasOwnProperty,Ic=Object.prototype.propertyIsEnumerable,Si=s((e,t,n)=>t in e?bc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,"Qr"),Es=s((e,t)=>{for(var n in t||(t={}))Oc.call(t,n)&&Si(e,n,t[n]);if(Bi)for(var n of Bi(t))Ic.call(t,n)&&Si(e,n,t[n]);return e},"gn"),ji=s((e,t)=>vc(e,Ec(t)),"to");const Ui="did:pkh:",xc={eip155:"Ethereum",solana:"Solana",bip122:"Bitcoin"},Pc=s(e=>e?xc[e]||e:"","Dc"),hr=s(e=>e?.split(":"),"ye"),Ac=s(e=>{const t=e&&hr(e);if(t)return e.includes(Ui)?t[3]:t[1]},"no"),Bc=s(e=>{const t=e&&hr(e);if(t)return e.includes(Ui)?t[2]:t[0]},"ro"),Ni=s(e=>{const t=e&&hr(e);if(t)return t[2]+":"+t[3]},"oo"),Os=s(e=>{const t=e&&hr(e);if(t)return t.pop()},"bn");async function Sc(e){const{cacao:t,projectId:n}=e,{s:r,p:i}=t,o=Ci(i,i.iss),c=Os(i.iss);return await ac(c,o,r,Ni(i.iss),n)}s(Sc,"Vc");const Ci=s((e,t)=>{const n=Bc(t);if(!n)throw new Error("Invalid issuer: "+t);const r=`${e.domain} wants you to sign in with your ${Pc(n)} account:`,i=Os(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 c=`URI: ${e.aud||e.uri}
2`,f=`Version: ${e.version}`,h=`Chain ID: ${Ac(t)}`,g=`Nonce: ${e.nonce}`,p=`Issued At: ${e.iat}`,m=e.exp?`Expiration Time: ${e.exp}`:void 0,d=e.nbf?`Not Before: ${e.nbf}`:void 0,w=e.requestId?`Request ID: ${e.requestId}`:void 0,x=e.resources?`Resources:${e.resources.map(A=>` 3- ${A}`).join("")}`:void 0,P=dr(e.resources);if(P){const A=Tt(P);o=$i(o,A)}return[r,i,"",o,"",c,f,h,g,p,m,d,w,x].filter(A=>A!=null).join(` 4`)},"so");function Ru(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}}s(Ru,"Mc");function $u(e){var t;const{authPayload:n,chains:r,methods:i}=e,o=n.statement||"";if(!(r!=null&&r.length))return n;const c=n.chains,f=Zt(c,r);if(!(f!=null&&f.length))throw new Error("No supported chains");const h=jc(n.resources);if(!h)return n;ht(h);const g=Uc(h,"eip155");let p=n?.resources||[];if(g!=null&&g.length){const m=Nc(g),d=Zt(m,i);if(!(d!=null&&d.length))throw new Error(`Supported methods don't satisfy the requested: ${JSON.stringify(m)}, supported: ${JSON.stringify(i)}`);const w=Di("request",d,{chains:f}),x=$c(h,"eip155",w);p=((t=n?.resources)==null?void 0:t.slice(0,-1))||[],p.push(Is(x))}return ji(Es({},n),{statement:Mc(o,dr(p)),chains:f,resources:n!=null&&n.resources||p.length>0?p:void 0})}s($u,"Kc");function jc(e){const t=dr(e);if(t&&Ri(t))return Tt(t)}s(jc,"io");function Lu(e,t){var n;return(n=e?.att)==null?void 0:n.hasOwnProperty(t)}s(Lu,"qc");function Uc(e,t){var n,r;return(n=e?.att)!=null&&n[t]?Object.keys((r=e?.att)==null?void 0:r[t]):[]}s(Uc,"co");function Tu(e){return e?.map(t=>Object.keys(t))||[]}s(Tu,"Fc");function Nc(e){return e?.map(t=>{var n;return(n=t.split("/"))==null?void 0:n[1]})||[]}s(Nc,"fo");function Cc(e){return Z.from(JSON.stringify(e)).toString("base64")}s(Cc,"ao");function Dc(e){return JSON.parse(Z.from(e,"base64").toString("utf-8"))}s(Dc,"uo");function ht(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(i=>{const o=r[i];if(!Array.isArray(o))throw new Error(`Ability limits ${i} must be an array of objects, found: ${o}`);if(!o.length)throw new Error(`Value of ${i} is empty array, must be an array with objects`);o.forEach(c=>{if(typeof c!="object")throw new Error(`Ability limits (${i}) must be an array of objects, found: ${c}`)})})})}s(ht,"mt");function Rc(e,t,n,r={}){return n?.sort((i,o)=>i.localeCompare(o)),{att:{[e]:Di(t,n,r)}}}s(Rc,"lo");function $c(e,t,n){var r;e.att[t]=Es({},n);const i=(r=Object.keys(e.att))==null?void 0:r.sort((c,f)=>c.localeCompare(f)),o={att:{}};return i.reduce((c,f)=>(c.att[f]=e.att[f],c),o)}s($c,"ho");function Di(e,t,n={}){t=t?.sort((i,o)=>i.localeCompare(o));const r=t.map(i=>({[`${e}/${i}`]:[n]}));return Object.assign({},...r)}s(Di,"yn");function Is(e){return ht(e),`urn:recap:${Cc(e).replace(/=/g,"")}`}s(Is,"Ce");function Tt(e){const t=Dc(e.replace("urn:recap:",""));return ht(t),t}s(Tt,"kt");function Lc(e,t,n){const r=Rc(e,t,n);return Is(r)}s(Lc,"Zc");function Ri(e){return e&&e.includes("urn:recap:")}s(Ri,"mn");function Tc(e,t){const n=Tt(e),r=Tt(t),i=kc(n,r);return Is(i)}s(Tc,"Gc");function kc(e,t){ht(e),ht(t);const n=Object.keys(e.att).concat(Object.keys(t.att)).sort((i,o)=>i.localeCompare(o)),r={att:{}};return n.forEach(i=>{var o,c;Object.keys(((o=e.att)==null?void 0:o[i])||{}).concat(Object.keys(((c=t.att)==null?void 0:c[i])||{})).sort((f,h)=>f.localeCompare(h)).forEach(f=>{var h,g;r.att[i]=ji(Es({},r.att[i]),{[f]:((h=e.att[i])==null?void 0:h[f])||((g=t.att[i])==null?void 0:g[f])})})}),r}s(kc,"po");function $i(e="",t){ht(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 i=0;Object.keys(t.att).forEach(f=>{const h=Object.keys(t.att[f]).map(m=>({ability:m.split("/")[0],action:m.split("/")[1]}));h.sort((m,d)=>m.action.localeCompare(d.action));const g={};h.forEach(m=>{g[m.ability]||(g[m.ability]=[]),g[m.ability].push(m.action)});const p=Object.keys(g).map(m=>(i++,`(${i}) '${m}': '${g[m].join("', '")}' for '${f}'.`));
4r.push(p.join(", ").replace(".,","."))});const o=r.join(" "),c=`${n}${o}`;return`${e?e+" ":""}${c}`}s($i,"wn");function Fc(e){var t;const n=Tt(e);ht(n);const r=(t=n.att)==null?void 0:t.eip155;return r?Object.keys(r).map(i=>i.split("/")[1]):[]}s(Fc,"zc");function Hc(e){const t=Tt(e);ht(t);const n=[];return Object.values(t.att).forEach(r=>{Object.values(r).forEach(i=>{var o;(o=i?.[0])!=null&&o.chains&&n.push(i[0].chains)})}),[...new Set(n.flat())]}s(Hc,"Yc");function Mc(e,t){if(!t)return e;const n=Tt(t);return ht(n),$i(e,n)}s(Mc,"go");function dr(e){if(!e)return;const t=e?.[e.length-1];return Ri(t)?t:void 0}s(dr,"je");function Li(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}s(Li,"bo");function xs(e){if(typeof e!="boolean")throw new Error(`boolean expected, not ${e}`)}s(xs,"vn");function Ps(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}s(Ps,"xn");function $e(e,...t){if(!Li(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)}s($e,"ot");function Ti(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")}s(Ti,"yo");function Kc(e,t){$e(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}s(Kc,"Xc");function Bt(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}s(Bt,"Pt");function nn(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}s(nn,"Qt");function Vc(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}s(Vc,"Wc");const _c=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function qc(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}s(qc,"Qc");function As(e){if(typeof e=="string")e=qc(e);else if(Li(e))e=Bs(e);else throw new Error("Uint8Array expected, got "+typeof e);return e}s(As,"En");function Wc(e,t){if(t==null||typeof t!="object")throw new Error("options must be defined");return Object.assign(e,t)}s(Wc,"tf");function Gc(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}s(Gc,"ef");const Zc=s((e,t)=>{function n(r,...i){if($e(r),!_c)throw new Error("Non little-endian hardware is not yet supported");if(e.nonceLength!==void 0){const g=i[0];if(!g)throw new Error("nonce / iv required");e.varSizeNonce?$e(g):$e(g,e.nonceLength)}const o=e.tagLength;o&&i[1]!==void 0&&$e(i[1]);const c=t(r,...i),f=s((g,p)=>{if(p!==void 0){if(g!==2)throw new Error("cipher output not supported");$e(p)}},"c");let h=!1;return{encrypt(g,p){if(h)throw new Error("cannot encrypt() twice with same key + nonce");return h=!0,$e(g),f(c.encrypt.length,p),c.encrypt(g,p)},decrypt(g,p){if($e(g),o&&g.length<o)throw new Error("invalid ciphertext length: smaller than tagLength="+o);return f(c.decrypt.length,p),c.decrypt(g,p)}}}return s(n,"n"),Object.assign(n,e),n},"nf");function ki(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&&!Yc(t))throw new Error("invalid output, must be aligned");return t}s(ki,"mo");function Fi(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const i=BigInt(32),o=BigInt(4294967295),c=Number(n>>i&o),f=Number(n&o),h=r?4:0,g=r?0:4;e.setUint32(t+h,c,r),e.setUint32(t+g,f,r)}s(Fi,"wo");function zc(e,t,n){xs(n);const r=new Uint8Array(16),i=Vc(r);return Fi(i,0,BigInt(t),n),Fi(i,8,BigInt(e),n),r}s(zc,"rf");function Yc(e){return e.byteOffset%4===0}s(Yc,"of");function Bs(e){return Uint8Array.from(e)}s(Bs,"Bn");const Hi=s(e=>Uint8Array.from(e.split("").map(t=>t.charCodeAt(0))),"vo"),Xc=Hi("expand 16-byte k"),Jc=Hi("expand 32-byte k"),Qc=Bt(Xc),ea=Bt(Jc);function re(e,t){return e<<t|e>>>32-t}s(re,"K");function Ss(e){return e.byteOffset%4===0}s(Ss,"In");const pr=64,ta=16,Mi=2**32-1,Ki=new Uint32Array;function na(e,t,n,r,i,o,c,f){const h=i.length,g=new Uint8Array(pr),p=Bt(g),m=Ss(i)&&Ss(o),d=m?Bt(i):Ki,w=m?Bt(
vendor: 4,492 bytes, line 4
4o):Ki;for(let x=0;x<h;c++){if(e(t,n,r,p,c,f),c>=Mi)throw new Error("arx: counter overflow");const P=Math.min(pr,h-x);if(m&&P===pr){const A=x/4;if(x%4!==0)throw new Error("arx: invalid block position");for(let V=0,ae;V<ta;V++)ae=A+V,w[ae]=d[ae]^p[V];x+=pr;continue}for(let A=0,V;A<P;A++)V=x+A,o[V]=i[V]^g[A];x+=P}}s(na,"lf");function ra(e,t){const{allowShortKeys:n,extendNonceFn:r,counterLength:i,counterRight:o,rounds:c}=Wc({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if(typeof e!="function")throw new Error("core must be a function");return Ps(i),Ps(c),xs(o),xs(n),(f,h,g,p,m=0)=>{$e(f),$e(h),$e(g);const d=g.length;if(p===void 0&&(p=new Uint8Array(d)),$e(p),Ps(m),m<0||m>=Mi)throw new Error("arx: counter overflow");if(p.length<d)throw new Error(`arx: output (${p.length}) is shorter than data (${d})`);const w=[];let x=f.length,P,A;if(x===32)w.push(P=Bs(f)),A=ea;else if(x===16&&n)P=new Uint8Array(32),P.set(f),P.set(f,16),A=Qc,w.push(P);else throw new Error(`arx: invalid 32-byte key, got length=${x}`);Ss(h)||w.push(h=Bs(h));const V=Bt(P);if(r){if(h.length!==24)throw new Error("arx: extended nonce must be 24 bytes");r(A,V,Bt(h.subarray(0,16)),V),h=h.subarray(16)}const ae=16-i;if(ae!==h.length)throw new Error(`arx: nonce must be ${ae} or 16 bytes`);if(ae!==12){const fe=new Uint8Array(12);fe.set(h,o?0:12-h.length),h=fe,w.push(h)}const K=Bt(h);return na(e,A,V,K,g,p,m,c),nn(...w),p}}s(ra,"df");const be=s((e,t)=>e[t++]&255|(e[t++]&255)<<8,"X"),ui=class ui{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=As(t),$e(t,32);const n=be(t,0),r=be(t,2),i=be(t,4),o=be(t,6),c=be(t,8),f=be(t,10),h=be(t,12),g=be(t,14);this.r[0]=n&8191,this.r[1]=(n>>>13|r<<3)&8191,this.r[2]=(r>>>10|i<<6)&7939,this.r[3]=(i>>>7|o<<9)&8191,this.r[4]=(o>>>4|c<<12)&255,this.r[5]=c>>>1&8190,this.r[6]=(c>>>14|f<<2)&8191,this.r[7]=(f>>>11|h<<5)&8065,this.r[8]=(h>>>8|g<<8)&8191,this.r[9]=g>>>5&127;for(let p=0;p<8;p++)this.pad[p]=be(t,16+2*p)}process(t,n,r=!1){const i=r?0:2048,{h:o,r:c}=this,f=c[0],h=c[1],g=c[2],p=c[3],m=c[4],d=c[5],w=c[6],x=c[7],P=c[8],A=c[9],V=be(t,n+0),ae=be(t,n+2),K=be(t,n+4),fe=be(t,n+6),ee=be(t,n+8),Y=be(t,n+10),X=be(t,n+12),J=be(t,n+14);let H=o[0]+(V&8191),W=o[1]+((V>>>13|ae<<3)&8191),G=o[2]+((ae>>>10|K<<6)&8191),C=o[3]+((K>>>7|fe<<9)&8191),$=o[4]+((fe>>>4|ee<<12)&8191),v=o[5]+(ee>>>1&8191),O=o[6]+((ee>>>14|Y<<2)&8191),E=o[7]+((Y>>>11|X<<5)&8191),j=o[8]+((X>>>8|J<<8)&8191),N=o[9]+(J>>>5|i),S=0,R=S+H*f+W*(5*A)+G*(5*P)+C*(5*x)+$*(5*w);S=R>>>13,R&=8191,R+=v*(5*d)+O*(5*m)+E*(5*p)+j*(5*g)+N*(5*h),S+=R>>>13,R&=8191;let D=S+H*h+W*f+G*(5*A)+C*(5*P)+$*(5*x);S=D>>>13,D&=8191,D+=v*(5*w)+O*(5*d)+E*(5*m)+j*(5*p)+N*(5*g),S+=D>>>13,D&=8191;let T=S+H*g+W*h+G*f+C*(5*A)+$*(5*P);S=T>>>13,T&=8191,T+=v*(5*x)+O*(5*w)+E*(5*d)+j*(5*m)+N*(5*p),S+=T>>>13,T&=8191;let M=S+H*p+W*g+G*h+C*f+$*(5*A);S=M>>>13,M&=8191,M+=v*(5*P)+O*(5*x)+E*(5*w)+j*(5*d)+N*(5*m),S+=M>>>13,M&=8191;let ce=S+H*m+W*p+G*g+C*h+$*f;S=ce>>>13,ce&=8191,ce+=v*(5*A)+O*(5*P)+E*(5*x)+j*(5*w)+N*(5*d),S+=ce>>>13,ce&=8191;let ne=S+H*d+W*m+G*p+C*g+$*h;S=ne>>>13,ne&=8191,ne+=v*f+O*(5*A)+E*(5*P)+j*(5*x)+N*(5*w),S+=ne>>>13,ne&=8191;let _=S+H*w+W*d+G*m+C*p+$*g;S=_>>>13,_&=8191,_+=v*h+O*f+E*(5*A)+j*(5*P)+N*(5*x),S+=_>>>13,_&=8191;let se=S+H*x+W*w+G*d+C*m+$*p;S=se>>>13,se&=8191,se+=v*g+O*h+E*f+j*(5*A)+N*(5*P),S+=se>>>13,se&=8191;let oe=S+H*P+W*x+G*w+C*d+$*m;S=oe>>>13,oe&=8191,oe+=v*p+O*g+E*h+j*f+N*(5*A),S+=oe>>>13,oe&=8191;let pe=S+H*A+W*P+G*x+C*w+$*d;S=pe>>>13,pe&=8191,pe+=v*m+O*p+E*g+j*h+N*f,S+=pe>>>13,pe&=8191,S=(S<<2)+S|0,S=S+R|0,R=S&8191,S=S>>>13,D+=S,o[0]=R,o[1]=D,o[2]=T,o[3]=M,o[4]=ce,o[5]=ne,o[6]=_,o[7]=se,o[8]=oe,o[9]=pe}finalize(){const{h:t,pad:n}=this,r=new Uint16Array(10);let i=t[1]>>>13;t[1]&=8191;for(let f=2;f<10;f++)t[f]+=i,i=t[f]>>>13,t[f]&=8191;t[0]+=i*5,i=t[0]>>>13,t[0]&=8191,t[1]+=i,i=t[1]>>>13,t[1]&=8191,t[2]+=i,r[0]=t[0]+5,i=r[0]>>>13,r[0]&=8191;for(let f=1;f<10;f++)r[f]=t[f]+i,i=r[f]>>>13,r[f]&=8191;r[9]-=8192;let o=(i^1)-1;for(let f=0;f<10;f++)r[f]&=o;o=~o;for(let f=0;f<10;f++)t[f]=t[f]&o|r[f];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 c=t[0]+n[0];t[0]=c&65535;for(let f=1;f<8;f++)c=(t[f]+n[f]|0)+(c>>>16)|0,t[f]=c&65535;nn(r)}
4update(t){Ti(this),t=As(t),$e(t);const{buffer:n,blockLen:r}=this,i=t.length;for(let o=0;o<i;){const c=Math.min(r-this.pos,i-o);if(c===r){for(;r<=i-o;o+=r)this.process(t,o);continue}n.set(t.subarray(o,o+c),this.pos),this.pos+=c,o+=c,this.pos===r&&(this.process(n,0,!1),this.pos=0)}return this}destroy(){nn(this.h,this.r,this.buffer,this.pad)}digestInto(t){Ti(this),Kc(t,this),this.finished=!0;const{buffer:n,h:r}=this;let{pos:i}=this;if(i){for(n[i++]=1;i<16;i++)n[i]=0;this.process(n,0,!0)}this.finalize();let o=0;for(let c=0;c<8;c++)t[o++]=r[c]>>>0,t[o++]=r[c]>>>8;return t}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}};s(ui,"hf");let js=ui;function sa(e){const t=s((r,i)=>e(i).update(As(r)).digest(),"e"),n=e(new Uint8Array(32));return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=r=>e(r),t}s(sa,"pf");const ia=sa(e=>new js(e));function oa(e,t,n,r,i,o=20){let c=e[0],f=e[1],h=e[2],g=e[3],p=t[0],m=t[1],d=t[2],w=t[3],x=t[4],P=t[5],A=t[6],V=t[7],ae=i,K=n[0],fe=n[1],ee=n[2],Y=c,X=f,J=h,H=g,W=p,G=m,C=d,$=w,v=x,O=P,E=A,j=V,N=ae,S=K,R=fe,D=ee;for(let M=0;M<o;M+=2)Y=Y+W|0,N=re(N^Y,16),v=v+N|0,W=re(W^v,12),Y=Y+W|0,N=re(N^Y,8),v=v+N|0,W=re(W^v,7),X=X+G|0,S=re(S^X,16),O=O+S|0,G=re(G^O,12),X=X+G|0,S=re(S^X,8),O=O+S|0,G=re(G^O,7),J=J+C|0,R=re(R^J,16),E=E+R|0,C=re(C^E,12),J=J+C|0,R=re(R^J,8),E=E+R|0,C=re(C^E,7),H=H+$|0,D=re(D^H,16),j=j+D|0,$=re($^j,12),H=H+$|0,D=re(D^H,8),j=j+D|0,$=re($^j,7),Y=Y+G|0,D=re(D^Y,16),E=E+D|0,G=re(G^E,12),Y=Y+G|0,D=re(D^Y,8),E=E+D|0,G=re(G^E,7),X=X+C|0,N=re(N^X,16),j=j+N|0,C=re(C^j,12),X=X+C|0,N=re(N^X,8),j=j+N|0,C=re(C^j,7),J=J+$|0,S=re(S^J,16),v=v+S|0,$=re($^v,12),J=J+$|0,S=re(S^J,8),v=v+S|0,$=re($^v,7),H=H+W|0,R=re(R^H,16),O=O+R|0,W=re(W^O,12),H=H+W|0,R=re(R^H,8),O=O+R|0,W=re(W^O,7);let T=0;r[T++]=c+Y|0,r[T++]=f+X|0,r[T++]=h+J|0,r[T++]=g+H|0,r[T++]=p+W|0,r[T++]=m+G|0,r[T++]=d+C|0,r[T++]=w+$|0,r[T++]=x+v|0,r[T++]=P+O|0,r[T++]=A+E|0,r[T++]=V+j|0,r[T++]=ae+N|0,r[T++]=K+S|0,r[T++]=fe+R|0,r[T++]=ee+D|0}s(oa,"bf");const ca=ra(oa,{counterRight:!1,counterLength:4,allowShortKeys:!1}),aa=new Uint8Array(16),Vi=s((e,t)=>{e.update(t);const n=t.length%16;n&&e.update(aa.subarray(n))},"Bo"),fa=new Uint8Array(32);function _i(e,t,n,r,i){const o=e(t,n,fa),c=ia.create(o);i&&Vi(c,i),Vi(c,r);const f=zc(r.length,i?i.length:0,!0);c.update(f);const h=c.digest();return nn(o,f),h}s(_i,"Io");const ua=s(e=>(t,n,r)=>({encrypt(i,o){const c=i.length;o=ki(c+16,o,!1),o.set(i);const f=o.subarray(0,-16);e(t,n,f,f,1);const h=_i(e,t,n,f,r);return o.set(h,c),nn(h),o},decrypt(i,o){o=ki(i.length-16,o,!1);const c=i.subarray(0,-16),f=i.subarray(-16),h=_i(e,t,n,c,r);if(!Gc(f,h))throw new Error("invalid tag");return o.set(i.subarray(0,-16)),e(t,n,o,o,1),nn(h),o}}),"vf"),qi=Zc({blockSize:64,nonceLength:12,tagLength:16},ua(ca)),li=class li extends I{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,bt(t);const r=l(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 i=this.blockLen,o=new Uint8Array(i);o.set(r.length>i?t.create().update(r).digest():r);for(let c=0;c<o.length;c++)o[c]^=54;this.iHash.update(o),this.oHash=t.create();for(let c=0;c<o.length;c++)o[c]^=106;this.oHash.update(o),Se(o)}update(t){return ot(this),this.iHash.update(t),this}digestInto(t){ot(this),me(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:i,destroyed:o,blockLen:c,outputLen:f}=this;return t=t,t.finished=i,t.destroyed=o,t.blockLen=c,t.outputLen=f,t.oHash=n._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};s(li,"So");let gr=li;const yr=s((e,t,n)=>new gr(e,t).update(n).digest(),"ke");yr.create=(e,t)=>new gr(e,t);function la(e,t,n){return bt(e),n===void 0&&(n=new Uint8Array(e.outputLen)),yr(e,l(n),l(t))}s(la,"xf");const Us=Uint8Array.from([0]),Wi=Uint8Array.of();function ha(e,t,n,r=32){bt(e),Qe(r);const i=e.outputLen;if(r>255*i)throw new Error("Length should be <= 255*HashLen");const o=Math.ceil(r/i);n===void 0&&(n=Wi);const c=new Uint8Array(o*i),f=yr.create(e,t),h=f._cloneInto(),g=new Uint8Array(f.outputLen);for(let p=0;p<o;p++)Us[0]=p+1,h.update(p===0?Wi:g).update(n).update(Us).digestInto(g),c.set(g,i*p),f._
4cloneInto(h);return f.destroy(),h.destroy(),Se(g,Us),c.slice(0,r)}s(ha,"Ef");const da=s((e,t,n,r,i)=>ha(e,la(e,t,n),r,i),"Bf"),mr=lr,Ns=BigInt(0),Cs=BigInt(1);function wr(e,t=""){if(typeof e!="boolean"){const n=t&&`"${t}"`;throw new Error(n+"expected boolean, got type="+typeof e)}return e}s(wr,"He");function kt(e,t,n=""){const r=Xt(e),i=e?.length,o=t!==void 0;if(!r||o&&i!==t){const c=n&&`"${n}" `,f=o?` of length ${t}`:"",h=r?`length=${i}`:`type=${typeof e}`;throw new Error(c+"expected Uint8Array"+f+", got "+h)}return e}s(kt,"qt");function br(e){const t=e.toString(16);return t.length&1?"0"+t:t}s(br,"De");function Gi(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?Ns:BigInt("0x"+e)}s(Gi,"No");function vr(e){return Gi(ct(e))}s(vr,"Ve");function Er(e){return me(e),Gi(ct(Uint8Array.from(e).reverse()))}s(Er,"Me");function Ds(e,t){return u(e.toString(16).padStart(t*2,"0"))}s(Ds,"Nn");function Rs(e,t){return Ds(e,t).reverse()}s(Rs,"Un");function Pe(e,t,n){let r;if(typeof t=="string")try{r=u(t)}catch(o){throw new Error(e+" must be hex string or Uint8Array, cause: "+o)}else if(Xt(t))r=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");const i=r.length;if(typeof n=="number"&&i!==n)throw new Error(e+" of length "+n+" expected, got "+i);return r}s(Pe,"tt");const $s=s(e=>typeof e=="bigint"&&Ns<=e,"_n");function pa(e,t,n){return $s(e)&&$s(t)&&$s(n)&&t<=e&&e<n}s(pa,"If");function Ls(e,t,n,r){if(!pa(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}s(Ls,"Rn");function Zi(e){let t;for(t=0;e>Ns;e>>=Cs,t+=1);return t}s(Zi,"Uo");const Ln=s(e=>(Cs<<BigInt(e))-Cs,"me");function ga(e,t,n){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");const r=s(d=>new Uint8Array(d),"r"),i=s(d=>Uint8Array.of(d),"o");
4let o=r(e),c=r(e),f=0;const h=s(()=>{o.fill(1),c.fill(0),f=0},"f"),g=s((...d)=>n(c,o,...d),"u"),p=s((d=r(0))=>{c=g(i(0),d),o=g(),d.length!==0&&(c=g(i(1),d),o=g())},"a"),m=s(()=>{if(f++>=1e3)throw new Error("drbg: tried 1000 values");let d=0;const w=[];for(;d<t;){o=g();const x=o.slice();w.push(x),d+=o.length}return y(...w)},"l");return(d,w)=>{h(),p(d);let x;for(;!(x=w(m()));)p();return h(),x}}s(ga,"Af");function Or(e,t,n={}){if(!e||typeof e!="object")throw new Error("expected valid options object");function r(i,o,c){const f=e[i];if(c&&f===void 0)return;const h=typeof f;if(h!==o||f===null)throw new Error(`param "${i}" is invalid: expected ${o}, got ${h}`)}s(r,"r"),Object.entries(t).forEach(([i,o])=>r(i,o,!1)),Object.entries(n).forEach(([i,o])=>r(i,o,!0))}s(Or,"Ke");function zi(e){const t=new WeakMap;return(n,...r)=>{const i=t.get(n);if(i!==void 0)return i;const o=e(n,...r);return t.set(n,o),o}}s(zi,"_o");const Le=BigInt(0),Ue=BigInt(1),Ft=BigInt(2),Yi=BigInt(3),Xi=BigInt(4),Ji=BigInt(5),ya=BigInt(7),Qi=BigInt(8),ma=BigInt(9),eo=BigInt(16);function Ke(e,t){const n=e%t;return n>=Le?n:t+n}s(Ke,"ct");function tt(e,t,n){let r=e;for(;t-- >Le;)r*=r,r%=n;return r}s(tt,"gt");function to(e,t){if(e===Le)throw new Error("invert: expected non-zero number");if(t<=Le)throw new Error("invert: expected positive modulus, got "+t);let n=Ke(e,t),r=t,i=Le,o=Ue;for(;n!==Le;){const c=r/n,f=r%n,h=i-o*c;r=n,n=f,i=o,o=h}if(r!==Ue)throw new Error("invert: does not exist");return Ke(i,t)}s(to,"Lo");function Ts(e,t,n){if(!e.eql(e.sqr(t),n))throw new Error("Cannot find square root")}s(Ts,"$n");function no(e,t){const n=(e.ORDER+Ue)/Xi,r=e.pow(t,n);return Ts(e,r,t),r}s(no,"ko");function wa(e,t){const n=(e.ORDER-Ji)/Qi,r=e.mul(t,Ft),i=e.pow(r,n),o=e.mul(t,i),c=e.mul(e.mul(o,Ft),i),f=e.mul(o,e.sub(c,e.ONE));return Ts(e,f,t),f}s(wa,"Nf");function ba(e){const t=St(e),n=ro(e),r=n(t,t.neg(t.ONE)),i=n(t,r),o=n(t,t.neg(r)),c=(e+ya)/eo;return(f,h)=>{let g=f.pow(h,c),p=f.mul(g,r);const m=f.mul(g,i),d=f.mul(g,o),w=f.eql(f.sqr(p),h),x=f.eql(f.sqr(m),h);g=f.cmov(g,p,w),p=f.cmov(d,m,x);const P=f.eql(f.sqr(p),h),A=f.cmov(g,p,P);return Ts(f,A,h),A}}s(ba,"Uf");function ro(e){if(e<Yi)throw new Error("sqrt is not defined for small field");let t=e-Ue,n=0;for(;t%Ft===Le;)t/=Ft,n++;let r=Ft;const i=St(e);for(;io(i,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return no;let o=i.pow(r,t);const c=(t+Ue)/Ft;return function(f,h){if(f.is0(h))return h;if(io(f,h)!==1)throw new Error("Cannot find square root");let g=n,p=f.mul(f.ONE,o),m=f.pow(h,t),d=f.pow(h,c);for(;!f.eql(m,f.ONE);){if(f.is0(m))return f.ZERO;let w=1,x=f.sqr(m);for(;!f.eql(x,f.ONE);)if(w++,x=f.sqr(x),w===g)throw new Error("Cannot find square root");const P=Ue<<BigInt(g-w-1),A=f.pow(p,P);g=w,p=f.sqr(A),m=f.mul(m,p),d=f.mul(d,A)}return d}}s(ro,"Po");function va(e){return e%Xi===Yi?no:e%Qi===Ji?wa:e%eo===ma?ba(e):ro(e)}s(va,"_f");const Ea=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Oa(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},n=Ea.reduce((r,i)=>(r[i]="function",r),t);return Or(e,n),e}s(Oa,"$f");function Ia(e,t,n){if(n<Le)throw new Error("invalid exponent, negatives unsupported");if(n===Le)return e.ONE;if(n===Ue)return t;let r=e.ONE,i=t;for(;n>Le;)n&Ue&&(r=e.mul(r,i)),i=e.sqr(i),n>>=Ue;return r}s(Ia,"Tf");function so(e,t,n=!1){const r=new Array(t.length).fill(n?e.ZERO:void 0),i=t.reduce((c,f,h)=>e.is0(f)?c:(r[h]=c,e.mul(c,f)),e.ONE),o=e.inv(i);return t.reduceRight((c,f,h)=>e.is0(f)?c:(r[h]=e.mul(c,r[h]),e.mul(c,f)),o),r}s(so,"Ho");function io(e,t){const n=(e.ORDER-Ue)/Ft,r=e.pow(t,n),i=e.eql(r,e.ONE),o=e.eql(r,e.ZERO),c=e.eql(r,e.neg(e.ONE));if(!i&&!o&&!c)throw new Error("invalid Legendre symbol result");return i?1:o?0:-1}s(io,"Do");function oo(e,t){t!==void 0&&Qe(t);const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}s(oo,"Vo");function St(e,t,n=!1,r={}){if(e<=Le)throw new Error("invalid field: expected ORDER > 0, got "+e);let i,o,c=!1,f;if(typeof t=="object"&&t!=null){if(r.sqrt||n)throw new Error("cannot specify opts in two arguments");const d=t;d.BITS&&(i=d.BITS),d.sqrt&&(o=d.sqrt),typeof d.isLE=="boolean"&&(n=d.isLE),typeof d.modFromBytes=="boolean"&&(c=d.modFromBytes),f=d.allowedLengths}else typeof t=="number"&&(i=t),r.sqrt&&(o=r.sqrt);const{nBitLength:h,nByteLength:g}=oo(e,i);if(g>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let p;const m=Object.freeze({ORDER:e,isLE:n,BITS:h,BYTES:g,MASK:Ln(h),ZERO:Le,ONE:Ue,allowedLengths:f,create:s(d=>Ke(d,e),"create"),isValid:s(d=>
4{if(typeof d!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof d);return Le<=d&&d<e},"isValid"),is0:s(d=>d===Le,"is0"),isValidNot0:s(d=>!m.is0(d)&&m.isValid(d),"isValidNot0"),isOdd:s(d=>(d&Ue)===Ue,"isOdd"),neg:s(d=>Ke(-d,e),"neg"),eql:s((d,w)=>d===w,"eql"),sqr:s(d=>Ke(d*d,e),"sqr"),add:s((d,w)=>Ke(d+w,e),"add"),sub:s((d,w)=>Ke(d-w,e),"sub"),mul:s((d,w)=>Ke(d*w,e),"mul"),pow:s((d,w)=>Ia(m,d,w),"pow"),div:s((d,w)=>Ke(d*to(w,e),e),"div"),sqrN:s(d=>d*d,"sqrN"),addN:s((d,w)=>d+w,"addN"),subN:s((d,w)=>d-w,"subN"),mulN:s((d,w)=>d*w,"mulN"),inv:s(d=>to(d,e),"inv"),sqrt:o||(d=>(p||(p=va(e)),p(m,d))),toBytes:s(d=>n?Rs(d,g):Ds(d,g),"toBytes"),fromBytes:s((d,w=!0)=>{if(f){if(!f.includes(d.length)||d.length>g)throw new Error("Field.fromBytes: expected "+f+" bytes, got "+d.length);const P=new Uint8Array(g);P.set(d,n?0:P.length-d.length),d=P}if(d.length!==g)throw new Error("Field.fromBytes: expected "+g+" bytes, got "+d.length);let x=n?Er(d):vr(d);if(c&&(x=Ke(x,e)),!w&&!m.isValid(x))throw new Error("invalid field element: outside of range 0..ORDER");return x},"fromBytes"),invertBatch:s(d=>so(m,d),"invertBatch"),cmov:s((d,w,x)=>x?w:d,"cmov")});return Object.freeze(m)}s(St,"Ht");function co(e){if(typeof e!="bigint")throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}s(co,"Mo");function ao(e){const t=co(e);return t+Math.ceil(t/2)}s(ao,"Ko");function xa(e,t,n=!1){const r=e.length,i=co(t),o=ao(t);if(r<16||r<o||r>1024)throw new Error("expected "+o+"-1024 bytes of input, got "+r);const c=n?Er(e):vr(e),f=Ke(c,t-Ue)+Ue;return n?Rs(f,i):Ds(f,i)}s(xa,"Cf");const rn=BigInt(0),Ht=BigInt(1);function Ir(e,t){const n=t.negate();return e?n:t}s(Ir,"qe");function ks(e,t){const n=so(e.Fp,t.map(r=>r.Z));return t.map((r,i)=>e.fromAffine(r.toAffine(n[i])))}s(ks,"Tn");function fo(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}s(fo,"qo");function Fs(e,t){fo(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1),i=2**e,o=Ln(e),c=BigInt(e);return{windows:n,windowSize:r,mask:o,maxNumber:i,shiftBy:c}}s(Fs,"Cn");function uo(e,t,n){const{windowSize:r,mask:i,maxNumber:o,shiftBy:c}=n;let f=Number(e&i),h=e>>c;f>r&&(f-=o,h+=Ht);const g=t*r,p=g+Math.abs(f)-1,m=f===0,d=f<0,w=t%2!==0;return{nextN:h,offset:p,isZero:m,isNeg:d,isNegF:w,offsetF:g}}s(uo,"Fo");function Pa(e,t){if(!Array.isArray(e))throw new Error("array expected");e.forEach((n,r)=>{if(!(n instanceof t))throw new Error("invalid point at index "+r)})}s(Pa,"jf");function Aa(e,t){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach((n,r)=>{if(!t.isValid(n))throw new Error("invalid scalar at index "+r)})}s(Aa,"Lf");const Hs=new WeakMap,lo=new WeakMap;function Ms(e){return lo.get(e)||1}s(Ms,"Ln");function ho(e){if(e!==rn)throw new Error("invalid wNAF")}s(ho,"Go");const hi=class hi{constructor(t,n){this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=n}_unsafeLadder(t,n,r=this.ZERO){let i=t;for(;n>rn;)n&Ht&&(r=r.add(i)),i=i.double(),n>>=Ht;return r}precomputeWindow(t,n){const{windows:r,windowSize:i}=Fs(n,this.bits),o=[];let c=t,f=c;for(let h=0;h<r;h++){f=c,o.push(f);for(let g=1;g<i;g++)f=f.add(c),o.push(f);c=f.double()}return o}wNAF(t,n,r){if(!this.Fn.isValid(r))throw new Error("invalid scalar");let i=this.ZERO,o=this.BASE;const c=Fs(t,this.bits);for(let f=0;f<c.windows;f++){const{nextN:h,offset:g,isZero:p,isNeg:m,isNegF:d,offsetF:w}=uo(r,f,c);r=h,p?o=o.add(Ir(d,n[w])):i=i.add(Ir(m,n[g]))}return ho(r),{p:i,f:o}}wNAFUnsafe(t,n,r,i=this.ZERO){const o=Fs(t,this.bits);for(let c=0;c<o.windows&&r!==rn;c++){const{nextN:f,offset:h,isZero:g,isNeg:p}=uo(r,c,o);if(r=f,!g){const m=n[h];i=i.add(p?m.negate():m)}}return ho(r),i}getPrecomputes(t,n,r){let i=Hs.get(n);return i||(i=this.precomputeWindow(n,t),t!==1&&(typeof r=="function"&&(i=r(i)),Hs.set(n,i))),i}cached(t,n,r){const i=Ms(t);return this.wNAF(i,this.getPrecomputes(i,t,r),n)}unsafe(t,n,r,i){const o=Ms(t);return o===1?this._unsafeLadder(t,n,i):this.wNAFUnsafe(o,this.getPrecomputes(o,t,r),n,i)}createCache(t,n){fo(n,this.bits),lo.set(t,n),Hs.delete(t)}hasCache(t){return Ms(t)!==1}};s(hi,"kf");let Ks=hi;function Ba(e,t,n,r){let i=t,o=e.ZERO,c=e.ZERO;for(;n>rn||r>rn;)n&Ht&&(o=o.add(i)),r&Ht&&(c=c.add(i)),i=i.double(),n>>=Ht,r>>=Ht;return{p1:o,p2:c}}s(Ba,"Pf");function Sa(e,t,n,r){Pa(n,e),Aa(r,t);const i=n.length,o=r.length;if(i!==o)throw new Error("arrays of points and scalars must have equal length");const c=e.ZERO,f=Zi(BigInt(i));let h=1;f>12?h=f-3:f>4?h=f-2:f>0&&(h=2);const g=Ln(h),p=new Array(Number(g)+1).fill(c),m=Math.floor((t.BITS-1)/h)*h;let d=c;for(let w=m;w>=0;w-=h){p.fill(c);for(let P=0;P<o;P++){const A=r[P],V=Number(A>>BigInt(w)&g);p[V]=p[V].add(n[P])}let x=c;for(let P=p.length-1,A=c;P>0;P--)A=A.add(p[P]),x=x.add(A);if(d=d.add(x),w!==0)for(let P=0;P<h;P++)d=d.double()}return d}s(Sa,"Hf");
4function po(e,t,n){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return Oa(t),t}else return St(e,{isLE:n})}s(po,"zo");function ja(e,t,n={},r){if(r===void 0&&(r=e==="edwards"),!t||typeof t!="object")throw new Error(`expected valid ${e} CURVE object`);for(const f of["p","n","h"]){const h=t[f];if(!(typeof h=="bigint"&&h>rn))throw new Error(`CURVE.${f} must be positive bigint`)}const i=po(t.p,n.Fp,r),o=po(t.n,n.Fn,r),c=["Gx","Gy","a",e==="weierstrass"?"b":"d"];for(const f of c)if(!i.isValid(t[f]))throw new Error(`CURVE.${f} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:i,Fn:o}}s(ja,"Df"),BigInt(0),BigInt(1),BigInt(2),BigInt(8),a("HashToScalar-");const Tn=BigInt(0),sn=BigInt(1),xr=BigInt(2);function Ua(e){return Or(e,{adjustScalarBytes:"function",powPminus2:"function"}),Object.freeze({...e})}s(Ua,"Vf");function Na(e){const t=Ua(e),{P:n,type:r,adjustScalarBytes:i,powPminus2:o,randomBytes:c}=t,f=r==="x25519";if(!f&&r!=="x448")throw new Error("invalid type");const h=c||U,g=f?255:448,p=f?32:56,m=BigInt(f?9:5),d=BigInt(f?121665:39081),w=f?xr**BigInt(254):xr**BigInt(447),x=f?BigInt(8)*xr**BigInt(251)-sn:BigInt(4)*xr**BigInt(445)-sn,P=w+x+sn,A=s(C=>Ke(C,n),"w"),V=ae(m);function ae(C){return Rs(A(C),p)}s(ae,"F");function K(C){const $=Pe("u coordinate",C,p);return f&&($[31]&=127),A(Er($))}s(K,"R");function fe(C){return Er(i(Pe("scalar",C,p)))}s(fe,"Z");function ee(C,$){const v=J(K($),fe(C));if(v===Tn)throw new Error("invalid private or public key received");return ae(v)}s(ee,"H");function Y(C){return ee(C,V)}s(Y,"j");function X(C,$,v){const O=A(C*($-v));return $=A($-O),v=A(v+O),{x_2:$,x_3:v}}s(X,"L");function J(C,$){Ls("u",C,Tn,n),Ls("scalar",$,w,P);const v=$,O=C;let E=sn,j=Tn,N=C,S=sn,R=Tn;for(let T=BigInt(g-1);T>=Tn;T--){const M=v>>T&sn;R^=M,{x_2:E,x_3:N}=X(R,E,N),{x_2:j,x_3:S}=X(R,j,S),R=M;const ce=E+j,ne=A(ce*ce),_=E-j,se=A(_*_),oe=ne-se,pe=N+S,le=N-S,we=A(le*ce),Kt=A(pe*_),Kn=we+Kt,Vn=we-Kt;N=A(Kn*Kn),S=A(O*A(Vn*Vn)),E=A(ne*se),j=A(oe*(ne+A(d*oe)))}({x_2:E,x_3:N}=X(R,E,N)),{x_2:j,x_3:S}=X(R,j,S);const D=o(j);return A(E*D)}s(J,"k");const H={secretKey:p,publicKey:p,seed:p},W=s((C=h(p))=>(me(C,H.seed),C),"T");function G(C){const $=W(C);return{secretKey:$,publicKey:Y($)}}return s(G,"C"),{keygen:G,getSharedSecret:s((C,$)=>ee(C,$),"getSharedSecret"),getPublicKey:s(C=>Y(C),"getPublicKey"),scalarMult:ee,scalarMultBase:Y,utils:{randomSecretKey:W,randomPrivateKey:W},GuBytes:V.slice(),lengths:H}}s(Na,"Mf");const Ca=BigInt(1),go=BigInt(2),Da=BigInt(3),Ra=BigInt(5),$a=BigInt(8),yo=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),La={p:yo,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:$a,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function Ta(e){const t=BigInt(10),n=BigInt(20),r=BigInt(40),i=BigInt(80),o=yo,c=e*e%o*e%o,f=tt(c,go,o)*c%o,h=tt(f,Ca,o)*e%o,g=tt(h,Ra,o)*h%o,p=tt(g,t,o)*g%o,m=tt(p,n,o)*p%o,d=tt(m,r,o)*m%o,w=tt(d,i,o)*d%o,x=tt(w,i,o)*d%o,P=tt(x,t,o)*g%o;return{pow_p_5_8:tt(P,go,o)*e%o,b2:c}}s(Ta,"zf");function ka(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}s(ka,"Yf");const Fa=St(La.p,{isLE:!0}),Vs=(()=>{const e=Fa.ORDER;return Na({P:e,type:"x25519",powPminus2:s(t=>{const{pow_p_5_8:n,b2:r}=Ta(t);return Ke(tt(n,Da,e)*r,e)},"powPminus2"),adjustScalarBytes:ka})})(),mo=s((e,t)=>(e+(e>=0?t:-t)/wo)/t,"Wo");function Ha(e,t,n){const[[r,i],[o,c]]=t,f=mo(c*e,n),h=mo(-i*e,n);let g=e-f*r-h*o,p=-f*i-h*c;const m=g<pt,d=p<pt;m&&(g=-g),d&&(p=-p);const w=Ln(Math.ceil(Zi(n)/2))+on;if(g<pt||g>=w||p<pt||p>=w)throw new Error("splitScalar (endomorphism): failed, k="+e);return{k1neg:m,k1:g,k2neg:d,k2:p}}s(Ha,"Wf");function _s(e){if(!["compact","recovered","der"].includes(e))throw new Error('Signature format must be "compact", "recovered", or "der"');return e}s(_s,"Pn");function qs(e,t){const n={};for(let r of Object.keys(t))n[r]=e[r]===void 0?t[r]:e[r];return wr(n.lowS,"lowS"),wr(n.prehash,"prehash"),n.format!==void 0&&_s(n.format),n}s(qs,"Hn");
4const di=class di extends Error{constructor(t=""){super(t)}};s(di,"Jf");let Ws=di;const dt={Err:Ws,_tlv:{encode:s((e,t)=>{const{Err:n}=dt;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length&1)throw new n("tlv.encode: unpadded data");const r=t.length/2,i=br(r);if(i.length/2&128)throw new n("tlv.encode: long form length too big");const o=r>127?br(i.length/2|128):"";return br(e)+o+i+t},"encode"),decode(e,t){const{Err:n}=dt;let r=0;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length<2||t[r++]!==e)throw new n("tlv.decode: wrong tlv");const i=t[r++],o=!!(i&128);let c=0;if(!o)c=i;else{const h=i&127;if(!h)throw new n("tlv.decode(long): indefinite length not supported");if(h>4)throw new n("tlv.decode(long): byte length is too big");const g=t.subarray(r,r+h);if(g.length!==h)throw new n("tlv.decode: length bytes not complete");if(g[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(const p of g)c=c<<8|p;if(r+=h,c<128)throw new n("tlv.decode(long): not minimal encoding")}const f=t.subarray(r,r+c);if(f.length!==c)throw new n("tlv.decode: wrong value length");return{v:f,l:t.subarray(r+c)}}},_int:{encode(e){const{Err:t}=dt;if(e<pt)throw new t("integer: negative integers are not allowed");let n=br(e);if(Number.parseInt(n[0],16)&8&&(n="00"+n),n.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return n},decode(e){const{Err:t}=dt;if(e[0]&128)throw new t("invalid signature integer: negative");if(e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return vr(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=dt,i=Pe("signature",e),{v:o,l:c}=r.decode(48,i);if(c.length)throw new t("invalid signature: left bytes after parsing");const{v:f,l:h}=r.decode(2,o),{v:g,l:p}=r.decode(2,h);if(p.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(f),s:n.decode(g)}},hexFromSig(e){const{_tlv:t,_int:n}=dt,r=t.encode(2,n.encode(e.r)),i=t.encode(2,n.encode(e.s)),o=r+i;return t.encode(48,o)}},pt=BigInt(0),on=BigInt(1),wo=BigInt(2),Pr=BigInt(3),Ma=BigInt(4);function cn(e,t){const{BYTES:n}=e;let r;if(typeof t=="bigint")r=t;else{let i=Pe("private key",t);try{r=e.fromBytes(i)}catch{throw new Error(`invalid private key: expected ui8a of size ${n}, got ${typeof t}`)}}if(!e.isValidNot0(r))throw new Error("invalid private key: out of range [1..N-1]");return r}s(cn,"re");function Ka(e,t={}){const n=ja("weierstrass",e,t),{Fp:r,Fn:i}=n;let o=n.CURVE;const{h:c,n:f}=o;Or(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:h}=t;if(h&&(!r.is0(o.a)||typeof h.beta!="bigint"||!Array.isArray(h.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const g=vo(r,i);function p(){if(!r.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}s(p,"a");function m($,v,O){const{x:E,y:j}=v.toAffine(),N=r.toBytes(E);if(wr(O,"isCompressed"),O){p();const S=!r.isOdd(j);return y(bo(S),N)}else return y(Uint8Array.of(4),N,r.toBytes(j))}s(m,"l");function d($){kt($,void 0,"Point");const{publicKey:v,publicKeyUncompressed:O}=g,E=$.length,j=$[0],N=$.subarray(1);if(E===v&&(j===2||j===3)){const S=r.fromBytes(N);if(!r.isValid(S))throw new Error("bad point: is not on curve, wrong x");const R=P(S);let D;try{D=r.sqrt(R)}catch(M){const ce=M instanceof Error?": "+M.message:"";throw new Error("bad point: is not on curve, sqrt error"+ce)}p();const T=r.isOdd(D);return(j&1)===1!==T&&(D=r.neg(D)),{x:S,y:D}}else if(E===O&&j===4){const S=r.BYTES,R=r.fromBytes(N.subarray(0,S)),D=r.fromBytes(N.subarray(S,S*2));if(!A(R,D))throw new Error("bad point: is not on curve");return{x:R,y:D}}else throw new Error(`bad point: got length ${E}, expected compressed=${v} or uncompressed=${O}`)}s(d,"d");const w=t.toBytes||m,x=t.fromBytes||d;function P($){const v=r.sqr($),O=r.mul(v,$);return r.add(r.add(O,r.mul($,o.a)),o.b)}s(P,"m");function A($,v){const O=r.sqr(v),E=P($);return r.eql(O,E)}if(s(A,"w"),!A(o.Gx,o.Gy))throw new Error("bad curve params: generator point");const V=r.mul(r.pow(o.a,Pr),Ma),ae=r.mul(r.sqr(o.b),BigInt(27));if(r.is0(r.add(V,ae)))throw new Error("bad curve params: a or b");function K($,v,O=!1){if(!r.isValid(v)||O&&r.is0(v))throw new Error(`bad point coordinate ${$}`);return v}s(K,"R");function fe($){if(!($ instanceof H))throw new Error("ProjectivePoint expected")}s(fe,"Z");function ee($){if(!h||!h.basises)throw new Error("no endo");return Ha($,h.basises,i.ORDER)}s(ee,"H");const Y=zi(($,v)=>{const{X:O,Y:E,Z:j}=$;if(r.eql(j,r.ONE))return{x:O,y:E};const N=$.is0();v==null&&(v=N?r.ONE:r.inv(j));const S=r.mul(O,v),R=r.mul(E,v),D=r.mul(j,v);if(N)return{x:r.ZERO,y:r.ZERO};
vendor: 4,143 bytes, line 4
4if(!r.eql(D,r.ONE))throw new Error("invZ was invalid");return{x:S,y:R}}),X=zi($=>{if($.is0()){if(t.allowInfinityPoint&&!r.is0($.Y))return;throw new Error("bad point: ZERO")}const{x:v,y:O}=$.toAffine();if(!r.isValid(v)||!r.isValid(O))throw new Error("bad point: x or y not field elements");if(!A(v,O))throw new Error("bad point: equation left != right");if(!$.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function J($,v,O,E,j){return O=new H(r.mul(O.X,$),O.Y,O.Z),v=Ir(E,v),O=Ir(j,O),v.add(O)}s(J,"k");const C=class C{constructor(v,O,E){this.X=K("x",v),this.Y=K("y",O,!0),this.Z=K("z",E),Object.freeze(this)}static CURVE(){return o}static fromAffine(v){const{x:O,y:E}=v||{};if(!v||!r.isValid(O)||!r.isValid(E))throw new Error("invalid affine point");if(v instanceof C)throw new Error("projective point not allowed");return r.is0(O)&&r.is0(E)?C.ZERO:new C(O,E,r.ONE)}static fromBytes(v){const O=C.fromAffine(x(kt(v,void 0,"point")));return O.assertValidity(),O}static fromHex(v){return C.fromBytes(Pe("pointHex",v))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(v=8,O=!0){return G.createCache(this,v),O||this.multiply(Pr),this}assertValidity(){X(this)}hasEvenY(){const{y:v}=this.toAffine();if(!r.isOdd)throw new Error("Field doesn't support isOdd");return!r.isOdd(v)}equals(v){fe(v);const{X:O,Y:E,Z:j}=this,{X:N,Y:S,Z:R}=v,D=r.eql(r.mul(O,R),r.mul(N,j)),T=r.eql(r.mul(E,R),r.mul(S,j));return D&&T}negate(){return new C(this.X,r.neg(this.Y),this.Z)}double(){const{a:v,b:O}=o,E=r.mul(O,Pr),{X:j,Y:N,Z:S}=this;let R=r.ZERO,D=r.ZERO,T=r.ZERO,M=r.mul(j,j),ce=r.mul(N,N),ne=r.mul(S,S),_=r.mul(j,N);return _=r.add(_,_),T=r.mul(j,S),T=r.add(T,T),R=r.mul(v,T),D=r.mul(E,ne),D=r.add(R,D),R=r.sub(ce,D),D=r.add(ce,D),D=r.mul(R,D),R=r.mul(_,R),T=r.mul(E,T),ne=r.mul(v,ne),_=r.sub(M,ne),_=r.mul(v,_),_=r.add(_,T),T=r.add(M,M),M=r.add(T,M),M=r.add(M,ne),M=r.mul(M,_),D=r.add(D,M),ne=r.mul(N,S),ne=r.add(ne,ne),M=r.mul(ne,_),R=r.sub(R,M),T=r.mul(ne,ce),T=r.add(T,T),T=r.add(T,T),new C(R,D,T)}add(v){fe(v);const{X:O,Y:E,Z:j}=this,{X:N,Y:S,Z:R}=v;let D=r.ZERO,T=r.ZERO,M=r.ZERO;const ce=o.a,ne=r.mul(o.b,Pr);let _=r.mul(O,N),se=r.mul(E,S),oe=r.mul(j,R),pe=r.add(O,E),le=r.add(N,S);pe=r.mul(pe,le),le=r.add(_,se),pe=r.sub(pe,le),le=r.add(O,j);let we=r.add(N,R);return le=r.mul(le,we),we=r.add(_,oe),le=r.sub(le,we),we=r.add(E,j),D=r.add(S,R),we=r.mul(we,D),D=r.add(se,oe),we=r.sub(we,D),M=r.mul(ce,le),D=r.mul(ne,oe),M=r.add(D,M),D=r.sub(se,M),M=r.add(se,M),T=r.mul(D,M),se=r.add(_,_),se=r.add(se,_),oe=r.mul(ce,oe),le=r.mul(ne,le),se=r.add(se,oe),oe=r.sub(_,oe),oe=r.mul(ce,oe),le=r.add(le,oe),_=r.mul(se,le),T=r.add(T,_),_=r.mul(we,le),D=r.mul(pe,D),D=r.sub(D,_),_=r.mul(pe,se),M=r.mul(we,M),M=r.add(M,_),new C(D,T,M)}subtract(v){return this.add(v.negate())}is0(){return this.equals(C.ZERO)}multiply(v){const{endo:O}=t;if(!i.isValidNot0(v))throw new Error("invalid scalar: out of range");let E,j;const N=s(S=>G.cached(this,S,R=>ks(C,R)),"E");if(O){const{k1neg:S,k1:R,k2neg:D,k2:T}=ee(v),{p:M,f:ce}=N(R),{p:ne,f:_}=N(T);j=ce.add(_),E=J(O.beta,M,ne,S,D)}else{const{p:S,f:R}=N(v);E=S,j=R}return ks(C,[E,j])[0]}multiplyUnsafe(v){const{endo:O}=t,E=this;if(!i.isValid(v))throw new Error("invalid scalar: out of range");if(v===pt||E.is0())return C.ZERO;if(v===on)return E;if(G.hasCache(this))return this.multiply(v);if(O){const{k1neg:j,k1:N,k2neg:S,k2:R}=ee(v),{p1:D,p2:T}=Ba(C,E,N,R);return J(O.beta,D,T,j,S)}else return G.unsafe(E,v)}multiplyAndAddUnsafe(v,O,E){const j=this.multiplyUnsafe(O).add(v.multiplyUnsafe(E));return j.is0()?void 0:j}toAffine(v){return Y(this,v)}isTorsionFree(){const{isTorsionFree:v}=t;return c===on?!0:v?v(C,this):G.unsafe(this,f).is0()}clearCofactor(){const{clearCofactor:v}=t;return c===on?this:v?v(C,this):this.multiplyUnsafe(c)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}toBytes(v=!0){return wr(v,"isCompressed"),this.assertValidity(),w(C,this,v)}toHex(v=!0){return ct(this.toBytes(v))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(v=!0){return this.toBytes(v)}
4_setWindowSize(v){this.precompute(v)}static normalizeZ(v){return ks(C,v)}static msm(v,O){return Sa(C,i,v,O)}static fromPrivateKey(v){return C.BASE.multiply(cn(i,v))}};s(C,"O");let H=C;H.BASE=new H(o.Gx,o.Gy,r.ONE),H.ZERO=new H(r.ZERO,r.ONE,r.ZERO),H.Fp=r,H.Fn=i;const W=i.BITS,G=new Ks(H,t.endo?Math.ceil(W/2):W);return H.BASE.precompute(8),H}s(Ka,"ta");function bo(e){return Uint8Array.of(e?2:3)}s(bo,"Qo");function vo(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}s(vo,"ts");function Va(e,t={}){const{Fn:n}=e,r=t.randomBytes||U,i=Object.assign(vo(e.Fp,n),{seed:ao(n.ORDER)});function o(d){try{return!!cn(n,d)}catch{return!1}}s(o,"s");function c(d,w){const{publicKey:x,publicKeyUncompressed:P}=i;try{const A=d.length;return w===!0&&A!==x||w===!1&&A!==P?!1:!!e.fromBytes(d)}catch{return!1}}s(c,"i");function f(d=r(i.seed)){return xa(kt(d,i.seed,"seed"),n.ORDER)}s(f,"c");function h(d,w=!0){return e.BASE.multiply(cn(n,d)).toBytes(w)}s(h,"f");function g(d){const w=f(d);return{secretKey:w,publicKey:h(w)}}s(g,"u");function p(d){if(typeof d=="bigint")return!1;if(d instanceof e)return!0;const{secretKey:w,publicKey:x,publicKeyUncompressed:P}=i;if(n.allowedLengths||w===x)return;const A=Pe("key",d).length;return A===x||A===P}s(p,"a");function m(d,w,x=!0){if(p(d)===!0)throw new Error("first arg must be private key");if(p(w)===!1)throw new Error("second arg must be public key");const P=cn(n,d);return e.fromHex(w).multiply(P).toBytes(x)}return s(m,"l"),Object.freeze({getPublicKey:h,getSharedSecret:m,keygen:g,Point:e,utils:{isValidSecretKey:o,isValidPublicKey:c,randomSecretKey:f,isValidPrivateKey:o,randomPrivateKey:f,normPrivateKeyToScalar:s(d=>cn(n,d),"normPrivateKeyToScalar"),precompute(d=8,w=e.BASE){return w.precompute(d,!1)}},lengths:i})}s(Va,"ea");function _a(e,t,n={}){bt(t),Or(n,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const r=n.randomBytes||U,i=n.hmac||((O,...E)=>yr(t,O,y(...E))),{Fp:o,Fn:c}=e,{ORDER:f,BITS:h}=c,{keygen:g,getPublicKey:p,getSharedSecret:m,utils:d,lengths:w}=Va(e,n),x={prehash:!1,lowS:typeof n.lowS=="boolean"?n.lowS:!1,format:void 0,extraEntropy:!1},P="compact";function A(O){const E=f>>on;return O>E}s(A,"w");function V(O,E){if(!c.isValidNot0(E))throw new Error(`invalid signature ${O}: out of range 1..Point.Fn.ORDER`);return E}s(V,"U");function ae(O,E){_s(E);const j=w.signature,N=E==="compact"?j:E==="recovered"?j+1:void 0;return kt(O,N,`${E} signature`)}s(ae,"F");const v=class v{constructor(E,j,N){this.r=V("r",E),this.s=V("s",j),N!=null&&(this.recovery=N),Ob
vendor: 4,877 bytes, line 4
4ject.freeze(this)}static fromBytes(E,j=P){ae(E,j);let N;if(j==="der"){const{r:T,s:M}=dt.toSig(kt(E));return new v(T,M)}j==="recovered"&&(N=E[0],j="compact",E=E.subarray(1));const S=c.BYTES,R=E.subarray(0,S),D=E.subarray(S,S*2);return new v(c.fromBytes(R),c.fromBytes(D),N)}static fromHex(E,j){return this.fromBytes(u(E),j)}addRecoveryBit(E){return new v(this.r,this.s,E)}recoverPublicKey(E){const j=o.ORDER,{r:N,s:S,recovery:R}=this;if(R==null||![0,1,2,3].includes(R))throw new Error("recovery id invalid");if(f*wo<j&&R>1)throw new Error("recovery id is ambiguous for h>1 curve");const D=R===2||R===3?N+f:N;if(!o.isValid(D))throw new Error("recovery id 2 or 3 invalid");const T=o.toBytes(D),M=e.fromBytes(y(bo((R&1)===0),T)),ce=c.inv(D),ne=ee(Pe("msgHash",E)),_=c.create(-ne*ce),se=c.create(S*ce),oe=e.BASE.multiplyUnsafe(_).add(M.multiplyUnsafe(se));if(oe.is0())throw new Error("point at infinify");return oe.assertValidity(),oe}hasHighS(){return A(this.s)}toBytes(E=P){if(_s(E),E==="der")return u(dt.hexFromSig(this));const j=c.toBytes(this.r),N=c.toBytes(this.s);if(E==="recovered"){if(this.recovery==null)throw new Error("recovery bit must be present");return y(Uint8Array.of(this.recovery),j,N)}return y(j,N)}toHex(E){return ct(this.toBytes(E))}assertValidity(){}static fromCompact(E){return v.fromBytes(Pe("sig",E),"compact")}static fromDER(E){return v.fromBytes(Pe("sig",E),"der")}normalizeS(){return this.hasHighS()?new v(this.r,c.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return ct(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return ct(this.toBytes("compact"))}};s(v,"R");let K=v;const fe=n.bits2int||function(O){if(O.length>8192)throw new Error("input is too large");const E=vr(O),j=O.length*8-h;return j>0?E>>BigInt(j):E},ee=n.bits2int_modN||function(O){return c.create(fe(O))},Y=Ln(h);function X(O){return Ls("num < 2^"+h,O,pt,Y),c.toBytes(O)}s(X,"L");function J(O,E){return kt(O,void 0,"message"),E?kt(t(O),void 0,"prehashed message"):O}s(J,"k");function H(O,E,j){if(["recovered","canonical"].some(se=>se in j))throw new Error("sign() legacy options not supported");const{lowS:N,prehash:S,extraEntropy:R}=qs(j,x);O=J(O,S);const D=ee(O),T=cn(c,E),M=[X(T),X(D)];if(R!=null&&R!==!1){const se=R===!0?r(w.secretKey):R;M.push(Pe("extraEntropy",se))}const ce=y(...M),ne=D;function _(se){const oe=fe(se);if(!c.isValidNot0(oe))return;const pe=c.inv(oe),le=e.BASE.multiply(oe).toAffine(),we=c.create(le.x);if(we===pt)return;const Kt=c.create(pe*c.create(ne+we*T));if(Kt===pt)return;let Kn=(le.x===we?0:2)|Number(le.y&on),Vn=Kt;return N&&A(Kt)&&(Vn=c.neg(Kt),Kn^=1),new K(we,Vn,Kn)}return s(_,"$"),{seed:ce,k2sig:_}}s(H,"O");function W(O,E,j={}){O=Pe("message",O);const{seed:N,k2sig:S}=H(O,E,j);return ga(t.outputLen,c.BYTES,i)(N,S)}s(W,"T");function G(O){let E;const j=typeof O=="string"||Xt(O),N=!j&&O!==null&&typeof O=="object"&&typeof O.r=="bigint"&&typeof O.s=="bigint";if(!j&&!N)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(N)E=new K(O.r,O.s);else if(j){try{E=K.fromBytes(Pe("sig",O),"der")}catch(S){if(!(S instanceof dt.Err))throw S}if(!E)try{E=K.fromBytes(Pe("sig",O),"compact")}catch{return!1}}return E||!1}s(G,"C");function C(O,E,j,N={}){const{lowS:S,prehash:R,format:D}=qs(N,x);if(j=Pe("publicKey",j),E=J(Pe("message",E),R),"strict"in N)throw new Error("options.strict was renamed to lowS");const T=D===void 0?G(O):K.fromBytes(Pe("sig",O),D);if(T===!1)return!1;try{const M=e.fromBytes(j);if(S&&T.hasHighS())return!1;const{r:ce,s:ne}=T,_=ee(E),se=c.inv(ne),oe=c.create(_*se),pe=c.create(ce*se),le=e.BASE.multiplyUnsafe(oe).add(M.multiplyUnsafe(pe));return le.is0()?!1:c.create(le.x)===ce}catch{return!1}}s(C,"_");function $(O,E,j={}){const{prehash:N}=qs(j,x);return E=J(E,N),K.fromBytes(O,"recovered").recoverPublicKey(E).toBytes()}return s($,"p"),Object.freeze({keygen:g,getPublicKey:p,getSharedSecret:m,utils:d,lengths:w,Point:e,sign:W,verify:C,recoverPublicKey:$,Signature:K,hash:t})}s(_a,"na");function qa(e){const t={a:e.a,b:e.b,p:e.Fp.ORDER,n:e.n,h:e.h,Gx:e.Gx,Gy:e.Gy},n=e.Fp;let r=e.allowedPrivateKeyLengths?Array.from(new Set(e.allowedPrivateKeyLengths.map(c=>Math.ceil(c/2)))):void 0;const i=St(t.n,{BITS:e.nBitLength,allowedLengths:r,modFromBytes:e.wrapPrivateKey}),o={Fp:n,Fn:i,allowInfinityPoint:e.allowInfinityPoint,endo:e.endo,isTorsionFree:e.isTorsionFree,clearCofactor:e.clearCofactor,fromBytes:e.fromBytes,toBytes:e.toBytes};return{CURVE:t,curveOpts:o}}s(qa,"ra");function Wa(e){const{CURVE:t,curveOpts:n}=qa(e),r={hmac:e.hmac,randomBytes:e.randomBytes,lowS:e.lowS,bits2int:e.bits2int,bits2int_modN:e.bits2int_modN};return{CURVE:t,curveOpts:n,hash:e.hash,ecdsaOpts:r}}s(Wa,"oa");function Ga(e,t){const n=t.Point;return Object.assign({},t,{ProjectivePoint:n,CURVE:Object.assign({},e,oo(n.Fn.ORDER,n.Fn.BITS))})}
4s(Ga,"sa");function Za(e){const{CURVE:t,curveOpts:n,hash:r,ecdsaOpts:i}=Wa(e),o=Ka(t,n),c=_a(o,r,i);return Ga(e,c)}s(Za,"ia");function Gs(e,t){const n=s(r=>Za({...e,hash:r}),"n");return{...n(t),create:n}}s(Gs,"Dn");const Eo={p:BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),h:BigInt(1),a:BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")},Oo={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff"),n:BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973"),h:BigInt(1),a:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000fffffffc"),b:BigInt("0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef"),Gx:BigInt("0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7"),Gy:BigInt("0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f")},Io={p:BigInt("0x1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),n:BigInt("0x01fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa51868783bf2f966b7fcc0148f709a5d03bb5c9b8899c47aebb6fb71e91386409"),h:BigInt(1),a:BigInt("0x1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc"),b:BigInt("0x0051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00"),Gx:BigInt("0x00c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66"),Gy:BigInt("0x011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650")},za=St(Eo.p),Ya=St(Oo.p),Xa=St(Io.p),Ja=Gs({...Eo,Fp:za,lowS:!1},lr);Gs({...Oo,Fp:Ya,lowS:!1},nc),Gs({...Io,Fp:Xa,lowS:!1,allowedPrivateKeyLengths:[130,131,132]},tc);const Qa=Ja,xo="base10",Ne="base16",an="base64pad",Ar="base64url",kn="utf8",Po=0,fn=1,Fn=2,ef=0,Ao=1,Hn=12,Zs=32;function tf(){const e=Vs.utils.randomPrivateKey(),t=Vs.getPublicKey(e);return{privateKey:(0,q.dI)(e,Ne),publicKey:(0,q.dI)(t,Ne)}}s(tf,"ha");function nf(){const e=U(Zs);return(0,q.dI)(e,Ne)}s(nf,"pa");function rf(e,t){const n=Vs.getSharedSecret((0,q.sH)(e,Ne),(0,q.sH)(t,Ne)),r=da(mr,n,void 0,void 0,Zs);return(0,q.dI)(r,Ne)}s(rf,"ga");function sf(e){const t=mr((0,q.sH)(e,Ne));return(0,q.dI)(t,Ne)}s(sf,"ba");function of(e){const t=mr((0,q.sH)(e,kn));return(0,q.dI)(t,Ne)}s(of,"ya");function Bo(e){return(0,q.sH)(`${e}`,xo)}s(Bo,"qn");function Mt(e){return Number((0,q.dI)(e,xo))}s(Mt,"Gt");function So(e){return e.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}s(So,"ss");function jo(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=(4-t.length%4)%4;return t+"=".repeat(n)}s(jo,"is");function cf(e){const t=Bo(typeof e.type<"u"?e.type:Po);if(Mt(t)===fn&&typeof e.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const n=typeof e.senderPublicKey<"u"?(0,q.sH)(e.senderPublicKey,Ne):void 0,r=typeof e.iv<"u"?(0,q.sH)(e.iv,Ne):U(Hn),i=(0,q.sH)(e.symKey,Ne),o=qi(i,r).encrypt((0,q.sH)(e.message,kn)),c=Uo({type:t,sealed:o,iv:r,senderPublicKey:n});return e.encoding===Ar?So(c):c}s(cf,"ma");function af(e){const t=(0,q.sH)(e.symKey,Ne),{sealed:n,iv:r}=Br({encoded:e.encoded,encoding:e.encoding}),i=qi(t,r).decrypt(n);if(i===null)throw new Error("Failed to decrypt");return(0,q.dI)(i,kn)}s(af,"wa");function ff(e,t){const n=Bo(Fn),r=U(Hn),i=(0,q.sH)(e,kn),o=Uo({type:n,sealed:i,iv:r});return t===Ar?So(o):o}s(ff,"va");function uf(e,t){const{sealed:n}=Br({encoded:e,encoding:t});return(0,q.dI)(n,kn)}s(uf,"xa");function Uo(e){if(Mt(e.type)===Fn)return(0,q.dI)((0,q.xW)([e.type,e.sealed]),an);if(Mt(e.type)===fn){if(typeof e.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");
4return(0,q.dI)((0,q.xW)([e.type,e.senderPublicKey,e.iv,e.sealed]),an)}return(0,q.dI)((0,q.xW)([e.type,e.iv,e.sealed]),an)}s(Uo,"Fn");function Br(e){const t=(e.encoding||an)===Ar?jo(e.encoded):e.encoded,n=(0,q.sH)(t,an),r=n.slice(ef,Ao),i=Ao;if(Mt(r)===fn){const h=i+Zs,g=h+Hn,p=n.slice(i,h),m=n.slice(h,g),d=n.slice(g);return{type:r,sealed:d,iv:m,senderPublicKey:p}}if(Mt(r)===Fn){const h=n.slice(i),g=U(Hn);return{type:r,sealed:h,iv:g}}const o=i+Hn,c=n.slice(i,o),f=n.slice(o);return{type:r,sealed:f,iv:c}}s(Br,"ze");function lf(e,t){const n=Br({encoded:e,encoding:t?.encoding});return No({type:Mt(n.type),senderPublicKey:typeof n.senderPublicKey<"u"?(0,q.dI)(n.senderPublicKey,Ne):void 0,receiverPublicKey:t?.receiverPublicKey})}s(lf,"Ea");function No(e){const t=e?.type||Po;if(t===fn){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}}s(No,"cs");function hf(e){return e.type===fn&&typeof e.senderPublicKey=="string"&&typeof e.receiverPublicKey=="string"}s(hf,"Ba");function df(e){return e.type===Fn}s(df,"Ia");function pf(e){const t=Z.from(e.x,"base64"),n=Z.from(e.y,"base64");return(0,q.xW)([new Uint8Array([4]),t,n])}s(pf,"fs");function gf(e,t){const[n,r,i]=e.split("."),o=Z.from(jo(i),"base64");if(o.length!==64)throw new Error("Invalid signature length");const c=o.slice(0,32),f=o.slice(32,64),h=`${n}.${r}`,g=mr(h),p=pf(t);if(!Qa.verify((0,q.xW)([c,f]),g,p))throw new Error("Invalid signature");return(0,at.Cq)(e).payload}s(gf,"Aa");const yf="irn";function mf(e){return e?.relay||{protocol:yf}}s(mf,"Sa");function wf(e){const t=ke.CG[e];if(typeof t>"u")throw new Error(`Relay Protocol not supported: ${e}`);return t}s(wf,"Oa");var bf=Object.defineProperty,vf=Object.defineProperties,Ef=Object.getOwnPropertyDescriptors,Co=Object.getOwnPropertySymbols,Of=Object.prototype.hasOwnProperty,If=Object.prototype.propertyIsEnumerable,Do=s((e,t,n)=>t in e?bf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,"ls"),zs=s((e,t)=>{for(var n in t||(t={}))Of.call(t,n)&&Do(e,n,t[n]);if(Co)for(var n of Co(t))If.call(t,n)&&Do(e,n,t[n]);return e},"Zn"),xf=s((e,t)=>vf(e,Ef(t)),"Ta");function Pf(e,t="-"){const n={},r="relay"+t;return Object.keys(e).forEach(i=>{if(i.startsWith(r)){const o=i.replace(r,""),c=e[i];n[o]=c}}),n}s(Pf,"ds");function Af(e){if(!e.includes("wc:")){const g=zt(e);g!=null&&g.includes("wc:")&&(e=g)}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),i=e.substring(t+1,n).split("@"),o=typeof n<"u"?e.substring(n):"",c=new URLSearchParams(o),f=Object.fromEntries(c.entries()),h=typeof f.methods=="str
4ing"?f.methods.split(","):void 0;return{protocol:r,topic:Bf(i[0]),version:parseInt(i[1],10),symKey:f.symKey,relay:Pf(f),methods:h,expiryTimestamp:f.expiryTimestamp?parseInt(f.expiryTimestamp,10):void 0}}s(Af,"Ca");function Bf(e){return e.startsWith("//")?e.substring(2):e}s(Bf,"hs");function Sf(e,t="-"){const n="relay",r={};return Object.keys(e).forEach(i=>{const o=i,c=n+t+o;e[o]&&(r[c]=e[o])}),r}s(Sf,"ps");function jf(e){const t=new URLSearchParams,n=zs(zs(xf(zs({},Sf(e.relay)),{symKey:e.symKey}),e.expiryTimestamp&&{expiryTimestamp:e.expiryTimestamp.toString()}),e.methods&&{methods:e.methods.join(",")});return Object.entries(n).sort(([r],[i])=>r.localeCompare(i)).forEach(([r,i])=>{i!==void 0&&t.append(r,String(i))}),`${e.protocol}:${e.topic}@${e.version}?${t}`}s(jf,"ja");function Uf(e,t,n){return`${e}?wc_ev=${n}&topic=${t}`}s(Uf,"La");var Nf=Object.defineProperty,Cf=Object.defineProperties,Df=Object.getOwnPropertyDescriptors,Ro=Object.getOwnPropertySymbols,Rf=Object.prototype.hasOwnProperty,$f=Object.prototype.propertyIsEnumerable,$o=s((e,t,n)=>t in e?Nf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,"bs"),Lf=s((e,t)=>{for(var n in t||(t={}))Rf.call(t,n)&&$o(e,n,t[n]);if(Ro)for(var n of Ro(t))$f.call(t,n)&&$o(e,n,t[n]);return e},"Ma"),Tf=s((e,t)=>Cf(e,Df(t)),"Ka");function un(e){const t=[];return e.forEach(n=>{const[r,i]=n.split(":");t.push(`${r}:${i}`)}),t}s(un,"zt");function Lo(e){const t=[];return Object.values(e).forEach(n=>{t.push(...un(n.accounts))}),[...new Set(t)]}s(Lo,"ys");function kf(e){const t=[];return Object.values(e).forEach(n=>{t.push(...n.methods)}),[...new Set(t)]}s(kf,"qa");function Ff(e){const t=[];return Object.values(e).forEach(n=>{t.push(...n.events)}),[...new Set(t)]}s(Ff,"Fa");function Hf(e,t){const n=[];return Object.values(e).forEach(r=>{un(r.accounts).includes(t)&&n.push(...r.methods)}),n}s(Hf,"ms");function Mf(e,t){const n=[];return Object.values(e).forEach(r=>{un(r.accounts).includes(t)&&n.push(...r.events)}),n}s(Mf,"ws");function ku(e,t){const n=Ho(e,t);if(n)throw new Error(n.message);const r={};for(const[i,o]of Object.entries(e))r[i]={methods:o.methods,events:o.events,chains:o.accounts.map(c=>`${c.split(":")[0]}:${c.split(":")[1]}`)};return r}s(ku,"Za");function Fu(e){var t;const{proposal:{requiredNamespaces:n,optionalNamespaces:r={}},supportedNamespaces:i}=e,o=Sr(n),c=Sr(r),f={};
4Object.keys(i).forEach(p=>{const m=i[p].chains,d=i[p].methods,w=i[p].events,x=i[p].accounts;m.forEach(P=>{if(!x.some(A=>A.includes(P)))throw new Error(`No accounts provided for chain ${P} in namespace ${p}`)}),f[p]={chains:m,methods:d,events:w,accounts:x}});const h=Ko(n,f,"approve()");if(h)throw new Error(h.message);const g={};if(!Object.keys(n).length&&!Object.keys(r).length)return f;Object.keys(o).forEach(p=>{const m=i[p].chains.filter(P=>{var A,V;return(V=(A=o[p])==null?void 0:A.chains)==null?void 0:V.includes(P)}),d=i[p].methods.filter(P=>{var A,V;return(V=(A=o[p])==null?void 0:A.methods)==null?void 0:V.includes(P)}),w=i[p].events.filter(P=>{var A,V;return(V=(A=o[p])==null?void 0:A.events)==null?void 0:V.includes(P)}),x=m.map(P=>i[p].accounts.filter(A=>A.includes(`${P}:`))).flat();g[p]={chains:m,methods:d,events:w,accounts:x}}),Object.keys(c).forEach(p=>{var m,d,w,x,P,A;if(!i[p])return;const V=(d=(m=c[p])==null?void 0:m.chains)==null?void 0:d.filter(ee=>i[p].chains.includes(ee)),ae=i[p].methods.filter(ee=>{var Y,X;return(X=(Y=c[p])==null?void 0:Y.methods)==null?void 0:X.includes(ee)}),K=i[p].events.filter(ee=>{var Y,X;return(X=(Y=c[p])==null?void 0:Y.events)==null?void 0:X.includes(ee)}),fe=V?.map(ee=>i[p].accounts.filter(Y=>Y.includes(`${ee}:`))).flat();g[p]={chains:Be((w=g[p])==null?void 0:w.chains,V),methods:Be((x=g[p])==null?void 0:x.methods,ae),events:Be((P=g[p])==null?void 0:P.events,K),accounts:Be((A=g[p])==null?void 0:A.accounts,fe)}});for(const[p,m]of Object.entries(g))(m.accounts.length===0||((t=m?.chains)==null?void 0:t.length)===0)&&delete g[p];return g}s(Fu,"Ga");function Ys(e){return e.includes(":")}s(Ys,"Gn");function To(e){return Ys(e)?e.split(":")[0]:e}s(To,"vs");function Sr(e){var t,n,r;const i={};if(!jr(e))return i;for(const[o,c]of Object.entries(e)){const f=Ys(o)?[o]:c.chains,h=c.methods||[],g=c.events||[],p=To(o);i[p]=Tf(Lf({},i[p]),{chains:Be(f,(t=i[p])==null?void 0:t.chains),methods:Be(h,(n=i[p])==null?void 0:n.methods),events:Be(g,(r=i[p])==null?void 0:r.events)})}return i}s(Sr,"Ee");function Kf(e){const t={};return e?.forEach(n=>{var r;const[i,o]=n.split(":");t[i]||(t[i]={accounts:[],chains:[],events:[],methods:[]}),t[i].accounts.push(n),(r=t[i].chains)==null||r.push(`${i}:${o}`)}),t}s(Kf,"xs");function Vf(e,t){t=t.map(r=>r.replace("did:pkh:",""));const n=Kf(t);for(const[r,i]of Object.entries(n))i.methods?i.methods=Be(i.methods,e):i.methods=e,i.events=["chainChanged","accountsChanged"];return n}s(Vf,"za");function _f(e,t){var n,r,i,o,c,f;const h=Sr(e),g=Sr(t),p={},m=Object.keys(h).concat(Object.keys(g));for(const d of m)p[d]={chains:Be((n=h[d])==null?void 0:n.chains,(r=g[d])==null?void 0:r.chains),methods:Be((i=h[d])==null?void 0:i.methods,(o=g[d])==null?void 0:o.methods),events:Be((c=h[d])==null?void 0:c.events,(f=g[d])==null?void 0:f.events)};return p}s(_f,"Ya");function Mn(e,t){return Array.isArray(e)?typeof t<"u"&&e.length?e.every(t):!0:!1}s(Mn,"Be");function jr(e){return Object.getPrototypeOf(e)===Object.prototype&&Object.keys(e).length}s(jr,"Ye");function jt(e){return typeof e>"u"}s(jt,"Dt");function Ve(e,t){return t&&jt(e)?!0:typeof e=="string"&&!!e.trim().length}s(Ve,"ft");function Xs(e,t){return t&&jt(e)?!0:typeof e=="number"&&!isNaN(e)}s(Xs,"Xe");function qf(e,t){const{requiredNamespaces:n}=t,r=Object.keys(e.namespaces),i=Object.keys(n);let o=!0;return ut(i,r)?(r.forEach(c=>{const{accounts:f,methods:h,events:g}=e.namespaces[c],p=un(f),m=n[c];(!ut(hn(c,m),p)||!ut(m.methods,h)||!ut(m.events,g))&&(o=!1)}),o):!1}s(qf,"Xa");function Ur(e){return Ve(e,!1)&&e.includes(":")?e.split(":").length===2:!1}s(Ur,"Ie");function Wf(e){if(Ve(e,!1)&&e.includes(":")){const t=e.split(":");if(t.length===3){const n=t[0]+":"+t[1];return!!t[2]&&Ur(n)}}return!1}s(Wf,"Es");function Gf(e){function t(n){try{return typeof new URL(n)<"u"}catch{return!1}}s(t,"e");try{if(Ve(e,!1)){if(t(e))return!0;const n=zt(e);return t(n)}}catch{}return!1}s(Gf,"Wa");function Zf(e){var t;return(t=e?.proposer)==null?void 0:t.publicKey}s(Zf,"Ja");function zf(e){return e?.topic}s(zf,"Qa");function Yf(e,t){let n=null;return Ve(e?.publicKey,!1)||(n=We("MISSING_OR_INVALID",`${t} controller public key should be a string`)),n}s(Yf,"tu");function ko(e){let t=!0;return Mn(e)?e.length&&(t=e.every(n=>Ve(n,!1))):t=!1,t}s(ko,"zn");function Xf(e,t,n){let r=null;return Mn(t)&&t.length?t.forEach(i=>
4{r||Ur(i)||(r=Xe("UNSUPPORTED_CHAINS",`${n}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):Ur(e)||(r=Xe("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}s(Xf,"Bs");function Jf(e,t,n){let r=null;return Object.entries(e).forEach(([i,o])=>{if(r)return;const c=Xf(i,hn(i,o),`${t} ${n}`);c&&(r=c)}),r}s(Jf,"Is");function Qf(e,t){let n=null;return Mn(e)?e.forEach(r=>{n||Wf(r)||(n=Xe("UNSUPPORTED_ACCOUNTS",`${t}, account ${r} should be a string and conform to "namespace:chainId:address" format`))}):n=Xe("UNSUPPORTED_ACCOUNTS",`${t}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),n}s(Qf,"As");function eu(e,t){let n=null;return Object.values(e).forEach(r=>{if(n)return;const i=Qf(r?.accounts,`${t} namespace`);i&&(n=i)}),n}s(eu,"Ss");function tu(e,t){let n=null;return ko(e?.methods)?ko(e?.events)||(n=Xe("UNSUPPORTED_EVENTS",`${t}, events should be an array of strings or empty array for no events`)):n=Xe("UNSUPPORTED_METHODS",`${t}, methods should be an array of strings or empty array for no methods`),n}s(tu,"Os");function Fo(e,t){let n=null;return Object.values(e).forEach(r=>{if(n)return;const i=tu(r,`${t}, namespace`);i&&(n=i)}),n}s(Fo,"Yn");function nu(e,t,n){let r=null;if(e&&jr(e)){const i=Fo(e,t);i&&(r=i);const o=Jf(e,t,n);o&&(r=o)}else r=We("MISSING_OR_INVALID",`${t}, ${n} should be an object with data`);return r}s(nu,"eu");function Ho(e,t){let n=null;if(e&&jr(e)){const r=Fo(e,t);r&&(n=r);const i=eu(e,t);i&&(n=i)}else n=We("MISSING_OR_INVALID",`${t}, namespaces should be an object with data`);return n}s(Ho,"Ns");function Mo(e){return Ve(e.protocol,!0)}s(Mo,"Us");function ru(e,t){let n=!1;return t&&!e?n=!0:e&&Mn(e)&&e.length&&e.forEach(r=>{n=Mo(r)}),n}s(ru,"nu");function su(e){return typeof e=="number"}s(su,"ru");function iu(e){return typeof e<"u"&&typeof e!==null}s(iu,"ou");function ou(e){return!(!e||typeof e!="object"||!e.code||!Xs(e.code,!1)||!e.message||!Ve(e.message,!1))}s(ou,"su");function cu(e){return!(jt(e)||!Ve(e.method,!1))}s(cu,"iu");function au(e){return!(jt(e)||jt(e.result)&&jt(e.error)||!Xs(e.id,!1)||!Ve(e.jsonrpc,!1))}s(au,"cu");function fu(e){return!(jt(e)||!Ve(e.name,!1))}s(fu,"fu");function uu(e,t){return!(!Ur(t)||!Lo(e).includes(t))}s(uu,"au");function lu(e,t,n){return Ve(n,!1)?Hf(e,t).includes(n):!1}s(lu,"uu");function hu(e,t,n){return Ve(n,!1)?Mf(e,t).includes(n):!1}s(hu,"lu");function Ko(e,t,n){let r=null;const i=du(e),o=pu(t),c=Object.keys(i),f=Object.keys(o),h=Vo(Object.keys(e)),g=Vo(Object.keys(t)),p=h.filter(m=>!g.includes(m));return p.length&&(r=We("NON_CONFORMING_NAMESPACES",`${n} namespaces keys don't satisfy requiredNamespaces. 5 Required: ${p.toString()} 6 Received: ${Object.keys(t).toString()}`)),ut(c,f)||(r=We("NON_CONFORMING_NAMESPACES",`${n} namespaces chains don't satisfy required namespaces. 7 Required: ${c.toString()} 8 Approved: ${f.toString()}`)),Object.keys(t).forEach(m=>{if(!m.includes(":")||r)return;const d=un(t[m].accounts);d.includes(m)||(r=We("NON_CONFORMING_NAMESPACES",`${n} namespaces accounts don't satisfy namespace accounts for ${m} 9 Required: ${m} 10 Approved: ${d.toString()}`))}),c.forEach(m=>{r||(ut(i[m].methods,o[m].methods)?ut(i[m].events,o[m].events)||(r=We("NON_CONFORMING_NAMESPACES",`${n} namespaces events don't satisfy namespace events for ${m}`)):r=We("NON_CONFORMING_NAMESPACES",`${n} namespaces methods don't satisfy namespace methods for ${m}`))}),r}s(Ko,"_s");function du(e){const t={};return Object.keys(e).forEach(n=>{var r;n.includes(":")?t[n]=e[n]:(r=e[n].chains)==null||r.forEach(i=>{t[i]={methods:e[n].methods,events:e[n].events}})}),t}s(du,"du");function Vo(e){return[...new Set(e.map(t=>t.includes(":")?t.split(":")[0]:t))]}s(Vo,"Rs");function pu(e){const t={};return Object.keys(e).forEach(n=>{n.includes(":")?t[n]=e[n]:un(e[n].accounts)?.forEach(i=>{t[i]={accounts:e[n].accounts.filter(o=>o.includes(`${i}:`)),methods:e[n].methods,events:e[n].events}})}),t}s(pu,"hu");function gu(e,t){return Xs(e,!1)&&e<=t.max&&e>=t.min}s(gu,"pu");function yu(){const e=yt();return new Promise(t=>{switch(e){case ye.browser:t(mu());break;case ye.reactNative:t(wu());break;case ye.node:t(bu());break;default:t(!0)}})}s(yu,"gu");function mu(){return ft()&&navigator?.onLine}s(mu,"$s");async function wu(){return Je()&&typeof k.g<"u"&&k.g!=null&&k.g.NetInfo?(await(k.g==null?void 0:k.g.NetInfo.fetch()))?.isConnected:!0}s(wu,"Ts");function bu(){return!0}s(bu,"Cs");function vu(e){switch(yt()){case ye.browser:Eu(e);break;case ye.reactNative:Ou(e);break;case ye.node:break}}s(vu,"bu");function Eu(e){!Je()&&ft()&&(window.addEventListener("online",()=>e(!0)),window.addEventListener("offline",()=>e(!1)))}s(Eu,"js");function Ou(e){Je()&&typeof k.g<"u"&&k.g!=null&&k.g.NetInfo&&k.g?.NetInfo.addEventListener(t=>e(t?.isConnected))}s(Ou,"Ls");function Iu(){var e;return ft()&&(0,ge.getDocument)()?((e=(0,ge.getDocument)())==null?void 0:e.visibilityState)==="visible":!0}s(Iu,"yu");const Js={},pi=class pi{static get(t){return Js[t]}static set(t,n){Js[t]=n}static delete(t){delete Js[t]}};s(pi,"mu");let Qs=pi;function xu(e){const t=qe.tw.decode(e);if(t.length<33)throw new Error("Too short to contain a public key");return t.slice(1,33)}s(xu,"ks");function Pu({publicKey:e,signature:t,payload:n}){var r;const i=ei(n.method),o=128|parseInt(((r=n.version)==null?void 0:r.toString())||"4"),c=Su(n.address),f=n.era==="00"?new Uint8Array([0]):ei(n.era);if(f.length!==1&&f.length!==2)throw new Error("Invalid era length");const h=parseInt(n.nonce,16),g=new Uint8Array([h&255,h>>8&255]),p=BigInt(`0x${Bu(n.tip)}`),m=Uu(p),d=new Uint8Array([0,...e,c,...t,...f,...g,...m,...i]),w=ju(d.length+1);return new Uint8Array([...w,o,...d])}s(Pu,"Ps");function Au(e){const t=ei(e),n=(0,_n.blake2b)(t,void 0,32);return"0x"+Z.from(n).toString("hex")}s(Au,"Hs");function ei(e){return new Uint8Array(e.replace(/^0x/,"").match(/.{1,2}/g).map(t=>
10parseInt(t,16)))}s(ei,"Wn");function Bu(e){return e.startsWith("0x")?e.slice(2):e}s(Bu,"wu");function Su(e){const t=qe.tw.decode(e)[0];return t===42?0:t===60?2:1}s(Su,"vu");function ju(e){if(e<64)return new Uint8Array([e<<2]);if(e<16384){const t=e<<2|1;return new Uint8Array([t&255,t>>8&255])}else if(e<1<<30){const t=e<<2|2;return new Uint8Array([t&255,t>>8&255,t>>16&255,t>>24&255])}else throw new Error("Compact encoding > 2^30 not supported")}s(ju,"xu");function Uu(e){if(e<BigInt(1)<<BigInt(6))return new Uint8Array([Number(e<<BigInt(2))]);if(e<BigInt(1)<<BigInt(14)){const t=e<<BigInt(2)|BigInt(1);return new Uint8Array([Number(t&BigInt(255)),Number(t>>BigInt(8)&BigInt(255))])}else if(e<BigInt(1)<<BigInt(30)){const t=e<<BigInt(2)|BigInt(2);return new Uint8Array([Number(t&BigInt(255)),Number(t>>BigInt(8)&BigInt(255)),Number(t>>BigInt(16)&BigInt(255)),Number(t>>BigInt(24)&BigInt(255))])}else throw new Error("BigInt compact encoding not supported > 2^30")}s(Uu,"Eu");function Nu(e){const t=Uint8Array.from(Z.from(e.signature,"hex")),n=xu(e.transaction.address),r=Pu({publicKey:n,signature:t,payload:e.transaction}),i=Z.from(r).toString("hex");return Au(i)}s(Nu,"Bu");function Cu({logger:e,name:t}){const n=typeof e=="string"?(0,Ae.D5)({opts:{level:e,name:t}}).logger:e;return n.level=typeof e=="string"?e:e.level,n}s(Cu,"Iu")}}]);})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.