@wormhole-foundation/wormhole-connect 1.1.4-beta.1-development → 1.1.4-beta.2-development
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{algorand-CL9E7qV4.js → algorand-CyJRjYjt.js} +2 -2
- package/dist/assets/{aptos-CYfJ6QKV.js → aptos-k14Q8oIC.js} +2 -2
- package/dist/assets/{ccip-Cfs6IR2H.js → ccip-BNTHR_fq.js} +1 -1
- package/dist/assets/{cosmwasm-B8f9g9-e.js → cosmwasm-Bb55TeV-.js} +3 -3
- package/dist/assets/{evm-BeHPA-N8.js → evm-BxXdWj24.js} +5 -5
- package/dist/assets/{evm-DsaBFKKm.js → evm-C-buBtRY.js} +2 -2
- package/dist/assets/{index-DzWKLl_i.js → index-BAmVCbB-.js} +1 -1
- package/dist/assets/{index-C0jKBHol.js → index-BEc0YFBn.js} +1 -1
- package/dist/assets/{index-DW2PHjzW.js → index-BLMTT3rM.js} +1 -1
- package/dist/assets/{index-CVz7Lfsa.js → index-BY0kgWx8.js} +1 -1
- package/dist/assets/{index-BtIDaBGl.js → index-BfDApobA.js} +1 -1
- package/dist/assets/{index-Cka3pqB6.js → index-BwBQHmYt.js} +1 -1
- package/dist/assets/{index-B1Zd6Tbj.js → index-C0psfra-.js} +1 -1
- package/dist/assets/{index-Dmt4H-sz.js → index-C2FPBPlV.js} +1 -1
- package/dist/assets/{index-DyOk_vKo.js → index-C3Sky6pw.js} +1 -1
- package/dist/assets/{index-DEXJQ6UW.js → index-C87qdc5P.js} +1 -1
- package/dist/assets/{index-QCp2fK6U.js → index-D2LZykJf.js} +2 -2
- package/dist/assets/{index-DSNr6Aeg.js → index-DoWu6bTw.js} +1 -1
- package/dist/assets/{index-DkQt9fOR.js → index-Dqm3REGN.js} +1 -1
- package/dist/assets/{index-BQIi8F3e.js → index-FQGd6qGV.js} +1 -1
- package/dist/assets/{index-QJ2zlRk3.js → index-IlqLhD3I.js} +1 -1
- package/dist/assets/{index-q0W2SHor.js → index-YIP9QK2L.js} +1 -1
- package/dist/assets/{index-TrUYBc0F.js → index-nosdUF9i.js} +1 -1
- package/dist/assets/{index-CFYbGyvs.js → index-xo-ROtuF.js} +1 -1
- package/dist/assets/{index-CZCNUCD6.js → index-yAX3aWkW.js} +1 -1
- package/dist/assets/{index.es-xWGpyzms.js → index.es--WISYjTj.js} +3 -3
- package/dist/assets/{keccak-Dh1-j093.js → keccak-DYzglTc3.js} +1 -1
- package/dist/assets/{solana-FuO6ds45.js → solana-BmGIyTEt.js} +2 -2
- package/dist/assets/{solana-HXT1gH4s.js → solana-D5RkygmT.js} +2 -2
- package/dist/assets/{solanaEmbed.esm-CmWxi_NO.js → solanaEmbed.esm-CFdxIRQj.js} +1 -1
- package/dist/assets/{sui-CQYR74Ws.js → sui-CW05lm4n.js} +2 -2
- package/dist/assets/{unsignedTransaction-YIv7ff3U.js → unsignedTransaction-DAYPmfUj.js} +1 -1
- package/dist/main.js +69 -69
- package/lib/{algorand-DMWnCGDD.js → algorand-B9Pcx34H.js} +1 -1
- package/lib/{algorand-CKeviXZg.mjs → algorand-BfdC8LMm.mjs} +3 -3
- package/lib/{aptos-LGyhejg2.mjs → aptos-CuQYjxz4.mjs} +1 -1
- package/lib/{aptos-DBFfVz6j.js → aptos-D8msRZYc.js} +1 -1
- package/lib/{aptos-DNei2Fw9.mjs → aptos-DISEuAM4.mjs} +3 -3
- package/lib/{aptos-CAJat9Bn.js → aptos-DlboPucS.js} +2 -2
- package/lib/{ccip-E64BZKbj.js → ccip-BqkngZ6V.js} +1 -1
- package/lib/{ccip-gtLK9yzS.mjs → ccip-DV1T5CQz.mjs} +1 -1
- package/lib/{cosmwasm-CnK43h4P.mjs → cosmwasm-BFPK6deV.mjs} +111 -7
- package/lib/{cosmwasm-CmkeZSLD.js → cosmwasm-D3ZKcsjq.js} +2 -2
- package/lib/{events-dBi7i6gd.mjs → events-CaIL5tL1.mjs} +1 -1
- package/lib/{events-D5Nem7a2.js → events-Cxw8aBUy.js} +1 -1
- package/lib/{evm-DyPy8X4q.mjs → evm-7idwo4la.mjs} +5 -5
- package/lib/{evm-Bsq-lyhx.mjs → evm-D11YbeC_.mjs} +7 -7
- package/lib/{evm-BEkpevR1.js → evm-D12EHZXD.js} +4 -4
- package/lib/{evm-JR5REYuq.js → evm-UrRoO3lT.js} +1 -1
- package/lib/{index-DWFG3ux-.js → index-B-m7_r9W.js} +1 -1
- package/lib/{index-BZTaoymt.mjs → index-BEfsEC8g.mjs} +3 -3
- package/lib/{index-Cc_mraT5.mjs → index-BKeG3u48.mjs} +2 -2
- package/lib/{index-FW1hHPsY.js → index-BMLK3kVY.js} +1 -1
- package/lib/{index-CrVV6hQ2.js → index-BMsGsrRe.js} +1 -1
- package/lib/{index-xr-_5YwS.mjs → index-BPD6tZ5I.mjs} +7575 -5146
- package/lib/{index-CL3ekJSh.js → index-BQI2oZiv.js} +1 -1
- package/lib/{index-CeksQZJ0.mjs → index-BUGIe9Q0.mjs} +4 -4
- package/lib/{index-CvX8wxOG.mjs → index-BkUc_QzZ.mjs} +2 -2
- package/lib/{index-DE7BjSqw.js → index-Br_1eyUd.js} +1 -1
- package/lib/{index-C8MkGmi-.mjs → index-C1KUJpQh.mjs} +1 -1
- package/lib/{index-B_wAMidq.js → index-C6ww0FoG.js} +1 -1
- package/lib/{index-YigUyjDr.mjs → index-CBnSdTOm.mjs} +1 -1
- package/lib/{index-DD4g5WJB.mjs → index-CDGkVXf1.mjs} +2 -2
- package/lib/{index-D5un17aL.mjs → index-CG2dc9k1.mjs} +13 -13
- package/lib/{index-CsYGJh8i.js → index-CGqBKzB5.js} +1 -1
- package/lib/{index-TidzojcT.js → index-CHGr1Xo0.js} +1 -1
- package/lib/{index-BHnHO_u8.js → index-CJ8hOjdz.js} +1 -1
- package/lib/{index-BlRWSvuT.js → index-COW9BRyV.js} +1 -1
- package/lib/{index-jnHYrj-0.mjs → index-CeK6G0Jr.mjs} +2 -2
- package/lib/{index-u9NHndtJ.mjs → index-Cfupv0rQ.mjs} +4 -4
- package/lib/{index-C-MpEmke.mjs → index-Cg19mcso.mjs} +1 -1
- package/lib/{index-DhJzyV8c.js → index-Cg6LDJti.js} +1 -1
- package/lib/{index-Cwf7_SpM.js → index-CkHXWtPG.js} +1 -1
- package/lib/{index-B9YINx-j.mjs → index-ClI_55nW.mjs} +7 -7
- package/lib/{index-BSXkcZeB.mjs → index-ClbyJuae.mjs} +2 -2
- package/lib/{index-DRTJX6NI.mjs → index-Cs8OaRdq.mjs} +2 -2
- package/lib/{index-B6Yxe_gd.mjs → index-D4FfgE9k.mjs} +2 -2
- package/lib/{index-PebPsVgf.js → index-D9Ezmk4f.js} +1 -1
- package/lib/{index-BIhEJqD8.js → index-DgKyQSTc.js} +1 -1
- package/lib/{index-BxaWYSOO.js → index-Dh6mkRtz.js} +74 -74
- package/lib/{index-w88sWpdI.js → index-DjZ438HP.js} +1 -1
- package/lib/{index-DSJ41rGf.mjs → index-DlXF_HRr.mjs} +2 -2
- package/lib/{index-DRDlsqLC.js → index-DsMw6BFg.js} +1 -1
- package/lib/{index-CtuM0Nhj.mjs → index-GKdJmpc9.mjs} +2 -2
- package/lib/{index-CAOx_2w0.mjs → index-IwSEAKjs.mjs} +3 -3
- package/lib/{index-CvLvO-ub.mjs → index-VO5jvtPN.mjs} +1 -1
- package/lib/{index-fpX08H1Q.js → index-Vouac_sN.js} +1 -1
- package/lib/{index-snvFYwLU.mjs → index-f6MztC_k.mjs} +2 -2
- package/lib/{index-BrZMeh8Y.js → index-hb33T1qT.js} +1 -1
- package/lib/{index-D9LNItFN.js → index-s_6sncui.js} +1 -1
- package/lib/{index-CN4S3GOd.mjs → index-vmVyLCAM.mjs} +3 -3
- package/lib/{index-CLImffCI.js → index-xTifobUX.js} +1 -1
- package/lib/{index-Brws-ttZ.js → index-yYbCizsj.js} +1 -1
- package/lib/{index.es-BgIY-CJP.mjs → index.es-Bld6bvmZ.mjs} +5 -5
- package/lib/{index.es-DA6xjT-p.js → index.es-DWCjm6mS.js} +2 -2
- package/lib/index.js +1 -1
- package/lib/index.mjs +1 -1
- package/lib/{keccak-D3kXYcOs.mjs → keccak-BwFcIiaM.mjs} +1 -1
- package/lib/{keccak-xKB7Kino.js → keccak-C8mX3bFz.js} +1 -1
- package/lib/{pbkdf2-DCnqfxZR.js → pbkdf2-Bk-3RPXm.js} +1 -1
- package/lib/{pbkdf2-Dg0HWbq4.mjs → pbkdf2-CeHVjwwG.mjs} +1 -1
- package/lib/{signer-DIzVzPl8.mjs → signer-DXNU3KLz.mjs} +1 -1
- package/lib/{signer-CbcYYMJ7.js → signer-LadskxdY.js} +1 -1
- package/lib/solana-B15fGx9S.js +1 -0
- package/lib/{solana-BVgObkcE.mjs → solana-BasjNE9K.mjs} +4 -4
- package/lib/{solana-DmCHygOA.js → solana-C9iEiCkx.js} +1 -1
- package/lib/{solana-HKO9jNRD.mjs → solana-CfCGAR-_.mjs} +5 -5
- package/lib/{solanaEmbed.esm-DqNfqaxI.js → solanaEmbed.esm-CJdWWBYT.js} +1 -1
- package/lib/{solanaEmbed.esm-DEAHXGVn.mjs → solanaEmbed.esm-pwzJ8Zc0.mjs} +3 -3
- package/lib/{sui-DN8E0m68.mjs → sui-B9B-EQyp.mjs} +4 -4
- package/lib/{sui-BDoIBdRb.js → sui-BJBxQjSI.js} +2 -2
- package/lib/{sui-Bp2zLhA_.mjs → sui-HC466JTC.mjs} +1 -1
- package/lib/{sui-W_WW-YXK.js → sui-iJeaGeqF.js} +1 -1
- package/lib/{unsignedTransaction-Dkfjd5_o.js → unsignedTransaction-CmgkSLIX.js} +1 -1
- package/lib/unsignedTransaction-Di5zQIK0.mjs +35 -0
- package/package.json +3 -3
- package/lib/solana-BYXqKgjy.js +0 -1
- package/lib/unsignedTransaction-C32EJDkZ.mjs +0 -35
|
@@ -1 +1 @@
|
|
|
1
|
-
var h=Object.defineProperty;var m=(i,e,t)=>e in i?h(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var o=(i,e,t)=>m(i,typeof e!="symbol"?e+"":e,t);import{
|
|
1
|
+
var h=Object.defineProperty;var m=(i,e,t)=>e in i?h(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var o=(i,e,t)=>m(i,typeof e!="symbol"?e+"":e,t);import{b2 as w,ci as g,cT as p,ad as u,c1 as l}from"../main.js";import{A as f}from"./aptos-k14Q8oIC.js";class c{constructor(e,t,r,s){o(this,"network");o(this,"chain");o(this,"connection");o(this,"contracts");o(this,"chainId");o(this,"coreBridge");this.network=e,this.chain=t,this.connection=r,this.contracts=s,this.chainId=w(t);const n=s.coreBridge;if(!n)throw new Error(`CoreBridge contract Address for chain ${t} not found`);this.coreBridge=n}getGuardianSet(e){throw new Error("Method not implemented.")}getGuardianSetIndex(){throw new Error("Method not implemented.")}getMessageFee(){throw new Error("Method not implemented.")}static async fromRpc(e,t){const[r,s]=await f.chainFromRpc(e),n=t[s];if(n.network!==r)throw new Error(`Network mismatch: ${n.network} !== ${r}`);return new c(r,s,e,n.contracts)}async*publishMessage(e,t){throw new Error("Method not implemented.")}async*verifyMessage(e,t){throw new Error("Not implemented.")}async parseTransaction(e){return(await this.parseMessages(e)).map(r=>({chain:r.emitterChain,emitter:r.emitterAddress,sequence:r.sequence}))}async parseMessages(e){const t=await this.connection.getTransactionByHash(e);if(t.type!=="user_transaction")throw new Error(`${e} is not a user_transaction`);const s=t.events.filter(n=>n.type.endsWith("WormholeMessage"));if(!s||s.length===0)throw new Error(`WormholeMessage not found for ${e}`);return s.map(n=>{const a=n.data,d=new g(BigInt(a.sender).toString(16).padStart(64,"0"));return p("Uint8Array",{guardianSet:0,emitterChain:this.chain,emitterAddress:d,sequence:BigInt(a.sequence),timestamp:Number(a.timestamp),consistencyLevel:a.consistency_level,nonce:Number(a.nonce),signatures:[],payload:u.decode(a.payload)})})}}l("Aptos","WormholeCore",c);export{c as AptosWormholeCore};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{aW as td,i as H,O as th,U as rd,s as rh,P as id,T as nd}from"../main.js";import{d as sd}from"./dijkstra-D_NXgYpA.js";import{e as cr,a as ih}from"./events-C1UiYlrP.js";import{c as U,s as zn,x as nh,r as Kn,H as od,a as sh,q as Nn}from"./index-DyOk_vKo.js";import{r as ad,a as Hr,g as Wr,i as Ot,b as jn,I as Xr,f as Nt,t as gt,c as ms,x as Ws,C as cd,d as hd,E as ht,y as _t,k as mo,A as ld,h as ud,e as ea,j as dd,s as fd,q as oh,l as pd,m as yo,n as vo,o as ah,p as Zt,u as si}from"./index-Cka3pqB6.js";let gd=class extends ad{constructor(e){super(e),this.events=new cr.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(Hr(e.method,e.params||[],e.id||Wr().toString()),r)}async requestStrict(e,r){return new Promise(async(i,n)=>{if(!this.connection.connected)try{await this.open()}catch(s){n(s)}this.events.on(`${e.id}`,s=>{Ot(s)?n(s.error):i(s.result)});try{await this.connection.send(e,r)}catch(s){n(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),jn(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}};var md=function(){var t=document.getSelection();if(!t.rangeCount)return function(){};for(var e=document.activeElement,r=[],i=0;i<t.rangeCount;i++)r.push(t.getRangeAt(i));switch(e.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":e.blur();break;default:e=null;break}return t.removeAllRanges(),function(){t.type==="Caret"&&t.removeAllRanges(),t.rangeCount||r.forEach(function(n){t.addRange(n)}),e&&e.focus()}},yd=md,ta={"text/plain":"Text","text/html":"Url",default:"Text"},vd="Copy to clipboard: #{key}, Enter";function wd(t){var e=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return t.replace(/#{\s*key\s*}/g,e)}function _d(t,e){var r,i,n,s,o,a,h=!1;e||(e={}),r=e.debug||!1;try{n=yd(),s=document.createRange(),o=document.getSelection(),a=document.createElement("span"),a.textContent=t,a.ariaHidden="true",a.style.all="unset",a.style.position="fixed",a.style.top=0,a.style.clip="rect(0, 0, 0, 0)",a.style.whiteSpace="pre",a.style.webkitUserSelect="text",a.style.MozUserSelect="text",a.style.msUserSelect="text",a.style.userSelect="text",a.addEventListener("copy",function(f){if(f.stopPropagation(),e.format)if(f.preventDefault(),typeof f.clipboardData>"u"){r&&console.warn("unable to use e.clipboardData"),r&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var m=ta[e.format]||ta.default;window.clipboardData.setData(m,t)}else f.clipboardData.clearData(),f.clipboardData.setData(e.format,t);e.onCopy&&(f.preventDefault(),e.onCopy(f.clipboardData))}),document.body.appendChild(a),s.selectNodeContents(a),o.addRange(s);var u=document.execCommand("copy");if(!u)throw new Error("copy command was unsuccessful");h=!0}catch(f){r&&console.error("unable to copy using execCommand: ",f),r&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(e.format||"text",t),e.onCopy&&e.onCopy(window.clipboardData),h=!0}catch(m){r&&console.error("unable to copy using clipboardData: ",m),r&&console.error("falling back to prompt"),i=wd("message"in e?e.message:vd),window.prompt(i,t)}}finally{o&&(typeof o.removeRange=="function"?o.removeRange(s):o.removeAllRanges()),a&&document.body.removeChild(a),n()}return h}var bd=_d,Ad={}.toString,wo=Array.isArray||function(t){return Ad.call(t)=="[object Array]"},Ed=td(),_o={},he={};Object.defineProperty(he,"__esModule",{value:!0});var ch=he.getLocalStorage=wh=he.getLocalStorageOrThrow=vh=he.getCrypto=yh=he.getCryptoOrThrow=mh=he.getLocation=gh=he.getLocationOrThrow=ph=he.getNavigator=fh=he.getNavigatorOrThrow=dh=he.getDocument=uh=he.getDocumentOrThrow=lh=he.getFromWindowOrThrow=hh=he.getFromWindow=void 0;function Zr(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}var hh=he.getFromWindow=Zr;function bi(t){const e=Zr(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}var lh=he.getFromWindowOrThrow=bi;function Sd(){return bi("document")}var uh=he.getDocumentOrThrow=Sd;function Id(){return Zr("document")}var dh=he.getDocument=Id;function Md(){return bi("navigator")}var fh=he.getNavigatorOrThrow=Md;function xd(){return Zr("navigator")}var ph=he.getNavigator=xd;function Nd(){return bi("location")}var gh=he.getLocationOrThrow=Nd;function Cd(){return Zr("location")}var mh=he.getLocation=Cd;function Td(){return bi("crypto")}var yh=he.getCryptoOrThrow=Td;function Rd(){return Zr("crypto")}var vh=he.getCrypto=Rd;function Pd(){return bi("localStorage")}var wh=he.getLocalStorageOrThrow=Pd;function Od(){return Zr("localStorage")}ch=he.getLocalStorage=Od;Object.defineProperty(_o,"__esModule",{value:!0});var _h=_o.getWindowMetadata=void 0;const ra=he;function kd(){let t,e;try{t=ra.getDocumentOrThrow(),e=ra.getLocationOrThrow()}catch{return null}function r(){const m=t.getElementsByTagName("link"),b=[];for(let v=0;v<m.length;v++){const E=m[v],x=E.getAttribute("rel");if(x&&x.toLowerCase().indexOf("icon")>-1){const S=E.getAttribute("href");if(S)if(S.toLowerCase().indexOf("https:")===-1&&S.toLowerCase().indexOf("http:")===-1&&S.indexOf("//")!==0){let N=e.protocol+"//"+e.host;if(S.indexOf("/")===0)N+=S;else{const T=e.pathname.split("/");T.pop();const P=T.join("/");N+=P+"/"+S}b.push(N)}else if(S.indexOf("//")===0){const N=e.protocol+S;b.push(N)}else b.push(S)}}return b}function i(...m){const b=t.getElementsByTagName("meta");for(let v=0;v<b.length;v++){const E=b[v],x=["itemprop","property","name"].map(S=>E.getAttribute(S)).filter(S=>S?m.includes(S):!1);if(x.length&&x){const S=E.getAttribute("content");if(S)return S}}return""}function n(){let m=i("name","og:site_name","og:title","twitter:title");return m||(m=t.title),m}function s(){return i("description","og:description","twitter:description","keywords")}const o=n(),a=s(),h=e.origin,u=r();return{description:a,url:h,icons:u,name:o}}_h=_o.getWindowMetadata=kd;var Bd=function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var i=Array(t),n=0,e=0;e<r;e++)for(var s=arguments[e],o=0,a=s.length;o<a;o++,n++)i[n]=s[o];return i},Dd=function(){function t(e,r,i){this.name=e,this.version=r,this.os=i,this.type="browser"}return t}(),Fd=function(){function t(e){this.version=e,this.type="node",this.name="node",this.os=H.process.platform}return t}(),Ld=function(){function t(e,r,i,n){this.name=e,this.version=r,this.os=i,this.bot=n,this.type="bot-device"}return t}(),qd=function(){function t(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return t}(),Ud=function(){function t(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return t}(),$d=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,zd=/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,ia=3,Kd=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FBAV\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["searchbot",$d]],na=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function jd(t){return t?sa(t):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new Ud:typeof navigator<"u"?sa(navigator.userAgent):Wd()}function Vd(t){return t!==""&&Kd.reduce(function(e,r){var i=r[0],n=r[1];if(e)return e;var s=n.exec(t);return!!s&&[i,s]},!1)}function sa(t){var e=Vd(t);if(!e)return null;var r=e[0],i=e[1];if(r==="searchbot")return new qd;var n=i[1]&&i[1].split(/[._]/).slice(0,3);n?n.length<ia&&(n=Bd(n,Qd(ia-n.length))):n=[];var s=n.join("."),o=Hd(t),a=zd.exec(t);return a&&a[1]?new Ld(r,s,o,a[1]):new Dd(r,s,o)}function Hd(t){for(var e=0,r=na.length;e<r;e++){var i=na[e],n=i[0],s=i[1],o=s.exec(t);if(o)return n}return null}function Wd(){var t=typeof H.process<"u"&&H.process.version;return t?new Fd(H.process.version.slice(1)):null}function Qd(t){for(var e=[],r=0;r<t;r++)e.push("0");return e}function bo(t){return jd(t)}function Vn(){const t=bo();return t&&t.os?t.os:void 0}function bh(){const t=Vn();return t?t.toLowerCase().includes("android"):!1}function Ah(){const t=Vn();return t?t.toLowerCase().includes("ios")||t.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1:!1}function Gd(){return Vn()?bh()||Ah():!1}function Eh(){const t=bo();return t&&t.name?t.name.toLowerCase()==="node":!1}function Jd(){return!Eh()&&!!Sh()}const Yd=hh,Xd=lh,Zd=uh,ef=dh,tf=fh,Sh=ph,rf=gh,nf=mh,sf=yh,of=vh,af=wh,Hn=ch;function cf(){return _h()}function hf(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return JSON.parse(t)}catch{return t}}function lf(t){return typeof t=="string"?t:JSON.stringify(t)}const Ih=hf,Mh=lf;function xh(t,e){const r=Mh(e),i=Hn();i&&i.setItem(t,r)}function uf(t){let e=null,r=null;const i=Hn();return i&&(r=i.getItem(t)),e=r&&Ih(r),e}function df(t){const e=Hn();e&&e.removeItem(t)}const Nh="WALLETCONNECT_DEEPLINK_CHOICE";function ff(t,e){const r=encodeURIComponent(t);return e.universalLink?`${e.universalLink}/wc?uri=${r}`:e.deepLink?`${e.deepLink}${e.deepLink.endsWith(":")?"//":"/"}wc?uri=${r}`:""}function pf(t){const e=t.href.split("?")[0];xh(Nh,Object.assign(Object.assign({},t),{href:e}))}function Ch(t,e){return t.filter(r=>r.name.toLowerCase().includes(e.toLowerCase()))[0]}function gf(t,e){let r=t;return e&&(r=e.map(i=>Ch(t,i)).filter(Boolean)),r}const Th="https://registry.walletconnect.com";function mf(){return Th+"/api/v2/wallets"}function yf(){return Th+"/api/v2/dapps"}function Rh(t,e="mobile"){var r;return{name:t.name||"",shortName:t.metadata.shortName||"",color:t.metadata.colors.primary||"",logo:(r=t.image_url.sm)!==null&&r!==void 0?r:"",universalLink:t[e].universal||"",deepLink:t[e].native||""}}function vf(t,e="mobile"){return Object.values(t).filter(r=>!!r[e].universal||!!r[e].native).map(r=>Rh(r,e))}const wf=Object.freeze(Object.defineProperty({__proto__:null,detectEnv:bo,detectOS:Vn,formatIOSMobile:ff,formatMobileRegistry:vf,formatMobileRegistryEntry:Rh,getClientMeta:cf,getCrypto:of,getCryptoOrThrow:sf,getDappRegistryUrl:yf,getDocument:ef,getDocumentOrThrow:Zd,getFromWindow:Yd,getFromWindowOrThrow:Xd,getLocal:uf,getLocalStorage:Hn,getLocalStorageOrThrow:af,getLocation:nf,getLocationOrThrow:rf,getMobileLinkRegistry:gf,getMobileRegistryEntry:Ch,getNavigator:Sh,getNavigatorOrThrow:tf,getWalletRegistryUrl:mf,isAndroid:bh,isBrowser:Jd,isIOS:Ah,isMobile:Gd,isNode:Eh,mobileLinkChoiceKey:Nh,removeLocal:df,safeJsonParse:Ih,safeJsonStringify:Mh,saveMobileLinkInfo:pf,setLocal:xh},Symbol.toStringTag,{value:"Module"})),_f=th(wf);var rn={},bf=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},Ph={},Sr={},Af=wo;function Ef(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},t.foo()===42}catch{return!1}}ie.TYPED_ARRAY_SUPPORT=Ef();var oa=ie.TYPED_ARRAY_SUPPORT?2147483647:1073741823;function ie(t,e,r){return!ie.TYPED_ARRAY_SUPPORT&&!(this instanceof ie)?new ie(t,e,r):typeof t=="number"?Oh(this,t):Tf(this,t,e,r)}ie.TYPED_ARRAY_SUPPORT&&(ie.prototype.__proto__=Uint8Array.prototype,ie.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&ie[Symbol.species]===ie&&Object.defineProperty(ie,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}));function Ao(t){if(t>=oa)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+oa.toString(16)+" bytes");return t|0}function Sf(t){return t!==t}function di(t,e){var r;return ie.TYPED_ARRAY_SUPPORT?(r=new Uint8Array(e),r.__proto__=ie.prototype):(r=t,r===null&&(r=new ie(e)),r.length=e),r}function Oh(t,e){var r=di(t,e<0?0:Ao(e)|0);if(!ie.TYPED_ARRAY_SUPPORT)for(var i=0;i<e;++i)r[i]=0;return r}function If(t,e){var r=Bh(e)|0,i=di(t,r),n=i.write(e);return n!==r&&(i=i.slice(0,n)),i}function Qs(t,e){for(var r=e.length<0?0:Ao(e.length)|0,i=di(t,r),n=0;n<r;n+=1)i[n]=e[n]&255;return i}function Mf(t,e,r,i){if(r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(i||0))throw new RangeError("'length' is out of bounds");var n;return r===void 0&&i===void 0?n=new Uint8Array(e):i===void 0?n=new Uint8Array(e,r):n=new Uint8Array(e,r,i),ie.TYPED_ARRAY_SUPPORT?n.__proto__=ie.prototype:n=Qs(t,n),n}function xf(t,e){if(ie.isBuffer(e)){var r=Ao(e.length)|0,i=di(t,r);return i.length===0||e.copy(i,0,0,r),i}if(e){if(typeof ArrayBuffer<"u"&&e.buffer instanceof ArrayBuffer||"length"in e)return typeof e.length!="number"||Sf(e.length)?di(t,0):Qs(t,e);if(e.type==="Buffer"&&Array.isArray(e.data))return Qs(t,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function kh(t,e){e=e||1/0;for(var r,i=t.length,n=null,s=[],o=0;o<i;++o){if(r=t.charCodeAt(o),r>55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===i){(e-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),n=r;continue}r=(n-55296<<10|r-56320)+65536}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function Bh(t){if(ie.isBuffer(t))return t.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;typeof t!="string"&&(t=""+t);var e=t.length;return e===0?0:kh(t).length}function Nf(t,e,r,i){for(var n=0;n<i&&!(n+r>=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function Cf(t,e,r,i){return Nf(kh(e,t.length-r),t,r,i)}function Tf(t,e,r,i){if(typeof e=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer?Mf(t,e,r,i):typeof e=="string"?If(t,e):xf(t,e)}ie.prototype.write=function(e,r,i){r===void 0?(i=this.length,r=0):i===void 0&&typeof r=="string"?(i=this.length,r=0):isFinite(r)&&(r=r|0,isFinite(i)?i=i|0:i=void 0);var n=this.length-r;if((i===void 0||i>n)&&(i=n),e.length>0&&(i<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");return Cf(this,e,r,i)};ie.prototype.slice=function(e,r){var i=this.length;e=~~e,r=r===void 0?i:~~r,e<0?(e+=i,e<0&&(e=0)):e>i&&(e=i),r<0?(r+=i,r<0&&(r=0)):r>i&&(r=i),r<e&&(r=e);var n;if(ie.TYPED_ARRAY_SUPPORT)n=this.subarray(e,r),n.__proto__=ie.prototype;else{var s=r-e;n=new ie(s,void 0);for(var o=0;o<s;++o)n[o]=this[o+e]}return n};ie.prototype.copy=function(e,r,i,n){if(i||(i=0),!n&&n!==0&&(n=this.length),r>=e.length&&(r=e.length),r||(r=0),n>0&&n<i&&(n=i),n===i||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-r<n-i&&(n=e.length-r+i);var s=n-i,o;if(this===e&&i<r&&r<n)for(o=s-1;o>=0;--o)e[o+r]=this[o+i];else if(s<1e3||!ie.TYPED_ARRAY_SUPPORT)for(o=0;o<s;++o)e[o+r]=this[o+i];else Uint8Array.prototype.set.call(e,this.subarray(i,i+s),r);return s};ie.prototype.fill=function(e,r,i){if(typeof e=="string"){if(typeof r=="string"?(r=0,i=this.length):typeof i=="string"&&(i=this.length),e.length===1){var n=e.charCodeAt(0);n<256&&(e=n)}}else typeof e=="number"&&(e=e&255);if(r<0||this.length<r||this.length<i)throw new RangeError("Out of range index");if(i<=r)return this;r=r>>>0,i=i===void 0?this.length:i>>>0,e||(e=0);var s;if(typeof e=="number")for(s=r;s<i;++s)this[s]=e;else{var o=ie.isBuffer(e)?e:new ie(e),a=o.length;for(s=0;s<i-r;++s)this[s+r]=o[s%a]}return this};ie.concat=function(e,r){if(!Af(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return di(null,0);var i;if(r===void 0)for(r=0,i=0;i<e.length;++i)r+=e[i].length;var n=Oh(null,r),s=0;for(i=0;i<e.length;++i){var o=e[i];if(!ie.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,s),s+=o.length}return n};ie.byteLength=Bh;ie.prototype._isBuffer=!0;ie.isBuffer=function(e){return!!(e!=null&&e._isBuffer)};Sr.alloc=function(t){var e=new ie(t);return e.fill(0),e};Sr.from=function(t){return new ie(t)};var bt={},Eo,Rf=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];bt.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return e*4+17};bt.getSymbolTotalCodewords=function(e){return Rf[e]};bt.getBCHDigit=function(t){for(var e=0;t!==0;)e++,t>>>=1;return e};bt.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');Eo=e};bt.isKanjiModeEnabled=function(){return typeof Eo<"u"};bt.toSJIS=function(e){return Eo(e)};var Wn={};(function(t){t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2};function e(r){if(typeof r!="string")throw new Error("Param is not a string");var i=r.toLowerCase();switch(i){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+r)}}t.isValid=function(i){return i&&typeof i.bit<"u"&&i.bit>=0&&i.bit<4},t.from=function(i,n){if(t.isValid(i))return i;try{return e(i)}catch{return n}}})(Wn);function Dh(){this.buffer=[],this.length=0}Dh.prototype={get:function(t){var e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)===1},put:function(t,e){for(var r=0;r<e;r++)this.putBit((t>>>e-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};var Pf=Dh,aa=Sr;function nn(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=aa.alloc(t*t),this.reservedBit=aa.alloc(t*t)}nn.prototype.set=function(t,e,r,i){var n=t*this.size+e;this.data[n]=r,i&&(this.reservedBit[n]=!0)};nn.prototype.get=function(t,e){return this.data[t*this.size+e]};nn.prototype.xor=function(t,e,r){this.data[t*this.size+e]^=r};nn.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};var Of=nn,Fh={};(function(t){var e=bt.getSymbolSize;t.getRowColCoords=function(i){if(i===1)return[];for(var n=Math.floor(i/7)+2,s=e(i),o=s===145?26:Math.ceil((s-13)/(2*n-2))*2,a=[s-7],h=1;h<n-1;h++)a[h]=a[h-1]-o;return a.push(6),a.reverse()},t.getPositions=function(i){for(var n=[],s=t.getRowColCoords(i),o=s.length,a=0;a<o;a++)for(var h=0;h<o;h++)a===0&&h===0||a===0&&h===o-1||a===o-1&&h===0||n.push([s[a],s[h]]);return n}})(Fh);var Lh={},kf=bt.getSymbolSize,ca=7;Lh.getPositions=function(e){var r=kf(e);return[[0,0],[r-ca,0],[0,r-ca]]};var qh={};(function(t){t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var e={N1:3,N2:3,N3:40,N4:10};t.isValid=function(n){return n!=null&&n!==""&&!isNaN(n)&&n>=0&&n<=7},t.from=function(n){return t.isValid(n)?parseInt(n,10):void 0},t.getPenaltyN1=function(n){for(var s=n.size,o=0,a=0,h=0,u=null,f=null,m=0;m<s;m++){a=h=0,u=f=null;for(var b=0;b<s;b++){var v=n.get(m,b);v===u?a++:(a>=5&&(o+=e.N1+(a-5)),u=v,a=1),v=n.get(b,m),v===f?h++:(h>=5&&(o+=e.N1+(h-5)),f=v,h=1)}a>=5&&(o+=e.N1+(a-5)),h>=5&&(o+=e.N1+(h-5))}return o},t.getPenaltyN2=function(n){for(var s=n.size,o=0,a=0;a<s-1;a++)for(var h=0;h<s-1;h++){var u=n.get(a,h)+n.get(a,h+1)+n.get(a+1,h)+n.get(a+1,h+1);(u===4||u===0)&&o++}return o*e.N2},t.getPenaltyN3=function(n){for(var s=n.size,o=0,a=0,h=0,u=0;u<s;u++){a=h=0;for(var f=0;f<s;f++)a=a<<1&2047|n.get(u,f),f>=10&&(a===1488||a===93)&&o++,h=h<<1&2047|n.get(f,u),f>=10&&(h===1488||h===93)&&o++}return o*e.N3},t.getPenaltyN4=function(n){for(var s=0,o=n.data.length,a=0;a<o;a++)s+=n.data[a];var h=Math.abs(Math.ceil(s*100/o/5)-10);return h*e.N4};function r(i,n,s){switch(i){case t.Patterns.PATTERN000:return(n+s)%2===0;case t.Patterns.PATTERN001:return n%2===0;case t.Patterns.PATTERN010:return s%3===0;case t.Patterns.PATTERN011:return(n+s)%3===0;case t.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(s/3))%2===0;case t.Patterns.PATTERN101:return n*s%2+n*s%3===0;case t.Patterns.PATTERN110:return(n*s%2+n*s%3)%2===0;case t.Patterns.PATTERN111:return(n*s%3+(n+s)%2)%2===0;default:throw new Error("bad maskPattern:"+i)}}t.applyMask=function(n,s){for(var o=s.size,a=0;a<o;a++)for(var h=0;h<o;h++)s.isReserved(h,a)||s.xor(h,a,r(n,h,a))},t.getBestMask=function(n,s){for(var o=Object.keys(t.Patterns).length,a=0,h=1/0,u=0;u<o;u++){s(u),t.applyMask(u,n);var f=t.getPenaltyN1(n)+t.getPenaltyN2(n)+t.getPenaltyN3(n)+t.getPenaltyN4(n);t.applyMask(u,n),f<h&&(h=f,a=u)}return a}})(qh);var Qn={},br=Wn,fn=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],pn=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];Qn.getBlocksCount=function(e,r){switch(r){case br.L:return fn[(e-1)*4+0];case br.M:return fn[(e-1)*4+1];case br.Q:return fn[(e-1)*4+2];case br.H:return fn[(e-1)*4+3];default:return}};Qn.getTotalCodewordsCount=function(e,r){switch(r){case br.L:return pn[(e-1)*4+0];case br.M:return pn[(e-1)*4+1];case br.Q:return pn[(e-1)*4+2];case br.H:return pn[(e-1)*4+3];default:return}};var Uh={},Gn={},$h=Sr,Ki=$h.alloc(512),Cn=$h.alloc(256);(function(){for(var e=1,r=0;r<255;r++)Ki[r]=e,Cn[e]=r,e<<=1,e&256&&(e^=285);for(r=255;r<512;r++)Ki[r]=Ki[r-255]})();Gn.log=function(e){if(e<1)throw new Error("log("+e+")");return Cn[e]};Gn.exp=function(e){return Ki[e]};Gn.mul=function(e,r){return e===0||r===0?0:Ki[Cn[e]+Cn[r]]};(function(t){var e=Sr,r=Gn;t.mul=function(n,s){for(var o=e.alloc(n.length+s.length-1),a=0;a<n.length;a++)for(var h=0;h<s.length;h++)o[a+h]^=r.mul(n[a],s[h]);return o},t.mod=function(n,s){for(var o=e.from(n);o.length-s.length>=0;){for(var a=o[0],h=0;h<s.length;h++)o[h]^=r.mul(s[h],a);for(var u=0;u<o.length&&o[u]===0;)u++;o=o.slice(u)}return o},t.generateECPolynomial=function(n){for(var s=e.from([1]),o=0;o<n;o++)s=t.mul(s,[1,r.exp(o)]);return s}})(Uh);var ha=Sr,zh=Uh,Bf=rd.Buffer;function So(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}So.prototype.initialize=function(e){this.degree=e,this.genPoly=zh.generateECPolynomial(this.degree)};So.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");var r=ha.alloc(this.degree),i=Bf.concat([e,r],e.length+this.degree),n=zh.mod(i,this.genPoly),s=this.degree-n.length;if(s>0){var o=ha.alloc(this.degree);return n.copy(o,s),o}return n};var Df=So,Kh={},Ir={},Io={};Io.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40};var Jt={},jh="[0-9]+",Ff="[A-Z $%*+\\-./:]+",Ji="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Ji=Ji.replace(/u/g,"\\u");var Lf="(?:(?![A-Z0-9 $%*+\\-./:]|"+Ji+`)(?:.|[\r
|
|
1
|
+
import{aX as td,i as H,O as th,U as rd,s as rh,P as id,T as nd}from"../main.js";import{d as sd}from"./dijkstra-D_NXgYpA.js";import{e as cr,a as ih}from"./events-C1UiYlrP.js";import{c as U,s as zn,x as nh,r as Kn,H as od,a as sh,q as Nn}from"./index-C3Sky6pw.js";import{r as ad,a as Hr,g as Wr,i as Ot,b as jn,I as Xr,f as Nt,t as gt,c as ms,x as Ws,C as cd,d as hd,E as ht,y as _t,k as mo,A as ld,h as ud,e as ea,j as dd,s as fd,q as oh,l as pd,m as yo,n as vo,o as ah,p as Zt,u as si}from"./index-BwBQHmYt.js";let gd=class extends ad{constructor(e){super(e),this.events=new cr.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(Hr(e.method,e.params||[],e.id||Wr().toString()),r)}async requestStrict(e,r){return new Promise(async(i,n)=>{if(!this.connection.connected)try{await this.open()}catch(s){n(s)}this.events.on(`${e.id}`,s=>{Ot(s)?n(s.error):i(s.result)});try{await this.connection.send(e,r)}catch(s){n(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),jn(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}};var md=function(){var t=document.getSelection();if(!t.rangeCount)return function(){};for(var e=document.activeElement,r=[],i=0;i<t.rangeCount;i++)r.push(t.getRangeAt(i));switch(e.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":e.blur();break;default:e=null;break}return t.removeAllRanges(),function(){t.type==="Caret"&&t.removeAllRanges(),t.rangeCount||r.forEach(function(n){t.addRange(n)}),e&&e.focus()}},yd=md,ta={"text/plain":"Text","text/html":"Url",default:"Text"},vd="Copy to clipboard: #{key}, Enter";function wd(t){var e=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return t.replace(/#{\s*key\s*}/g,e)}function _d(t,e){var r,i,n,s,o,a,h=!1;e||(e={}),r=e.debug||!1;try{n=yd(),s=document.createRange(),o=document.getSelection(),a=document.createElement("span"),a.textContent=t,a.ariaHidden="true",a.style.all="unset",a.style.position="fixed",a.style.top=0,a.style.clip="rect(0, 0, 0, 0)",a.style.whiteSpace="pre",a.style.webkitUserSelect="text",a.style.MozUserSelect="text",a.style.msUserSelect="text",a.style.userSelect="text",a.addEventListener("copy",function(f){if(f.stopPropagation(),e.format)if(f.preventDefault(),typeof f.clipboardData>"u"){r&&console.warn("unable to use e.clipboardData"),r&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var m=ta[e.format]||ta.default;window.clipboardData.setData(m,t)}else f.clipboardData.clearData(),f.clipboardData.setData(e.format,t);e.onCopy&&(f.preventDefault(),e.onCopy(f.clipboardData))}),document.body.appendChild(a),s.selectNodeContents(a),o.addRange(s);var u=document.execCommand("copy");if(!u)throw new Error("copy command was unsuccessful");h=!0}catch(f){r&&console.error("unable to copy using execCommand: ",f),r&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(e.format||"text",t),e.onCopy&&e.onCopy(window.clipboardData),h=!0}catch(m){r&&console.error("unable to copy using clipboardData: ",m),r&&console.error("falling back to prompt"),i=wd("message"in e?e.message:vd),window.prompt(i,t)}}finally{o&&(typeof o.removeRange=="function"?o.removeRange(s):o.removeAllRanges()),a&&document.body.removeChild(a),n()}return h}var bd=_d,Ad={}.toString,wo=Array.isArray||function(t){return Ad.call(t)=="[object Array]"},Ed=td(),_o={},he={};Object.defineProperty(he,"__esModule",{value:!0});var ch=he.getLocalStorage=wh=he.getLocalStorageOrThrow=vh=he.getCrypto=yh=he.getCryptoOrThrow=mh=he.getLocation=gh=he.getLocationOrThrow=ph=he.getNavigator=fh=he.getNavigatorOrThrow=dh=he.getDocument=uh=he.getDocumentOrThrow=lh=he.getFromWindowOrThrow=hh=he.getFromWindow=void 0;function Zr(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}var hh=he.getFromWindow=Zr;function bi(t){const e=Zr(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}var lh=he.getFromWindowOrThrow=bi;function Sd(){return bi("document")}var uh=he.getDocumentOrThrow=Sd;function Id(){return Zr("document")}var dh=he.getDocument=Id;function Md(){return bi("navigator")}var fh=he.getNavigatorOrThrow=Md;function xd(){return Zr("navigator")}var ph=he.getNavigator=xd;function Nd(){return bi("location")}var gh=he.getLocationOrThrow=Nd;function Cd(){return Zr("location")}var mh=he.getLocation=Cd;function Td(){return bi("crypto")}var yh=he.getCryptoOrThrow=Td;function Rd(){return Zr("crypto")}var vh=he.getCrypto=Rd;function Pd(){return bi("localStorage")}var wh=he.getLocalStorageOrThrow=Pd;function Od(){return Zr("localStorage")}ch=he.getLocalStorage=Od;Object.defineProperty(_o,"__esModule",{value:!0});var _h=_o.getWindowMetadata=void 0;const ra=he;function kd(){let t,e;try{t=ra.getDocumentOrThrow(),e=ra.getLocationOrThrow()}catch{return null}function r(){const m=t.getElementsByTagName("link"),b=[];for(let v=0;v<m.length;v++){const E=m[v],x=E.getAttribute("rel");if(x&&x.toLowerCase().indexOf("icon")>-1){const S=E.getAttribute("href");if(S)if(S.toLowerCase().indexOf("https:")===-1&&S.toLowerCase().indexOf("http:")===-1&&S.indexOf("//")!==0){let N=e.protocol+"//"+e.host;if(S.indexOf("/")===0)N+=S;else{const T=e.pathname.split("/");T.pop();const P=T.join("/");N+=P+"/"+S}b.push(N)}else if(S.indexOf("//")===0){const N=e.protocol+S;b.push(N)}else b.push(S)}}return b}function i(...m){const b=t.getElementsByTagName("meta");for(let v=0;v<b.length;v++){const E=b[v],x=["itemprop","property","name"].map(S=>E.getAttribute(S)).filter(S=>S?m.includes(S):!1);if(x.length&&x){const S=E.getAttribute("content");if(S)return S}}return""}function n(){let m=i("name","og:site_name","og:title","twitter:title");return m||(m=t.title),m}function s(){return i("description","og:description","twitter:description","keywords")}const o=n(),a=s(),h=e.origin,u=r();return{description:a,url:h,icons:u,name:o}}_h=_o.getWindowMetadata=kd;var Bd=function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var i=Array(t),n=0,e=0;e<r;e++)for(var s=arguments[e],o=0,a=s.length;o<a;o++,n++)i[n]=s[o];return i},Dd=function(){function t(e,r,i){this.name=e,this.version=r,this.os=i,this.type="browser"}return t}(),Fd=function(){function t(e){this.version=e,this.type="node",this.name="node",this.os=H.process.platform}return t}(),Ld=function(){function t(e,r,i,n){this.name=e,this.version=r,this.os=i,this.bot=n,this.type="bot-device"}return t}(),qd=function(){function t(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return t}(),Ud=function(){function t(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return t}(),$d=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,zd=/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,ia=3,Kd=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FBAV\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["searchbot",$d]],na=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function jd(t){return t?sa(t):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new Ud:typeof navigator<"u"?sa(navigator.userAgent):Wd()}function Vd(t){return t!==""&&Kd.reduce(function(e,r){var i=r[0],n=r[1];if(e)return e;var s=n.exec(t);return!!s&&[i,s]},!1)}function sa(t){var e=Vd(t);if(!e)return null;var r=e[0],i=e[1];if(r==="searchbot")return new qd;var n=i[1]&&i[1].split(/[._]/).slice(0,3);n?n.length<ia&&(n=Bd(n,Qd(ia-n.length))):n=[];var s=n.join("."),o=Hd(t),a=zd.exec(t);return a&&a[1]?new Ld(r,s,o,a[1]):new Dd(r,s,o)}function Hd(t){for(var e=0,r=na.length;e<r;e++){var i=na[e],n=i[0],s=i[1],o=s.exec(t);if(o)return n}return null}function Wd(){var t=typeof H.process<"u"&&H.process.version;return t?new Fd(H.process.version.slice(1)):null}function Qd(t){for(var e=[],r=0;r<t;r++)e.push("0");return e}function bo(t){return jd(t)}function Vn(){const t=bo();return t&&t.os?t.os:void 0}function bh(){const t=Vn();return t?t.toLowerCase().includes("android"):!1}function Ah(){const t=Vn();return t?t.toLowerCase().includes("ios")||t.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1:!1}function Gd(){return Vn()?bh()||Ah():!1}function Eh(){const t=bo();return t&&t.name?t.name.toLowerCase()==="node":!1}function Jd(){return!Eh()&&!!Sh()}const Yd=hh,Xd=lh,Zd=uh,ef=dh,tf=fh,Sh=ph,rf=gh,nf=mh,sf=yh,of=vh,af=wh,Hn=ch;function cf(){return _h()}function hf(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return JSON.parse(t)}catch{return t}}function lf(t){return typeof t=="string"?t:JSON.stringify(t)}const Ih=hf,Mh=lf;function xh(t,e){const r=Mh(e),i=Hn();i&&i.setItem(t,r)}function uf(t){let e=null,r=null;const i=Hn();return i&&(r=i.getItem(t)),e=r&&Ih(r),e}function df(t){const e=Hn();e&&e.removeItem(t)}const Nh="WALLETCONNECT_DEEPLINK_CHOICE";function ff(t,e){const r=encodeURIComponent(t);return e.universalLink?`${e.universalLink}/wc?uri=${r}`:e.deepLink?`${e.deepLink}${e.deepLink.endsWith(":")?"//":"/"}wc?uri=${r}`:""}function pf(t){const e=t.href.split("?")[0];xh(Nh,Object.assign(Object.assign({},t),{href:e}))}function Ch(t,e){return t.filter(r=>r.name.toLowerCase().includes(e.toLowerCase()))[0]}function gf(t,e){let r=t;return e&&(r=e.map(i=>Ch(t,i)).filter(Boolean)),r}const Th="https://registry.walletconnect.com";function mf(){return Th+"/api/v2/wallets"}function yf(){return Th+"/api/v2/dapps"}function Rh(t,e="mobile"){var r;return{name:t.name||"",shortName:t.metadata.shortName||"",color:t.metadata.colors.primary||"",logo:(r=t.image_url.sm)!==null&&r!==void 0?r:"",universalLink:t[e].universal||"",deepLink:t[e].native||""}}function vf(t,e="mobile"){return Object.values(t).filter(r=>!!r[e].universal||!!r[e].native).map(r=>Rh(r,e))}const wf=Object.freeze(Object.defineProperty({__proto__:null,detectEnv:bo,detectOS:Vn,formatIOSMobile:ff,formatMobileRegistry:vf,formatMobileRegistryEntry:Rh,getClientMeta:cf,getCrypto:of,getCryptoOrThrow:sf,getDappRegistryUrl:yf,getDocument:ef,getDocumentOrThrow:Zd,getFromWindow:Yd,getFromWindowOrThrow:Xd,getLocal:uf,getLocalStorage:Hn,getLocalStorageOrThrow:af,getLocation:nf,getLocationOrThrow:rf,getMobileLinkRegistry:gf,getMobileRegistryEntry:Ch,getNavigator:Sh,getNavigatorOrThrow:tf,getWalletRegistryUrl:mf,isAndroid:bh,isBrowser:Jd,isIOS:Ah,isMobile:Gd,isNode:Eh,mobileLinkChoiceKey:Nh,removeLocal:df,safeJsonParse:Ih,safeJsonStringify:Mh,saveMobileLinkInfo:pf,setLocal:xh},Symbol.toStringTag,{value:"Module"})),_f=th(wf);var rn={},bf=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},Ph={},Sr={},Af=wo;function Ef(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},t.foo()===42}catch{return!1}}ie.TYPED_ARRAY_SUPPORT=Ef();var oa=ie.TYPED_ARRAY_SUPPORT?2147483647:1073741823;function ie(t,e,r){return!ie.TYPED_ARRAY_SUPPORT&&!(this instanceof ie)?new ie(t,e,r):typeof t=="number"?Oh(this,t):Tf(this,t,e,r)}ie.TYPED_ARRAY_SUPPORT&&(ie.prototype.__proto__=Uint8Array.prototype,ie.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&ie[Symbol.species]===ie&&Object.defineProperty(ie,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}));function Ao(t){if(t>=oa)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+oa.toString(16)+" bytes");return t|0}function Sf(t){return t!==t}function di(t,e){var r;return ie.TYPED_ARRAY_SUPPORT?(r=new Uint8Array(e),r.__proto__=ie.prototype):(r=t,r===null&&(r=new ie(e)),r.length=e),r}function Oh(t,e){var r=di(t,e<0?0:Ao(e)|0);if(!ie.TYPED_ARRAY_SUPPORT)for(var i=0;i<e;++i)r[i]=0;return r}function If(t,e){var r=Bh(e)|0,i=di(t,r),n=i.write(e);return n!==r&&(i=i.slice(0,n)),i}function Qs(t,e){for(var r=e.length<0?0:Ao(e.length)|0,i=di(t,r),n=0;n<r;n+=1)i[n]=e[n]&255;return i}function Mf(t,e,r,i){if(r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(i||0))throw new RangeError("'length' is out of bounds");var n;return r===void 0&&i===void 0?n=new Uint8Array(e):i===void 0?n=new Uint8Array(e,r):n=new Uint8Array(e,r,i),ie.TYPED_ARRAY_SUPPORT?n.__proto__=ie.prototype:n=Qs(t,n),n}function xf(t,e){if(ie.isBuffer(e)){var r=Ao(e.length)|0,i=di(t,r);return i.length===0||e.copy(i,0,0,r),i}if(e){if(typeof ArrayBuffer<"u"&&e.buffer instanceof ArrayBuffer||"length"in e)return typeof e.length!="number"||Sf(e.length)?di(t,0):Qs(t,e);if(e.type==="Buffer"&&Array.isArray(e.data))return Qs(t,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function kh(t,e){e=e||1/0;for(var r,i=t.length,n=null,s=[],o=0;o<i;++o){if(r=t.charCodeAt(o),r>55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===i){(e-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),n=r;continue}r=(n-55296<<10|r-56320)+65536}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function Bh(t){if(ie.isBuffer(t))return t.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;typeof t!="string"&&(t=""+t);var e=t.length;return e===0?0:kh(t).length}function Nf(t,e,r,i){for(var n=0;n<i&&!(n+r>=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function Cf(t,e,r,i){return Nf(kh(e,t.length-r),t,r,i)}function Tf(t,e,r,i){if(typeof e=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer?Mf(t,e,r,i):typeof e=="string"?If(t,e):xf(t,e)}ie.prototype.write=function(e,r,i){r===void 0?(i=this.length,r=0):i===void 0&&typeof r=="string"?(i=this.length,r=0):isFinite(r)&&(r=r|0,isFinite(i)?i=i|0:i=void 0);var n=this.length-r;if((i===void 0||i>n)&&(i=n),e.length>0&&(i<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");return Cf(this,e,r,i)};ie.prototype.slice=function(e,r){var i=this.length;e=~~e,r=r===void 0?i:~~r,e<0?(e+=i,e<0&&(e=0)):e>i&&(e=i),r<0?(r+=i,r<0&&(r=0)):r>i&&(r=i),r<e&&(r=e);var n;if(ie.TYPED_ARRAY_SUPPORT)n=this.subarray(e,r),n.__proto__=ie.prototype;else{var s=r-e;n=new ie(s,void 0);for(var o=0;o<s;++o)n[o]=this[o+e]}return n};ie.prototype.copy=function(e,r,i,n){if(i||(i=0),!n&&n!==0&&(n=this.length),r>=e.length&&(r=e.length),r||(r=0),n>0&&n<i&&(n=i),n===i||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-r<n-i&&(n=e.length-r+i);var s=n-i,o;if(this===e&&i<r&&r<n)for(o=s-1;o>=0;--o)e[o+r]=this[o+i];else if(s<1e3||!ie.TYPED_ARRAY_SUPPORT)for(o=0;o<s;++o)e[o+r]=this[o+i];else Uint8Array.prototype.set.call(e,this.subarray(i,i+s),r);return s};ie.prototype.fill=function(e,r,i){if(typeof e=="string"){if(typeof r=="string"?(r=0,i=this.length):typeof i=="string"&&(i=this.length),e.length===1){var n=e.charCodeAt(0);n<256&&(e=n)}}else typeof e=="number"&&(e=e&255);if(r<0||this.length<r||this.length<i)throw new RangeError("Out of range index");if(i<=r)return this;r=r>>>0,i=i===void 0?this.length:i>>>0,e||(e=0);var s;if(typeof e=="number")for(s=r;s<i;++s)this[s]=e;else{var o=ie.isBuffer(e)?e:new ie(e),a=o.length;for(s=0;s<i-r;++s)this[s+r]=o[s%a]}return this};ie.concat=function(e,r){if(!Af(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return di(null,0);var i;if(r===void 0)for(r=0,i=0;i<e.length;++i)r+=e[i].length;var n=Oh(null,r),s=0;for(i=0;i<e.length;++i){var o=e[i];if(!ie.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,s),s+=o.length}return n};ie.byteLength=Bh;ie.prototype._isBuffer=!0;ie.isBuffer=function(e){return!!(e!=null&&e._isBuffer)};Sr.alloc=function(t){var e=new ie(t);return e.fill(0),e};Sr.from=function(t){return new ie(t)};var bt={},Eo,Rf=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];bt.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return e*4+17};bt.getSymbolTotalCodewords=function(e){return Rf[e]};bt.getBCHDigit=function(t){for(var e=0;t!==0;)e++,t>>>=1;return e};bt.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');Eo=e};bt.isKanjiModeEnabled=function(){return typeof Eo<"u"};bt.toSJIS=function(e){return Eo(e)};var Wn={};(function(t){t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2};function e(r){if(typeof r!="string")throw new Error("Param is not a string");var i=r.toLowerCase();switch(i){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+r)}}t.isValid=function(i){return i&&typeof i.bit<"u"&&i.bit>=0&&i.bit<4},t.from=function(i,n){if(t.isValid(i))return i;try{return e(i)}catch{return n}}})(Wn);function Dh(){this.buffer=[],this.length=0}Dh.prototype={get:function(t){var e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)===1},put:function(t,e){for(var r=0;r<e;r++)this.putBit((t>>>e-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};var Pf=Dh,aa=Sr;function nn(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=aa.alloc(t*t),this.reservedBit=aa.alloc(t*t)}nn.prototype.set=function(t,e,r,i){var n=t*this.size+e;this.data[n]=r,i&&(this.reservedBit[n]=!0)};nn.prototype.get=function(t,e){return this.data[t*this.size+e]};nn.prototype.xor=function(t,e,r){this.data[t*this.size+e]^=r};nn.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};var Of=nn,Fh={};(function(t){var e=bt.getSymbolSize;t.getRowColCoords=function(i){if(i===1)return[];for(var n=Math.floor(i/7)+2,s=e(i),o=s===145?26:Math.ceil((s-13)/(2*n-2))*2,a=[s-7],h=1;h<n-1;h++)a[h]=a[h-1]-o;return a.push(6),a.reverse()},t.getPositions=function(i){for(var n=[],s=t.getRowColCoords(i),o=s.length,a=0;a<o;a++)for(var h=0;h<o;h++)a===0&&h===0||a===0&&h===o-1||a===o-1&&h===0||n.push([s[a],s[h]]);return n}})(Fh);var Lh={},kf=bt.getSymbolSize,ca=7;Lh.getPositions=function(e){var r=kf(e);return[[0,0],[r-ca,0],[0,r-ca]]};var qh={};(function(t){t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var e={N1:3,N2:3,N3:40,N4:10};t.isValid=function(n){return n!=null&&n!==""&&!isNaN(n)&&n>=0&&n<=7},t.from=function(n){return t.isValid(n)?parseInt(n,10):void 0},t.getPenaltyN1=function(n){for(var s=n.size,o=0,a=0,h=0,u=null,f=null,m=0;m<s;m++){a=h=0,u=f=null;for(var b=0;b<s;b++){var v=n.get(m,b);v===u?a++:(a>=5&&(o+=e.N1+(a-5)),u=v,a=1),v=n.get(b,m),v===f?h++:(h>=5&&(o+=e.N1+(h-5)),f=v,h=1)}a>=5&&(o+=e.N1+(a-5)),h>=5&&(o+=e.N1+(h-5))}return o},t.getPenaltyN2=function(n){for(var s=n.size,o=0,a=0;a<s-1;a++)for(var h=0;h<s-1;h++){var u=n.get(a,h)+n.get(a,h+1)+n.get(a+1,h)+n.get(a+1,h+1);(u===4||u===0)&&o++}return o*e.N2},t.getPenaltyN3=function(n){for(var s=n.size,o=0,a=0,h=0,u=0;u<s;u++){a=h=0;for(var f=0;f<s;f++)a=a<<1&2047|n.get(u,f),f>=10&&(a===1488||a===93)&&o++,h=h<<1&2047|n.get(f,u),f>=10&&(h===1488||h===93)&&o++}return o*e.N3},t.getPenaltyN4=function(n){for(var s=0,o=n.data.length,a=0;a<o;a++)s+=n.data[a];var h=Math.abs(Math.ceil(s*100/o/5)-10);return h*e.N4};function r(i,n,s){switch(i){case t.Patterns.PATTERN000:return(n+s)%2===0;case t.Patterns.PATTERN001:return n%2===0;case t.Patterns.PATTERN010:return s%3===0;case t.Patterns.PATTERN011:return(n+s)%3===0;case t.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(s/3))%2===0;case t.Patterns.PATTERN101:return n*s%2+n*s%3===0;case t.Patterns.PATTERN110:return(n*s%2+n*s%3)%2===0;case t.Patterns.PATTERN111:return(n*s%3+(n+s)%2)%2===0;default:throw new Error("bad maskPattern:"+i)}}t.applyMask=function(n,s){for(var o=s.size,a=0;a<o;a++)for(var h=0;h<o;h++)s.isReserved(h,a)||s.xor(h,a,r(n,h,a))},t.getBestMask=function(n,s){for(var o=Object.keys(t.Patterns).length,a=0,h=1/0,u=0;u<o;u++){s(u),t.applyMask(u,n);var f=t.getPenaltyN1(n)+t.getPenaltyN2(n)+t.getPenaltyN3(n)+t.getPenaltyN4(n);t.applyMask(u,n),f<h&&(h=f,a=u)}return a}})(qh);var Qn={},br=Wn,fn=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],pn=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];Qn.getBlocksCount=function(e,r){switch(r){case br.L:return fn[(e-1)*4+0];case br.M:return fn[(e-1)*4+1];case br.Q:return fn[(e-1)*4+2];case br.H:return fn[(e-1)*4+3];default:return}};Qn.getTotalCodewordsCount=function(e,r){switch(r){case br.L:return pn[(e-1)*4+0];case br.M:return pn[(e-1)*4+1];case br.Q:return pn[(e-1)*4+2];case br.H:return pn[(e-1)*4+3];default:return}};var Uh={},Gn={},$h=Sr,Ki=$h.alloc(512),Cn=$h.alloc(256);(function(){for(var e=1,r=0;r<255;r++)Ki[r]=e,Cn[e]=r,e<<=1,e&256&&(e^=285);for(r=255;r<512;r++)Ki[r]=Ki[r-255]})();Gn.log=function(e){if(e<1)throw new Error("log("+e+")");return Cn[e]};Gn.exp=function(e){return Ki[e]};Gn.mul=function(e,r){return e===0||r===0?0:Ki[Cn[e]+Cn[r]]};(function(t){var e=Sr,r=Gn;t.mul=function(n,s){for(var o=e.alloc(n.length+s.length-1),a=0;a<n.length;a++)for(var h=0;h<s.length;h++)o[a+h]^=r.mul(n[a],s[h]);return o},t.mod=function(n,s){for(var o=e.from(n);o.length-s.length>=0;){for(var a=o[0],h=0;h<s.length;h++)o[h]^=r.mul(s[h],a);for(var u=0;u<o.length&&o[u]===0;)u++;o=o.slice(u)}return o},t.generateECPolynomial=function(n){for(var s=e.from([1]),o=0;o<n;o++)s=t.mul(s,[1,r.exp(o)]);return s}})(Uh);var ha=Sr,zh=Uh,Bf=rd.Buffer;function So(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}So.prototype.initialize=function(e){this.degree=e,this.genPoly=zh.generateECPolynomial(this.degree)};So.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");var r=ha.alloc(this.degree),i=Bf.concat([e,r],e.length+this.degree),n=zh.mod(i,this.genPoly),s=this.degree-n.length;if(s>0){var o=ha.alloc(this.degree);return n.copy(o,s),o}return n};var Df=So,Kh={},Ir={},Io={};Io.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40};var Jt={},jh="[0-9]+",Ff="[A-Z $%*+\\-./:]+",Ji="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Ji=Ji.replace(/u/g,"\\u");var Lf="(?:(?![A-Z0-9 $%*+\\-./:]|"+Ji+`)(?:.|[\r
|
|
2
2
|
]))+`;Jt.KANJI=new RegExp(Ji,"g");Jt.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");Jt.BYTE=new RegExp(Lf,"g");Jt.NUMERIC=new RegExp(jh,"g");Jt.ALPHANUMERIC=new RegExp(Ff,"g");var qf=new RegExp("^"+Ji+"$"),Uf=new RegExp("^"+jh+"$"),$f=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");Jt.testKanji=function(e){return qf.test(e)};Jt.testNumeric=function(e){return Uf.test(e)};Jt.testAlphanumeric=function(e){return $f.test(e)};(function(t){var e=Io,r=Jt;t.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},t.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},t.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},t.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},t.MIXED={bit:-1},t.getCharCountIndicator=function(s,o){if(!s.ccBits)throw new Error("Invalid mode: "+s);if(!e.isValid(o))throw new Error("Invalid version: "+o);return o>=1&&o<10?s.ccBits[0]:o<27?s.ccBits[1]:s.ccBits[2]},t.getBestModeForData=function(s){return r.testNumeric(s)?t.NUMERIC:r.testAlphanumeric(s)?t.ALPHANUMERIC:r.testKanji(s)?t.KANJI:t.BYTE},t.toString=function(s){if(s&&s.id)return s.id;throw new Error("Invalid mode")},t.isValid=function(s){return s&&s.bit&&s.ccBits};function i(n){if(typeof n!="string")throw new Error("Param is not a string");var s=n.toLowerCase();switch(s){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw new Error("Unknown mode: "+n)}}t.from=function(s,o){if(t.isValid(s))return s;try{return i(s)}catch{return o}}})(Ir);(function(t){var e=bt,r=Qn,i=Wn,n=Ir,s=Io,o=wo,a=7973,h=e.getBCHDigit(a);function u(v,E,x){for(var S=1;S<=40;S++)if(E<=t.getCapacity(S,x,v))return S}function f(v,E){return n.getCharCountIndicator(v,E)+4}function m(v,E){var x=0;return v.forEach(function(S){var N=f(S.mode,E);x+=N+S.getBitsLength()}),x}function b(v,E){for(var x=1;x<=40;x++){var S=m(v,x);if(S<=t.getCapacity(x,E,n.MIXED))return x}}t.from=function(E,x){return s.isValid(E)?parseInt(E,10):x},t.getCapacity=function(E,x,S){if(!s.isValid(E))throw new Error("Invalid QR Code version");typeof S>"u"&&(S=n.BYTE);var N=e.getSymbolTotalCodewords(E),T=r.getTotalCodewordsCount(E,x),P=(N-T)*8;if(S===n.MIXED)return P;var C=P-f(S,E);switch(S){case n.NUMERIC:return Math.floor(C/10*3);case n.ALPHANUMERIC:return Math.floor(C/11*2);case n.KANJI:return Math.floor(C/13);case n.BYTE:default:return Math.floor(C/8)}},t.getBestVersionForData=function(E,x){var S,N=i.from(x,i.M);if(o(E)){if(E.length>1)return b(E,N);if(E.length===0)return 1;S=E[0]}else S=E;return u(S.mode,S.getLength(),N)},t.getEncodedBits=function(E){if(!s.isValid(E)||E<7)throw new Error("Invalid QR Code version");for(var x=E<<12;e.getBCHDigit(x)-h>=0;)x^=a<<e.getBCHDigit(x)-h;return E<<12|x}})(Kh);var Vh={},Gs=bt,Hh=1335,zf=21522,la=Gs.getBCHDigit(Hh);Vh.getEncodedBits=function(e,r){for(var i=e.bit<<3|r,n=i<<10;Gs.getBCHDigit(n)-la>=0;)n^=Hh<<Gs.getBCHDigit(n)-la;return(i<<10|n)^zf};var Wh={},Kf=Ir;function fi(t){this.mode=Kf.NUMERIC,this.data=t.toString()}fi.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};fi.prototype.getLength=function(){return this.data.length};fi.prototype.getBitsLength=function(){return fi.getBitsLength(this.data.length)};fi.prototype.write=function(e){var r,i,n;for(r=0;r+3<=this.data.length;r+=3)i=this.data.substr(r,3),n=parseInt(i,10),e.put(n,10);var s=this.data.length-r;s>0&&(i=this.data.substr(r),n=parseInt(i,10),e.put(n,s*3+1))};var jf=fi,Vf=Ir,ys=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function pi(t){this.mode=Vf.ALPHANUMERIC,this.data=t}pi.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};pi.prototype.getLength=function(){return this.data.length};pi.prototype.getBitsLength=function(){return pi.getBitsLength(this.data.length)};pi.prototype.write=function(e){var r;for(r=0;r+2<=this.data.length;r+=2){var i=ys.indexOf(this.data[r])*45;i+=ys.indexOf(this.data[r+1]),e.put(i,11)}this.data.length%2&&e.put(ys.indexOf(this.data[r]),6)};var Hf=pi,Wf=Sr,Qf=Ir;function gi(t){this.mode=Qf.BYTE,this.data=Wf.from(t)}gi.getBitsLength=function(e){return e*8};gi.prototype.getLength=function(){return this.data.length};gi.prototype.getBitsLength=function(){return gi.getBitsLength(this.data.length)};gi.prototype.write=function(t){for(var e=0,r=this.data.length;e<r;e++)t.put(this.data[e],8)};var Gf=gi,Jf=Ir,Yf=bt;function mi(t){this.mode=Jf.KANJI,this.data=t}mi.getBitsLength=function(e){return e*13};mi.prototype.getLength=function(){return this.data.length};mi.prototype.getBitsLength=function(){return mi.getBitsLength(this.data.length)};mi.prototype.write=function(t){var e;for(e=0;e<this.data.length;e++){var r=Yf.toSJIS(this.data[e]);if(r>=33088&&r<=40956)r-=33088;else if(r>=57408&&r<=60351)r-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+`
|
|
3
3
|
Make sure your charset is UTF-8`);r=(r>>>8&255)*192+(r&255),t.put(r,13)}};var Xf=mi;(function(t){var e=Ir,r=jf,i=Hf,n=Gf,s=Xf,o=Jt,a=bt,h=sd;function u(N){return unescape(encodeURIComponent(N)).length}function f(N,T,P){for(var C=[],B;(B=N.exec(P))!==null;)C.push({data:B[0],index:B.index,mode:T,length:B[0].length});return C}function m(N){var T=f(o.NUMERIC,e.NUMERIC,N),P=f(o.ALPHANUMERIC,e.ALPHANUMERIC,N),C,B;a.isKanjiModeEnabled()?(C=f(o.BYTE,e.BYTE,N),B=f(o.KANJI,e.KANJI,N)):(C=f(o.BYTE_KANJI,e.BYTE,N),B=[]);var D=T.concat(P,C,B);return D.sort(function(q,L){return q.index-L.index}).map(function(q){return{data:q.data,mode:q.mode,length:q.length}})}function b(N,T){switch(T){case e.NUMERIC:return r.getBitsLength(N);case e.ALPHANUMERIC:return i.getBitsLength(N);case e.KANJI:return s.getBitsLength(N);case e.BYTE:return n.getBitsLength(N)}}function v(N){return N.reduce(function(T,P){var C=T.length-1>=0?T[T.length-1]:null;return C&&C.mode===P.mode?(T[T.length-1].data+=P.data,T):(T.push(P),T)},[])}function E(N){for(var T=[],P=0;P<N.length;P++){var C=N[P];switch(C.mode){case e.NUMERIC:T.push([C,{data:C.data,mode:e.ALPHANUMERIC,length:C.length},{data:C.data,mode:e.BYTE,length:C.length}]);break;case e.ALPHANUMERIC:T.push([C,{data:C.data,mode:e.BYTE,length:C.length}]);break;case e.KANJI:T.push([C,{data:C.data,mode:e.BYTE,length:u(C.data)}]);break;case e.BYTE:T.push([{data:C.data,mode:e.BYTE,length:u(C.data)}])}}return T}function x(N,T){for(var P={},C={start:{}},B=["start"],D=0;D<N.length;D++){for(var q=N[D],L=[],Z=0;Z<q.length;Z++){var se=q[Z],ee=""+D+Z;L.push(ee),P[ee]={node:se,lastCount:0},C[ee]={};for(var ce=0;ce<B.length;ce++){var c=B[ce];P[c]&&P[c].node.mode===se.mode?(C[c][ee]=b(P[c].lastCount+se.length,se.mode)-b(P[c].lastCount,se.mode),P[c].lastCount+=se.length):(P[c]&&(P[c].lastCount=se.length),C[c][ee]=b(se.length,se.mode)+4+e.getCharCountIndicator(se.mode,T))}}B=L}for(ce=0;ce<B.length;ce++)C[B[ce]].end=0;return{map:C,table:P}}function S(N,T){var P,C=e.getBestModeForData(N);if(P=e.from(T,C),P!==e.BYTE&&P.bit<C.bit)throw new Error('"'+N+'" cannot be encoded with mode '+e.toString(P)+`.
|
|
4
4
|
Suggested mode is: `+e.toString(C));switch(P===e.KANJI&&!a.isKanjiModeEnabled()&&(P=e.BYTE),P){case e.NUMERIC:return new r(N);case e.ALPHANUMERIC:return new i(N);case e.KANJI:return new s(N);case e.BYTE:return new n(N)}}t.fromArray=function(T){return T.reduce(function(P,C){return typeof C=="string"?P.push(S(C,null)):C.data&&P.push(S(C.data,C.mode)),P},[])},t.fromString=function(T,P){for(var C=m(T,a.isKanjiModeEnabled()),B=E(C),D=x(B,P),q=h.find_path(D.map,"start","end"),L=[],Z=1;Z<q.length-1;Z++)L.push(D.table[q[Z]].node);return t.fromArray(v(L))},t.rawSplit=function(T){return t.fromArray(m(T,a.isKanjiModeEnabled()))}})(Wh);var ua=Sr,Jn=bt,vs=Wn,Zf=Pf,ep=Of,tp=Fh,rp=Lh,Js=qh,Ys=Qn,ip=Df,Tn=Kh,np=Vh,sp=Ir,ws=Wh,op=wo;function ap(t,e){for(var r=t.size,i=rp.getPositions(e),n=0;n<i.length;n++)for(var s=i[n][0],o=i[n][1],a=-1;a<=7;a++)if(!(s+a<=-1||r<=s+a))for(var h=-1;h<=7;h++)o+h<=-1||r<=o+h||(a>=0&&a<=6&&(h===0||h===6)||h>=0&&h<=6&&(a===0||a===6)||a>=2&&a<=4&&h>=2&&h<=4?t.set(s+a,o+h,!0,!0):t.set(s+a,o+h,!1,!0))}function cp(t){for(var e=t.size,r=8;r<e-8;r++){var i=r%2===0;t.set(r,6,i,!0),t.set(6,r,i,!0)}}function hp(t,e){for(var r=tp.getPositions(e),i=0;i<r.length;i++)for(var n=r[i][0],s=r[i][1],o=-2;o<=2;o++)for(var a=-2;a<=2;a++)o===-2||o===2||a===-2||a===2||o===0&&a===0?t.set(n+o,s+a,!0,!0):t.set(n+o,s+a,!1,!0)}function lp(t,e){for(var r=t.size,i=Tn.getEncodedBits(e),n,s,o,a=0;a<18;a++)n=Math.floor(a/3),s=a%3+r-8-3,o=(i>>a&1)===1,t.set(n,s,o,!0),t.set(s,n,o,!0)}function _s(t,e,r){var i=t.size,n=np.getEncodedBits(e,r),s,o;for(s=0;s<15;s++)o=(n>>s&1)===1,s<6?t.set(s,8,o,!0):s<8?t.set(s+1,8,o,!0):t.set(i-15+s,8,o,!0),s<8?t.set(8,i-s-1,o,!0):s<9?t.set(8,15-s-1+1,o,!0):t.set(8,15-s-1,o,!0);t.set(i-8,8,1,!0)}function up(t,e){for(var r=t.size,i=-1,n=r-1,s=7,o=0,a=r-1;a>0;a-=2)for(a===6&&a--;;){for(var h=0;h<2;h++)if(!t.isReserved(n,a-h)){var u=!1;o<e.length&&(u=(e[o]>>>s&1)===1),t.set(n,a-h,u),s--,s===-1&&(o++,s=7)}if(n+=i,n<0||r<=n){n-=i,i=-i;break}}}function dp(t,e,r){var i=new Zf;r.forEach(function(u){i.put(u.mode.bit,4),i.put(u.getLength(),sp.getCharCountIndicator(u.mode,t)),u.write(i)});var n=Jn.getSymbolTotalCodewords(t),s=Ys.getTotalCodewordsCount(t,e),o=(n-s)*8;for(i.getLengthInBits()+4<=o&&i.put(0,4);i.getLengthInBits()%8!==0;)i.putBit(0);for(var a=(o-i.getLengthInBits())/8,h=0;h<a;h++)i.put(h%2?17:236,8);return fp(i,t,e)}function fp(t,e,r){for(var i=Jn.getSymbolTotalCodewords(e),n=Ys.getTotalCodewordsCount(e,r),s=i-n,o=Ys.getBlocksCount(e,r),a=i%o,h=o-a,u=Math.floor(i/o),f=Math.floor(s/o),m=f+1,b=u-f,v=new ip(b),E=0,x=new Array(o),S=new Array(o),N=0,T=ua.from(t.buffer),P=0;P<o;P++){var C=P<h?f:m;x[P]=T.slice(E,E+C),S[P]=v.encode(x[P]),E+=C,N=Math.max(N,C)}var B=ua.alloc(i),D=0,q,L;for(q=0;q<N;q++)for(L=0;L<o;L++)q<x[L].length&&(B[D++]=x[L][q]);for(q=0;q<b;q++)for(L=0;L<o;L++)B[D++]=S[L][q];return B}function pp(t,e,r,i){var n;if(op(t))n=ws.fromArray(t);else if(typeof t=="string"){var s=e;if(!s){var o=ws.rawSplit(t);s=Tn.getBestVersionForData(o,r)}n=ws.fromString(t,s||40)}else throw new Error("Invalid data");var a=Tn.getBestVersionForData(n,r);if(!a)throw new Error("The amount of data is too big to be stored in a QR Code");if(!e)e=a;else if(e<a)throw new Error(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as Gt,s as Dr,O as Yn,K as Zt}from"../main.js";import{i as qn,b as Zn,d as Qn,e as ti,f as ei,g as ri,h as ni,j as ii,k as si,l as oi,m as ai,w as $r,r as Kr,c as fi}from"./index-DyOk_vKo.js";import{e as ci}from"./events-C1UiYlrP.js";function Ur(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function ui(t,r){r||(r=t.reduce((o,h)=>o+h.length,0));const n=Ur(r);let c=0;for(const o of t)n.set(o,c),c+=o.length;return n}const mr={...qn,...Zn,...Qn,...ti,...ei,...ri,...ni,...ii,...si,...oi};function Hr(t,r,n,c){return{name:t,prefix:r,encoder:{name:t,prefix:r,encode:n},decoder:{decode:c}}}const xr=Hr("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),qe=Hr("ascii","a",t=>{let r="a";for(let n=0;n<t.length;n++)r+=String.fromCharCode(t[n]);return r},t=>{t=t.substring(1);const r=Ur(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}),Fr={utf8:xr,"utf-8":xr,hex:mr.base16,latin1:qe,ascii:qe,binary:qe,...mr};function me(t,r="utf8"){const n=Fr[r];if(!n)throw new Error(`Unsupported encoding "${r}"`);return(r==="utf8"||r==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t,"utf8"):n.decoder.decode(`${n.prefix}${t}`)}function We(t,r="utf8"){const n=Fr[r];if(!n)throw new Error(`Unsupported encoding "${r}"`);return(r==="utf8"||r==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("utf8"):n.encoder.encode(t).substring(1)}const jo={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe",batchFetchMessages:"waku_batchFetchMessages"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe",batchFetchMessages:"irn_batchFetchMessages"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe",batchFetchMessages:"iridium_batchFetchMessages"}},li=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,hi=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,di=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function bi(t,r){if(t==="__proto__"||t==="constructor"&&r&&typeof r=="object"&&"prototype"in r){gi(t);return}return r}function gi(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function Be(t,r={}){if(typeof t!="string")return t;const n=t.trim();if(t[0]==='"'&&t.endsWith('"')&&!t.includes("\\"))return n.slice(1,-1);if(n.length<=9){const c=n.toLowerCase();if(c==="true")return!0;if(c==="false")return!1;if(c==="undefined")return;if(c==="null")return null;if(c==="nan")return Number.NaN;if(c==="infinity")return Number.POSITIVE_INFINITY;if(c==="-infinity")return Number.NEGATIVE_INFINITY}if(!di.test(t)){if(r.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(li.test(t)||hi.test(t)){if(r.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,bi)}return JSON.parse(t)}catch(c){if(r.strict)throw c;return t}}function yi(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function Ot(t,...r){try{return yi(t(...r))}catch(n){return Promise.reject(n)}}function pi(t){const r=typeof t;return t===null||r!=="object"&&r!=="function"}function _i(t){const r=Object.getPrototypeOf(t);return!r||r.isPrototypeOf(Object)}function Ke(t){if(pi(t))return String(t);if(_i(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return Ke(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function Gr(){if(typeof Gt.Buffer>"u")throw new TypeError("[unstorage] Buffer is not supported!")}const er="base64:";function mi(t){if(typeof t=="string")return t;Gr();const r=Gt.Buffer.from(t).toString("base64");return er+r}function xi(t){return typeof t!="string"||!t.startsWith(er)?t:(Gr(),Gt.Buffer.from(t.slice(er.length),"base64"))}function Dt(t){return t?t.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function wi(...t){return Dt(t.join(":"))}function De(t){return t=Dt(t),t?t+":":""}const vi="memory",Si=()=>{const t=new Map;return{name:vi,getInstance:()=>t,hasItem(r){return t.has(r)},getItem(r){return t.get(r)??null},getItemRaw(r){return t.get(r)??null},setItem(r,n){t.set(r,n)},setItemRaw(r,n){t.set(r,n)},removeItem(r){t.delete(r)},getKeys(){return[...t.keys()]},clear(){t.clear()},dispose(){t.clear()}}};function Ei(t={}){const r={mounts:{"":t.driver||Si()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},n=s=>{for(const u of r.mountpoints)if(s.startsWith(u))return{base:u,relativeKey:s.slice(u.length),driver:r.mounts[u]};return{base:"",relativeKey:s,driver:r.mounts[""]}},c=(s,u)=>r.mountpoints.filter(y=>y.startsWith(s)||u&&s.startsWith(y)).map(y=>({relativeBase:s.length>y.length?s.slice(y.length):void 0,mountpoint:y,driver:r.mounts[y]})),o=(s,u)=>{if(r.watching){u=Dt(u);for(const y of r.watchListeners)y(s,u)}},h=async()=>{if(!r.watching){r.watching=!0;for(const s in r.mounts)r.unwatch[s]=await wr(r.mounts[s],o,s)}},E=async()=>{if(r.watching){for(const s in r.unwatch)await r.unwatch[s]();r.unwatch={},r.watching=!1}},S=(s,u,y)=>{const v=new Map,w=x=>{let N=v.get(x.base);return N||(N={driver:x.driver,base:x.base,items:[]},v.set(x.base,N)),N};for(const x of s){const N=typeof x=="string",H=Dt(N?x:x.key),ct=N?void 0:x.value,M=N||!x.options?u:{...u,...x.options},Tt=n(H);w(Tt).items.push({key:H,value:ct,relativeKey:Tt.relativeKey,options:M})}return Promise.all([...v.values()].map(x=>y(x))).then(x=>x.flat())},g={hasItem(s,u={}){s=Dt(s);const{relativeKey:y,driver:v}=n(s);return Ot(v.hasItem,y,u)},getItem(s,u={}){s=Dt(s);const{relativeKey:y,driver:v}=n(s);return Ot(v.getItem,y,u).then(w=>Be(w))},getItems(s,u){return S(s,u,y=>y.driver.getItems?Ot(y.driver.getItems,y.items.map(v=>({key:v.relativeKey,options:v.options})),u).then(v=>v.map(w=>({key:wi(y.base,w.key),value:Be(w.value)}))):Promise.all(y.items.map(v=>Ot(y.driver.getItem,v.relativeKey,v.options).then(w=>({key:v.key,value:Be(w)})))))},getItemRaw(s,u={}){s=Dt(s);const{relativeKey:y,driver:v}=n(s);return v.getItemRaw?Ot(v.getItemRaw,y,u):Ot(v.getItem,y,u).then(w=>xi(w))},async setItem(s,u,y={}){if(u===void 0)return g.removeItem(s);s=Dt(s);const{relativeKey:v,driver:w}=n(s);w.setItem&&(await Ot(w.setItem,v,Ke(u),y),w.watch||o("update",s))},async setItems(s,u){await S(s,u,async y=>{if(y.driver.setItems)return Ot(y.driver.setItems,y.items.map(v=>({key:v.relativeKey,value:Ke(v.value),options:v.options})),u);y.driver.setItem&&await Promise.all(y.items.map(v=>Ot(y.driver.setItem,v.relativeKey,Ke(v.value),v.options)))})},async setItemRaw(s,u,y={}){if(u===void 0)return g.removeItem(s,y);s=Dt(s);const{relativeKey:v,driver:w}=n(s);if(w.setItemRaw)await Ot(w.setItemRaw,v,u,y);else if(w.setItem)await Ot(w.setItem,v,mi(u),y);else return;w.watch||o("update",s)},async removeItem(s,u={}){typeof u=="boolean"&&(u={removeMeta:u}),s=Dt(s);const{relativeKey:y,driver:v}=n(s);v.removeItem&&(await Ot(v.removeItem,y,u),(u.removeMeta||u.removeMata)&&await Ot(v.removeItem,y+"$",u),v.watch||o("remove",s))},async getMeta(s,u={}){typeof u=="boolean"&&(u={nativeOnly:u}),s=Dt(s);const{relativeKey:y,driver:v}=n(s),w=Object.create(null);if(v.getMeta&&Object.assign(w,await Ot(v.getMeta,y,u)),!u.nativeOnly){const x=await Ot(v.getItem,y+"$",u).then(N=>Be(N));x&&typeof x=="object"&&(typeof x.atime=="string"&&(x.atime=new Date(x.atime)),typeof x.mtime=="string"&&(x.mtime=new Date(x.mtime)),Object.assign(w,x))}return w},setMeta(s,u,y={}){return this.setItem(s+"$",u,y)},removeMeta(s,u={}){return this.removeItem(s+"$",u)},async getKeys(s,u={}){s=De(s);const y=c(s,!0);let v=[];const w=[];for(const x of y){const N=await Ot(x.driver.getKeys,x.relativeBase,u);for(const H of N){const ct=x.mountpoint+Dt(H);v.some(M=>ct.startsWith(M))||w.push(ct)}v=[x.mountpoint,...v.filter(H=>!H.startsWith(x.mountpoint))]}return s?w.filter(x=>x.startsWith(s)&&x[x.length-1]!=="$"):w.filter(x=>x[x.length-1]!=="$")},async clear(s,u={}){s=De(s),await Promise.all(c(s,!1).map(async y=>{if(y.driver.clear)return Ot(y.driver.clear,y.relativeBase,u);if(y.driver.removeItem){const v=await y.driver.getKeys(y.relativeBase||"",u);return Promise.all(v.map(w=>y.driver.removeItem(w,u)))}}))},async dispose(){await Promise.all(Object.values(r.mounts).map(s=>vr(s)))},async watch(s){return await h(),r.watchListeners.push(s),async()=>{r.watchListeners=r.watchListeners.filter(u=>u!==s),r.watchListeners.length===0&&await E()}},async unwatch(){r.watchListeners=[],await E()},mount(s,u){if(s=De(s),s&&r.mounts[s])throw new Error(`already mounted at ${s}`);return s&&(r.mountpoints.push(s),r.mountpoints.sort((y,v)=>v.length-y.length)),r.mounts[s]=u,r.watching&&Promise.resolve(wr(u,o,s)).then(y=>{r.unwatch[s]=y}).catch(console.error),g},async unmount(s,u=!0){s=De(s),!(!s||!r.mounts[s])&&(r.watching&&s in r.unwatch&&(r.unwatch[s](),delete r.unwatch[s]),u&&await vr(r.mounts[s]),r.mountpoints=r.mountpoints.filter(y=>y!==s),delete r.mounts[s])},getMount(s=""){s=Dt(s)+":";const u=n(s);return{driver:u.driver,base:u.base}},getMounts(s="",u={}){return s=Dt(s),c(s,u.parents).map(v=>({driver:v.driver,base:v.mountpoint}))},keys:(s,u={})=>g.getKeys(s,u),get:(s,u={})=>g.getItem(s,u),set:(s,u,y={})=>g.setItem(s,u,y),has:(s,u={})=>g.hasItem(s,u),del:(s,u={})=>g.removeItem(s,u),remove:(s,u={})=>g.removeItem(s,u)};return g}function wr(t,r,n){return t.watch?t.watch((c,o)=>r(c,n+o)):()=>{}}async function vr(t){typeof t.dispose=="function"&&await Ot(t.dispose)}function de(t){return new Promise((r,n)=>{t.oncomplete=t.onsuccess=()=>r(t.result),t.onabort=t.onerror=()=>n(t.error)})}function Jr(t,r){const n=indexedDB.open(t);n.onupgradeneeded=()=>n.result.createObjectStore(r);const c=de(n);return(o,h)=>c.then(E=>h(E.transaction(r,o).objectStore(r)))}let Ze;function Le(){return Ze||(Ze=Jr("keyval-store","keyval")),Ze}function Sr(t,r=Le()){return r("readonly",n=>de(n.get(t)))}function Ii(t,r,n=Le()){return n("readwrite",c=>(c.put(r,t),de(c.transaction)))}function Oi(t,r=Le()){return r("readwrite",n=>(n.delete(t),de(n.transaction)))}function Ti(t=Le()){return t("readwrite",r=>(r.clear(),de(r.transaction)))}function Li(t,r){return t.openCursor().onsuccess=function(){this.result&&(r(this.result),this.result.continue())},de(t.transaction)}function Ai(t=Le()){return t("readonly",r=>{if(r.getAllKeys)return de(r.getAllKeys());const n=[];return Li(r,c=>n.push(c.key)).then(()=>n)})}const Ri=t=>JSON.stringify(t,(r,n)=>typeof n=="bigint"?n.toString()+"n":n),Pi=t=>{const r=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,n=t.replace(r,'$1"$2n"$3');return JSON.parse(n,(c,o)=>typeof o=="string"&&o.match(/^\d+n$/)?BigInt(o.substring(0,o.length-1)):o)};function kr(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return Pi(t)}catch{return t}}function Wr(t){return typeof t=="string"?t:Ri(t)||""}const Ci="idb-keyval";var ji=(t={})=>{const r=t.base&&t.base.length>0?`${t.base}:`:"",n=o=>r+o;let c;return t.dbName&&t.storeName&&(c=Jr(t.dbName,t.storeName)),{name:Ci,options:t,async hasItem(o){return!(typeof await Sr(n(o),c)>"u")},async getItem(o){return await Sr(n(o),c)??null},setItem(o,h){return Ii(n(o),h,c)},removeItem(o){return Oi(n(o),c)},getKeys(){return Ai(c)},clear(){return Ti(c)}}};const Ni="WALLET_CONNECT_V2_INDEXED_DB",Mi="keyvaluestorage";let zi=class{constructor(){this.indexedDb=Ei({driver:ji({dbName:Ni,storeName:Mi})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(r=>[r.key,r.value])}async getItem(r){const n=await this.indexedDb.getItem(r);if(n!==null)return n}async setItem(r,n){await this.indexedDb.setItem(r,Wr(n))}async removeItem(r){await this.indexedDb.removeItem(r)}};var Qe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof Gt.global<"u"?Gt.global:typeof self<"u"?self:{},Ue={exports:{}};(function(){let t;function r(){}t=r,t.prototype.getItem=function(n){return this.hasOwnProperty(n)?String(this[n]):null},t.prototype.setItem=function(n,c){this[n]=String(c)},t.prototype.removeItem=function(n){delete this[n]},t.prototype.clear=function(){const n=this;Object.keys(n).forEach(function(c){n[c]=void 0,delete n[c]})},t.prototype.key=function(n){return n=n||0,Object.keys(this)[n]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof Qe<"u"&&Qe.localStorage?Ue.exports=Qe.localStorage:typeof window<"u"&&window.localStorage?Ue.exports=window.localStorage:Ue.exports=new r})();function Bi(t){var r;return[t[0],kr((r=t[1])!=null?r:"")]}class Di{constructor(){this.localStorage=Ue.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(Bi)}async getItem(r){const n=this.localStorage.getItem(r);if(n!==null)return kr(n)}async setItem(r,n){this.localStorage.setItem(r,Wr(n))}async removeItem(r){this.localStorage.removeItem(r)}}const $i="wc_storage_version",Er=1,Ki=async(t,r,n)=>{const c=$i,o=await r.getItem(c);if(o&&o>=Er){n(r);return}const h=await t.getKeys();if(!h.length){n(r);return}const E=[];for(;h.length;){const S=h.shift();if(!S)continue;const g=S.toLowerCase();if(g.includes("wc@")||g.includes("walletconnect")||g.includes("wc_")||g.includes("wallet_connect")){const s=await t.getItem(S);await r.setItem(S,s),E.push(S)}}await r.setItem(c,Er),n(r),Ui(t,E)},Ui=async(t,r)=>{r.length&&r.forEach(async n=>{await t.removeItem(n)})};let Mo=class{constructor(){this.initialized=!1,this.setInitialized=n=>{this.storage=n,this.initialized=!0};const r=new Di;this.storage=r;try{const n=new zi;Ki(r,n,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(r){return await this.initialize(),this.storage.getItem(r)}async setItem(r,n){return await this.initialize(),this.storage.setItem(r,n)}async removeItem(r){return await this.initialize(),this.storage.removeItem(r)}async initialize(){this.initialized||await new Promise(r=>{const n=setInterval(()=>{this.initialized&&(clearInterval(n),r())},20)})}};class Bo{}function Hi(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var Fi=Gi;function Gi(t,r,n){var c=n&&n.stringify||Hi,o=1;if(typeof t=="object"&&t!==null){var h=r.length+o;if(h===1)return t;var E=new Array(h);E[0]=c(t);for(var S=1;S<h;S++)E[S]=c(r[S]);return E.join(" ")}if(typeof t!="string")return t;var g=r.length;if(g===0)return t;for(var s="",u=1-o,y=-1,v=t&&t.length||0,w=0;w<v;){if(t.charCodeAt(w)===37&&w+1<v){switch(y=y>-1?y:0,t.charCodeAt(w+1)){case 100:case 102:if(u>=g||r[u]==null)break;y<w&&(s+=t.slice(y,w)),s+=Number(r[u]),y=w+2,w++;break;case 105:if(u>=g||r[u]==null)break;y<w&&(s+=t.slice(y,w)),s+=Math.floor(Number(r[u])),y=w+2,w++;break;case 79:case 111:case 106:if(u>=g||r[u]===void 0)break;y<w&&(s+=t.slice(y,w));var x=typeof r[u];if(x==="string"){s+="'"+r[u]+"'",y=w+2,w++;break}if(x==="function"){s+=r[u].name||"<anonymous>",y=w+2,w++;break}s+=c(r[u]),y=w+2,w++;break;case 115:if(u>=g)break;y<w&&(s+=t.slice(y,w)),s+=String(r[u]),y=w+2,w++;break;case 37:y<w&&(s+=t.slice(y,w)),s+="%",y=w+2,w++,u--;break}++u}++w}return y===-1?t:(y<v&&(s+=t.slice(y)),s)}const Ir=Fi;var _e=Qt;const Ie=ts().console||{},Ji={mapHttpRequest:$e,mapHttpResponse:$e,wrapRequestSerializer:tr,wrapResponseSerializer:tr,wrapErrorSerializer:tr,req:$e,res:$e,err:Yi};function ki(t,r){return Array.isArray(t)?t.filter(function(c){return c!=="!stdSerializers.err"}):t===!0?Object.keys(r):!1}function Qt(t){t=t||{},t.browser=t.browser||{};const r=t.browser.transmit;if(r&&typeof r.send!="function")throw Error("pino: transmit option must have a send function");const n=t.browser.write||Ie;t.browser.write&&(t.browser.asObject=!0);const c=t.serializers||{},o=ki(t.browser.serialize,c);let h=t.browser.serialize;Array.isArray(t.browser.serialize)&&t.browser.serialize.indexOf("!stdSerializers.err")>-1&&(h=!1);const E=["error","fatal","warn","info","debug","trace"];typeof n=="function"&&(n.error=n.fatal=n.warn=n.info=n.debug=n.trace=n),t.enabled===!1&&(t.level="silent");const S=t.level||"info",g=Object.create(n);g.log||(g.log=Oe),Object.defineProperty(g,"levelVal",{get:u}),Object.defineProperty(g,"level",{get:y,set:v});const s={transmit:r,serialize:o,asObject:t.browser.asObject,levels:E,timestamp:qi(t)};g.levels=Qt.levels,g.level=S,g.setMaxListeners=g.getMaxListeners=g.emit=g.addListener=g.on=g.prependListener=g.once=g.prependOnceListener=g.removeListener=g.removeAllListeners=g.listeners=g.listenerCount=g.eventNames=g.write=g.flush=Oe,g.serializers=c,g._serialize=o,g._stdErrSerialize=h,g.child=w,r&&(g._logEvent=rr());function u(){return this.level==="silent"?1/0:this.levels.values[this.level]}function y(){return this._level}function v(x){if(x!=="silent"&&!this.levels.values[x])throw Error("unknown level "+x);this._level=x,ye(s,g,"error","log"),ye(s,g,"fatal","error"),ye(s,g,"warn","error"),ye(s,g,"info","log"),ye(s,g,"debug","log"),ye(s,g,"trace","log")}function w(x,N){if(!x)throw new Error("missing bindings for child Pino");N=N||{},o&&x.serializers&&(N.serializers=x.serializers);const H=N.serializers;if(o&&H){var ct=Object.assign({},c,H),M=t.browser.serialize===!0?Object.keys(ct):o;delete x.serializers,Ve([x],M,ct,this._stdErrSerialize)}function Tt(bt){this._childLevel=(bt._childLevel|0)+1,this.error=pe(bt,x,"error"),this.fatal=pe(bt,x,"fatal"),this.warn=pe(bt,x,"warn"),this.info=pe(bt,x,"info"),this.debug=pe(bt,x,"debug"),this.trace=pe(bt,x,"trace"),ct&&(this.serializers=ct,this._serialize=M),r&&(this._logEvent=rr([].concat(bt._logEvent.bindings,x)))}return Tt.prototype=this,new Tt(this)}return g}Qt.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}};Qt.stdSerializers=Ji;Qt.stdTimeFunctions=Object.assign({},{nullTime:Vr,epochTime:Xr,unixTime:Zi,isoTime:Qi});function ye(t,r,n,c){const o=Object.getPrototypeOf(r);r[n]=r.levelVal>r.levels.values[n]?Oe:o[n]?o[n]:Ie[n]||Ie[c]||Oe,Wi(t,r,n)}function Wi(t,r,n){!t.transmit&&r[n]===Oe||(r[n]=function(c){return function(){const h=t.timestamp(),E=new Array(arguments.length),S=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Ie?Ie:this;for(var g=0;g<E.length;g++)E[g]=arguments[g];if(t.serialize&&!t.asObject&&Ve(E,this._serialize,this.serializers,this._stdErrSerialize),t.asObject?c.call(S,Vi(this,n,E,h)):c.apply(S,E),t.transmit){const s=t.transmit.level||r.level,u=Qt.levels.values[s],y=Qt.levels.values[n];if(y<u)return;Xi(this,{ts:h,methodLevel:n,methodValue:y,transmitLevel:s,transmitValue:Qt.levels.values[t.transmit.level||r.level],send:t.transmit.send,val:r.levelVal},E)}}}(r[n]))}function Vi(t,r,n,c){t._serialize&&Ve(n,t._serialize,t.serializers,t._stdErrSerialize);const o=n.slice();let h=o[0];const E={};c&&(E.time=c),E.level=Qt.levels.values[r];let S=(t._childLevel|0)+1;if(S<1&&(S=1),h!==null&&typeof h=="object"){for(;S--&&typeof o[0]=="object";)Object.assign(E,o.shift());h=o.length?Ir(o.shift(),o):void 0}else typeof h=="string"&&(h=Ir(o.shift(),o));return h!==void 0&&(E.msg=h),E}function Ve(t,r,n,c){for(const o in t)if(c&&t[o]instanceof Error)t[o]=Qt.stdSerializers.err(t[o]);else if(typeof t[o]=="object"&&!Array.isArray(t[o]))for(const h in t[o])r&&r.indexOf(h)>-1&&h in n&&(t[o][h]=n[h](t[o][h]))}function pe(t,r,n){return function(){const c=new Array(1+arguments.length);c[0]=r;for(var o=1;o<c.length;o++)c[o]=arguments[o-1];return t[n].apply(this,c)}}function Xi(t,r,n){const c=r.send,o=r.ts,h=r.methodLevel,E=r.methodValue,S=r.val,g=t._logEvent.bindings;Ve(n,t._serialize||Object.keys(t.serializers),t.serializers,t._stdErrSerialize===void 0?!0:t._stdErrSerialize),t._logEvent.ts=o,t._logEvent.messages=n.filter(function(s){return g.indexOf(s)===-1}),t._logEvent.level.label=h,t._logEvent.level.value=E,c(h,t._logEvent,S),t._logEvent=rr(g)}function rr(t){return{ts:0,messages:[],bindings:t||[],level:{label:"",value:0}}}function Yi(t){const r={type:t.constructor.name,msg:t.message,stack:t.stack};for(const n in t)r[n]===void 0&&(r[n]=t[n]);return r}function qi(t){return typeof t.timestamp=="function"?t.timestamp:t.timestamp===!1?Vr:Xr}function $e(){return{}}function tr(t){return t}function Oe(){}function Vr(){return!1}function Xr(){return Date.now()}function Zi(){return Math.round(Date.now()/1e3)}function Qi(){return new Date(Date.now()).toISOString()}function ts(){function t(r){return typeof r<"u"&&r}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return t(self)||t(window)||t(this)||{}}}const Yr=Dr(_e),es=t=>JSON.stringify(t,(r,n)=>typeof n=="bigint"?n.toString()+"n":n);function Or(t){return typeof t=="string"?t:es(t)||""}const rs={level:"info"},Ae="custom_context",or=1e3*1024;class ns{constructor(r){this.nodeValue=r,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}}class Tr{constructor(r){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=r,this.sizeInBytes=0}append(r){const n=new ns(r);if(n.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${r} with size ${n.size}`);for(;this.size+n.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=n),this.tail=n):(this.head=n,this.tail=n),this.lengthInNodes++,this.sizeInBytes+=n.size}shift(){if(!this.head)return;const r=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=r.size}toArray(){const r=[];let n=this.head;for(;n!==null;)r.push(n.value),n=n.next;return r}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let r=this.head;return{next:()=>{if(!r)return{done:!0,value:null};const n=r.value;return r=r.next,{done:!1,value:n}}}}}class qr{constructor(r,n=or){this.level=r??"error",this.levelValue=_e.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=n,this.logs=new Tr(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(r,n){n===_e.levels.values.error?console.error(r):n===_e.levels.values.warn?console.warn(r):n===_e.levels.values.debug?console.debug(r):n===_e.levels.values.trace?console.trace(r):console.log(r)}appendToLogs(r){this.logs.append(Or({timestamp:new Date().toISOString(),log:r}));const n=typeof r=="string"?JSON.parse(r).level:r.level;n>=this.levelValue&&this.forwardToConsole(r,n)}getLogs(){return this.logs}clearLogs(){this.logs=new Tr(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(r){const n=this.getLogArray();return n.push(Or({extraMetadata:r})),new Blob(n,{type:"application/json"})}}class is{constructor(r,n=or){this.baseChunkLogger=new qr(r,n)}write(r){this.baseChunkLogger.appendToLogs(r)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(r){return this.baseChunkLogger.logsToBlob(r)}downloadLogsBlobInBrowser(r){const n=URL.createObjectURL(this.logsToBlob(r)),c=document.createElement("a");c.href=n,c.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(c),c.click(),document.body.removeChild(c),URL.revokeObjectURL(n)}}class ss{constructor(r,n=or){this.baseChunkLogger=new qr(r,n)}write(r){this.baseChunkLogger.appendToLogs(r)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(r){return this.baseChunkLogger.logsToBlob(r)}}var os=Object.defineProperty,as=Object.defineProperties,fs=Object.getOwnPropertyDescriptors,Lr=Object.getOwnPropertySymbols,cs=Object.prototype.hasOwnProperty,us=Object.prototype.propertyIsEnumerable,Ar=(t,r,n)=>r in t?os(t,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[r]=n,He=(t,r)=>{for(var n in r||(r={}))cs.call(r,n)&&Ar(t,n,r[n]);if(Lr)for(var n of Lr(r))us.call(r,n)&&Ar(t,n,r[n]);return t},Fe=(t,r)=>as(t,fs(r));function Do(t){return Fe(He({},t),{level:(t==null?void 0:t.level)||rs.level})}function ls(t,r=Ae){return t[r]||""}function hs(t,r,n=Ae){return t[n]=r,t}function ds(t,r=Ae){let n="";return typeof t.bindings>"u"?n=ls(t,r):n=t.bindings().context||"",n}function bs(t,r,n=Ae){const c=ds(t,n);return c.trim()?`${c}/${r}`:r}function $o(t,r,n=Ae){const c=bs(t,r,n),o=t.child({context:c});return hs(o,c,n)}function gs(t){var r,n;const c=new is((r=t.opts)==null?void 0:r.level,t.maxSizeInBytes);return{logger:Yr(Fe(He({},t.opts),{level:"trace",browser:Fe(He({},(n=t.opts)==null?void 0:n.browser),{write:o=>c.write(o)})})),chunkLoggerController:c}}function ys(t){var r;const n=new ss((r=t.opts)==null?void 0:r.level,t.maxSizeInBytes);return{logger:Yr(Fe(He({},t.opts),{level:"trace"}),n),chunkLoggerController:n}}function Ko(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?gs(t):ys(t)}var ar={},Zr={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});var r=ai,n=$r;t.DIGEST_LENGTH=64,t.BLOCK_SIZE=128;var c=function(){function S(){this.digestLength=t.DIGEST_LENGTH,this.blockSize=t.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return S.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},S.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},S.prototype.clean=function(){n.wipe(this._buffer),n.wipe(this._tempHi),n.wipe(this._tempLo),this.reset()},S.prototype.update=function(g,s){if(s===void 0&&(s=g.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var u=0;if(this._bytesHashed+=s,this._bufferLength>0){for(;this._bufferLength<t.BLOCK_SIZE&&s>0;)this._buffer[this._bufferLength++]=g[u++],s--;this._bufferLength===this.blockSize&&(h(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(s>=this.blockSize&&(u=h(this._tempHi,this._tempLo,this._stateHi,this._stateLo,g,u,s),s%=this.blockSize);s>0;)this._buffer[this._bufferLength++]=g[u++],s--;return this},S.prototype.finish=function(g){if(!this._finished){var s=this._bytesHashed,u=this._bufferLength,y=s/536870912|0,v=s<<3,w=s%128<112?128:256;this._buffer[u]=128;for(var x=u+1;x<w-8;x++)this._buffer[x]=0;r.writeUint32BE(y,this._buffer,w-8),r.writeUint32BE(v,this._buffer,w-4),h(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,w),this._finished=!0}for(var x=0;x<this.digestLength/8;x++)r.writeUint32BE(this._stateHi[x],g,x*8),r.writeUint32BE(this._stateLo[x],g,x*8+4);return this},S.prototype.digest=function(){var g=new Uint8Array(this.digestLength);return this.finish(g),g},S.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{stateHi:new Int32Array(this._stateHi),stateLo:new Int32Array(this._stateLo),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},S.prototype.restoreState=function(g){return this._stateHi.set(g.stateHi),this._stateLo.set(g.stateLo),this._bufferLength=g.bufferLength,g.buffer&&this._buffer.set(g.buffer),this._bytesHashed=g.bytesHashed,this._finished=!1,this},S.prototype.cleanSavedState=function(g){n.wipe(g.stateHi),n.wipe(g.stateLo),g.buffer&&n.wipe(g.buffer),g.bufferLength=0,g.bytesHashed=0},S}();t.SHA512=c;var o=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function h(S,g,s,u,y,v,w){for(var x=s[0],N=s[1],H=s[2],ct=s[3],M=s[4],Tt=s[5],bt=s[6],Ct=s[7],F=u[0],j=u[1],jt=u[2],te=u[3],gt=u[4],Jt=u[5],$t=u[6],Vt=u[7],m,_,X,ut,A,I,O,L;w>=128;){for(var Lt=0;Lt<16;Lt++){var et=8*Lt+v;S[Lt]=r.readUint32BE(y,et),g[Lt]=r.readUint32BE(y,et+4)}for(var Lt=0;Lt<80;Lt++){var xe=x,z=N,be=H,b=ct,d=M,l=Tt,e=bt,a=Ct,R=F,P=j,D=jt,$=te,B=gt,K=Jt,At=$t,lt=Vt;if(m=Ct,_=Vt,A=_&65535,I=_>>>16,O=m&65535,L=m>>>16,m=(M>>>14|gt<<18)^(M>>>18|gt<<14)^(gt>>>9|M<<23),_=(gt>>>14|M<<18)^(gt>>>18|M<<14)^(M>>>9|gt<<23),A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,m=M&Tt^~M&bt,_=gt&Jt^~gt&$t,A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,m=o[Lt*2],_=o[Lt*2+1],A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,m=S[Lt%16],_=g[Lt%16],A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,I+=A>>>16,O+=I>>>16,L+=O>>>16,X=O&65535|L<<16,ut=A&65535|I<<16,m=X,_=ut,A=_&65535,I=_>>>16,O=m&65535,L=m>>>16,m=(x>>>28|F<<4)^(F>>>2|x<<30)^(F>>>7|x<<25),_=(F>>>28|x<<4)^(x>>>2|F<<30)^(x>>>7|F<<25),A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,m=x&N^x&H^N&H,_=F&j^F&jt^j&jt,A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,I+=A>>>16,O+=I>>>16,L+=O>>>16,a=O&65535|L<<16,lt=A&65535|I<<16,m=b,_=$,A=_&65535,I=_>>>16,O=m&65535,L=m>>>16,m=X,_=ut,A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,I+=A>>>16,O+=I>>>16,L+=O>>>16,b=O&65535|L<<16,$=A&65535|I<<16,N=xe,H=z,ct=be,M=b,Tt=d,bt=l,Ct=e,x=a,j=R,jt=P,te=D,gt=$,Jt=B,$t=K,Vt=At,F=lt,Lt%16===15)for(var et=0;et<16;et++)m=S[et],_=g[et],A=_&65535,I=_>>>16,O=m&65535,L=m>>>16,m=S[(et+9)%16],_=g[(et+9)%16],A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,X=S[(et+1)%16],ut=g[(et+1)%16],m=(X>>>1|ut<<31)^(X>>>8|ut<<24)^X>>>7,_=(ut>>>1|X<<31)^(ut>>>8|X<<24)^(ut>>>7|X<<25),A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,X=S[(et+14)%16],ut=g[(et+14)%16],m=(X>>>19|ut<<13)^(ut>>>29|X<<3)^X>>>6,_=(ut>>>19|X<<13)^(X>>>29|ut<<3)^(ut>>>6|X<<26),A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,I+=A>>>16,O+=I>>>16,L+=O>>>16,S[et]=O&65535|L<<16,g[et]=A&65535|I<<16}m=x,_=F,A=_&65535,I=_>>>16,O=m&65535,L=m>>>16,m=s[0],_=u[0],A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,I+=A>>>16,O+=I>>>16,L+=O>>>16,s[0]=x=O&65535|L<<16,u[0]=F=A&65535|I<<16,m=N,_=j,A=_&65535,I=_>>>16,O=m&65535,L=m>>>16,m=s[1],_=u[1],A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,I+=A>>>16,O+=I>>>16,L+=O>>>16,s[1]=N=O&65535|L<<16,u[1]=j=A&65535|I<<16,m=H,_=jt,A=_&65535,I=_>>>16,O=m&65535,L=m>>>16,m=s[2],_=u[2],A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,I+=A>>>16,O+=I>>>16,L+=O>>>16,s[2]=H=O&65535|L<<16,u[2]=jt=A&65535|I<<16,m=ct,_=te,A=_&65535,I=_>>>16,O=m&65535,L=m>>>16,m=s[3],_=u[3],A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,I+=A>>>16,O+=I>>>16,L+=O>>>16,s[3]=ct=O&65535|L<<16,u[3]=te=A&65535|I<<16,m=M,_=gt,A=_&65535,I=_>>>16,O=m&65535,L=m>>>16,m=s[4],_=u[4],A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,I+=A>>>16,O+=I>>>16,L+=O>>>16,s[4]=M=O&65535|L<<16,u[4]=gt=A&65535|I<<16,m=Tt,_=Jt,A=_&65535,I=_>>>16,O=m&65535,L=m>>>16,m=s[5],_=u[5],A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,I+=A>>>16,O+=I>>>16,L+=O>>>16,s[5]=Tt=O&65535|L<<16,u[5]=Jt=A&65535|I<<16,m=bt,_=$t,A=_&65535,I=_>>>16,O=m&65535,L=m>>>16,m=s[6],_=u[6],A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,I+=A>>>16,O+=I>>>16,L+=O>>>16,s[6]=bt=O&65535|L<<16,u[6]=$t=A&65535|I<<16,m=Ct,_=Vt,A=_&65535,I=_>>>16,O=m&65535,L=m>>>16,m=s[7],_=u[7],A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,I+=A>>>16,O+=I>>>16,L+=O>>>16,s[7]=Ct=O&65535|L<<16,u[7]=Vt=A&65535|I<<16,v+=128,w-=128}return v}function E(S){var g=new c;g.update(S);var s=g.digest();return g.clean(),s}t.hash=E})(Zr);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertSecretKeyToX25519=t.convertPublicKeyToX25519=t.verify=t.sign=t.extractPublicKeyFromSecretKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.SEED_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=t.SIGNATURE_LENGTH=void 0;const r=Kr,n=Zr,c=$r;t.SIGNATURE_LENGTH=64,t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=64,t.SEED_LENGTH=32;function o(b){const d=new Float64Array(16);if(b)for(let l=0;l<b.length;l++)d[l]=b[l];return d}const h=new Uint8Array(32);h[0]=9;const E=o(),S=o([1]),g=o([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),s=o([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),u=o([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),y=o([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),v=o([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function w(b,d){for(let l=0;l<16;l++)b[l]=d[l]|0}function x(b){let d=1;for(let l=0;l<16;l++){let e=b[l]+d+65535;d=Math.floor(e/65536),b[l]=e-d*65536}b[0]+=d-1+37*(d-1)}function N(b,d,l){const e=~(l-1);for(let a=0;a<16;a++){const R=e&(b[a]^d[a]);b[a]^=R,d[a]^=R}}function H(b,d){const l=o(),e=o();for(let a=0;a<16;a++)e[a]=d[a];x(e),x(e),x(e);for(let a=0;a<2;a++){l[0]=e[0]-65517;for(let P=1;P<15;P++)l[P]=e[P]-65535-(l[P-1]>>16&1),l[P-1]&=65535;l[15]=e[15]-32767-(l[14]>>16&1);const R=l[15]>>16&1;l[14]&=65535,N(e,l,1-R)}for(let a=0;a<16;a++)b[2*a]=e[a]&255,b[2*a+1]=e[a]>>8}function ct(b,d){let l=0;for(let e=0;e<32;e++)l|=b[e]^d[e];return(1&l-1>>>8)-1}function M(b,d){const l=new Uint8Array(32),e=new Uint8Array(32);return H(l,b),H(e,d),ct(l,e)}function Tt(b){const d=new Uint8Array(32);return H(d,b),d[0]&1}function bt(b,d){for(let l=0;l<16;l++)b[l]=d[2*l]+(d[2*l+1]<<8);b[15]&=32767}function Ct(b,d,l){for(let e=0;e<16;e++)b[e]=d[e]+l[e]}function F(b,d,l){for(let e=0;e<16;e++)b[e]=d[e]-l[e]}function j(b,d,l){let e,a,R=0,P=0,D=0,$=0,B=0,K=0,At=0,lt=0,Rt=0,yt=0,ht=0,rt=0,tt=0,Y=0,W=0,U=0,nt=0,pt=0,G=0,Nt=0,zt=0,Kt=0,Ut=0,Bt=0,Xt=0,qt=0,se=0,Ht=0,ce=0,we=0,Re=0,it=l[0],q=l[1],st=l[2],ot=l[3],at=l[4],Z=l[5],_t=l[6],mt=l[7],xt=l[8],wt=l[9],vt=l[10],dt=l[11],ft=l[12],k=l[13],St=l[14],Et=l[15];e=d[0],R+=e*it,P+=e*q,D+=e*st,$+=e*ot,B+=e*at,K+=e*Z,At+=e*_t,lt+=e*mt,Rt+=e*xt,yt+=e*wt,ht+=e*vt,rt+=e*dt,tt+=e*ft,Y+=e*k,W+=e*St,U+=e*Et,e=d[1],P+=e*it,D+=e*q,$+=e*st,B+=e*ot,K+=e*at,At+=e*Z,lt+=e*_t,Rt+=e*mt,yt+=e*xt,ht+=e*wt,rt+=e*vt,tt+=e*dt,Y+=e*ft,W+=e*k,U+=e*St,nt+=e*Et,e=d[2],D+=e*it,$+=e*q,B+=e*st,K+=e*ot,At+=e*at,lt+=e*Z,Rt+=e*_t,yt+=e*mt,ht+=e*xt,rt+=e*wt,tt+=e*vt,Y+=e*dt,W+=e*ft,U+=e*k,nt+=e*St,pt+=e*Et,e=d[3],$+=e*it,B+=e*q,K+=e*st,At+=e*ot,lt+=e*at,Rt+=e*Z,yt+=e*_t,ht+=e*mt,rt+=e*xt,tt+=e*wt,Y+=e*vt,W+=e*dt,U+=e*ft,nt+=e*k,pt+=e*St,G+=e*Et,e=d[4],B+=e*it,K+=e*q,At+=e*st,lt+=e*ot,Rt+=e*at,yt+=e*Z,ht+=e*_t,rt+=e*mt,tt+=e*xt,Y+=e*wt,W+=e*vt,U+=e*dt,nt+=e*ft,pt+=e*k,G+=e*St,Nt+=e*Et,e=d[5],K+=e*it,At+=e*q,lt+=e*st,Rt+=e*ot,yt+=e*at,ht+=e*Z,rt+=e*_t,tt+=e*mt,Y+=e*xt,W+=e*wt,U+=e*vt,nt+=e*dt,pt+=e*ft,G+=e*k,Nt+=e*St,zt+=e*Et,e=d[6],At+=e*it,lt+=e*q,Rt+=e*st,yt+=e*ot,ht+=e*at,rt+=e*Z,tt+=e*_t,Y+=e*mt,W+=e*xt,U+=e*wt,nt+=e*vt,pt+=e*dt,G+=e*ft,Nt+=e*k,zt+=e*St,Kt+=e*Et,e=d[7],lt+=e*it,Rt+=e*q,yt+=e*st,ht+=e*ot,rt+=e*at,tt+=e*Z,Y+=e*_t,W+=e*mt,U+=e*xt,nt+=e*wt,pt+=e*vt,G+=e*dt,Nt+=e*ft,zt+=e*k,Kt+=e*St,Ut+=e*Et,e=d[8],Rt+=e*it,yt+=e*q,ht+=e*st,rt+=e*ot,tt+=e*at,Y+=e*Z,W+=e*_t,U+=e*mt,nt+=e*xt,pt+=e*wt,G+=e*vt,Nt+=e*dt,zt+=e*ft,Kt+=e*k,Ut+=e*St,Bt+=e*Et,e=d[9],yt+=e*it,ht+=e*q,rt+=e*st,tt+=e*ot,Y+=e*at,W+=e*Z,U+=e*_t,nt+=e*mt,pt+=e*xt,G+=e*wt,Nt+=e*vt,zt+=e*dt,Kt+=e*ft,Ut+=e*k,Bt+=e*St,Xt+=e*Et,e=d[10],ht+=e*it,rt+=e*q,tt+=e*st,Y+=e*ot,W+=e*at,U+=e*Z,nt+=e*_t,pt+=e*mt,G+=e*xt,Nt+=e*wt,zt+=e*vt,Kt+=e*dt,Ut+=e*ft,Bt+=e*k,Xt+=e*St,qt+=e*Et,e=d[11],rt+=e*it,tt+=e*q,Y+=e*st,W+=e*ot,U+=e*at,nt+=e*Z,pt+=e*_t,G+=e*mt,Nt+=e*xt,zt+=e*wt,Kt+=e*vt,Ut+=e*dt,Bt+=e*ft,Xt+=e*k,qt+=e*St,se+=e*Et,e=d[12],tt+=e*it,Y+=e*q,W+=e*st,U+=e*ot,nt+=e*at,pt+=e*Z,G+=e*_t,Nt+=e*mt,zt+=e*xt,Kt+=e*wt,Ut+=e*vt,Bt+=e*dt,Xt+=e*ft,qt+=e*k,se+=e*St,Ht+=e*Et,e=d[13],Y+=e*it,W+=e*q,U+=e*st,nt+=e*ot,pt+=e*at,G+=e*Z,Nt+=e*_t,zt+=e*mt,Kt+=e*xt,Ut+=e*wt,Bt+=e*vt,Xt+=e*dt,qt+=e*ft,se+=e*k,Ht+=e*St,ce+=e*Et,e=d[14],W+=e*it,U+=e*q,nt+=e*st,pt+=e*ot,G+=e*at,Nt+=e*Z,zt+=e*_t,Kt+=e*mt,Ut+=e*xt,Bt+=e*wt,Xt+=e*vt,qt+=e*dt,se+=e*ft,Ht+=e*k,ce+=e*St,we+=e*Et,e=d[15],U+=e*it,nt+=e*q,pt+=e*st,G+=e*ot,Nt+=e*at,zt+=e*Z,Kt+=e*_t,Ut+=e*mt,Bt+=e*xt,Xt+=e*wt,qt+=e*vt,se+=e*dt,Ht+=e*ft,ce+=e*k,we+=e*St,Re+=e*Et,R+=38*nt,P+=38*pt,D+=38*G,$+=38*Nt,B+=38*zt,K+=38*Kt,At+=38*Ut,lt+=38*Bt,Rt+=38*Xt,yt+=38*qt,ht+=38*se,rt+=38*Ht,tt+=38*ce,Y+=38*we,W+=38*Re,a=1,e=R+a+65535,a=Math.floor(e/65536),R=e-a*65536,e=P+a+65535,a=Math.floor(e/65536),P=e-a*65536,e=D+a+65535,a=Math.floor(e/65536),D=e-a*65536,e=$+a+65535,a=Math.floor(e/65536),$=e-a*65536,e=B+a+65535,a=Math.floor(e/65536),B=e-a*65536,e=K+a+65535,a=Math.floor(e/65536),K=e-a*65536,e=At+a+65535,a=Math.floor(e/65536),At=e-a*65536,e=lt+a+65535,a=Math.floor(e/65536),lt=e-a*65536,e=Rt+a+65535,a=Math.floor(e/65536),Rt=e-a*65536,e=yt+a+65535,a=Math.floor(e/65536),yt=e-a*65536,e=ht+a+65535,a=Math.floor(e/65536),ht=e-a*65536,e=rt+a+65535,a=Math.floor(e/65536),rt=e-a*65536,e=tt+a+65535,a=Math.floor(e/65536),tt=e-a*65536,e=Y+a+65535,a=Math.floor(e/65536),Y=e-a*65536,e=W+a+65535,a=Math.floor(e/65536),W=e-a*65536,e=U+a+65535,a=Math.floor(e/65536),U=e-a*65536,R+=a-1+37*(a-1),a=1,e=R+a+65535,a=Math.floor(e/65536),R=e-a*65536,e=P+a+65535,a=Math.floor(e/65536),P=e-a*65536,e=D+a+65535,a=Math.floor(e/65536),D=e-a*65536,e=$+a+65535,a=Math.floor(e/65536),$=e-a*65536,e=B+a+65535,a=Math.floor(e/65536),B=e-a*65536,e=K+a+65535,a=Math.floor(e/65536),K=e-a*65536,e=At+a+65535,a=Math.floor(e/65536),At=e-a*65536,e=lt+a+65535,a=Math.floor(e/65536),lt=e-a*65536,e=Rt+a+65535,a=Math.floor(e/65536),Rt=e-a*65536,e=yt+a+65535,a=Math.floor(e/65536),yt=e-a*65536,e=ht+a+65535,a=Math.floor(e/65536),ht=e-a*65536,e=rt+a+65535,a=Math.floor(e/65536),rt=e-a*65536,e=tt+a+65535,a=Math.floor(e/65536),tt=e-a*65536,e=Y+a+65535,a=Math.floor(e/65536),Y=e-a*65536,e=W+a+65535,a=Math.floor(e/65536),W=e-a*65536,e=U+a+65535,a=Math.floor(e/65536),U=e-a*65536,R+=a-1+37*(a-1),b[0]=R,b[1]=P,b[2]=D,b[3]=$,b[4]=B,b[5]=K,b[6]=At,b[7]=lt,b[8]=Rt,b[9]=yt,b[10]=ht,b[11]=rt,b[12]=tt,b[13]=Y,b[14]=W,b[15]=U}function jt(b,d){j(b,d,d)}function te(b,d){const l=o();let e;for(e=0;e<16;e++)l[e]=d[e];for(e=253;e>=0;e--)jt(l,l),e!==2&&e!==4&&j(l,l,d);for(e=0;e<16;e++)b[e]=l[e]}function gt(b,d){const l=o();let e;for(e=0;e<16;e++)l[e]=d[e];for(e=250;e>=0;e--)jt(l,l),e!==1&&j(l,l,d);for(e=0;e<16;e++)b[e]=l[e]}function Jt(b,d){const l=o(),e=o(),a=o(),R=o(),P=o(),D=o(),$=o(),B=o(),K=o();F(l,b[1],b[0]),F(K,d[1],d[0]),j(l,l,K),Ct(e,b[0],b[1]),Ct(K,d[0],d[1]),j(e,e,K),j(a,b[3],d[3]),j(a,a,s),j(R,b[2],d[2]),Ct(R,R,R),F(P,e,l),F(D,R,a),Ct($,R,a),Ct(B,e,l),j(b[0],P,D),j(b[1],B,$),j(b[2],$,D),j(b[3],P,B)}function $t(b,d,l){for(let e=0;e<4;e++)N(b[e],d[e],l)}function Vt(b,d){const l=o(),e=o(),a=o();te(a,d[2]),j(l,d[0],a),j(e,d[1],a),H(b,e),b[31]^=Tt(l)<<7}function m(b,d,l){w(b[0],E),w(b[1],S),w(b[2],S),w(b[3],E);for(let e=255;e>=0;--e){const a=l[e/8|0]>>(e&7)&1;$t(b,d,a),Jt(d,b),Jt(b,b),$t(b,d,a)}}function _(b,d){const l=[o(),o(),o(),o()];w(l[0],u),w(l[1],y),w(l[2],S),j(l[3],u,y),m(b,l,d)}function X(b){if(b.length!==t.SEED_LENGTH)throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`);const d=(0,n.hash)(b);d[0]&=248,d[31]&=127,d[31]|=64;const l=new Uint8Array(32),e=[o(),o(),o(),o()];_(e,d),Vt(l,e);const a=new Uint8Array(64);return a.set(b),a.set(l,32),{publicKey:l,secretKey:a}}t.generateKeyPairFromSeed=X;function ut(b){const d=(0,r.randomBytes)(32,b),l=X(d);return(0,c.wipe)(d),l}t.generateKeyPair=ut;function A(b){if(b.length!==t.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(b.subarray(32))}t.extractPublicKeyFromSecretKey=A;const I=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function O(b,d){let l,e,a,R;for(e=63;e>=32;--e){for(l=0,a=e-32,R=e-12;a<R;++a)d[a]+=l-16*d[e]*I[a-(e-32)],l=Math.floor((d[a]+128)/256),d[a]-=l*256;d[a]+=l,d[e]=0}for(l=0,a=0;a<32;a++)d[a]+=l-(d[31]>>4)*I[a],l=d[a]>>8,d[a]&=255;for(a=0;a<32;a++)d[a]-=l*I[a];for(e=0;e<32;e++)d[e+1]+=d[e]>>8,b[e]=d[e]&255}function L(b){const d=new Float64Array(64);for(let l=0;l<64;l++)d[l]=b[l];for(let l=0;l<64;l++)b[l]=0;O(b,d)}function Lt(b,d){const l=new Float64Array(64),e=[o(),o(),o(),o()],a=(0,n.hash)(b.subarray(0,32));a[0]&=248,a[31]&=127,a[31]|=64;const R=new Uint8Array(64);R.set(a.subarray(32),32);const P=new n.SHA512;P.update(R.subarray(32)),P.update(d);const D=P.digest();P.clean(),L(D),_(e,D),Vt(R,e),P.reset(),P.update(R.subarray(0,32)),P.update(b.subarray(32)),P.update(d);const $=P.digest();L($);for(let B=0;B<32;B++)l[B]=D[B];for(let B=0;B<32;B++)for(let K=0;K<32;K++)l[B+K]+=$[B]*a[K];return O(R.subarray(32),l),R}t.sign=Lt;function et(b,d){const l=o(),e=o(),a=o(),R=o(),P=o(),D=o(),$=o();return w(b[2],S),bt(b[1],d),jt(a,b[1]),j(R,a,g),F(a,a,b[2]),Ct(R,b[2],R),jt(P,R),jt(D,P),j($,D,P),j(l,$,a),j(l,l,R),gt(l,l),j(l,l,a),j(l,l,R),j(l,l,R),j(b[0],l,R),jt(e,b[0]),j(e,e,R),M(e,a)&&j(b[0],b[0],v),jt(e,b[0]),j(e,e,R),M(e,a)?-1:(Tt(b[0])===d[31]>>7&&F(b[0],E,b[0]),j(b[3],b[0],b[1]),0)}function xe(b,d,l){const e=new Uint8Array(32),a=[o(),o(),o(),o()],R=[o(),o(),o(),o()];if(l.length!==t.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`);if(et(R,b))return!1;const P=new n.SHA512;P.update(l.subarray(0,32)),P.update(b),P.update(d);const D=P.digest();return L(D),m(a,R,D),_(R,l.subarray(32)),Jt(a,R),Vt(e,a),!ct(l,e)}t.verify=xe;function z(b){let d=[o(),o(),o(),o()];if(et(d,b))throw new Error("Ed25519: invalid public key");let l=o(),e=o(),a=d[1];Ct(l,S,a),F(e,S,a),te(e,e),j(l,l,e);let R=new Uint8Array(32);return H(R,l),R}t.convertPublicKeyToX25519=z;function be(b){const d=(0,n.hash)(b.subarray(0,32));d[0]&=248,d[31]&=127,d[31]|=64;const l=new Uint8Array(d.subarray(0,32));return(0,c.wipe)(d),l}t.convertSecretKeyToX25519=be})(ar);const ps="EdDSA",_s="JWT",Ge=".",Xe="base64url",Qr="utf8",tn="utf8",ms=":",xs="did",ws="key",Rr="base58btc",vs="z",Ss="K36",Es=32,Is=t=>JSON.stringify(t,(r,n)=>typeof n=="bigint"?n.toString()+"n":n),Os=t=>{const r=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,n=t.replace(r,'$1"$2n"$3');return JSON.parse(n,(c,o)=>typeof o=="string"&&o.match(/^\d+n$/)?BigInt(o.substring(0,o.length-1)):o)};function Ts(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return Os(t)}catch{return t}}function Ls(t){return typeof t=="string"?t:Is(t)||""}function Pr(t){return Ts(We(me(t,Xe),Qr))}function Je(t){return We(me(Ls(t),Qr),Xe)}function As(t){const r=me(Ss,Rr),n=vs+We(ui([r,t]),Rr);return[xs,ws,n].join(ms)}function Rs(t){return We(t,Xe)}function Ps(t){return me(t,Xe)}function Cs(t){return me([Je(t.header),Je(t.payload)].join(Ge),tn)}function js(t){return[Je(t.header),Je(t.payload),Rs(t.signature)].join(Ge)}function Uo(t){const r=t.split(Ge),n=Pr(r[0]),c=Pr(r[1]),o=Ps(r[2]),h=me(r.slice(0,2).join(Ge),tn);return{header:n,payload:c,signature:o,data:h}}function Ho(t=Kr.randomBytes(Es)){return ar.generateKeyPairFromSeed(t)}async function Fo(t,r,n,c,o=fi.fromMiliseconds(Date.now())){const h={alg:ps,typ:_s},E=As(c.publicKey),S=o+n,g={iss:E,sub:t,aud:r,iat:o,exp:S},s=Cs({header:h,payload:g}),u=ar.sign(c.secretKey,s);return js({header:h,payload:g,signature:u})}const Ns="PARSE_ERROR",Ms="INVALID_REQUEST",zs="METHOD_NOT_FOUND",Bs="INVALID_PARAMS",en="INTERNAL_ERROR",fr="SERVER_ERROR",Ds=[-32700,-32600,-32601,-32602,-32603],Ee={[Ns]:{code:-32700,message:"Parse error"},[Ms]:{code:-32600,message:"Invalid Request"},[zs]:{code:-32601,message:"Method not found"},[Bs]:{code:-32602,message:"Invalid params"},[en]:{code:-32603,message:"Internal error"},[fr]:{code:-32e3,message:"Server error"}},rn=fr;function $s(t){return Ds.includes(t)}function Cr(t){return Object.keys(Ee).includes(t)?Ee[t]:Ee[rn]}function Ks(t){const r=Object.values(Ee).find(n=>n.code===t);return r||Ee[rn]}function Us(t,r,n){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${n} RPC url at ${r}`):t}var nn={};/*! *****************************************************************************
|
|
1
|
+
import{i as Gt,s as Dr,O as Yn,K as Zt}from"../main.js";import{i as qn,b as Zn,d as Qn,e as ti,f as ei,g as ri,h as ni,j as ii,k as si,l as oi,m as ai,w as $r,r as Kr,c as fi}from"./index-C3Sky6pw.js";import{e as ci}from"./events-C1UiYlrP.js";function Ur(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function ui(t,r){r||(r=t.reduce((o,h)=>o+h.length,0));const n=Ur(r);let c=0;for(const o of t)n.set(o,c),c+=o.length;return n}const mr={...qn,...Zn,...Qn,...ti,...ei,...ri,...ni,...ii,...si,...oi};function Hr(t,r,n,c){return{name:t,prefix:r,encoder:{name:t,prefix:r,encode:n},decoder:{decode:c}}}const xr=Hr("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),qe=Hr("ascii","a",t=>{let r="a";for(let n=0;n<t.length;n++)r+=String.fromCharCode(t[n]);return r},t=>{t=t.substring(1);const r=Ur(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}),Fr={utf8:xr,"utf-8":xr,hex:mr.base16,latin1:qe,ascii:qe,binary:qe,...mr};function me(t,r="utf8"){const n=Fr[r];if(!n)throw new Error(`Unsupported encoding "${r}"`);return(r==="utf8"||r==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t,"utf8"):n.decoder.decode(`${n.prefix}${t}`)}function We(t,r="utf8"){const n=Fr[r];if(!n)throw new Error(`Unsupported encoding "${r}"`);return(r==="utf8"||r==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("utf8"):n.encoder.encode(t).substring(1)}const jo={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe",batchFetchMessages:"waku_batchFetchMessages"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe",batchFetchMessages:"irn_batchFetchMessages"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe",batchFetchMessages:"iridium_batchFetchMessages"}},li=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,hi=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,di=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function bi(t,r){if(t==="__proto__"||t==="constructor"&&r&&typeof r=="object"&&"prototype"in r){gi(t);return}return r}function gi(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function Be(t,r={}){if(typeof t!="string")return t;const n=t.trim();if(t[0]==='"'&&t.endsWith('"')&&!t.includes("\\"))return n.slice(1,-1);if(n.length<=9){const c=n.toLowerCase();if(c==="true")return!0;if(c==="false")return!1;if(c==="undefined")return;if(c==="null")return null;if(c==="nan")return Number.NaN;if(c==="infinity")return Number.POSITIVE_INFINITY;if(c==="-infinity")return Number.NEGATIVE_INFINITY}if(!di.test(t)){if(r.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(li.test(t)||hi.test(t)){if(r.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,bi)}return JSON.parse(t)}catch(c){if(r.strict)throw c;return t}}function yi(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function Ot(t,...r){try{return yi(t(...r))}catch(n){return Promise.reject(n)}}function pi(t){const r=typeof t;return t===null||r!=="object"&&r!=="function"}function _i(t){const r=Object.getPrototypeOf(t);return!r||r.isPrototypeOf(Object)}function Ke(t){if(pi(t))return String(t);if(_i(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return Ke(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function Gr(){if(typeof Gt.Buffer>"u")throw new TypeError("[unstorage] Buffer is not supported!")}const er="base64:";function mi(t){if(typeof t=="string")return t;Gr();const r=Gt.Buffer.from(t).toString("base64");return er+r}function xi(t){return typeof t!="string"||!t.startsWith(er)?t:(Gr(),Gt.Buffer.from(t.slice(er.length),"base64"))}function Dt(t){return t?t.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function wi(...t){return Dt(t.join(":"))}function De(t){return t=Dt(t),t?t+":":""}const vi="memory",Si=()=>{const t=new Map;return{name:vi,getInstance:()=>t,hasItem(r){return t.has(r)},getItem(r){return t.get(r)??null},getItemRaw(r){return t.get(r)??null},setItem(r,n){t.set(r,n)},setItemRaw(r,n){t.set(r,n)},removeItem(r){t.delete(r)},getKeys(){return[...t.keys()]},clear(){t.clear()},dispose(){t.clear()}}};function Ei(t={}){const r={mounts:{"":t.driver||Si()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},n=s=>{for(const u of r.mountpoints)if(s.startsWith(u))return{base:u,relativeKey:s.slice(u.length),driver:r.mounts[u]};return{base:"",relativeKey:s,driver:r.mounts[""]}},c=(s,u)=>r.mountpoints.filter(y=>y.startsWith(s)||u&&s.startsWith(y)).map(y=>({relativeBase:s.length>y.length?s.slice(y.length):void 0,mountpoint:y,driver:r.mounts[y]})),o=(s,u)=>{if(r.watching){u=Dt(u);for(const y of r.watchListeners)y(s,u)}},h=async()=>{if(!r.watching){r.watching=!0;for(const s in r.mounts)r.unwatch[s]=await wr(r.mounts[s],o,s)}},E=async()=>{if(r.watching){for(const s in r.unwatch)await r.unwatch[s]();r.unwatch={},r.watching=!1}},S=(s,u,y)=>{const v=new Map,w=x=>{let N=v.get(x.base);return N||(N={driver:x.driver,base:x.base,items:[]},v.set(x.base,N)),N};for(const x of s){const N=typeof x=="string",H=Dt(N?x:x.key),ct=N?void 0:x.value,M=N||!x.options?u:{...u,...x.options},Tt=n(H);w(Tt).items.push({key:H,value:ct,relativeKey:Tt.relativeKey,options:M})}return Promise.all([...v.values()].map(x=>y(x))).then(x=>x.flat())},g={hasItem(s,u={}){s=Dt(s);const{relativeKey:y,driver:v}=n(s);return Ot(v.hasItem,y,u)},getItem(s,u={}){s=Dt(s);const{relativeKey:y,driver:v}=n(s);return Ot(v.getItem,y,u).then(w=>Be(w))},getItems(s,u){return S(s,u,y=>y.driver.getItems?Ot(y.driver.getItems,y.items.map(v=>({key:v.relativeKey,options:v.options})),u).then(v=>v.map(w=>({key:wi(y.base,w.key),value:Be(w.value)}))):Promise.all(y.items.map(v=>Ot(y.driver.getItem,v.relativeKey,v.options).then(w=>({key:v.key,value:Be(w)})))))},getItemRaw(s,u={}){s=Dt(s);const{relativeKey:y,driver:v}=n(s);return v.getItemRaw?Ot(v.getItemRaw,y,u):Ot(v.getItem,y,u).then(w=>xi(w))},async setItem(s,u,y={}){if(u===void 0)return g.removeItem(s);s=Dt(s);const{relativeKey:v,driver:w}=n(s);w.setItem&&(await Ot(w.setItem,v,Ke(u),y),w.watch||o("update",s))},async setItems(s,u){await S(s,u,async y=>{if(y.driver.setItems)return Ot(y.driver.setItems,y.items.map(v=>({key:v.relativeKey,value:Ke(v.value),options:v.options})),u);y.driver.setItem&&await Promise.all(y.items.map(v=>Ot(y.driver.setItem,v.relativeKey,Ke(v.value),v.options)))})},async setItemRaw(s,u,y={}){if(u===void 0)return g.removeItem(s,y);s=Dt(s);const{relativeKey:v,driver:w}=n(s);if(w.setItemRaw)await Ot(w.setItemRaw,v,u,y);else if(w.setItem)await Ot(w.setItem,v,mi(u),y);else return;w.watch||o("update",s)},async removeItem(s,u={}){typeof u=="boolean"&&(u={removeMeta:u}),s=Dt(s);const{relativeKey:y,driver:v}=n(s);v.removeItem&&(await Ot(v.removeItem,y,u),(u.removeMeta||u.removeMata)&&await Ot(v.removeItem,y+"$",u),v.watch||o("remove",s))},async getMeta(s,u={}){typeof u=="boolean"&&(u={nativeOnly:u}),s=Dt(s);const{relativeKey:y,driver:v}=n(s),w=Object.create(null);if(v.getMeta&&Object.assign(w,await Ot(v.getMeta,y,u)),!u.nativeOnly){const x=await Ot(v.getItem,y+"$",u).then(N=>Be(N));x&&typeof x=="object"&&(typeof x.atime=="string"&&(x.atime=new Date(x.atime)),typeof x.mtime=="string"&&(x.mtime=new Date(x.mtime)),Object.assign(w,x))}return w},setMeta(s,u,y={}){return this.setItem(s+"$",u,y)},removeMeta(s,u={}){return this.removeItem(s+"$",u)},async getKeys(s,u={}){s=De(s);const y=c(s,!0);let v=[];const w=[];for(const x of y){const N=await Ot(x.driver.getKeys,x.relativeBase,u);for(const H of N){const ct=x.mountpoint+Dt(H);v.some(M=>ct.startsWith(M))||w.push(ct)}v=[x.mountpoint,...v.filter(H=>!H.startsWith(x.mountpoint))]}return s?w.filter(x=>x.startsWith(s)&&x[x.length-1]!=="$"):w.filter(x=>x[x.length-1]!=="$")},async clear(s,u={}){s=De(s),await Promise.all(c(s,!1).map(async y=>{if(y.driver.clear)return Ot(y.driver.clear,y.relativeBase,u);if(y.driver.removeItem){const v=await y.driver.getKeys(y.relativeBase||"",u);return Promise.all(v.map(w=>y.driver.removeItem(w,u)))}}))},async dispose(){await Promise.all(Object.values(r.mounts).map(s=>vr(s)))},async watch(s){return await h(),r.watchListeners.push(s),async()=>{r.watchListeners=r.watchListeners.filter(u=>u!==s),r.watchListeners.length===0&&await E()}},async unwatch(){r.watchListeners=[],await E()},mount(s,u){if(s=De(s),s&&r.mounts[s])throw new Error(`already mounted at ${s}`);return s&&(r.mountpoints.push(s),r.mountpoints.sort((y,v)=>v.length-y.length)),r.mounts[s]=u,r.watching&&Promise.resolve(wr(u,o,s)).then(y=>{r.unwatch[s]=y}).catch(console.error),g},async unmount(s,u=!0){s=De(s),!(!s||!r.mounts[s])&&(r.watching&&s in r.unwatch&&(r.unwatch[s](),delete r.unwatch[s]),u&&await vr(r.mounts[s]),r.mountpoints=r.mountpoints.filter(y=>y!==s),delete r.mounts[s])},getMount(s=""){s=Dt(s)+":";const u=n(s);return{driver:u.driver,base:u.base}},getMounts(s="",u={}){return s=Dt(s),c(s,u.parents).map(v=>({driver:v.driver,base:v.mountpoint}))},keys:(s,u={})=>g.getKeys(s,u),get:(s,u={})=>g.getItem(s,u),set:(s,u,y={})=>g.setItem(s,u,y),has:(s,u={})=>g.hasItem(s,u),del:(s,u={})=>g.removeItem(s,u),remove:(s,u={})=>g.removeItem(s,u)};return g}function wr(t,r,n){return t.watch?t.watch((c,o)=>r(c,n+o)):()=>{}}async function vr(t){typeof t.dispose=="function"&&await Ot(t.dispose)}function de(t){return new Promise((r,n)=>{t.oncomplete=t.onsuccess=()=>r(t.result),t.onabort=t.onerror=()=>n(t.error)})}function Jr(t,r){const n=indexedDB.open(t);n.onupgradeneeded=()=>n.result.createObjectStore(r);const c=de(n);return(o,h)=>c.then(E=>h(E.transaction(r,o).objectStore(r)))}let Ze;function Le(){return Ze||(Ze=Jr("keyval-store","keyval")),Ze}function Sr(t,r=Le()){return r("readonly",n=>de(n.get(t)))}function Ii(t,r,n=Le()){return n("readwrite",c=>(c.put(r,t),de(c.transaction)))}function Oi(t,r=Le()){return r("readwrite",n=>(n.delete(t),de(n.transaction)))}function Ti(t=Le()){return t("readwrite",r=>(r.clear(),de(r.transaction)))}function Li(t,r){return t.openCursor().onsuccess=function(){this.result&&(r(this.result),this.result.continue())},de(t.transaction)}function Ai(t=Le()){return t("readonly",r=>{if(r.getAllKeys)return de(r.getAllKeys());const n=[];return Li(r,c=>n.push(c.key)).then(()=>n)})}const Ri=t=>JSON.stringify(t,(r,n)=>typeof n=="bigint"?n.toString()+"n":n),Pi=t=>{const r=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,n=t.replace(r,'$1"$2n"$3');return JSON.parse(n,(c,o)=>typeof o=="string"&&o.match(/^\d+n$/)?BigInt(o.substring(0,o.length-1)):o)};function kr(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return Pi(t)}catch{return t}}function Wr(t){return typeof t=="string"?t:Ri(t)||""}const Ci="idb-keyval";var ji=(t={})=>{const r=t.base&&t.base.length>0?`${t.base}:`:"",n=o=>r+o;let c;return t.dbName&&t.storeName&&(c=Jr(t.dbName,t.storeName)),{name:Ci,options:t,async hasItem(o){return!(typeof await Sr(n(o),c)>"u")},async getItem(o){return await Sr(n(o),c)??null},setItem(o,h){return Ii(n(o),h,c)},removeItem(o){return Oi(n(o),c)},getKeys(){return Ai(c)},clear(){return Ti(c)}}};const Ni="WALLET_CONNECT_V2_INDEXED_DB",Mi="keyvaluestorage";let zi=class{constructor(){this.indexedDb=Ei({driver:ji({dbName:Ni,storeName:Mi})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(r=>[r.key,r.value])}async getItem(r){const n=await this.indexedDb.getItem(r);if(n!==null)return n}async setItem(r,n){await this.indexedDb.setItem(r,Wr(n))}async removeItem(r){await this.indexedDb.removeItem(r)}};var Qe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof Gt.global<"u"?Gt.global:typeof self<"u"?self:{},Ue={exports:{}};(function(){let t;function r(){}t=r,t.prototype.getItem=function(n){return this.hasOwnProperty(n)?String(this[n]):null},t.prototype.setItem=function(n,c){this[n]=String(c)},t.prototype.removeItem=function(n){delete this[n]},t.prototype.clear=function(){const n=this;Object.keys(n).forEach(function(c){n[c]=void 0,delete n[c]})},t.prototype.key=function(n){return n=n||0,Object.keys(this)[n]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof Qe<"u"&&Qe.localStorage?Ue.exports=Qe.localStorage:typeof window<"u"&&window.localStorage?Ue.exports=window.localStorage:Ue.exports=new r})();function Bi(t){var r;return[t[0],kr((r=t[1])!=null?r:"")]}class Di{constructor(){this.localStorage=Ue.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(Bi)}async getItem(r){const n=this.localStorage.getItem(r);if(n!==null)return kr(n)}async setItem(r,n){this.localStorage.setItem(r,Wr(n))}async removeItem(r){this.localStorage.removeItem(r)}}const $i="wc_storage_version",Er=1,Ki=async(t,r,n)=>{const c=$i,o=await r.getItem(c);if(o&&o>=Er){n(r);return}const h=await t.getKeys();if(!h.length){n(r);return}const E=[];for(;h.length;){const S=h.shift();if(!S)continue;const g=S.toLowerCase();if(g.includes("wc@")||g.includes("walletconnect")||g.includes("wc_")||g.includes("wallet_connect")){const s=await t.getItem(S);await r.setItem(S,s),E.push(S)}}await r.setItem(c,Er),n(r),Ui(t,E)},Ui=async(t,r)=>{r.length&&r.forEach(async n=>{await t.removeItem(n)})};let Mo=class{constructor(){this.initialized=!1,this.setInitialized=n=>{this.storage=n,this.initialized=!0};const r=new Di;this.storage=r;try{const n=new zi;Ki(r,n,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(r){return await this.initialize(),this.storage.getItem(r)}async setItem(r,n){return await this.initialize(),this.storage.setItem(r,n)}async removeItem(r){return await this.initialize(),this.storage.removeItem(r)}async initialize(){this.initialized||await new Promise(r=>{const n=setInterval(()=>{this.initialized&&(clearInterval(n),r())},20)})}};class Bo{}function Hi(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var Fi=Gi;function Gi(t,r,n){var c=n&&n.stringify||Hi,o=1;if(typeof t=="object"&&t!==null){var h=r.length+o;if(h===1)return t;var E=new Array(h);E[0]=c(t);for(var S=1;S<h;S++)E[S]=c(r[S]);return E.join(" ")}if(typeof t!="string")return t;var g=r.length;if(g===0)return t;for(var s="",u=1-o,y=-1,v=t&&t.length||0,w=0;w<v;){if(t.charCodeAt(w)===37&&w+1<v){switch(y=y>-1?y:0,t.charCodeAt(w+1)){case 100:case 102:if(u>=g||r[u]==null)break;y<w&&(s+=t.slice(y,w)),s+=Number(r[u]),y=w+2,w++;break;case 105:if(u>=g||r[u]==null)break;y<w&&(s+=t.slice(y,w)),s+=Math.floor(Number(r[u])),y=w+2,w++;break;case 79:case 111:case 106:if(u>=g||r[u]===void 0)break;y<w&&(s+=t.slice(y,w));var x=typeof r[u];if(x==="string"){s+="'"+r[u]+"'",y=w+2,w++;break}if(x==="function"){s+=r[u].name||"<anonymous>",y=w+2,w++;break}s+=c(r[u]),y=w+2,w++;break;case 115:if(u>=g)break;y<w&&(s+=t.slice(y,w)),s+=String(r[u]),y=w+2,w++;break;case 37:y<w&&(s+=t.slice(y,w)),s+="%",y=w+2,w++,u--;break}++u}++w}return y===-1?t:(y<v&&(s+=t.slice(y)),s)}const Ir=Fi;var _e=Qt;const Ie=ts().console||{},Ji={mapHttpRequest:$e,mapHttpResponse:$e,wrapRequestSerializer:tr,wrapResponseSerializer:tr,wrapErrorSerializer:tr,req:$e,res:$e,err:Yi};function ki(t,r){return Array.isArray(t)?t.filter(function(c){return c!=="!stdSerializers.err"}):t===!0?Object.keys(r):!1}function Qt(t){t=t||{},t.browser=t.browser||{};const r=t.browser.transmit;if(r&&typeof r.send!="function")throw Error("pino: transmit option must have a send function");const n=t.browser.write||Ie;t.browser.write&&(t.browser.asObject=!0);const c=t.serializers||{},o=ki(t.browser.serialize,c);let h=t.browser.serialize;Array.isArray(t.browser.serialize)&&t.browser.serialize.indexOf("!stdSerializers.err")>-1&&(h=!1);const E=["error","fatal","warn","info","debug","trace"];typeof n=="function"&&(n.error=n.fatal=n.warn=n.info=n.debug=n.trace=n),t.enabled===!1&&(t.level="silent");const S=t.level||"info",g=Object.create(n);g.log||(g.log=Oe),Object.defineProperty(g,"levelVal",{get:u}),Object.defineProperty(g,"level",{get:y,set:v});const s={transmit:r,serialize:o,asObject:t.browser.asObject,levels:E,timestamp:qi(t)};g.levels=Qt.levels,g.level=S,g.setMaxListeners=g.getMaxListeners=g.emit=g.addListener=g.on=g.prependListener=g.once=g.prependOnceListener=g.removeListener=g.removeAllListeners=g.listeners=g.listenerCount=g.eventNames=g.write=g.flush=Oe,g.serializers=c,g._serialize=o,g._stdErrSerialize=h,g.child=w,r&&(g._logEvent=rr());function u(){return this.level==="silent"?1/0:this.levels.values[this.level]}function y(){return this._level}function v(x){if(x!=="silent"&&!this.levels.values[x])throw Error("unknown level "+x);this._level=x,ye(s,g,"error","log"),ye(s,g,"fatal","error"),ye(s,g,"warn","error"),ye(s,g,"info","log"),ye(s,g,"debug","log"),ye(s,g,"trace","log")}function w(x,N){if(!x)throw new Error("missing bindings for child Pino");N=N||{},o&&x.serializers&&(N.serializers=x.serializers);const H=N.serializers;if(o&&H){var ct=Object.assign({},c,H),M=t.browser.serialize===!0?Object.keys(ct):o;delete x.serializers,Ve([x],M,ct,this._stdErrSerialize)}function Tt(bt){this._childLevel=(bt._childLevel|0)+1,this.error=pe(bt,x,"error"),this.fatal=pe(bt,x,"fatal"),this.warn=pe(bt,x,"warn"),this.info=pe(bt,x,"info"),this.debug=pe(bt,x,"debug"),this.trace=pe(bt,x,"trace"),ct&&(this.serializers=ct,this._serialize=M),r&&(this._logEvent=rr([].concat(bt._logEvent.bindings,x)))}return Tt.prototype=this,new Tt(this)}return g}Qt.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}};Qt.stdSerializers=Ji;Qt.stdTimeFunctions=Object.assign({},{nullTime:Vr,epochTime:Xr,unixTime:Zi,isoTime:Qi});function ye(t,r,n,c){const o=Object.getPrototypeOf(r);r[n]=r.levelVal>r.levels.values[n]?Oe:o[n]?o[n]:Ie[n]||Ie[c]||Oe,Wi(t,r,n)}function Wi(t,r,n){!t.transmit&&r[n]===Oe||(r[n]=function(c){return function(){const h=t.timestamp(),E=new Array(arguments.length),S=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Ie?Ie:this;for(var g=0;g<E.length;g++)E[g]=arguments[g];if(t.serialize&&!t.asObject&&Ve(E,this._serialize,this.serializers,this._stdErrSerialize),t.asObject?c.call(S,Vi(this,n,E,h)):c.apply(S,E),t.transmit){const s=t.transmit.level||r.level,u=Qt.levels.values[s],y=Qt.levels.values[n];if(y<u)return;Xi(this,{ts:h,methodLevel:n,methodValue:y,transmitLevel:s,transmitValue:Qt.levels.values[t.transmit.level||r.level],send:t.transmit.send,val:r.levelVal},E)}}}(r[n]))}function Vi(t,r,n,c){t._serialize&&Ve(n,t._serialize,t.serializers,t._stdErrSerialize);const o=n.slice();let h=o[0];const E={};c&&(E.time=c),E.level=Qt.levels.values[r];let S=(t._childLevel|0)+1;if(S<1&&(S=1),h!==null&&typeof h=="object"){for(;S--&&typeof o[0]=="object";)Object.assign(E,o.shift());h=o.length?Ir(o.shift(),o):void 0}else typeof h=="string"&&(h=Ir(o.shift(),o));return h!==void 0&&(E.msg=h),E}function Ve(t,r,n,c){for(const o in t)if(c&&t[o]instanceof Error)t[o]=Qt.stdSerializers.err(t[o]);else if(typeof t[o]=="object"&&!Array.isArray(t[o]))for(const h in t[o])r&&r.indexOf(h)>-1&&h in n&&(t[o][h]=n[h](t[o][h]))}function pe(t,r,n){return function(){const c=new Array(1+arguments.length);c[0]=r;for(var o=1;o<c.length;o++)c[o]=arguments[o-1];return t[n].apply(this,c)}}function Xi(t,r,n){const c=r.send,o=r.ts,h=r.methodLevel,E=r.methodValue,S=r.val,g=t._logEvent.bindings;Ve(n,t._serialize||Object.keys(t.serializers),t.serializers,t._stdErrSerialize===void 0?!0:t._stdErrSerialize),t._logEvent.ts=o,t._logEvent.messages=n.filter(function(s){return g.indexOf(s)===-1}),t._logEvent.level.label=h,t._logEvent.level.value=E,c(h,t._logEvent,S),t._logEvent=rr(g)}function rr(t){return{ts:0,messages:[],bindings:t||[],level:{label:"",value:0}}}function Yi(t){const r={type:t.constructor.name,msg:t.message,stack:t.stack};for(const n in t)r[n]===void 0&&(r[n]=t[n]);return r}function qi(t){return typeof t.timestamp=="function"?t.timestamp:t.timestamp===!1?Vr:Xr}function $e(){return{}}function tr(t){return t}function Oe(){}function Vr(){return!1}function Xr(){return Date.now()}function Zi(){return Math.round(Date.now()/1e3)}function Qi(){return new Date(Date.now()).toISOString()}function ts(){function t(r){return typeof r<"u"&&r}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return t(self)||t(window)||t(this)||{}}}const Yr=Dr(_e),es=t=>JSON.stringify(t,(r,n)=>typeof n=="bigint"?n.toString()+"n":n);function Or(t){return typeof t=="string"?t:es(t)||""}const rs={level:"info"},Ae="custom_context",or=1e3*1024;class ns{constructor(r){this.nodeValue=r,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}}class Tr{constructor(r){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=r,this.sizeInBytes=0}append(r){const n=new ns(r);if(n.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${r} with size ${n.size}`);for(;this.size+n.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=n),this.tail=n):(this.head=n,this.tail=n),this.lengthInNodes++,this.sizeInBytes+=n.size}shift(){if(!this.head)return;const r=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=r.size}toArray(){const r=[];let n=this.head;for(;n!==null;)r.push(n.value),n=n.next;return r}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let r=this.head;return{next:()=>{if(!r)return{done:!0,value:null};const n=r.value;return r=r.next,{done:!1,value:n}}}}}class qr{constructor(r,n=or){this.level=r??"error",this.levelValue=_e.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=n,this.logs=new Tr(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(r,n){n===_e.levels.values.error?console.error(r):n===_e.levels.values.warn?console.warn(r):n===_e.levels.values.debug?console.debug(r):n===_e.levels.values.trace?console.trace(r):console.log(r)}appendToLogs(r){this.logs.append(Or({timestamp:new Date().toISOString(),log:r}));const n=typeof r=="string"?JSON.parse(r).level:r.level;n>=this.levelValue&&this.forwardToConsole(r,n)}getLogs(){return this.logs}clearLogs(){this.logs=new Tr(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(r){const n=this.getLogArray();return n.push(Or({extraMetadata:r})),new Blob(n,{type:"application/json"})}}class is{constructor(r,n=or){this.baseChunkLogger=new qr(r,n)}write(r){this.baseChunkLogger.appendToLogs(r)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(r){return this.baseChunkLogger.logsToBlob(r)}downloadLogsBlobInBrowser(r){const n=URL.createObjectURL(this.logsToBlob(r)),c=document.createElement("a");c.href=n,c.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(c),c.click(),document.body.removeChild(c),URL.revokeObjectURL(n)}}class ss{constructor(r,n=or){this.baseChunkLogger=new qr(r,n)}write(r){this.baseChunkLogger.appendToLogs(r)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(r){return this.baseChunkLogger.logsToBlob(r)}}var os=Object.defineProperty,as=Object.defineProperties,fs=Object.getOwnPropertyDescriptors,Lr=Object.getOwnPropertySymbols,cs=Object.prototype.hasOwnProperty,us=Object.prototype.propertyIsEnumerable,Ar=(t,r,n)=>r in t?os(t,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[r]=n,He=(t,r)=>{for(var n in r||(r={}))cs.call(r,n)&&Ar(t,n,r[n]);if(Lr)for(var n of Lr(r))us.call(r,n)&&Ar(t,n,r[n]);return t},Fe=(t,r)=>as(t,fs(r));function Do(t){return Fe(He({},t),{level:(t==null?void 0:t.level)||rs.level})}function ls(t,r=Ae){return t[r]||""}function hs(t,r,n=Ae){return t[n]=r,t}function ds(t,r=Ae){let n="";return typeof t.bindings>"u"?n=ls(t,r):n=t.bindings().context||"",n}function bs(t,r,n=Ae){const c=ds(t,n);return c.trim()?`${c}/${r}`:r}function $o(t,r,n=Ae){const c=bs(t,r,n),o=t.child({context:c});return hs(o,c,n)}function gs(t){var r,n;const c=new is((r=t.opts)==null?void 0:r.level,t.maxSizeInBytes);return{logger:Yr(Fe(He({},t.opts),{level:"trace",browser:Fe(He({},(n=t.opts)==null?void 0:n.browser),{write:o=>c.write(o)})})),chunkLoggerController:c}}function ys(t){var r;const n=new ss((r=t.opts)==null?void 0:r.level,t.maxSizeInBytes);return{logger:Yr(Fe(He({},t.opts),{level:"trace"}),n),chunkLoggerController:n}}function Ko(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?gs(t):ys(t)}var ar={},Zr={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});var r=ai,n=$r;t.DIGEST_LENGTH=64,t.BLOCK_SIZE=128;var c=function(){function S(){this.digestLength=t.DIGEST_LENGTH,this.blockSize=t.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return S.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},S.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},S.prototype.clean=function(){n.wipe(this._buffer),n.wipe(this._tempHi),n.wipe(this._tempLo),this.reset()},S.prototype.update=function(g,s){if(s===void 0&&(s=g.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var u=0;if(this._bytesHashed+=s,this._bufferLength>0){for(;this._bufferLength<t.BLOCK_SIZE&&s>0;)this._buffer[this._bufferLength++]=g[u++],s--;this._bufferLength===this.blockSize&&(h(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(s>=this.blockSize&&(u=h(this._tempHi,this._tempLo,this._stateHi,this._stateLo,g,u,s),s%=this.blockSize);s>0;)this._buffer[this._bufferLength++]=g[u++],s--;return this},S.prototype.finish=function(g){if(!this._finished){var s=this._bytesHashed,u=this._bufferLength,y=s/536870912|0,v=s<<3,w=s%128<112?128:256;this._buffer[u]=128;for(var x=u+1;x<w-8;x++)this._buffer[x]=0;r.writeUint32BE(y,this._buffer,w-8),r.writeUint32BE(v,this._buffer,w-4),h(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,w),this._finished=!0}for(var x=0;x<this.digestLength/8;x++)r.writeUint32BE(this._stateHi[x],g,x*8),r.writeUint32BE(this._stateLo[x],g,x*8+4);return this},S.prototype.digest=function(){var g=new Uint8Array(this.digestLength);return this.finish(g),g},S.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{stateHi:new Int32Array(this._stateHi),stateLo:new Int32Array(this._stateLo),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},S.prototype.restoreState=function(g){return this._stateHi.set(g.stateHi),this._stateLo.set(g.stateLo),this._bufferLength=g.bufferLength,g.buffer&&this._buffer.set(g.buffer),this._bytesHashed=g.bytesHashed,this._finished=!1,this},S.prototype.cleanSavedState=function(g){n.wipe(g.stateHi),n.wipe(g.stateLo),g.buffer&&n.wipe(g.buffer),g.bufferLength=0,g.bytesHashed=0},S}();t.SHA512=c;var o=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function h(S,g,s,u,y,v,w){for(var x=s[0],N=s[1],H=s[2],ct=s[3],M=s[4],Tt=s[5],bt=s[6],Ct=s[7],F=u[0],j=u[1],jt=u[2],te=u[3],gt=u[4],Jt=u[5],$t=u[6],Vt=u[7],m,_,X,ut,A,I,O,L;w>=128;){for(var Lt=0;Lt<16;Lt++){var et=8*Lt+v;S[Lt]=r.readUint32BE(y,et),g[Lt]=r.readUint32BE(y,et+4)}for(var Lt=0;Lt<80;Lt++){var xe=x,z=N,be=H,b=ct,d=M,l=Tt,e=bt,a=Ct,R=F,P=j,D=jt,$=te,B=gt,K=Jt,At=$t,lt=Vt;if(m=Ct,_=Vt,A=_&65535,I=_>>>16,O=m&65535,L=m>>>16,m=(M>>>14|gt<<18)^(M>>>18|gt<<14)^(gt>>>9|M<<23),_=(gt>>>14|M<<18)^(gt>>>18|M<<14)^(M>>>9|gt<<23),A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,m=M&Tt^~M&bt,_=gt&Jt^~gt&$t,A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,m=o[Lt*2],_=o[Lt*2+1],A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,m=S[Lt%16],_=g[Lt%16],A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,I+=A>>>16,O+=I>>>16,L+=O>>>16,X=O&65535|L<<16,ut=A&65535|I<<16,m=X,_=ut,A=_&65535,I=_>>>16,O=m&65535,L=m>>>16,m=(x>>>28|F<<4)^(F>>>2|x<<30)^(F>>>7|x<<25),_=(F>>>28|x<<4)^(x>>>2|F<<30)^(x>>>7|F<<25),A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,m=x&N^x&H^N&H,_=F&j^F&jt^j&jt,A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,I+=A>>>16,O+=I>>>16,L+=O>>>16,a=O&65535|L<<16,lt=A&65535|I<<16,m=b,_=$,A=_&65535,I=_>>>16,O=m&65535,L=m>>>16,m=X,_=ut,A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,I+=A>>>16,O+=I>>>16,L+=O>>>16,b=O&65535|L<<16,$=A&65535|I<<16,N=xe,H=z,ct=be,M=b,Tt=d,bt=l,Ct=e,x=a,j=R,jt=P,te=D,gt=$,Jt=B,$t=K,Vt=At,F=lt,Lt%16===15)for(var et=0;et<16;et++)m=S[et],_=g[et],A=_&65535,I=_>>>16,O=m&65535,L=m>>>16,m=S[(et+9)%16],_=g[(et+9)%16],A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,X=S[(et+1)%16],ut=g[(et+1)%16],m=(X>>>1|ut<<31)^(X>>>8|ut<<24)^X>>>7,_=(ut>>>1|X<<31)^(ut>>>8|X<<24)^(ut>>>7|X<<25),A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,X=S[(et+14)%16],ut=g[(et+14)%16],m=(X>>>19|ut<<13)^(ut>>>29|X<<3)^X>>>6,_=(ut>>>19|X<<13)^(X>>>29|ut<<3)^(ut>>>6|X<<26),A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,I+=A>>>16,O+=I>>>16,L+=O>>>16,S[et]=O&65535|L<<16,g[et]=A&65535|I<<16}m=x,_=F,A=_&65535,I=_>>>16,O=m&65535,L=m>>>16,m=s[0],_=u[0],A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,I+=A>>>16,O+=I>>>16,L+=O>>>16,s[0]=x=O&65535|L<<16,u[0]=F=A&65535|I<<16,m=N,_=j,A=_&65535,I=_>>>16,O=m&65535,L=m>>>16,m=s[1],_=u[1],A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,I+=A>>>16,O+=I>>>16,L+=O>>>16,s[1]=N=O&65535|L<<16,u[1]=j=A&65535|I<<16,m=H,_=jt,A=_&65535,I=_>>>16,O=m&65535,L=m>>>16,m=s[2],_=u[2],A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,I+=A>>>16,O+=I>>>16,L+=O>>>16,s[2]=H=O&65535|L<<16,u[2]=jt=A&65535|I<<16,m=ct,_=te,A=_&65535,I=_>>>16,O=m&65535,L=m>>>16,m=s[3],_=u[3],A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,I+=A>>>16,O+=I>>>16,L+=O>>>16,s[3]=ct=O&65535|L<<16,u[3]=te=A&65535|I<<16,m=M,_=gt,A=_&65535,I=_>>>16,O=m&65535,L=m>>>16,m=s[4],_=u[4],A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,I+=A>>>16,O+=I>>>16,L+=O>>>16,s[4]=M=O&65535|L<<16,u[4]=gt=A&65535|I<<16,m=Tt,_=Jt,A=_&65535,I=_>>>16,O=m&65535,L=m>>>16,m=s[5],_=u[5],A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,I+=A>>>16,O+=I>>>16,L+=O>>>16,s[5]=Tt=O&65535|L<<16,u[5]=Jt=A&65535|I<<16,m=bt,_=$t,A=_&65535,I=_>>>16,O=m&65535,L=m>>>16,m=s[6],_=u[6],A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,I+=A>>>16,O+=I>>>16,L+=O>>>16,s[6]=bt=O&65535|L<<16,u[6]=$t=A&65535|I<<16,m=Ct,_=Vt,A=_&65535,I=_>>>16,O=m&65535,L=m>>>16,m=s[7],_=u[7],A+=_&65535,I+=_>>>16,O+=m&65535,L+=m>>>16,I+=A>>>16,O+=I>>>16,L+=O>>>16,s[7]=Ct=O&65535|L<<16,u[7]=Vt=A&65535|I<<16,v+=128,w-=128}return v}function E(S){var g=new c;g.update(S);var s=g.digest();return g.clean(),s}t.hash=E})(Zr);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertSecretKeyToX25519=t.convertPublicKeyToX25519=t.verify=t.sign=t.extractPublicKeyFromSecretKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.SEED_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=t.SIGNATURE_LENGTH=void 0;const r=Kr,n=Zr,c=$r;t.SIGNATURE_LENGTH=64,t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=64,t.SEED_LENGTH=32;function o(b){const d=new Float64Array(16);if(b)for(let l=0;l<b.length;l++)d[l]=b[l];return d}const h=new Uint8Array(32);h[0]=9;const E=o(),S=o([1]),g=o([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),s=o([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),u=o([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),y=o([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),v=o([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function w(b,d){for(let l=0;l<16;l++)b[l]=d[l]|0}function x(b){let d=1;for(let l=0;l<16;l++){let e=b[l]+d+65535;d=Math.floor(e/65536),b[l]=e-d*65536}b[0]+=d-1+37*(d-1)}function N(b,d,l){const e=~(l-1);for(let a=0;a<16;a++){const R=e&(b[a]^d[a]);b[a]^=R,d[a]^=R}}function H(b,d){const l=o(),e=o();for(let a=0;a<16;a++)e[a]=d[a];x(e),x(e),x(e);for(let a=0;a<2;a++){l[0]=e[0]-65517;for(let P=1;P<15;P++)l[P]=e[P]-65535-(l[P-1]>>16&1),l[P-1]&=65535;l[15]=e[15]-32767-(l[14]>>16&1);const R=l[15]>>16&1;l[14]&=65535,N(e,l,1-R)}for(let a=0;a<16;a++)b[2*a]=e[a]&255,b[2*a+1]=e[a]>>8}function ct(b,d){let l=0;for(let e=0;e<32;e++)l|=b[e]^d[e];return(1&l-1>>>8)-1}function M(b,d){const l=new Uint8Array(32),e=new Uint8Array(32);return H(l,b),H(e,d),ct(l,e)}function Tt(b){const d=new Uint8Array(32);return H(d,b),d[0]&1}function bt(b,d){for(let l=0;l<16;l++)b[l]=d[2*l]+(d[2*l+1]<<8);b[15]&=32767}function Ct(b,d,l){for(let e=0;e<16;e++)b[e]=d[e]+l[e]}function F(b,d,l){for(let e=0;e<16;e++)b[e]=d[e]-l[e]}function j(b,d,l){let e,a,R=0,P=0,D=0,$=0,B=0,K=0,At=0,lt=0,Rt=0,yt=0,ht=0,rt=0,tt=0,Y=0,W=0,U=0,nt=0,pt=0,G=0,Nt=0,zt=0,Kt=0,Ut=0,Bt=0,Xt=0,qt=0,se=0,Ht=0,ce=0,we=0,Re=0,it=l[0],q=l[1],st=l[2],ot=l[3],at=l[4],Z=l[5],_t=l[6],mt=l[7],xt=l[8],wt=l[9],vt=l[10],dt=l[11],ft=l[12],k=l[13],St=l[14],Et=l[15];e=d[0],R+=e*it,P+=e*q,D+=e*st,$+=e*ot,B+=e*at,K+=e*Z,At+=e*_t,lt+=e*mt,Rt+=e*xt,yt+=e*wt,ht+=e*vt,rt+=e*dt,tt+=e*ft,Y+=e*k,W+=e*St,U+=e*Et,e=d[1],P+=e*it,D+=e*q,$+=e*st,B+=e*ot,K+=e*at,At+=e*Z,lt+=e*_t,Rt+=e*mt,yt+=e*xt,ht+=e*wt,rt+=e*vt,tt+=e*dt,Y+=e*ft,W+=e*k,U+=e*St,nt+=e*Et,e=d[2],D+=e*it,$+=e*q,B+=e*st,K+=e*ot,At+=e*at,lt+=e*Z,Rt+=e*_t,yt+=e*mt,ht+=e*xt,rt+=e*wt,tt+=e*vt,Y+=e*dt,W+=e*ft,U+=e*k,nt+=e*St,pt+=e*Et,e=d[3],$+=e*it,B+=e*q,K+=e*st,At+=e*ot,lt+=e*at,Rt+=e*Z,yt+=e*_t,ht+=e*mt,rt+=e*xt,tt+=e*wt,Y+=e*vt,W+=e*dt,U+=e*ft,nt+=e*k,pt+=e*St,G+=e*Et,e=d[4],B+=e*it,K+=e*q,At+=e*st,lt+=e*ot,Rt+=e*at,yt+=e*Z,ht+=e*_t,rt+=e*mt,tt+=e*xt,Y+=e*wt,W+=e*vt,U+=e*dt,nt+=e*ft,pt+=e*k,G+=e*St,Nt+=e*Et,e=d[5],K+=e*it,At+=e*q,lt+=e*st,Rt+=e*ot,yt+=e*at,ht+=e*Z,rt+=e*_t,tt+=e*mt,Y+=e*xt,W+=e*wt,U+=e*vt,nt+=e*dt,pt+=e*ft,G+=e*k,Nt+=e*St,zt+=e*Et,e=d[6],At+=e*it,lt+=e*q,Rt+=e*st,yt+=e*ot,ht+=e*at,rt+=e*Z,tt+=e*_t,Y+=e*mt,W+=e*xt,U+=e*wt,nt+=e*vt,pt+=e*dt,G+=e*ft,Nt+=e*k,zt+=e*St,Kt+=e*Et,e=d[7],lt+=e*it,Rt+=e*q,yt+=e*st,ht+=e*ot,rt+=e*at,tt+=e*Z,Y+=e*_t,W+=e*mt,U+=e*xt,nt+=e*wt,pt+=e*vt,G+=e*dt,Nt+=e*ft,zt+=e*k,Kt+=e*St,Ut+=e*Et,e=d[8],Rt+=e*it,yt+=e*q,ht+=e*st,rt+=e*ot,tt+=e*at,Y+=e*Z,W+=e*_t,U+=e*mt,nt+=e*xt,pt+=e*wt,G+=e*vt,Nt+=e*dt,zt+=e*ft,Kt+=e*k,Ut+=e*St,Bt+=e*Et,e=d[9],yt+=e*it,ht+=e*q,rt+=e*st,tt+=e*ot,Y+=e*at,W+=e*Z,U+=e*_t,nt+=e*mt,pt+=e*xt,G+=e*wt,Nt+=e*vt,zt+=e*dt,Kt+=e*ft,Ut+=e*k,Bt+=e*St,Xt+=e*Et,e=d[10],ht+=e*it,rt+=e*q,tt+=e*st,Y+=e*ot,W+=e*at,U+=e*Z,nt+=e*_t,pt+=e*mt,G+=e*xt,Nt+=e*wt,zt+=e*vt,Kt+=e*dt,Ut+=e*ft,Bt+=e*k,Xt+=e*St,qt+=e*Et,e=d[11],rt+=e*it,tt+=e*q,Y+=e*st,W+=e*ot,U+=e*at,nt+=e*Z,pt+=e*_t,G+=e*mt,Nt+=e*xt,zt+=e*wt,Kt+=e*vt,Ut+=e*dt,Bt+=e*ft,Xt+=e*k,qt+=e*St,se+=e*Et,e=d[12],tt+=e*it,Y+=e*q,W+=e*st,U+=e*ot,nt+=e*at,pt+=e*Z,G+=e*_t,Nt+=e*mt,zt+=e*xt,Kt+=e*wt,Ut+=e*vt,Bt+=e*dt,Xt+=e*ft,qt+=e*k,se+=e*St,Ht+=e*Et,e=d[13],Y+=e*it,W+=e*q,U+=e*st,nt+=e*ot,pt+=e*at,G+=e*Z,Nt+=e*_t,zt+=e*mt,Kt+=e*xt,Ut+=e*wt,Bt+=e*vt,Xt+=e*dt,qt+=e*ft,se+=e*k,Ht+=e*St,ce+=e*Et,e=d[14],W+=e*it,U+=e*q,nt+=e*st,pt+=e*ot,G+=e*at,Nt+=e*Z,zt+=e*_t,Kt+=e*mt,Ut+=e*xt,Bt+=e*wt,Xt+=e*vt,qt+=e*dt,se+=e*ft,Ht+=e*k,ce+=e*St,we+=e*Et,e=d[15],U+=e*it,nt+=e*q,pt+=e*st,G+=e*ot,Nt+=e*at,zt+=e*Z,Kt+=e*_t,Ut+=e*mt,Bt+=e*xt,Xt+=e*wt,qt+=e*vt,se+=e*dt,Ht+=e*ft,ce+=e*k,we+=e*St,Re+=e*Et,R+=38*nt,P+=38*pt,D+=38*G,$+=38*Nt,B+=38*zt,K+=38*Kt,At+=38*Ut,lt+=38*Bt,Rt+=38*Xt,yt+=38*qt,ht+=38*se,rt+=38*Ht,tt+=38*ce,Y+=38*we,W+=38*Re,a=1,e=R+a+65535,a=Math.floor(e/65536),R=e-a*65536,e=P+a+65535,a=Math.floor(e/65536),P=e-a*65536,e=D+a+65535,a=Math.floor(e/65536),D=e-a*65536,e=$+a+65535,a=Math.floor(e/65536),$=e-a*65536,e=B+a+65535,a=Math.floor(e/65536),B=e-a*65536,e=K+a+65535,a=Math.floor(e/65536),K=e-a*65536,e=At+a+65535,a=Math.floor(e/65536),At=e-a*65536,e=lt+a+65535,a=Math.floor(e/65536),lt=e-a*65536,e=Rt+a+65535,a=Math.floor(e/65536),Rt=e-a*65536,e=yt+a+65535,a=Math.floor(e/65536),yt=e-a*65536,e=ht+a+65535,a=Math.floor(e/65536),ht=e-a*65536,e=rt+a+65535,a=Math.floor(e/65536),rt=e-a*65536,e=tt+a+65535,a=Math.floor(e/65536),tt=e-a*65536,e=Y+a+65535,a=Math.floor(e/65536),Y=e-a*65536,e=W+a+65535,a=Math.floor(e/65536),W=e-a*65536,e=U+a+65535,a=Math.floor(e/65536),U=e-a*65536,R+=a-1+37*(a-1),a=1,e=R+a+65535,a=Math.floor(e/65536),R=e-a*65536,e=P+a+65535,a=Math.floor(e/65536),P=e-a*65536,e=D+a+65535,a=Math.floor(e/65536),D=e-a*65536,e=$+a+65535,a=Math.floor(e/65536),$=e-a*65536,e=B+a+65535,a=Math.floor(e/65536),B=e-a*65536,e=K+a+65535,a=Math.floor(e/65536),K=e-a*65536,e=At+a+65535,a=Math.floor(e/65536),At=e-a*65536,e=lt+a+65535,a=Math.floor(e/65536),lt=e-a*65536,e=Rt+a+65535,a=Math.floor(e/65536),Rt=e-a*65536,e=yt+a+65535,a=Math.floor(e/65536),yt=e-a*65536,e=ht+a+65535,a=Math.floor(e/65536),ht=e-a*65536,e=rt+a+65535,a=Math.floor(e/65536),rt=e-a*65536,e=tt+a+65535,a=Math.floor(e/65536),tt=e-a*65536,e=Y+a+65535,a=Math.floor(e/65536),Y=e-a*65536,e=W+a+65535,a=Math.floor(e/65536),W=e-a*65536,e=U+a+65535,a=Math.floor(e/65536),U=e-a*65536,R+=a-1+37*(a-1),b[0]=R,b[1]=P,b[2]=D,b[3]=$,b[4]=B,b[5]=K,b[6]=At,b[7]=lt,b[8]=Rt,b[9]=yt,b[10]=ht,b[11]=rt,b[12]=tt,b[13]=Y,b[14]=W,b[15]=U}function jt(b,d){j(b,d,d)}function te(b,d){const l=o();let e;for(e=0;e<16;e++)l[e]=d[e];for(e=253;e>=0;e--)jt(l,l),e!==2&&e!==4&&j(l,l,d);for(e=0;e<16;e++)b[e]=l[e]}function gt(b,d){const l=o();let e;for(e=0;e<16;e++)l[e]=d[e];for(e=250;e>=0;e--)jt(l,l),e!==1&&j(l,l,d);for(e=0;e<16;e++)b[e]=l[e]}function Jt(b,d){const l=o(),e=o(),a=o(),R=o(),P=o(),D=o(),$=o(),B=o(),K=o();F(l,b[1],b[0]),F(K,d[1],d[0]),j(l,l,K),Ct(e,b[0],b[1]),Ct(K,d[0],d[1]),j(e,e,K),j(a,b[3],d[3]),j(a,a,s),j(R,b[2],d[2]),Ct(R,R,R),F(P,e,l),F(D,R,a),Ct($,R,a),Ct(B,e,l),j(b[0],P,D),j(b[1],B,$),j(b[2],$,D),j(b[3],P,B)}function $t(b,d,l){for(let e=0;e<4;e++)N(b[e],d[e],l)}function Vt(b,d){const l=o(),e=o(),a=o();te(a,d[2]),j(l,d[0],a),j(e,d[1],a),H(b,e),b[31]^=Tt(l)<<7}function m(b,d,l){w(b[0],E),w(b[1],S),w(b[2],S),w(b[3],E);for(let e=255;e>=0;--e){const a=l[e/8|0]>>(e&7)&1;$t(b,d,a),Jt(d,b),Jt(b,b),$t(b,d,a)}}function _(b,d){const l=[o(),o(),o(),o()];w(l[0],u),w(l[1],y),w(l[2],S),j(l[3],u,y),m(b,l,d)}function X(b){if(b.length!==t.SEED_LENGTH)throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`);const d=(0,n.hash)(b);d[0]&=248,d[31]&=127,d[31]|=64;const l=new Uint8Array(32),e=[o(),o(),o(),o()];_(e,d),Vt(l,e);const a=new Uint8Array(64);return a.set(b),a.set(l,32),{publicKey:l,secretKey:a}}t.generateKeyPairFromSeed=X;function ut(b){const d=(0,r.randomBytes)(32,b),l=X(d);return(0,c.wipe)(d),l}t.generateKeyPair=ut;function A(b){if(b.length!==t.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(b.subarray(32))}t.extractPublicKeyFromSecretKey=A;const I=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function O(b,d){let l,e,a,R;for(e=63;e>=32;--e){for(l=0,a=e-32,R=e-12;a<R;++a)d[a]+=l-16*d[e]*I[a-(e-32)],l=Math.floor((d[a]+128)/256),d[a]-=l*256;d[a]+=l,d[e]=0}for(l=0,a=0;a<32;a++)d[a]+=l-(d[31]>>4)*I[a],l=d[a]>>8,d[a]&=255;for(a=0;a<32;a++)d[a]-=l*I[a];for(e=0;e<32;e++)d[e+1]+=d[e]>>8,b[e]=d[e]&255}function L(b){const d=new Float64Array(64);for(let l=0;l<64;l++)d[l]=b[l];for(let l=0;l<64;l++)b[l]=0;O(b,d)}function Lt(b,d){const l=new Float64Array(64),e=[o(),o(),o(),o()],a=(0,n.hash)(b.subarray(0,32));a[0]&=248,a[31]&=127,a[31]|=64;const R=new Uint8Array(64);R.set(a.subarray(32),32);const P=new n.SHA512;P.update(R.subarray(32)),P.update(d);const D=P.digest();P.clean(),L(D),_(e,D),Vt(R,e),P.reset(),P.update(R.subarray(0,32)),P.update(b.subarray(32)),P.update(d);const $=P.digest();L($);for(let B=0;B<32;B++)l[B]=D[B];for(let B=0;B<32;B++)for(let K=0;K<32;K++)l[B+K]+=$[B]*a[K];return O(R.subarray(32),l),R}t.sign=Lt;function et(b,d){const l=o(),e=o(),a=o(),R=o(),P=o(),D=o(),$=o();return w(b[2],S),bt(b[1],d),jt(a,b[1]),j(R,a,g),F(a,a,b[2]),Ct(R,b[2],R),jt(P,R),jt(D,P),j($,D,P),j(l,$,a),j(l,l,R),gt(l,l),j(l,l,a),j(l,l,R),j(l,l,R),j(b[0],l,R),jt(e,b[0]),j(e,e,R),M(e,a)&&j(b[0],b[0],v),jt(e,b[0]),j(e,e,R),M(e,a)?-1:(Tt(b[0])===d[31]>>7&&F(b[0],E,b[0]),j(b[3],b[0],b[1]),0)}function xe(b,d,l){const e=new Uint8Array(32),a=[o(),o(),o(),o()],R=[o(),o(),o(),o()];if(l.length!==t.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`);if(et(R,b))return!1;const P=new n.SHA512;P.update(l.subarray(0,32)),P.update(b),P.update(d);const D=P.digest();return L(D),m(a,R,D),_(R,l.subarray(32)),Jt(a,R),Vt(e,a),!ct(l,e)}t.verify=xe;function z(b){let d=[o(),o(),o(),o()];if(et(d,b))throw new Error("Ed25519: invalid public key");let l=o(),e=o(),a=d[1];Ct(l,S,a),F(e,S,a),te(e,e),j(l,l,e);let R=new Uint8Array(32);return H(R,l),R}t.convertPublicKeyToX25519=z;function be(b){const d=(0,n.hash)(b.subarray(0,32));d[0]&=248,d[31]&=127,d[31]|=64;const l=new Uint8Array(d.subarray(0,32));return(0,c.wipe)(d),l}t.convertSecretKeyToX25519=be})(ar);const ps="EdDSA",_s="JWT",Ge=".",Xe="base64url",Qr="utf8",tn="utf8",ms=":",xs="did",ws="key",Rr="base58btc",vs="z",Ss="K36",Es=32,Is=t=>JSON.stringify(t,(r,n)=>typeof n=="bigint"?n.toString()+"n":n),Os=t=>{const r=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,n=t.replace(r,'$1"$2n"$3');return JSON.parse(n,(c,o)=>typeof o=="string"&&o.match(/^\d+n$/)?BigInt(o.substring(0,o.length-1)):o)};function Ts(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return Os(t)}catch{return t}}function Ls(t){return typeof t=="string"?t:Is(t)||""}function Pr(t){return Ts(We(me(t,Xe),Qr))}function Je(t){return We(me(Ls(t),Qr),Xe)}function As(t){const r=me(Ss,Rr),n=vs+We(ui([r,t]),Rr);return[xs,ws,n].join(ms)}function Rs(t){return We(t,Xe)}function Ps(t){return me(t,Xe)}function Cs(t){return me([Je(t.header),Je(t.payload)].join(Ge),tn)}function js(t){return[Je(t.header),Je(t.payload),Rs(t.signature)].join(Ge)}function Uo(t){const r=t.split(Ge),n=Pr(r[0]),c=Pr(r[1]),o=Ps(r[2]),h=me(r.slice(0,2).join(Ge),tn);return{header:n,payload:c,signature:o,data:h}}function Ho(t=Kr.randomBytes(Es)){return ar.generateKeyPairFromSeed(t)}async function Fo(t,r,n,c,o=fi.fromMiliseconds(Date.now())){const h={alg:ps,typ:_s},E=As(c.publicKey),S=o+n,g={iss:E,sub:t,aud:r,iat:o,exp:S},s=Cs({header:h,payload:g}),u=ar.sign(c.secretKey,s);return js({header:h,payload:g,signature:u})}const Ns="PARSE_ERROR",Ms="INVALID_REQUEST",zs="METHOD_NOT_FOUND",Bs="INVALID_PARAMS",en="INTERNAL_ERROR",fr="SERVER_ERROR",Ds=[-32700,-32600,-32601,-32602,-32603],Ee={[Ns]:{code:-32700,message:"Parse error"},[Ms]:{code:-32600,message:"Invalid Request"},[zs]:{code:-32601,message:"Method not found"},[Bs]:{code:-32602,message:"Invalid params"},[en]:{code:-32603,message:"Internal error"},[fr]:{code:-32e3,message:"Server error"}},rn=fr;function $s(t){return Ds.includes(t)}function Cr(t){return Object.keys(Ee).includes(t)?Ee[t]:Ee[rn]}function Ks(t){const r=Object.values(Ee).find(n=>n.code===t);return r||Ee[rn]}function Us(t,r,n){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${n} RPC url at ${r}`):t}var nn={};/*! *****************************************************************************
|
|
2
2
|
Copyright (c) Microsoft Corporation.
|
|
3
3
|
|
|
4
4
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var se=Object.defineProperty;var oe=(s,e,t)=>e in s?se(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var d=(s,e,t)=>oe(s,typeof e!="symbol"?e+"":e,t);import{dh as l,di as T,dj as y,cy as _,
|
|
1
|
+
var se=Object.defineProperty;var oe=(s,e,t)=>e in s?se(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var d=(s,e,t)=>oe(s,typeof e!="symbol"?e+"":e,t);import{dh as l,di as T,dj as y,cy as _,b2 as j,a$ as f,al as re,ad as M,dk as Q,dl as ae,aF as S,dm as ie,i as ce,bo as X,dn as N,dp as P,dq as de,dr as Z,cT as pe,ds as ge,dt as ue,du as J,ck as fe,bY as le,c1 as he}from"../main.js";import{A as Ae}from"./algorand-CyJRjYjt.js";class ye{constructor(e,t,o,n,r=!1){d(this,"transaction");d(this,"network");d(this,"chain");d(this,"description");d(this,"parallelizable");this.transaction=e,this.network=t,this.chain=o,this.description=n,this.parallelizable=r}}const W=1002e3,V=15,Y=127,F=8,C=Y*F,ee=Y*V,K=F*ee,x={_limit:127,encodingLength:s=>{let e=0;for(;s>=128;e++)s>>=7;return e+1},encode:(s,e,t)=>{if(typeof s=="bigint"&&(s=l(s)),s<0)throw new RangeError("value must be unsigned");const o=x.encodingLength(s);if(e=e||new ArrayBuffer(o),t=t||0,e.byteLength<t+o)throw new RangeError("the buffer is too small to encode the number at the offset");const n=new Uint8Array(e,t);let r=0;for(;x._limit<s;)n[r++]=s&x._limit|128,s>>=7;return n[r]=Number(s),n},decode:(s,e=0)=>{let t=0,o=0,n;do{if(n=s[e+o],n===void 0)throw new RangeError("offset out of range");t+=(n&x._limit)<<o*7,o++}while(128<=n);return t}},g={forMessageId:(s,e)=>{const t=T(y(s)).publicKey,o=e.emitter.toUniversalAddress().toUint8Array(),n=_.toBytes(BigInt(j(e.chain)),2),r=f.concat(n,o);return g.fromData({appId:s,appAddress:t,idx:e.sequence/BigInt(K),address:r})},forWrappedAsset:(s,e)=>{if(re(e.address))throw new Error("native asset cannot be a wrapped asset");const t=T(y(s)).publicKey;return g.fromData({appId:s,appAddress:t,idx:BigInt(j(e.chain)),address:e.address.toUniversalAddress().toUint8Array()})},forNativeAsset:(s,e)=>{const t=T(y(s)).publicKey;return g.fromData({appId:s,appAddress:t,idx:e,address:f.encode("native")})},forGuardianSet:(s,e)=>{const t=T(y(s)).publicKey;return g.fromData({appId:s,appAddress:t,idx:BigInt(e),address:f.encode("guardian")})},forEmitter:(s,e)=>{const t=T(y(s)).publicKey;return g.fromData({appId:s,appAddress:t,idx:0n,address:e})},_encode:s=>typeof s=="bigint"?[M.encode(x.encode(s))]:[M.encode(x.encode(s.length)),M.encode(s)],fromData:s=>{const e=["0620010181",...g._encode(s.idx),"4880",...g._encode(s.address),"483110810612443119221244311881",...g._encode(s.appId),"1244312080",...g._encode(s.appAddress),"124431018100124431093203124431153203124422"],t=M.decode(e.join(""));return new Q(t)},decodeLocalState:async(s,e,t)=>{let o;try{const a=await s.accountApplicationInformation(t,l(e)).do();o=ae.from_obj_for_encoding(a).appLocalState}catch{return new Uint8Array}const n=S.encode("meta");let r=new Map;for(const a of o.keyValue){if(a.key===n)continue;const p=S.decode(a.key)[0],u=S.decode(a.value.bytes);r.set(p,u)}const c=[];for(let a=0;a<V;a++)r.has(a)&&c.push(r.get(a));return f.concat(...c)},checkBitsSet:async(s,e,t,o)=>{let n=!1,r;const c=await s.accountInformation(t).do(),p=ie.from_obj_for_encoding(c).appsLocalState;if(p&&p.forEach(m=>{BigInt(m.id)===e&&(r=m.keyValue)}),(r==null?void 0:r.length)===0)return n;const u=BigInt(K),A=BigInt(8),I=o/u*u,w=l(o-I),B=Math.floor(w/C),b=Math.floor((w-B*C)/8),U=S.encode(_.toBytes(B,1));return r==null||r.forEach(m=>{if(m.key===U){const v=ce.Buffer.from(m.value.bytes,"base64"),k=1<<l(o%A);n=(v[b]&k)!=0;return}}),n},storageAccountExists:async(s,e,t)=>{try{const o=await s.accountApplicationInformation(e,l(t)).do();return Object.keys(o).length>0}catch{}return!1}},i=class i{constructor(e,t,o,n){d(this,"network");d(this,"chain");d(this,"connection");d(this,"contracts");d(this,"chainId");d(this,"coreAppId");d(this,"coreAppAddress");d(this,"tokenBridgeAppId");d(this,"tokenBridgeAppAddress");if(this.network=e,this.chain=t,this.connection=o,this.contracts=n,this.chainId=j(t),!n.coreBridge)throw new Error(`Core contract address for chain ${t} not found`);const r=BigInt(n.coreBridge);if(this.coreAppId=r,this.coreAppAddress=y(r),!n.tokenBridge)throw new Error(`TokenBridge contract address for chain ${t} not found`);const c=BigInt(n.tokenBridge);this.tokenBridgeAppId=c,this.tokenBridgeAppAddress=y(c)}getGuardianSet(e){throw new Error("Method not implemented.")}async*verifyMessage(e,t,o){const n=new X(e).toString(),r=await i.submitVAAHeader(this.connection,this.coreAppId,o??this.coreAppId,t,n);for(const c of r.txs)yield this.createUnsignedTx(c,"Core.verifyMessage")}static async fromRpc(e,t){const[o,n]=await Ae.chainFromRpc(e),r=t[n];if(r.network!==o)throw new Error(`Network mismatch: ${r.network} !== ${o}`);return new i(o,n,e,r.contracts)}async*publishMessage(e,t){const o=new X(e),n=o.toString(),r=await this.connection.getTransactionParams().do(),c=g.forEmitter(this.coreAppId,o.toUint8Array()),{accounts:a,txs:p}=await i.maybeCreateStorageTx(this.connection,n,this.coreAppId,c,r);for(const A of p)yield this.createUnsignedTx(A,"Core.publishMessage",!0);const u=N({from:n,appIndex:l(this.coreAppId),appArgs:[i.publishMessage,t,_.toBytes(0n,8)],accounts:a,onComplete:P.NoOpOC,suggestedParams:r});yield this.createUnsignedTx({tx:u},"Core.publishMessage",!0)}async getMessageFee(){var n;const e=await this.connection.getApplicationByID(l(this.coreAppId)).do(),o=(n=de.from_obj_for_encoding(e).params.globalState)==null?void 0:n.find(r=>r.key===i.feeKey);return o?BigInt(o.value.uint):0n}async getGuardianSetIndex(){throw new Error("Not implemented")}async parseTransaction(e){const t=await this.connection.pendingTransactionInformation(e).do(),o=Z.from_obj_for_encoding(t);return this.parseTx(o).map(n=>({chain:n.emitterChain,emitter:n.emitterAddress,sequence:n.sequence}))}async parseMessages(e){const t=await this.connection.pendingTransactionInformation(e).do(),o=Z.from_obj_for_encoding(t);return this.parseTx(o)}parseTx(e){const t=[];if(e.innerTxns&&e.innerTxns.length>0&&t.push(...e.innerTxns.flatMap(p=>this.parseTx(p))),BigInt(e.txn.txn.apid??0)!==this.coreAppId||!e.logs||e.logs.length===0)return t;const o=e.txn.txn.apaa??[];if(o.length!==3||!f.equals(new Uint8Array(o[0]),i.publishMessage))return t;const n=_.decode(e.logs[0]),r=new X(e.txn.txn.snd).toUniversalAddress(),c=new Uint8Array(o[1]),a=_.decode(o[2]);return t.push(pe("Uint8Array",{emitterChain:this.chain,emitterAddress:r,sequence:n,guardianSet:0,timestamp:0,consistencyLevel:0,nonce:Number(a),payload:c,signatures:[]})),t}static async maybeCreateStorageTx(e,t,o,n,r){const c=y(o),a=n.address(),p=[];if(await g.storageAccountExists(e,a,o))return{accounts:[a],txs:p};r=r??await e.getTransactionParams().do();const u=ge({from:t,to:a,amount:W,suggestedParams:r});u.fee=u.fee*2,p.push({tx:u});const A=ue({from:a,appIndex:l(o),rekeyTo:c,suggestedParams:r});return A.fee=0,p.push({tx:A,signer:{address:n.address(),signTxn:I=>Promise.resolve(J(I,n).blob)}}),{accounts:[a],txs:p}}static async submitVAAHeader(e,t,o,n,r,c){c=c??await e.getTransactionParams().do();let a=[];const p=g.forMessageId(o,{chain:n.emitterChain,sequence:n.sequence,emitter:n.emitterAddress}),{accounts:u,txs:A}=await i.maybeCreateStorageTx(e,r,o,p,c);a.push(...A);const I=g.forGuardianSet(t,n.guardianSet),{accounts:[w],txs:B}=await i.maybeCreateStorageTx(e,r,t,I,c);a.push(...B);let b=[...u,w];const U=await g.decodeLocalState(e,t,w),m=fe(n.hash),v=n.signatures.length,k=Math.ceil(v/i.MAX_SIGS_PER_TXN),G=20,D=new Q(i.ALGO_VERIFY);for(let O=0;O<k;O++){const H=O*i.MAX_SIGS_PER_TXN,E=n.signatures.slice(H,H+i.MAX_SIGS_PER_TXN),te=E.length*G,q=new Uint8Array(te);for(let h=0;h<E.length;h++){const $=E[h],ne=U.slice($.guardianIndex*G+1,($.guardianIndex+1)*G+1);q.set(ne,h*20)}const z=N({appArgs:[i.verifySigs,f.concat(...E.map(h=>f.concat(new Uint8Array([h.guardianIndex]),h.signature.encode()))),q,m],accounts:b,appIndex:l(t),from:i.ALGO_VERIFY_HASH,onComplete:P.NoOpOC,suggestedParams:c});z.fee=0,a.push({tx:z,signer:{address:D.address(),signTxn:h=>Promise.resolve(J(h,D).blob)}})}const L=N({appArgs:[i.verifyVaa,le(n)],accounts:b,appIndex:l(t),from:r,onComplete:P.NoOpOC,suggestedParams:c});return L.fee=L.fee*(2+k),a.push({tx:L}),{accounts:b,txs:a}}createUnsignedTx(e,t,o=!0){return new ye(e,this.network,this.chain,t,o)}};d(i,"MAX_SIGS_PER_TXN",6),d(i,"ALGO_VERIFY_HASH","EZATROXX2HISIRZDRGXW4LRQ46Z6IUJYYIHU3PJGP7P5IQDPKVX42N767A"),d(i,"ALGO_VERIFY",new Uint8Array([6,32,4,1,0,32,20,38,1,0,49,32,50,3,18,68,49,1,35,18,68,49,16,129,6,18,68,54,26,1,54,26,3,54,26,2,136,0,3,68,34,67,53,2,53,1,53,0,40,53,240,40,53,241,52,0,21,53,5,35,53,3,35,53,4,52,3,52,5,12,65,0,68,52,1,52,0,52,3,129,65,8,34,88,23,52,0,52,3,34,8,36,88,52,0,52,3,129,33,8,36,88,7,0,53,241,53,240,52,2,52,4,37,88,52,240,52,241,80,2,87,12,20,18,68,52,3,129,66,8,53,3,52,4,37,8,53,4,66,255,180,34,137])),d(i,"feeKey",S.encode("MessageFee")),d(i,"verifyVaa",f.encode("verifyVAA")),d(i,"verifySigs",f.encode("verifySigs")),d(i,"publishMessage",f.encode("publishMessage"));let R=i;he("Algorand","WormholeCore",R);const we=Object.freeze(Object.defineProperty({__proto__:null,AlgorandWormholeCore:R,BITS_PER_BYTE:F,BITS_PER_KEY:C,MAX_BITS:K,MAX_BYTES:ee,MAX_BYTES_PER_KEY:Y,MAX_KEYS:V,SEED_AMT:W,StorageLogicSig:g,varint:x},Symbol.toStringTag,{value:"Module"}));export{R as A,g as S,ye as a,we as i};
|