@wormhole-foundation/wormhole-connect 0.3.18-beta.0-development → 0.3.18-beta.1-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/{ccip-Dkj0_PH1.js → ccip-D0VzrDKe.js} +1 -1
- package/dist/assets/cosmos-O8tTKeuk.js +37 -0
- package/dist/assets/{cosmwasm-DGW772Mb.js → cosmwasm-C3cFK7BC.js} +3 -3
- package/dist/assets/{ens-validation.es6-QG6c_Puy.js → ens-validation.es6-gsmLKNwB.js} +1 -1
- package/dist/assets/{evm-BDi9bPHV.js → evm--aNcFZ6S.js} +4 -4
- package/dist/assets/{index-C1x31Jxk.js → index-BjIxvQFV.js} +1 -1
- package/dist/assets/{index-CRnaWQgW.js → index-ByeOkyS8.js} +1 -1
- package/dist/assets/{index-KMQj8MBB.js → index-CV4pfIw7.js} +1 -1
- package/dist/assets/{index-CiEQK8J0.js → index-ClKrV_HJ.js} +2 -2
- package/dist/assets/index-Dqsfl0un.js +3 -0
- package/dist/assets/{index-BYhDDvwO.js → index-NBWkKzTR.js} +1 -1
- package/dist/assets/{index.es-D2AQfZFz.js → index.es-ASAVlsFm.js} +2 -2
- package/dist/assets/{solana-BZCNALCU.js → solana-Dn94-G2V.js} +2 -2
- package/dist/assets/{solanaEmbed.esm-D0yWLEo-.js → solanaEmbed.esm-rqFDr9AX.js} +1 -1
- package/dist/assets/{unsignedTransaction-D7VEWy8m.js → unsignedTransaction-B08fN_UW.js} +1 -1
- package/dist/main.js +10 -10
- package/dist/src/consts/wallet.d.ts.map +1 -1
- package/dist/src/utils/transferValidation.d.ts.map +1 -1
- package/lib/{algorand-DQDPJ26a.mjs → algorand-B9R5kDXf.mjs} +4 -4
- package/lib/{algorand-DVFRLYKg.js → algorand-BECExueP.js} +1 -1
- package/lib/{aptos-Cl1IkOfq.js → aptos-BpvpNYii.js} +2 -2
- package/lib/{aptos-4Buk4ifX.mjs → aptos-CgVUfeRr.mjs} +4 -4
- package/lib/{aptos-CUMbFUEx.mjs → aptos-Co4Dcnws.mjs} +1 -1
- package/lib/{aptos-DvZHyaGi.js → aptos-CzYa5HnG.js} +1 -1
- package/lib/{browser-D7Z49wZ4.mjs → browser-B79UewaZ.mjs} +2 -2
- package/lib/{browser-qdNhrgkB.js → browser-BnvapQOm.js} +1 -1
- package/lib/{ccip-5tJ4iGbd.mjs → ccip-CCScN0fp.mjs} +1 -1
- package/lib/{ccip-BKmEJ0zH.js → ccip-DkkpA67F.js} +1 -1
- package/lib/{chain-B1FOQWsW.mjs → chain-CkiAdRsF.mjs} +1 -1
- package/lib/{chain-y7sg4yrp.js → chain-dkt-tJ8j.js} +1 -1
- package/lib/{cosmos-DdK2yQGY.js → cosmos-BGtn0ce4.js} +1 -1
- package/lib/{cosmos-DW-Gxe0a.mjs → cosmos-CgRX0Wxh.mjs} +3 -3
- package/lib/{cosmwasm-Bh0-_wDY.mjs → cosmwasm-CZJBnOEX.mjs} +6 -6
- package/lib/{cosmwasm-CStFJLHq.js → cosmwasm-RnTbX7PN.js} +2 -2
- package/lib/{create-BKtLWPjt.js → create-BiAHw2aA.js} +1 -1
- package/lib/{create-B_LDrlra.mjs → create-CM-nUvHh.mjs} +1 -1
- package/lib/{ens-validation.es6-Cia-mNrr.mjs → ens-validation.es6-2EaRqlcZ.mjs} +2 -2
- package/lib/{ens-validation.es6-B-mETPjs.js → ens-validation.es6-Y7MuOU0N.js} +1 -1
- package/lib/{evm-CU-B8toy.mjs → evm-C3NODduF.mjs} +6 -6
- package/lib/{evm-D0eVTsjc.js → evm-DI8kbdHZ.js} +2 -2
- package/lib/{evm-CAQWUINN.js → evm-DXOSgo1P.js} +4 -4
- package/lib/{evm-DHOCCyVW.mjs → evm-HVKpaILW.mjs} +6 -6
- package/lib/{index-BsbdJZ3C.mjs → index--a8G4lcW.mjs} +36 -24
- package/lib/{index-C4_Mkq6F.mjs → index-0Y0qAS5l.mjs} +4 -4
- package/lib/{index-DRZymJsG.js → index-8qn1dGJN.js} +1 -1
- package/lib/{index-DNiXK70O.js → index-B4PE2HqL.js} +1 -1
- package/lib/{index-Cl0Q32gB.js → index-BJzrTwhK.js} +1 -1
- package/lib/{index-BoQrBK1v.mjs → index-BPseHNs4.mjs} +4 -4
- package/lib/{index-CLTi6Axr.js → index-BS73cCsm.js} +1 -1
- package/lib/{index-Clfmas--.mjs → index-Bmf0dJXk.mjs} +5 -5
- package/lib/{index-BQG8FYaZ.js → index-C2RXBAYV.js} +1 -1
- package/lib/{index-CfV2repP.mjs → index-C8vqaAeA.mjs} +4 -4
- package/lib/{index-gmV4k3Io.mjs → index-CEYaDz-X.mjs} +1 -1
- package/lib/{index-OPTA8sRP.js → index-CQ24ekSy.js} +1 -1
- package/lib/{index-BZQPVPp1.js → index-CSSe0BOU.js} +1 -1
- package/lib/{index-DugpMXHv.mjs → index-CSf329dI.mjs} +5 -5
- package/lib/{index-CRb6g19u.mjs → index-CUpI3flq.mjs} +3 -3
- package/lib/{index-BXA5PZNU.js → index-CYm8SRbD.js} +1 -1
- package/lib/{index-C990TILJ.js → index-C_Gyy-qu.js} +1 -1
- package/lib/{index-CerXrspf.js → index-C_nOcIfa.js} +1 -1
- package/lib/{index-DZxCgz6D.mjs → index-Cf6LTh_3.mjs} +3 -3
- package/lib/{index-D7N3abQJ.js → index-CjiTP7zj.js} +1 -1
- package/lib/{index-Dy60c9bL.mjs → index-CjzZno1u.mjs} +1 -1
- package/lib/{index-CnejtY47.mjs → index-Cm6qfNE2.mjs} +4 -4
- package/lib/{index-DyuvKSii.mjs → index-CnDfWZ3N.mjs} +2 -2
- package/lib/{index-UneRjAxx.js → index-CrUwXkHx.js} +1 -1
- package/lib/{index-B0L8gSK7.mjs → index-CtPlLWIc.mjs} +4 -4
- package/lib/{index-D1bcMAs6.js → index-D2IEwdXM.js} +4 -4
- package/lib/{index-d2eR5hEX.js → index-D3d590ml.js} +1 -1
- package/lib/{index-DSkKbEm6.mjs → index-D44yXRrW.mjs} +4 -4
- package/lib/{index-CGQQm-uD.js → index-D7vEVSNu.js} +1 -1
- package/lib/{index-BwXnmYxY.js → index-DD8O1gO1.js} +1 -1
- package/lib/{index-CyXba-yP.js → index-DMTxEDBY.js} +1 -1
- package/lib/{index-BUmh6veA.mjs → index-DRnbzgUh.mjs} +6 -6
- package/lib/{index-BGs-r2zq.mjs → index-D_DayKXK.mjs} +2 -2
- package/lib/{index-Bv2LxtBn.mjs → index-DabcAHr_.mjs} +4 -4
- package/lib/{index-B1m57rRr.mjs → index-DkVqkU1n.mjs} +2 -2
- package/lib/{index-C4Fm85ru.mjs → index-Dk_DxorB.mjs} +5 -5
- package/lib/{index-DgOzoVuQ.js → index-DnS14EZQ.js} +1 -1
- package/lib/{index-Bt_H55hU.mjs → index-Dsrx3yAj.mjs} +4 -4
- package/lib/{index-DnsX0bqc.mjs → index-Duj1DuCU.mjs} +4 -4
- package/lib/{index-D1bwJjqp.js → index-JwYCBrPA.js} +1 -1
- package/lib/{index-CczdQqB1.js → index-Nro7lr9I.js} +1 -1
- package/lib/{index-BJoVvo22.js → index-UmTItYQP.js} +1 -1
- package/lib/{index-BgeAXYll.mjs → index-VNaGZYsT.mjs} +3 -3
- package/lib/{index-CRZAVeIL.mjs → index-jZS8RCBJ.mjs} +4 -4
- package/lib/{index-DTJXuc64.js → index-vhST1GVD.js} +1 -1
- package/lib/{index-BPu5tyJL.js → index-yVQrO-w_.js} +1 -1
- package/lib/{index.es-DcCpnayP.mjs → index.es-BX3g_fEa.mjs} +4 -4
- package/lib/{index.es-D0De3MOj.js → index.es-DW3cpfqa.js} +2 -2
- package/lib/index.js +1 -1
- package/lib/index.mjs +1 -1
- package/lib/{libsodium-wrappers-BgNKJA-N.js → libsodium-wrappers-DJv6_KfX.js} +1 -1
- package/lib/{libsodium-wrappers-D-Q49aE_.mjs → libsodium-wrappers-m9ZOqx0p.mjs} +1 -1
- package/lib/{sei-DgZ6J40I.js → sei-BOeXaWS0.js} +1 -1
- package/lib/{sei-BoViQvrz.mjs → sei-DFzWb_82.mjs} +2 -2
- package/lib/{solana-W4XruJeE.mjs → solana-BweAibG_.mjs} +6 -6
- package/lib/{solana-DWLxhhWn.js → solana-DFmcWlKj.js} +2 -2
- package/lib/{solana-Cj-WXpIF.mjs → solana-DaSEOOB7.mjs} +3 -3
- package/lib/{solana-Bdi1CyTf.js → solana-Dv03uKoX.js} +1 -1
- package/lib/{solanaEmbed.esm-CKfg1ioH.mjs → solanaEmbed.esm-BxAUqIpC.mjs} +2 -2
- package/lib/{solanaEmbed.esm-WXkst5_I.js → solanaEmbed.esm-DJ48k1vp.js} +1 -1
- package/lib/src/consts/wallet.d.ts.map +1 -1
- package/lib/src/utils/transferValidation.d.ts.map +1 -1
- package/lib/{sui-DFQxJJBA.js → sui-4qNYTJYI.js} +1 -1
- package/lib/{sui-BwXBW1lD.mjs → sui-CRlPg_-w.mjs} +1 -1
- package/lib/{sui-4Ygokvkl.js → sui-CU34Vo-z.js} +2 -2
- package/lib/{sui-fzNqSygY.mjs → sui-DR9_UAz0.mjs} +4 -4
- package/lib/{unsignedTransaction-BcitBDHn.js → unsignedTransaction-oHvwquvT.js} +1 -1
- package/lib/{unsignedTransaction-Bh0f0Mvb.mjs → unsignedTransaction-qG9mWtn-.mjs} +2 -2
- package/package.json +1 -1
- package/dist/assets/cosmos-mS8jzs-K.js +0 -37
- package/dist/assets/index-CP2t4FxN.js +0 -3
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";const g=require("./index-D1bcMAs6.js");var Ne={},Ze={exports:{}},He={};(function(o){o.fetch=n(g.commonjsGlobal.fetch)&&n(g.commonjsGlobal.ReadableStream),o.writableStream=n(g.commonjsGlobal.WritableStream),o.abortController=n(g.commonjsGlobal.AbortController);var r;function h(){if(r!==void 0)return r;if(g.commonjsGlobal.XMLHttpRequest){r=new g.commonjsGlobal.XMLHttpRequest;try{r.open("GET",g.commonjsGlobal.XDomainRequest?"/":"https://example.com")}catch{r=null}}else r=null;return r}function f(b){var u=h();if(!u)return!1;try{return u.responseType=b,u.responseType===b}catch{}return!1}o.arraybuffer=o.fetch||f("arraybuffer"),o.msstream=!o.fetch&&f("ms-stream"),o.mozchunkedarraybuffer=!o.fetch&&f("moz-chunked-arraybuffer"),o.overrideMimeType=o.fetch||(h()?n(h().overrideMimeType):!1);function n(b){return typeof b=="function"}r=null})(He);var xe={},Ve=He,st=g.inherits_browserExports,Je=g.readableBrowserExports,Ce=xe.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},Ge=xe.IncomingMessage=function(o,r,h,f){var n=this;if(Je.Readable.call(n),n._mode=h,n.headers={},n.rawHeaders=[],n.trailers={},n.rawTrailers=[],n.on("end",function(){g.dist.process.nextTick(function(){n.emit("close")})}),h==="fetch"){let A=function(){u.read().then(function(d){if(!n._destroyed){if(f(d.done),d.done){n.push(null);return}n.push(g.dist.Buffer.from(d.value)),A()}}).catch(function(d){f(!0),n._destroyed||n.emit("error",d)})};if(n._fetchResponse=r,n.url=r.url,n.statusCode=r.status,n.statusMessage=r.statusText,r.headers.forEach(function(d,x){n.headers[x.toLowerCase()]=d,n.rawHeaders.push(x,d)}),Ve.writableStream){var b=new WritableStream({write:function(d){return f(!1),new Promise(function(x,ee){n._destroyed?ee():n.push(g.dist.Buffer.from(d))?x():n._resumeFetch=x})},close:function(){f(!0),n._destroyed||n.push(null)},abort:function(d){f(!0),n._destroyed||n.emit("error",d)}});try{r.body.pipeTo(b).catch(function(d){f(!0),n._destroyed||n.emit("error",d)});return}catch{}}var u=r.body.getReader();A()}else{n._xhr=o,n._pos=0,n.url=o.responseURL,n.statusCode=o.status,n.statusMessage=o.statusText;var a=o.getAllResponseHeaders().split(/\r?\n/);if(a.forEach(function(A){var d=A.match(/^([^:]+):\s*(.*)/);if(d){var x=d[1].toLowerCase();x==="set-cookie"?(n.headers[x]===void 0&&(n.headers[x]=[]),n.headers[x].push(d[2])):n.headers[x]!==void 0?n.headers[x]+=", "+d[2]:n.headers[x]=d[2],n.rawHeaders.push(d[1],d[2])}}),n._charset="x-user-defined",!Ve.overrideMimeType){var v=n.rawHeaders["mime-type"];if(v){var w=v.match(/;\s*charset=([^;])(;|$)/);w&&(n._charset=w[1].toLowerCase())}n._charset||(n._charset="utf-8")}}};st(Ge,Je.Readable);Ge.prototype._read=function(){var o=this,r=o._resumeFetch;r&&(o._resumeFetch=null,r())};Ge.prototype._onXHRProgress=function(o){var r=this,h=r._xhr,f=null;switch(r._mode){case"text":if(f=h.responseText,f.length>r._pos){var n=f.substr(r._pos);if(r._charset==="x-user-defined"){for(var b=g.dist.Buffer.alloc(n.length),u=0;u<n.length;u++)b[u]=n.charCodeAt(u)&255;r.push(b)}else r.push(n,r._charset);r._pos=f.length}break;case"arraybuffer":if(h.readyState!==Ce.DONE||!h.response)break;f=h.response,r.push(g.dist.Buffer.from(new Uint8Array(f)));break;case"moz-chunked-arraybuffer":if(f=h.response,h.readyState!==Ce.LOADING||!f)break;r.push(g.dist.Buffer.from(new Uint8Array(f)));break;case"ms-stream":if(f=h.response,h.readyState!==Ce.LOADING)break;var a=new g.commonjsGlobal.MSStreamReader;a.onprogress=function(){a.result.byteLength>r._pos&&(r.push(g.dist.Buffer.from(new Uint8Array(a.result.slice(r._pos)))),r._pos=a.result.byteLength)},a.onload=function(){o(!0),r.push(null)},a.readAsArrayBuffer(f);break}r._xhr.readyState===Ce.DONE&&r._mode!=="ms-stream"&&(o(!0),r.push(null))};var fe=He,at=g.inherits_browserExports,Qe=xe,ke=g.readableBrowserExports,it=Qe.IncomingMessage,Ye=Qe.readyStates;function ft(o,r){return fe.fetch&&r?"fetch":fe.mozchunkedarraybuffer?"moz-chunked-arraybuffer":fe.msstream?"ms-stream":fe.arraybuffer&&o?"arraybuffer":"text"}var S=Ze.exports=function(o){var r=this;ke.Writable.call(r),r._opts=o,r._body=[],r._headers={},o.auth&&r.setHeader("Authorization","Basic "+g.dist.Buffer.from(o.auth).toString("base64")),Object.keys(o.headers).forEach(function(n){r.setHeader(n,o.headers[n])});var h,f=!0;if(o.mode==="disable-fetch"||"requestTimeout"in o&&!fe.abortController)f=!1,h=!0;else if(o.mode==="prefer-streaming")h=!1;else if(o.mode==="allow-wrong-content-type")h=!fe.overrideMimeType;else if(!o.mode||o.mode==="default"||o.mode==="prefer-fast")h=!0;else throw new Error("Invalid value for opts.mode");r._mode=ft(h,f),r._fetchTimer=null,r._socketTimeout=null,r._socketTimer=null,r.on("finish",function(){r._onFinish()})};at(S,ke.Writable);S.prototype.setHeader=function(o,r){var h=this,f=o.toLowerCase();ut.indexOf(f)===-1&&(h._headers[f]={name:o,value:r})};S.prototype.getHeader=function(o){var r=this._headers[o.toLowerCase()];return r?r.value:null};S.prototype.removeHeader=function(o){var r=this;delete r._headers[o.toLowerCase()]};S.prototype._onFinish=function(){var o=this;if(!o._destroyed){var r=o._opts;"timeout"in r&&r.timeout!==0&&o.setTimeout(r.timeout);var h=o._headers,f=null;r.method!=="GET"&&r.method!=="HEAD"&&(f=new Blob(o._body,{type:(h["content-type"]||{}).value||""}));var n=[];if(Object.keys(h).forEach(function(v){var w=h[v].name,A=h[v].value;Array.isArray(A)?A.forEach(function(d){n.push([w,d])}):n.push([w,A])}),o._mode==="fetch"){var b=null;if(fe.abortController){var u=new AbortController;b=u.signal,o._fetchAbortController=u,"requestTimeout"in r&&r.requestTimeout!==0&&(o._fetchTimer=g.commonjsGlobal.setTimeout(function(){o.emit("requestTimeout"),o._fetchAbortController&&o._fetchAbortController.abort()},r.requestTimeout))}g.commonjsGlobal.fetch(o._opts.url,{method:o._opts.method,headers:n,body:f||void 0,mode:"cors",credentials:r.withCredentials?"include":"same-origin",signal:b}).then(function(v){o._fetchResponse=v,o._resetTimers(!1),o._connect()},function(v){o._resetTimers(!0),o._destroyed||o.emit("error",v)})}else{var a=o._xhr=new g.commonjsGlobal.XMLHttpRequest;try{a.open(o._opts.method,o._opts.url,!0)}catch(v){g.dist.process.nextTick(function(){o.emit("error",v)});return}"responseType"in a&&(a.responseType=o._mode),"withCredentials"in a&&(a.withCredentials=!!r.withCredentials),o._mode==="text"&&"overrideMimeType"in a&&a.overrideMimeType("text/plain; charset=x-user-defined"),"requestTimeout"in r&&(a.timeout=r.requestTimeout,a.ontimeout=function(){o.emit("requestTimeout")}),n.forEach(function(v){a.setRequestHeader(v[0],v[1])}),o._response=null,a.onreadystatechange=function(){switch(a.readyState){case Ye.LOADING:case Ye.DONE:o._onXHRProgress();break}},o._mode==="moz-chunked-arraybuffer"&&(a.onprogress=function(){o._onXHRProgress()}),a.onerror=function(){o._destroyed||(o._resetTimers(!0),o.emit("error",new Error("XHR error")))};try{a.send(f)}catch(v){g.dist.process.nextTick(function(){o.emit("error",v)});return}}}};function ht(o){try{var r=o.status;return r!==null&&r!==0}catch{return!1}}S.prototype._onXHRProgress=function(){var o=this;o._resetTimers(!1),!(!ht(o._xhr)||o._destroyed)&&(o._response||o._connect(),o._response._onXHRProgress(o._resetTimers.bind(o)))};S.prototype._connect=function(){var o=this;o._destroyed||(o._response=new it(o._xhr,o._fetchResponse,o._mode,o._resetTimers.bind(o)),o._response.on("error",function(r){o.emit("error",r)}),o.emit("response",o._response))};S.prototype._write=function(o,r,h){var f=this;f._body.push(o),h()};S.prototype._resetTimers=function(o){var r=this;g.commonjsGlobal.clearTimeout(r._socketTimer),r._socketTimer=null,o?(g.commonjsGlobal.clearTimeout(r._fetchTimer),r._fetchTimer=null):r._socketTimeout&&(r._socketTimer=g.commonjsGlobal.setTimeout(function(){r.emit("timeout")},r._socketTimeout))};S.prototype.abort=S.prototype.destroy=function(o){var r=this;r._destroyed=!0,r._resetTimers(!0),r._response&&(r._response._destroyed=!0),r._xhr?r._xhr.abort():r._fetchAbortController&&r._fetchAbortController.abort(),o&&r.emit("error",o)};S.prototype.end=function(o,r,h){var f=this;typeof o=="function"&&(h=o,o=void 0),ke.Writable.prototype.end.call(f,o,r,h)};S.prototype.setTimeout=function(o,r){var h=this;r&&h.once("timeout",r),h._socketTimeout=o,h._resetTimers(!1)};S.prototype.flushHeaders=function(){};S.prototype.setNoDelay=function(){};S.prototype.setSocketKeepAlive=function(){};var ut=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"],lt=Ze.exports,ct=mt,pt=Object.prototype.hasOwnProperty;function mt(){for(var o={},r=0;r<arguments.length;r++){var h=arguments[r];for(var f in h)pt.call(h,f)&&(o[f]=h[f])}return o}var dt={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"},Me={exports:{}},Ae={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */Ae.exports;(function(o,r){(function(h){var f=r&&!r.nodeType&&r,n=o&&!o.nodeType&&o,b=typeof g.commonjsGlobal=="object"&&g.commonjsGlobal;(b.global===b||b.window===b||b.self===b)&&(h=b);var u,a=2147483647,v=36,w=1,A=26,d=38,x=700,ee=72,se=128,I="-",Ee=/^xn--/,qe=/[^\x20-\x7E]/,Oe=/[\x2E\u3002\uFF0E\uFF61]/g,Ue={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},ce=v-w,F=Math.floor,te=String.fromCharCode,ae;function Z(i){throw new RangeError(Ue[i])}function pe(i,p){for(var y=i.length,T=[];y--;)T[y]=p(i[y]);return T}function be(i,p){var y=i.split("@"),T="";y.length>1&&(T=y[0]+"@",i=y[1]),i=i.replace(Oe,".");var R=i.split("."),L=pe(R,p).join(".");return T+L}function _e(i){for(var p=[],y=0,T=i.length,R,L;y<T;)R=i.charCodeAt(y++),R>=55296&&R<=56319&&y<T?(L=i.charCodeAt(y++),(L&64512)==56320?p.push(((R&1023)<<10)+(L&1023)+65536):(p.push(R),y--)):p.push(R);return p}function he(i){return pe(i,function(p){var y="";return p>65535&&(p-=65536,y+=te(p>>>10&1023|55296),p=56320|p&1023),y+=te(p),y}).join("")}function re(i){return i-48<10?i-22:i-65<26?i-65:i-97<26?i-97:v}function ue(i,p){return i+22+75*(i<26)-((p!=0)<<5)}function oe(i,p,y){var T=0;for(i=y?F(i/x):i>>1,i+=F(i/p);i>ce*A>>1;T+=v)i=F(i/ce);return F(T+(ce+1)*i/(i+d))}function Te(i){var p=[],y=i.length,T,R=0,L=se,E=ee,C,M,$,B,P,N,k,W,J;for(C=i.lastIndexOf(I),C<0&&(C=0),M=0;M<C;++M)i.charCodeAt(M)>=128&&Z("not-basic"),p.push(i.charCodeAt(M));for($=C>0?C+1:0;$<y;){for(B=R,P=1,N=v;$>=y&&Z("invalid-input"),k=re(i.charCodeAt($++)),(k>=v||k>F((a-R)/P))&&Z("overflow"),R+=k*P,W=N<=E?w:N>=E+A?A:N-E,!(k<W);N+=v)J=v-W,P>F(a/J)&&Z("overflow"),P*=J;T=p.length+1,E=oe(R-B,T,B==0),F(R/T)>a-L&&Z("overflow"),L+=F(R/T),R%=T,p.splice(R++,0,L)}return he(p)}function we(i){var p,y,T,R,L,E,C,M,$,B,P,N=[],k,W,J,me;for(i=_e(i),k=i.length,p=se,y=0,L=ee,E=0;E<k;++E)P=i[E],P<128&&N.push(te(P));for(T=R=N.length,R&&N.push(I);T<k;){for(C=a,E=0;E<k;++E)P=i[E],P>=p&&P<C&&(C=P);for(W=T+1,C-p>F((a-y)/W)&&Z("overflow"),y+=(C-p)*W,p=C,E=0;E<k;++E)if(P=i[E],P<p&&++y>a&&Z("overflow"),P==p){for(M=y,$=v;B=$<=L?w:$>=L+A?A:$-L,!(M<B);$+=v)me=M-B,J=v-B,N.push(te(ue(B+me%J,0))),M=F(me/J);N.push(te(ue(M,0))),L=oe(y,W,T==R),y=0,++T}++y,++p}return N.join("")}function Le(i){return be(i,function(p){return Ee.test(p)?Te(p.slice(4).toLowerCase()):p})}function Pe(i){return be(i,function(p){return qe.test(p)?"xn--"+we(p):p})}if(u={version:"1.4.1",ucs2:{decode:_e,encode:he},decode:Te,encode:we,toASCII:Pe,toUnicode:Le},f&&n)if(o.exports==f)n.exports=u;else for(ae in u)u.hasOwnProperty(ae)&&(f[ae]=u[ae]);else h.punycode=u})(g.commonjsGlobal)})(Ae,Ae.exports);var et=Ae.exports;(function(o,r){Object.defineProperty(r,"__esModule",{value:!0});var h=et,f=g.require$$2;function n(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var b=n(h),u=n(f),a={isString:function(e){return typeof e=="string"},isObject:function(e){return typeof e=="object"&&e!==null},isNull:function(e){return e===null},isNullOrUndefined:function(e){return e==null}},v=b.default,w=a,A=oe,d=we,x=Le,ee=Te,se=I;function I(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var Ee=/^([a-z0-9.+-]+:)/i,qe=/:[0-9]*$/,Oe=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,Ue=["<",">",'"',"`"," ","\r",`
|
|
1
|
+
"use strict";const g=require("./index-D2IEwdXM.js");var Ne={},Ze={exports:{}},He={};(function(o){o.fetch=n(g.commonjsGlobal.fetch)&&n(g.commonjsGlobal.ReadableStream),o.writableStream=n(g.commonjsGlobal.WritableStream),o.abortController=n(g.commonjsGlobal.AbortController);var r;function h(){if(r!==void 0)return r;if(g.commonjsGlobal.XMLHttpRequest){r=new g.commonjsGlobal.XMLHttpRequest;try{r.open("GET",g.commonjsGlobal.XDomainRequest?"/":"https://example.com")}catch{r=null}}else r=null;return r}function f(b){var u=h();if(!u)return!1;try{return u.responseType=b,u.responseType===b}catch{}return!1}o.arraybuffer=o.fetch||f("arraybuffer"),o.msstream=!o.fetch&&f("ms-stream"),o.mozchunkedarraybuffer=!o.fetch&&f("moz-chunked-arraybuffer"),o.overrideMimeType=o.fetch||(h()?n(h().overrideMimeType):!1);function n(b){return typeof b=="function"}r=null})(He);var xe={},Ve=He,st=g.inherits_browserExports,Je=g.readableBrowserExports,Ce=xe.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},Ge=xe.IncomingMessage=function(o,r,h,f){var n=this;if(Je.Readable.call(n),n._mode=h,n.headers={},n.rawHeaders=[],n.trailers={},n.rawTrailers=[],n.on("end",function(){g.dist.process.nextTick(function(){n.emit("close")})}),h==="fetch"){let A=function(){u.read().then(function(d){if(!n._destroyed){if(f(d.done),d.done){n.push(null);return}n.push(g.dist.Buffer.from(d.value)),A()}}).catch(function(d){f(!0),n._destroyed||n.emit("error",d)})};if(n._fetchResponse=r,n.url=r.url,n.statusCode=r.status,n.statusMessage=r.statusText,r.headers.forEach(function(d,x){n.headers[x.toLowerCase()]=d,n.rawHeaders.push(x,d)}),Ve.writableStream){var b=new WritableStream({write:function(d){return f(!1),new Promise(function(x,ee){n._destroyed?ee():n.push(g.dist.Buffer.from(d))?x():n._resumeFetch=x})},close:function(){f(!0),n._destroyed||n.push(null)},abort:function(d){f(!0),n._destroyed||n.emit("error",d)}});try{r.body.pipeTo(b).catch(function(d){f(!0),n._destroyed||n.emit("error",d)});return}catch{}}var u=r.body.getReader();A()}else{n._xhr=o,n._pos=0,n.url=o.responseURL,n.statusCode=o.status,n.statusMessage=o.statusText;var a=o.getAllResponseHeaders().split(/\r?\n/);if(a.forEach(function(A){var d=A.match(/^([^:]+):\s*(.*)/);if(d){var x=d[1].toLowerCase();x==="set-cookie"?(n.headers[x]===void 0&&(n.headers[x]=[]),n.headers[x].push(d[2])):n.headers[x]!==void 0?n.headers[x]+=", "+d[2]:n.headers[x]=d[2],n.rawHeaders.push(d[1],d[2])}}),n._charset="x-user-defined",!Ve.overrideMimeType){var v=n.rawHeaders["mime-type"];if(v){var w=v.match(/;\s*charset=([^;])(;|$)/);w&&(n._charset=w[1].toLowerCase())}n._charset||(n._charset="utf-8")}}};st(Ge,Je.Readable);Ge.prototype._read=function(){var o=this,r=o._resumeFetch;r&&(o._resumeFetch=null,r())};Ge.prototype._onXHRProgress=function(o){var r=this,h=r._xhr,f=null;switch(r._mode){case"text":if(f=h.responseText,f.length>r._pos){var n=f.substr(r._pos);if(r._charset==="x-user-defined"){for(var b=g.dist.Buffer.alloc(n.length),u=0;u<n.length;u++)b[u]=n.charCodeAt(u)&255;r.push(b)}else r.push(n,r._charset);r._pos=f.length}break;case"arraybuffer":if(h.readyState!==Ce.DONE||!h.response)break;f=h.response,r.push(g.dist.Buffer.from(new Uint8Array(f)));break;case"moz-chunked-arraybuffer":if(f=h.response,h.readyState!==Ce.LOADING||!f)break;r.push(g.dist.Buffer.from(new Uint8Array(f)));break;case"ms-stream":if(f=h.response,h.readyState!==Ce.LOADING)break;var a=new g.commonjsGlobal.MSStreamReader;a.onprogress=function(){a.result.byteLength>r._pos&&(r.push(g.dist.Buffer.from(new Uint8Array(a.result.slice(r._pos)))),r._pos=a.result.byteLength)},a.onload=function(){o(!0),r.push(null)},a.readAsArrayBuffer(f);break}r._xhr.readyState===Ce.DONE&&r._mode!=="ms-stream"&&(o(!0),r.push(null))};var fe=He,at=g.inherits_browserExports,Qe=xe,ke=g.readableBrowserExports,it=Qe.IncomingMessage,Ye=Qe.readyStates;function ft(o,r){return fe.fetch&&r?"fetch":fe.mozchunkedarraybuffer?"moz-chunked-arraybuffer":fe.msstream?"ms-stream":fe.arraybuffer&&o?"arraybuffer":"text"}var S=Ze.exports=function(o){var r=this;ke.Writable.call(r),r._opts=o,r._body=[],r._headers={},o.auth&&r.setHeader("Authorization","Basic "+g.dist.Buffer.from(o.auth).toString("base64")),Object.keys(o.headers).forEach(function(n){r.setHeader(n,o.headers[n])});var h,f=!0;if(o.mode==="disable-fetch"||"requestTimeout"in o&&!fe.abortController)f=!1,h=!0;else if(o.mode==="prefer-streaming")h=!1;else if(o.mode==="allow-wrong-content-type")h=!fe.overrideMimeType;else if(!o.mode||o.mode==="default"||o.mode==="prefer-fast")h=!0;else throw new Error("Invalid value for opts.mode");r._mode=ft(h,f),r._fetchTimer=null,r._socketTimeout=null,r._socketTimer=null,r.on("finish",function(){r._onFinish()})};at(S,ke.Writable);S.prototype.setHeader=function(o,r){var h=this,f=o.toLowerCase();ut.indexOf(f)===-1&&(h._headers[f]={name:o,value:r})};S.prototype.getHeader=function(o){var r=this._headers[o.toLowerCase()];return r?r.value:null};S.prototype.removeHeader=function(o){var r=this;delete r._headers[o.toLowerCase()]};S.prototype._onFinish=function(){var o=this;if(!o._destroyed){var r=o._opts;"timeout"in r&&r.timeout!==0&&o.setTimeout(r.timeout);var h=o._headers,f=null;r.method!=="GET"&&r.method!=="HEAD"&&(f=new Blob(o._body,{type:(h["content-type"]||{}).value||""}));var n=[];if(Object.keys(h).forEach(function(v){var w=h[v].name,A=h[v].value;Array.isArray(A)?A.forEach(function(d){n.push([w,d])}):n.push([w,A])}),o._mode==="fetch"){var b=null;if(fe.abortController){var u=new AbortController;b=u.signal,o._fetchAbortController=u,"requestTimeout"in r&&r.requestTimeout!==0&&(o._fetchTimer=g.commonjsGlobal.setTimeout(function(){o.emit("requestTimeout"),o._fetchAbortController&&o._fetchAbortController.abort()},r.requestTimeout))}g.commonjsGlobal.fetch(o._opts.url,{method:o._opts.method,headers:n,body:f||void 0,mode:"cors",credentials:r.withCredentials?"include":"same-origin",signal:b}).then(function(v){o._fetchResponse=v,o._resetTimers(!1),o._connect()},function(v){o._resetTimers(!0),o._destroyed||o.emit("error",v)})}else{var a=o._xhr=new g.commonjsGlobal.XMLHttpRequest;try{a.open(o._opts.method,o._opts.url,!0)}catch(v){g.dist.process.nextTick(function(){o.emit("error",v)});return}"responseType"in a&&(a.responseType=o._mode),"withCredentials"in a&&(a.withCredentials=!!r.withCredentials),o._mode==="text"&&"overrideMimeType"in a&&a.overrideMimeType("text/plain; charset=x-user-defined"),"requestTimeout"in r&&(a.timeout=r.requestTimeout,a.ontimeout=function(){o.emit("requestTimeout")}),n.forEach(function(v){a.setRequestHeader(v[0],v[1])}),o._response=null,a.onreadystatechange=function(){switch(a.readyState){case Ye.LOADING:case Ye.DONE:o._onXHRProgress();break}},o._mode==="moz-chunked-arraybuffer"&&(a.onprogress=function(){o._onXHRProgress()}),a.onerror=function(){o._destroyed||(o._resetTimers(!0),o.emit("error",new Error("XHR error")))};try{a.send(f)}catch(v){g.dist.process.nextTick(function(){o.emit("error",v)});return}}}};function ht(o){try{var r=o.status;return r!==null&&r!==0}catch{return!1}}S.prototype._onXHRProgress=function(){var o=this;o._resetTimers(!1),!(!ht(o._xhr)||o._destroyed)&&(o._response||o._connect(),o._response._onXHRProgress(o._resetTimers.bind(o)))};S.prototype._connect=function(){var o=this;o._destroyed||(o._response=new it(o._xhr,o._fetchResponse,o._mode,o._resetTimers.bind(o)),o._response.on("error",function(r){o.emit("error",r)}),o.emit("response",o._response))};S.prototype._write=function(o,r,h){var f=this;f._body.push(o),h()};S.prototype._resetTimers=function(o){var r=this;g.commonjsGlobal.clearTimeout(r._socketTimer),r._socketTimer=null,o?(g.commonjsGlobal.clearTimeout(r._fetchTimer),r._fetchTimer=null):r._socketTimeout&&(r._socketTimer=g.commonjsGlobal.setTimeout(function(){r.emit("timeout")},r._socketTimeout))};S.prototype.abort=S.prototype.destroy=function(o){var r=this;r._destroyed=!0,r._resetTimers(!0),r._response&&(r._response._destroyed=!0),r._xhr?r._xhr.abort():r._fetchAbortController&&r._fetchAbortController.abort(),o&&r.emit("error",o)};S.prototype.end=function(o,r,h){var f=this;typeof o=="function"&&(h=o,o=void 0),ke.Writable.prototype.end.call(f,o,r,h)};S.prototype.setTimeout=function(o,r){var h=this;r&&h.once("timeout",r),h._socketTimeout=o,h._resetTimers(!1)};S.prototype.flushHeaders=function(){};S.prototype.setNoDelay=function(){};S.prototype.setSocketKeepAlive=function(){};var ut=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"],lt=Ze.exports,ct=mt,pt=Object.prototype.hasOwnProperty;function mt(){for(var o={},r=0;r<arguments.length;r++){var h=arguments[r];for(var f in h)pt.call(h,f)&&(o[f]=h[f])}return o}var dt={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"},Me={exports:{}},Ae={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */Ae.exports;(function(o,r){(function(h){var f=r&&!r.nodeType&&r,n=o&&!o.nodeType&&o,b=typeof g.commonjsGlobal=="object"&&g.commonjsGlobal;(b.global===b||b.window===b||b.self===b)&&(h=b);var u,a=2147483647,v=36,w=1,A=26,d=38,x=700,ee=72,se=128,I="-",Ee=/^xn--/,qe=/[^\x20-\x7E]/,Oe=/[\x2E\u3002\uFF0E\uFF61]/g,Ue={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},ce=v-w,F=Math.floor,te=String.fromCharCode,ae;function Z(i){throw new RangeError(Ue[i])}function pe(i,p){for(var y=i.length,T=[];y--;)T[y]=p(i[y]);return T}function be(i,p){var y=i.split("@"),T="";y.length>1&&(T=y[0]+"@",i=y[1]),i=i.replace(Oe,".");var R=i.split("."),L=pe(R,p).join(".");return T+L}function _e(i){for(var p=[],y=0,T=i.length,R,L;y<T;)R=i.charCodeAt(y++),R>=55296&&R<=56319&&y<T?(L=i.charCodeAt(y++),(L&64512)==56320?p.push(((R&1023)<<10)+(L&1023)+65536):(p.push(R),y--)):p.push(R);return p}function he(i){return pe(i,function(p){var y="";return p>65535&&(p-=65536,y+=te(p>>>10&1023|55296),p=56320|p&1023),y+=te(p),y}).join("")}function re(i){return i-48<10?i-22:i-65<26?i-65:i-97<26?i-97:v}function ue(i,p){return i+22+75*(i<26)-((p!=0)<<5)}function oe(i,p,y){var T=0;for(i=y?F(i/x):i>>1,i+=F(i/p);i>ce*A>>1;T+=v)i=F(i/ce);return F(T+(ce+1)*i/(i+d))}function Te(i){var p=[],y=i.length,T,R=0,L=se,E=ee,C,M,$,B,P,N,k,W,J;for(C=i.lastIndexOf(I),C<0&&(C=0),M=0;M<C;++M)i.charCodeAt(M)>=128&&Z("not-basic"),p.push(i.charCodeAt(M));for($=C>0?C+1:0;$<y;){for(B=R,P=1,N=v;$>=y&&Z("invalid-input"),k=re(i.charCodeAt($++)),(k>=v||k>F((a-R)/P))&&Z("overflow"),R+=k*P,W=N<=E?w:N>=E+A?A:N-E,!(k<W);N+=v)J=v-W,P>F(a/J)&&Z("overflow"),P*=J;T=p.length+1,E=oe(R-B,T,B==0),F(R/T)>a-L&&Z("overflow"),L+=F(R/T),R%=T,p.splice(R++,0,L)}return he(p)}function we(i){var p,y,T,R,L,E,C,M,$,B,P,N=[],k,W,J,me;for(i=_e(i),k=i.length,p=se,y=0,L=ee,E=0;E<k;++E)P=i[E],P<128&&N.push(te(P));for(T=R=N.length,R&&N.push(I);T<k;){for(C=a,E=0;E<k;++E)P=i[E],P>=p&&P<C&&(C=P);for(W=T+1,C-p>F((a-y)/W)&&Z("overflow"),y+=(C-p)*W,p=C,E=0;E<k;++E)if(P=i[E],P<p&&++y>a&&Z("overflow"),P==p){for(M=y,$=v;B=$<=L?w:$>=L+A?A:$-L,!(M<B);$+=v)me=M-B,J=v-B,N.push(te(ue(B+me%J,0))),M=F(me/J);N.push(te(ue(M,0))),L=oe(y,W,T==R),y=0,++T}++y,++p}return N.join("")}function Le(i){return be(i,function(p){return Ee.test(p)?Te(p.slice(4).toLowerCase()):p})}function Pe(i){return be(i,function(p){return qe.test(p)?"xn--"+we(p):p})}if(u={version:"1.4.1",ucs2:{decode:_e,encode:he},decode:Te,encode:we,toASCII:Pe,toUnicode:Le},f&&n)if(o.exports==f)n.exports=u;else for(ae in u)u.hasOwnProperty(ae)&&(f[ae]=u[ae]);else h.punycode=u})(g.commonjsGlobal)})(Ae,Ae.exports);var et=Ae.exports;(function(o,r){Object.defineProperty(r,"__esModule",{value:!0});var h=et,f=g.require$$2;function n(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var b=n(h),u=n(f),a={isString:function(e){return typeof e=="string"},isObject:function(e){return typeof e=="object"&&e!==null},isNull:function(e){return e===null},isNullOrUndefined:function(e){return e==null}},v=b.default,w=a,A=oe,d=we,x=Le,ee=Te,se=I;function I(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var Ee=/^([a-z0-9.+-]+:)/i,qe=/:[0-9]*$/,Oe=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,Ue=["<",">",'"',"`"," ","\r",`
|
|
2
2
|
`," "],ce=["{","}","|","\\","^","`"].concat(Ue),F=["'"].concat(ce),te=["%","/","?",";","#"].concat(F),ae=["/","?","#"],Z=255,pe=/^[+a-z0-9A-Z_-]{0,63}$/,be=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,_e={javascript:!0,"javascript:":!0},he={javascript:!0,"javascript:":!0},re={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},ue=u.default;function oe(e,s,t){if(e&&w.isObject(e)&&e instanceof I)return e;var c=new I;return c.parse(e,s,t),c}I.prototype.parse=function(e,s,t){if(!w.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var c=e.indexOf("?"),_=c!==-1&&c<e.indexOf("#")?"?":"#",D=e.split(_),H=/\\/g;D[0]=D[0].replace(H,"/"),e=D.join(_);var l=e;if(l=l.trim(),!t&&e.split("#").length===1){var K=Oe.exec(l);if(K)return this.path=l,this.href=l,this.pathname=K[1],K[2]?(this.search=K[2],s?this.query=ue.parse(this.search.substr(1)):this.query=this.search.substr(1)):s&&(this.search="",this.query={}),this}var q=Ee.exec(l);if(q){q=q[0];var ie=q.toLowerCase();this.protocol=ie,l=l.substr(q.length)}if(t||q||l.match(/^\/\/[^@\/]+@[^@\/]+/)){var de=l.substr(0,2)==="//";de&&!(q&&he[q])&&(l=l.substr(2),this.slashes=!0)}if(!he[q]&&(de||q&&!re[q])){for(var j=-1,O=0;O<ae.length;O++){var Q=l.indexOf(ae[O]);Q!==-1&&(j===-1||Q<j)&&(j=Q)}var ve,G;j===-1?G=l.lastIndexOf("@"):G=l.lastIndexOf("@",j),G!==-1&&(ve=l.slice(0,G),l=l.slice(G+1),this.auth=decodeURIComponent(ve)),j=-1;for(var O=0;O<te.length;O++){var Q=l.indexOf(te[O]);Q!==-1&&(j===-1||Q<j)&&(j=Q)}j===-1&&(j=l.length),this.host=l.slice(0,j),l=l.slice(j),this.parseHost(),this.hostname=this.hostname||"";var ye=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!ye)for(var m=this.hostname.split(/\./),O=0,U=m.length;O<U;O++){var V=m[O];if(V&&!V.match(pe)){for(var z="",X=0,Se=V.length;X<Se;X++)V.charCodeAt(X)>127?z+="x":z+=V[X];if(!z.match(pe)){var ne=m.slice(0,O),Y=m.slice(O+1),le=V.match(be);le&&(ne.push(le[1]),Y.unshift(le[2])),Y.length&&(l="/"+Y.join(".")+l),this.hostname=ne.join(".");break}}}this.hostname.length>Z?this.hostname="":this.hostname=this.hostname.toLowerCase(),ye||(this.hostname=v.toASCII(this.hostname));var Ie=this.port?":"+this.port:"",ot=this.hostname||"";this.host=ot+Ie,this.href+=this.host,ye&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),l[0]!=="/"&&(l="/"+l))}if(!_e[ie])for(var O=0,U=F.length;O<U;O++){var ge=F[O];if(l.indexOf(ge)!==-1){var je=encodeURIComponent(ge);je===ge&&(je=escape(ge)),l=l.split(ge).join(je)}}var Fe=l.indexOf("#");Fe!==-1&&(this.hash=l.substr(Fe),l=l.slice(0,Fe));var Re=l.indexOf("?");if(Re!==-1?(this.search=l.substr(Re),this.query=l.substr(Re+1),s&&(this.query=ue.parse(this.query)),l=l.slice(0,Re)):s&&(this.search="",this.query={}),l&&(this.pathname=l),re[ie]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var Ie=this.pathname||"",nt=this.search||"";this.path=Ie+nt}return this.href=this.format(),this};function Te(e){return w.isString(e)&&(e=oe(e)),e instanceof I?e.format():I.prototype.format.call(e)}I.prototype.format=function(){var e=this.auth||"";e&&(e=encodeURIComponent(e),e=e.replace(/%3A/i,":"),e+="@");var s=this.protocol||"",t=this.pathname||"",c=this.hash||"",_=!1,D="";this.host?_=e+this.host:this.hostname&&(_=e+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(_+=":"+this.port)),this.query&&w.isObject(this.query)&&Object.keys(this.query).length&&(D=ue.stringify(this.query));var H=this.search||D&&"?"+D||"";return s&&s.substr(-1)!==":"&&(s+=":"),this.slashes||(!s||re[s])&&_!==!1?(_="//"+(_||""),t&&t.charAt(0)!=="/"&&(t="/"+t)):_||(_=""),c&&c.charAt(0)!=="#"&&(c="#"+c),H&&H.charAt(0)!=="?"&&(H="?"+H),t=t.replace(/[?#]/g,function(l){return encodeURIComponent(l)}),H=H.replace("#","%23"),s+_+t+H+c};function we(e,s){return oe(e,!1,!0).resolve(s)}I.prototype.resolve=function(e){return this.resolveObject(oe(e,!1,!0)).format()};function Le(e,s){return e?oe(e,!1,!0).resolveObject(s):s}I.prototype.resolveObject=function(e){if(w.isString(e)){var s=new I;s.parse(e,!1,!0),e=s}for(var t=new I,c=Object.keys(this),_=0;_<c.length;_++){var D=c[_];t[D]=this[D]}if(t.hash=e.hash,e.href==="")return t.href=t.format(),t;if(e.slashes&&!e.protocol){for(var H=Object.keys(e),l=0;l<H.length;l++){var K=H[l];K!=="protocol"&&(t[K]=e[K])}return re[t.protocol]&&t.hostname&&!t.pathname&&(t.path=t.pathname="/"),t.href=t.format(),t}if(e.protocol&&e.protocol!==t.protocol){if(!re[e.protocol]){for(var q=Object.keys(e),ie=0;ie<q.length;ie++){var de=q[ie];t[de]=e[de]}return t.href=t.format(),t}if(t.protocol=e.protocol,!e.host&&!he[e.protocol]){for(var U=(e.pathname||"").split("/");U.length&&!(e.host=U.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),U[0]!==""&&U.unshift(""),U.length<2&&U.unshift(""),t.pathname=U.join("/")}else t.pathname=e.pathname;if(t.search=e.search,t.query=e.query,t.host=e.host||"",t.auth=e.auth,t.hostname=e.hostname||e.host,t.port=e.port,t.pathname||t.search){var j=t.pathname||"",O=t.search||"";t.path=j+O}return t.slashes=t.slashes||e.slashes,t.href=t.format(),t}var Q=t.pathname&&t.pathname.charAt(0)==="/",ve=e.host||e.pathname&&e.pathname.charAt(0)==="/",G=ve||Q||t.host&&e.pathname,ye=G,m=t.pathname&&t.pathname.split("/")||[],U=e.pathname&&e.pathname.split("/")||[],V=t.protocol&&!re[t.protocol];if(V&&(t.hostname="",t.port=null,t.host&&(m[0]===""?m[0]=t.host:m.unshift(t.host)),t.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(U[0]===""?U[0]=e.host:U.unshift(e.host)),e.host=null),G=G&&(U[0]===""||m[0]==="")),ve)t.host=e.host||e.host===""?e.host:t.host,t.hostname=e.hostname||e.hostname===""?e.hostname:t.hostname,t.search=e.search,t.query=e.query,m=U;else if(U.length)m||(m=[]),m.pop(),m=m.concat(U),t.search=e.search,t.query=e.query;else if(!w.isNullOrUndefined(e.search)){if(V){t.hostname=t.host=m.shift();var z=t.host&&t.host.indexOf("@")>0?t.host.split("@"):!1;z&&(t.auth=z.shift(),t.host=t.hostname=z.shift())}return t.search=e.search,t.query=e.query,(!w.isNull(t.pathname)||!w.isNull(t.search))&&(t.path=(t.pathname?t.pathname:"")+(t.search?t.search:"")),t.href=t.format(),t}if(!m.length)return t.pathname=null,t.search?t.path="/"+t.search:t.path=null,t.href=t.format(),t;for(var X=m.slice(-1)[0],Se=(t.host||e.host||m.length>1)&&(X==="."||X==="..")||X==="",ne=0,Y=m.length;Y>=0;Y--)X=m[Y],X==="."?m.splice(Y,1):X===".."?(m.splice(Y,1),ne++):ne&&(m.splice(Y,1),ne--);if(!G&&!ye)for(;ne--;ne)m.unshift("..");G&&m[0]!==""&&(!m[0]||m[0].charAt(0)!=="/")&&m.unshift(""),Se&&m.join("/").substr(-1)!=="/"&&m.push("");var le=m[0]===""||m[0]&&m[0].charAt(0)==="/";if(V){t.hostname=t.host=le?"":m.length?m.shift():"";var z=t.host&&t.host.indexOf("@")>0?t.host.split("@"):!1;z&&(t.auth=z.shift(),t.host=t.hostname=z.shift())}return G=G||t.host&&m.length,G&&!le&&m.unshift(""),m.length?t.pathname=m.join("/"):(t.pathname=null,t.path=null),(!w.isNull(t.pathname)||!w.isNull(t.search))&&(t.path=(t.pathname?t.pathname:"")+(t.search?t.search:"")),t.auth=e.auth||t.auth,t.slashes=t.slashes||e.slashes,t.href=t.format(),t},I.prototype.parseHost=function(){var e=this.host,s=qe.exec(e);s&&(s=s[0],s!==":"&&(this.port=s.substr(1)),e=e.substr(0,e.length-s.length)),e&&(this.hostname=e)};function Pe(e,s){for(var t=0,c=e.length-1;c>=0;c--){var _=e[c];_==="."?e.splice(c,1):_===".."?(e.splice(c,1),t++):t&&(e.splice(c,1),t--)}if(s)for(;t--;t)e.unshift("..");return e}function i(){for(var e="",s=!1,t=arguments.length-1;t>=-1&&!s;t--){var c=t>=0?arguments[t]:"/";if(typeof c!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!c)continue;e=c+"/"+e,s=c.charAt(0)==="/"}return e=Pe(p(e.split("/"),function(_){return!!_}),!s).join("/"),(s?"/":"")+e||"."}function p(e,s){if(e.filter)return e.filter(s);for(var t=[],c=0;c<e.length;c++)s(e[c],c,e)&&t.push(e[c]);return t}var y=function(e){function s(){var c=this||self;return delete e.prototype.__magic__,c}if(typeof globalThis=="object")return globalThis;if(this)return s();e.defineProperty(e.prototype,"__magic__",{configurable:!0,get:s});var t=__magic__;return t}(Object),T=ee,R=A,L=d,E=se,C=y.URL,M=y.URLSearchParams,$=/%/g,B=/\\/g,P=/\n/g,N=/\r/g,k=/\t/g,W=47;function J(e){var s=e??null;return!!(s!==null&&(s!=null&&s.href)&&(s!=null&&s.origin))}function me(e){if(e.hostname!=="")throw new TypeError('File URL host must be "localhost" or empty on browser');for(var s=e.pathname,t=0;t<s.length;t++)if(s[t]==="%"){var c=s.codePointAt(t+2)|32;if(s[t+1]==="2"&&c===102)throw new TypeError("File URL path must not include encoded / characters")}return decodeURIComponent(s)}function rt(e){return e.includes("%")&&(e=e.replace($,"%25")),e.includes("\\")&&(e=e.replace(B,"%5C")),e.includes(`
|
|
3
3
|
`)&&(e=e.replace(P,"%0A")),e.includes("\r")&&(e=e.replace(N,"%0D")),e.includes(" ")&&(e=e.replace(k,"%09")),e}var $e=function(s){if(typeof s>"u")throw new TypeError('The "domain" argument must be specified');return new C("http://"+s).hostname},Be=function(s){if(typeof s>"u")throw new TypeError('The "domain" argument must be specified');return new C("http://"+s).hostname},ze=function(s){var t=new C("file://"),c=i(s),_=s.charCodeAt(s.length-1);return _===W&&c[c.length-1]!=="/"&&(c+="/"),t.pathname=rt(c),t},Xe=function(s){if(!J(s)&&typeof s!="string")throw new TypeError('The "path" argument must be of type string or an instance of URL. Received type '+typeof s+" ("+s+")");var t=new C(s);if(t.protocol!=="file:")throw new TypeError("The URL must be of scheme file");return me(t)},We=function(s,t){var c,_,D;if(t===void 0&&(t={}),!(s instanceof C))return T(s);if(typeof t!="object"||t===null)throw new TypeError('The "options" argument must be of type object.');var H=(c=t.auth)!=null?c:!0,l=(_=t.fragment)!=null?_:!0,K=(D=t.search)!=null?D:!0,q=new C(s.toString());return H||(q.username="",q.password=""),l||(q.hash=""),K||(q.search=""),q.toString()},Ke={format:We,parse:R,resolve:L,resolveObject:x,Url:E,URL:C,URLSearchParams:M,domainToASCII:$e,domainToUnicode:Be,pathToFileURL:ze,fileURLToPath:Xe};r.URL=C,r.URLSearchParams=M,r.Url=E,r.default=Ke,r.domainToASCII=$e,r.domainToUnicode=Be,r.fileURLToPath=Xe,r.format=We,r.parse=R,r.pathToFileURL=ze,r.resolve=L,r.resolveObject=x,r=o.exports=Ke})(Me,Me.exports);var De=Me.exports;(function(o){var r=lt,h=xe,f=ct,n=dt,b=De,u=o;u.request=function(a,v){typeof a=="string"?a=b.parse(a):a=f(a);var w=g.commonjsGlobal.location.protocol.search(/^https?:$/)===-1?"http:":"",A=a.protocol||w,d=a.hostname||a.host,x=a.port,ee=a.path||"/";d&&d.indexOf(":")!==-1&&(d="["+d+"]"),a.url=(d?A+"//"+d:"")+(x?":"+x:"")+ee,a.method=(a.method||"GET").toUpperCase(),a.headers=a.headers||{};var se=new r(a);return v&&se.on("response",v),se},u.get=function(v,w){var A=u.request(v,w);return A.end(),A},u.ClientRequest=r,u.IncomingMessage=h.IncomingMessage,u.Agent=function(){},u.Agent.defaultMaxSockets=4,u.globalAgent=new u.Agent,u.STATUS_CODES=n,u.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"]})(Ne);var tt={exports:{}};(function(o){var r=Ne,h=De,f=o.exports;for(var n in r)r.hasOwnProperty(n)&&(f[n]=r[n]);f.request=function(u,a){return u=b(u),r.request.call(this,u,a)},f.get=function(u,a){return u=b(u),r.get.call(this,u,a)};function b(u){if(typeof u=="string"&&(u=h.parse(u)),u.protocol||(u.protocol="https:"),u.protocol!=="https:")throw new Error('Protocol "'+u.protocol+'" not supported. Expected "https:"');return u}})(tt);var vt=tt.exports;exports.httpsBrowserifyExports=vt;exports.punycodeExports=et;exports.streamHttp=Ne;exports.urlExports=De;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { d as te, ab as el, y as It, bP as Bo, o as Nw, g as Tw } from "./index
|
|
2
|
-
import { c as U, s as Vo, x as tl, r as rl, H as Cw, a as il, q as xs } from "./index-
|
|
3
|
-
import { c as $w, a as xw, g as ku, s as Dw, d as Fw, k as qw, b as jw, I as mr, f as Et, t as dt, e as zu, C as Uw, r as Mw, h as Lr, i as sl, j as Nt, l as js, G as Lw, E as Ge, y as rt, o as Us, m as Ms, n as Hu, p as kw, q as zw, u as Hw, v as Ko, w as Ls, x as Wo, z as er, Y as Bw, A as Vw, B as Bu, D as Kw } from "./browser-
|
|
1
|
+
import { d as te, ab as el, y as It, bP as Bo, o as Nw, g as Tw } from "./index--a8G4lcW.mjs";
|
|
2
|
+
import { c as U, s as Vo, x as tl, r as rl, H as Cw, a as il, q as xs } from "./index-CEYaDz-X.mjs";
|
|
3
|
+
import { c as $w, a as xw, g as ku, s as Dw, d as Fw, k as qw, b as jw, I as mr, f as Et, t as dt, e as zu, C as Uw, r as Mw, h as Lr, i as sl, j as Nt, l as js, G as Lw, E as Ge, y as rt, o as Us, m as Ms, n as Hu, p as kw, q as zw, u as Hw, v as Ko, w as Ls, x as Wo, z as er, Y as Bw, A as Vw, B as Bu, D as Kw } from "./browser-B79UewaZ.mjs";
|
|
4
4
|
var he = {};
|
|
5
5
|
Object.defineProperty(he, "__esModule", { value: !0 });
|
|
6
6
|
he.getLocalStorage = he.getLocalStorageOrThrow = he.getCrypto = he.getCryptoOrThrow = he.getLocation = he.getLocationOrThrow = he.getNavigator = he.getNavigatorOrThrow = he.getDocument = he.getDocumentOrThrow = he.getFromWindowOrThrow = he.getFromWindow = void 0;
|
|
@@ -8620,7 +8620,7 @@ class ua {
|
|
|
8620
8620
|
if (this.rpc = this.getRpcConfig(t), this.chainId = this.rpc.chains.length ? qs(this.rpc.chains) : qs(this.rpc.optionalChains), this.signer = await wP.init({ projectId: this.rpc.projectId, metadata: this.rpc.metadata, disableProviderPing: t.disableProviderPing, relayUrl: t.relayUrl, storageOptions: t.storageOptions }), this.registerEventListeners(), await this.loadPersistedSession(), this.rpc.showQrModal) {
|
|
8621
8621
|
let r;
|
|
8622
8622
|
try {
|
|
8623
|
-
const { WalletConnectModal: s } = await import("./index-
|
|
8623
|
+
const { WalletConnectModal: s } = await import("./index-D_DayKXK.mjs").then((a) => a.i);
|
|
8624
8624
|
r = s;
|
|
8625
8625
|
} catch {
|
|
8626
8626
|
throw new Error("To use QR modal, please install @walletconnect/modal package");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const H=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const H=require("./index-D2IEwdXM.js"),F=require("./index-CrUwXkHx.js"),I=require("./browser-BnvapQOm.js");var le={};Object.defineProperty(le,"__esModule",{value:!0});le.getLocalStorage=le.getLocalStorageOrThrow=le.getCrypto=le.getCryptoOrThrow=le.getLocation=le.getLocationOrThrow=le.getNavigator=le.getNavigatorOrThrow=le.getDocument=le.getDocumentOrThrow=le.getFromWindowOrThrow=le.getFromWindow=void 0;function lr(o){let t;return typeof window<"u"&&typeof window[o]<"u"&&(t=window[o]),t}le.getFromWindow=lr;function Fr(o){const t=lr(o);if(!t)throw new Error(`${o} is not defined in Window`);return t}le.getFromWindowOrThrow=Fr;function nw(){return Fr("document")}le.getDocumentOrThrow=nw;function ow(){return lr("document")}le.getDocument=ow;function aw(){return Fr("navigator")}le.getNavigatorOrThrow=aw;function cw(){return lr("navigator")}le.getNavigator=cw;function uw(){return Fr("location")}le.getLocationOrThrow=uw;function hw(){return lr("location")}le.getLocation=hw;function lw(){return Fr("crypto")}le.getCryptoOrThrow=lw;function pw(){return lr("crypto")}le.getCrypto=pw;function dw(){return Fr("localStorage")}le.getLocalStorageOrThrow=dw;function fw(){return lr("localStorage")}le.getLocalStorage=fw;var $o={};Object.defineProperty($o,"__esModule",{value:!0});$o.getWindowMetadata=void 0;const Pu=le;function gw(){let o,t;try{o=Pu.getDocumentOrThrow(),t=Pu.getLocationOrThrow()}catch{return null}function r(){const R=o.getElementsByTagName("link"),N=[];for(let M=0;M<R.length;M++){const C=R[M],V=C.getAttribute("rel");if(V&&V.toLowerCase().indexOf("icon")>-1){const q=C.getAttribute("href");if(q)if(q.toLowerCase().indexOf("https:")===-1&&q.toLowerCase().indexOf("http:")===-1&&q.indexOf("//")!==0){let Y=t.protocol+"//"+t.host;if(q.indexOf("/")===0)Y+=q;else{const me=t.pathname.split("/");me.pop();const te=me.join("/");Y+=te+"/"+q}N.push(Y)}else if(q.indexOf("//")===0){const Y=t.protocol+q;N.push(Y)}else N.push(q)}}return N}function s(...R){const N=o.getElementsByTagName("meta");for(let M=0;M<N.length;M++){const C=N[M],V=["itemprop","property","name"].map(q=>C.getAttribute(q)).filter(q=>q?R.includes(q):!1);if(V.length&&V){const q=C.getAttribute("content");if(q)return q}}return""}function a(){let R=s("name","og:site_name","og:title","twitter:title");return R||(R=o.title),R}function u(){return s("description","og:description","twitter:description","keywords")}const l=a(),f=u(),w=t.origin,_=r();return{description:f,url:w,icons:_,name:l}}$o.getWindowMetadata=gw;function yw(o,t=[]){const r=[];return Object.keys(o).forEach(s=>{if(t.length&&!t.includes(s))return;const a=o[s];r.push(...a.accounts)}),r}const mw={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}};function vw(o,t){const{message:r,code:s}=mw[o];return{message:r,code:s}}function wo(o,t){return!!Array.isArray(o)}const ww=o=>JSON.stringify(o,(t,r)=>typeof r=="bigint"?r.toString()+"n":r),bw=o=>{const t=/([\[:])?(\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,r=o.replace(t,'$1"$2n"$3');return JSON.parse(r,(s,a)=>typeof a=="string"&&a.match(/^\d+n$/)?BigInt(a.substring(0,a.length-1)):a)};function xo(o){if(typeof o!="string")throw new Error(`Cannot safe json parse value of type ${typeof o}`);try{return bw(o)}catch{return o}}function Do(o){return typeof o=="string"?o:ww(o)||""}const _w="idb-keyval";var Ew=(o={})=>{const t=o.base&&o.base.length>0?`${o.base}:`:"",r=a=>t+a;let s;return o.dbName&&o.storeName&&(s=I.createStore(o.dbName,o.storeName)),{name:_w,options:o,async hasItem(a){return!(typeof await I.get(r(a),s)>"u")},async getItem(a){return await I.get(r(a),s)??null},setItem(a,u){return I.set(r(a),u,s)},removeItem(a){return I.del(r(a),s)},getKeys(){return I.keys(s)},clear(){return I.clear(s)}}};const Iw="WALLET_CONNECT_V2_INDEXED_DB",Pw="keyvaluestorage";let Sw=class{constructor(){this.indexedDb=I.createStorage({driver:Ew({dbName:Iw,storeName:Pw})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(t=>[t.key,t.value])}async getItem(t){const r=await this.indexedDb.getItem(t);if(r!==null)return r}async setItem(t,r){await this.indexedDb.setItem(t,Do(r))}async removeItem(t){await this.indexedDb.removeItem(t)}};var so=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof H.dist.global<"u"?H.dist.global:typeof self<"u"?self:{},Es={exports:{}};(function(){let o;function t(){}o=t,o.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},o.prototype.setItem=function(r,s){this[r]=String(s)},o.prototype.removeItem=function(r){delete this[r]},o.prototype.clear=function(){const r=this;Object.keys(r).forEach(function(s){r[s]=void 0,delete r[s]})},o.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},o.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof so<"u"&&so.localStorage?Es.exports=so.localStorage:typeof window<"u"&&window.localStorage?Es.exports=window.localStorage:Es.exports=new t})();function Ow(o){var t;return[o[0],xo((t=o[1])!=null?t:"")]}let Rw=class{constructor(){this.localStorage=Es.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(Ow)}async getItem(t){const r=this.localStorage.getItem(t);if(r!==null)return xo(r)}async setItem(t,r){this.localStorage.setItem(t,Do(r))}async removeItem(t){this.localStorage.removeItem(t)}};const Aw="wc_storage_version",Su=1,Nw=async(o,t,r)=>{const s=Aw,a=await t.getItem(s);if(a&&a>=Su){r(t);return}const u=await o.getKeys();if(!u.length){r(t);return}const l=[];for(;u.length;){const f=u.shift();if(!f)continue;const w=f.toLowerCase();if(w.includes("wc@")||w.includes("walletconnect")||w.includes("wc_")||w.includes("wallet_connect")){const _=await o.getItem(f);await t.setItem(f,_),l.push(f)}}await t.setItem(s,Su),r(t),Tw(o,l)},Tw=async(o,t)=>{t.length&&t.forEach(async r=>{await o.removeItem(r)})};let Cw=class{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const t=new Rw;this.storage=t;try{const r=new Sw;Nw(t,r,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(t){return await this.initialize(),this.storage.getItem(t)}async setItem(t,r){return await this.initialize(),this.storage.setItem(t,r)}async removeItem(t){return await this.initialize(),this.storage.removeItem(t)}async initialize(){this.initialized||await new Promise(t=>{const r=setInterval(()=>{this.initialized&&(clearInterval(r),t())},20)})}};var jr={};/*! *****************************************************************************
|
|
2
2
|
Copyright (c) Microsoft Corporation.
|
|
3
3
|
|
|
4
4
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -43,4 +43,4 @@ __p += '`),ee&&(A+=`' +
|
|
|
43
43
|
function print() { __p += __j.call(arguments, '') }
|
|
44
44
|
`:`;
|
|
45
45
|
`)+A+`return __p
|
|
46
|
-
}`;var G=_u(function(){return ie(d,U+"return "+A).apply(r,g)});if(G.source=A,Wn(G))throw G;return G}function pv(e){return se(e).toLowerCase()}function dv(e){return se(e).toUpperCase()}function fv(e,i,n){if(e=se(e),e&&(n||i===r))return Ta(e);if(!e||!(i=Ye(i)))return e;var c=ft(e),h=ft(i),d=Ca(c,h),g=$a(c,h)+1;return Wt(c,d,g).join("")}function gv(e,i,n){if(e=se(e),e&&(n||i===r))return e.slice(0,Da(e)+1);if(!e||!(i=Ye(i)))return e;var c=ft(e),h=$a(c,ft(i))+1;return Wt(c,0,h).join("")}function yv(e,i,n){if(e=se(e),e&&(n||i===r))return e.replace(Ks,"");if(!e||!(i=Ye(i)))return e;var c=ft(e),h=Ca(c,ft(i));return Wt(c,h).join("")}function mv(e,i){var n=Ds,c=rt;if(be(i)){var h="separator"in i?i.separator:h;n="length"in i?W(i.length):n,c="omission"in i?Ye(i.omission):c}e=se(e);var d=e.length;if(wr(e)){var g=ft(e);d=g.length}if(n>=d)return e;var y=n-br(c);if(y<1)return c;var v=g?Wt(g,0,y).join(""):e.slice(0,y);if(h===r)return v+c;if(g&&(y+=v.length-y),Jn(h)){if(e.slice(y).search(h)){var S,O=v;for(h.global||(h=hn(h.source,se(Zo.exec(h))+"g")),h.lastIndex=0;S=h.exec(O);)var A=S.index;v=v.slice(0,A===r?y:A)}}else if(e.indexOf(Ye(h),y)!=y){var D=v.lastIndexOf(h);D>-1&&(v=v.slice(0,D))}return v+c}function vv(e){return e=se(e),e&&Al.test(e)?e.replace(Go,Kp):e}var wv=Rr(function(e,i,n){return e+(n?" ":"")+i.toUpperCase()}),Yn=Ec("toUpperCase");function bu(e,i,n){return e=se(e),i=n?r:i,i===r?kp(e)?Gp(e):$p(e):e.match(i)||[]}var _u=Q(function(e,i){try{return Ge(e,r,i)}catch(n){return Wn(n)?n:new B(n)}}),bv=Ct(function(e,i){return st(i,function(n){n=It(n),Nt(e,n,Vn(e[n],e))}),e});function _v(e){var i=e==null?0:e.length,n=L();return e=i?ge(e,function(c){if(typeof c[1]!="function")throw new nt(l);return[n(c[0]),c[1]]}):[],Q(function(c){for(var h=-1;++h<i;){var d=e[h];if(Ge(d[0],this,c))return Ge(d[1],this,c)}})}function Ev(e){return Kd(at(e,R))}function Zn(e){return function(){return e}}function Iv(e,i){return e==null||e!==e?i:e}var Pv=Pc(),Sv=Pc(!0);function Ve(e){return e}function Xn(e){return ec(typeof e=="function"?e:at(e,R))}function Ov(e){return rc(at(e,R))}function Rv(e,i){return ic(e,at(i,R))}var Av=Q(function(e,i){return function(n){return si(n,e,i)}}),Nv=Q(function(e,i){return function(n){return si(e,n,i)}});function eo(e,i,n){var c=Ae(i),h=Zi(i,c);n==null&&!(be(i)&&(h.length||!c.length))&&(n=i,i=e,e=this,h=Zi(i,Ae(i)));var d=!(be(n)&&"chain"in n)||!!n.chain,g=xt(e);return st(h,function(y){var v=i[y];e[y]=v,g&&(e.prototype[y]=function(){var S=this.__chain__;if(d||S){var O=e(this.__wrapped__),A=O.__actions__=ze(this.__actions__);return A.push({func:v,args:arguments,thisArg:e}),O.__chain__=S,O}return v.apply(e,kt([this.value()],arguments))})}),e}function Tv(){return Ce._===this&&(Ce._=td),this}function to(){}function Cv(e){return e=W(e),Q(function(i){return sc(i,e)})}var $v=$n(ge),xv=$n(Sa),Dv=$n(rn);function Eu(e){return Mn(e)?sn(It(e)):hf(e)}function Fv(e){return function(i){return e==null?r:sr(e,i)}}var jv=Oc(),qv=Oc(!0);function ro(){return[]}function io(){return!1}function Uv(){return{}}function Mv(){return""}function Lv(){return!0}function kv(e,i){if(e=W(e),e<1||e>ue)return[];var n=De,c=Fe(e,De);i=L(i),e-=De;for(var h=an(c,i);++n<e;)i(n);return h}function zv(e){return K(e)?ge(e,It):Ze(e)?[e]:ze(zc(se(e)))}function Hv(e){var i=++Xp;return se(e)+i}var Bv=ss(function(e,i){return e+i},0),Vv=xn("ceil"),Kv=ss(function(e,i){return e/i},1),Wv=xn("floor");function Jv(e){return e&&e.length?Yi(e,Ve,vn):r}function Gv(e,i){return e&&e.length?Yi(e,L(i,2),vn):r}function Qv(e){return Aa(e,Ve)}function Yv(e,i){return Aa(e,L(i,2))}function Zv(e){return e&&e.length?Yi(e,Ve,En):r}function Xv(e,i){return e&&e.length?Yi(e,L(i,2),En):r}var ew=ss(function(e,i){return e*i},1),tw=xn("round"),rw=ss(function(e,i){return e-i},0);function iw(e){return e&&e.length?on(e,Ve):0}function sw(e,i){return e&&e.length?on(e,L(i,2)):0}return p.after=Oy,p.ary=Xc,p.assign=dm,p.assignIn=du,p.assignInWith=ms,p.assignWith=fm,p.at=gm,p.before=eu,p.bind=Vn,p.bindAll=bv,p.bindKey=tu,p.castArray=Uy,p.chain=Qc,p.chunk=Wf,p.compact=Jf,p.concat=Gf,p.cond=_v,p.conforms=Ev,p.constant=Zn,p.countBy=iy,p.create=ym,p.curry=ru,p.curryRight=iu,p.debounce=su,p.defaults=mm,p.defaultsDeep=vm,p.defer=Ry,p.delay=Ay,p.difference=Qf,p.differenceBy=Yf,p.differenceWith=Zf,p.drop=Xf,p.dropRight=eg,p.dropRightWhile=tg,p.dropWhile=rg,p.fill=ig,p.filter=ny,p.flatMap=cy,p.flatMapDeep=uy,p.flatMapDepth=hy,p.flatten=Kc,p.flattenDeep=sg,p.flattenDepth=ng,p.flip=Ny,p.flow=Pv,p.flowRight=Sv,p.fromPairs=og,p.functions=Sm,p.functionsIn=Om,p.groupBy=ly,p.initial=cg,p.intersection=ug,p.intersectionBy=hg,p.intersectionWith=lg,p.invert=Am,p.invertBy=Nm,p.invokeMap=dy,p.iteratee=Xn,p.keyBy=fy,p.keys=Ae,p.keysIn=Be,p.map=ls,p.mapKeys=Cm,p.mapValues=$m,p.matches=Ov,p.matchesProperty=Rv,p.memoize=ds,p.merge=xm,p.mergeWith=fu,p.method=Av,p.methodOf=Nv,p.mixin=eo,p.negate=fs,p.nthArg=Cv,p.omit=Dm,p.omitBy=Fm,p.once=Ty,p.orderBy=gy,p.over=$v,p.overArgs=Cy,p.overEvery=xv,p.overSome=Dv,p.partial=Kn,p.partialRight=nu,p.partition=yy,p.pick=jm,p.pickBy=gu,p.property=Eu,p.propertyOf=Fv,p.pull=gg,p.pullAll=Jc,p.pullAllBy=yg,p.pullAllWith=mg,p.pullAt=vg,p.range=jv,p.rangeRight=qv,p.rearg=$y,p.reject=wy,p.remove=wg,p.rest=xy,p.reverse=Hn,p.sampleSize=_y,p.set=Um,p.setWith=Mm,p.shuffle=Ey,p.slice=bg,p.sortBy=Sy,p.sortedUniq=Rg,p.sortedUniqBy=Ag,p.split=cv,p.spread=Dy,p.tail=Ng,p.take=Tg,p.takeRight=Cg,p.takeRightWhile=$g,p.takeWhile=xg,p.tap=Jg,p.throttle=Fy,p.thru=hs,p.toArray=hu,p.toPairs=yu,p.toPairsIn=mu,p.toPath=zv,p.toPlainObject=pu,p.transform=Lm,p.unary=jy,p.union=Dg,p.unionBy=Fg,p.unionWith=jg,p.uniq=qg,p.uniqBy=Ug,p.uniqWith=Mg,p.unset=km,p.unzip=Bn,p.unzipWith=Gc,p.update=zm,p.updateWith=Hm,p.values=Tr,p.valuesIn=Bm,p.without=Lg,p.words=bu,p.wrap=qy,p.xor=kg,p.xorBy=zg,p.xorWith=Hg,p.zip=Bg,p.zipObject=Vg,p.zipObjectDeep=Kg,p.zipWith=Wg,p.entries=yu,p.entriesIn=mu,p.extend=du,p.extendWith=ms,eo(p,p),p.add=Bv,p.attempt=_u,p.camelCase=Jm,p.capitalize=vu,p.ceil=Vv,p.clamp=Vm,p.clone=My,p.cloneDeep=ky,p.cloneDeepWith=zy,p.cloneWith=Ly,p.conformsTo=Hy,p.deburr=wu,p.defaultTo=Iv,p.divide=Kv,p.endsWith=Gm,p.eq=yt,p.escape=Qm,p.escapeRegExp=Ym,p.every=sy,p.find=oy,p.findIndex=Bc,p.findKey=wm,p.findLast=ay,p.findLastIndex=Vc,p.findLastKey=bm,p.floor=Wv,p.forEach=Yc,p.forEachRight=Zc,p.forIn=_m,p.forInRight=Em,p.forOwn=Im,p.forOwnRight=Pm,p.get=Gn,p.gt=By,p.gte=Vy,p.has=Rm,p.hasIn=Qn,p.head=Wc,p.identity=Ve,p.includes=py,p.indexOf=ag,p.inRange=Km,p.invoke=Tm,p.isArguments=ar,p.isArray=K,p.isArrayBuffer=Ky,p.isArrayLike=He,p.isArrayLikeObject=Ee,p.isBoolean=Wy,p.isBuffer=Jt,p.isDate=Jy,p.isElement=Gy,p.isEmpty=Qy,p.isEqual=Yy,p.isEqualWith=Zy,p.isError=Wn,p.isFinite=Xy,p.isFunction=xt,p.isInteger=ou,p.isLength=gs,p.isMap=au,p.isMatch=em,p.isMatchWith=tm,p.isNaN=rm,p.isNative=im,p.isNil=nm,p.isNull=sm,p.isNumber=cu,p.isObject=be,p.isObjectLike=_e,p.isPlainObject=hi,p.isRegExp=Jn,p.isSafeInteger=om,p.isSet=uu,p.isString=ys,p.isSymbol=Ze,p.isTypedArray=Nr,p.isUndefined=am,p.isWeakMap=cm,p.isWeakSet=um,p.join=pg,p.kebabCase=Zm,p.last=ut,p.lastIndexOf=dg,p.lowerCase=Xm,p.lowerFirst=ev,p.lt=hm,p.lte=lm,p.max=Jv,p.maxBy=Gv,p.mean=Qv,p.meanBy=Yv,p.min=Zv,p.minBy=Xv,p.stubArray=ro,p.stubFalse=io,p.stubObject=Uv,p.stubString=Mv,p.stubTrue=Lv,p.multiply=ew,p.nth=fg,p.noConflict=Tv,p.noop=to,p.now=ps,p.pad=tv,p.padEnd=rv,p.padStart=iv,p.parseInt=sv,p.random=Wm,p.reduce=my,p.reduceRight=vy,p.repeat=nv,p.replace=ov,p.result=qm,p.round=tw,p.runInContext=m,p.sample=by,p.size=Iy,p.snakeCase=av,p.some=Py,p.sortedIndex=_g,p.sortedIndexBy=Eg,p.sortedIndexOf=Ig,p.sortedLastIndex=Pg,p.sortedLastIndexBy=Sg,p.sortedLastIndexOf=Og,p.startCase=uv,p.startsWith=hv,p.subtract=rw,p.sum=iw,p.sumBy=sw,p.template=lv,p.times=kv,p.toFinite=Dt,p.toInteger=W,p.toLength=lu,p.toLower=pv,p.toNumber=ht,p.toSafeInteger=pm,p.toString=se,p.toUpper=dv,p.trim=fv,p.trimEnd=gv,p.trimStart=yv,p.truncate=mv,p.unescape=vv,p.uniqueId=Hv,p.upperCase=wv,p.upperFirst=Yn,p.each=Yc,p.eachRight=Zc,p.first=Wc,eo(p,function(){var e={};return _t(p,function(i,n){oe.call(p.prototype,n)||(e[n]=i)}),e}(),{chain:!1}),p.VERSION=s,st(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){p[e].placeholder=p}),st(["drop","take"],function(e,i){X.prototype[e]=function(n){n=n===r?1:Re(W(n),0);var c=this.__filtered__&&!i?new X(this):this.clone();return c.__filtered__?c.__takeCount__=Fe(n,c.__takeCount__):c.__views__.push({size:Fe(n,De),type:e+(c.__dir__<0?"Right":"")}),c},X.prototype[e+"Right"]=function(n){return this.reverse()[e](n).reverse()}}),st(["filter","map","takeWhile"],function(e,i){var n=i+1,c=n==E||n==J;X.prototype[e]=function(h){var d=this.clone();return d.__iteratees__.push({iteratee:L(h,3),type:n}),d.__filtered__=d.__filtered__||c,d}}),st(["head","last"],function(e,i){var n="take"+(i?"Right":"");X.prototype[e]=function(){return this[n](1).value()[0]}}),st(["initial","tail"],function(e,i){var n="drop"+(i?"":"Right");X.prototype[e]=function(){return this.__filtered__?new X(this):this[n](1)}}),X.prototype.compact=function(){return this.filter(Ve)},X.prototype.find=function(e){return this.filter(e).head()},X.prototype.findLast=function(e){return this.reverse().find(e)},X.prototype.invokeMap=Q(function(e,i){return typeof e=="function"?new X(this):this.map(function(n){return si(n,e,i)})}),X.prototype.reject=function(e){return this.filter(fs(L(e)))},X.prototype.slice=function(e,i){e=W(e);var n=this;return n.__filtered__&&(e>0||i<0)?new X(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),i!==r&&(i=W(i),n=i<0?n.dropRight(-i):n.take(i-e)),n)},X.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},X.prototype.toArray=function(){return this.take(De)},_t(X.prototype,function(e,i){var n=/^(?:filter|find|map|reject)|While$/.test(i),c=/^(?:head|last)$/.test(i),h=p[c?"take"+(i=="last"?"Right":""):i],d=c||/^find/.test(i);h&&(p.prototype[i]=function(){var g=this.__wrapped__,y=c?[1]:arguments,v=g instanceof X,S=y[0],O=v||K(g),A=function(Z){var ee=h.apply(p,kt([Z],y));return c&&D?ee[0]:ee};O&&n&&typeof S=="function"&&S.length!=1&&(v=O=!1);var D=this.__chain__,U=!!this.__actions__.length,k=d&&!D,G=v&&!U;if(!d&&O){g=G?g:new X(this);var z=e.apply(g,y);return z.__actions__.push({func:hs,args:[A],thisArg:r}),new ot(z,D)}return k&&G?e.apply(this,y):(z=this.thru(A),k?c?z.value()[0]:z.value():z)})}),st(["pop","push","shift","sort","splice","unshift"],function(e){var i=ji[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",c=/^(?:pop|shift)$/.test(e);p.prototype[e]=function(){var h=arguments;if(c&&!this.__chain__){var d=this.value();return i.apply(K(d)?d:[],h)}return this[n](function(g){return i.apply(K(g)?g:[],h)})}}),_t(X.prototype,function(e,i){var n=p[i];if(n){var c=n.name+"";oe.call(Pr,c)||(Pr[c]=[]),Pr[c].push({name:i,func:n})}}),Pr[is(r,Y).name]=[{name:"wrapper",func:r}],X.prototype.clone=md,X.prototype.reverse=vd,X.prototype.value=wd,p.prototype.at=Gg,p.prototype.chain=Qg,p.prototype.commit=Yg,p.prototype.next=Zg,p.prototype.plant=ey,p.prototype.reverse=ty,p.prototype.toJSON=p.prototype.valueOf=p.prototype.value=ry,p.prototype.first=p.prototype.head,Yr&&(p.prototype[Yr]=Xg),p},_r=Qp();Xt?((Xt.exports=_r)._=_r,Zs._=_r):Ce._=_r}).call(mi)})(Co,Co.exports);var cI=Object.defineProperty,uI=Object.defineProperties,hI=Object.getOwnPropertyDescriptors,Sh=Object.getOwnPropertySymbols,lI=Object.prototype.hasOwnProperty,pI=Object.prototype.propertyIsEnumerable,Oh=(o,t,r)=>t in o?cI(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,bs=(o,t)=>{for(var r in t||(t={}))lI.call(t,r)&&Oh(o,r,t[r]);if(Sh)for(var r of Sh(t))pI.call(t,r)&&Oh(o,r,t[r]);return o},dI=(o,t)=>uI(o,hI(t));function Yt(o,t,r){var s;const a=k0(o);return((s=t.rpcMap)==null?void 0:s[a.reference])||`${aI}?chainId=${a.namespace}:${a.reference}&projectId=${r}`}function fr(o){return o.includes(":")?o.split(":")[1]:o}function dl(o){return o.map(t=>`${t.split(":")[0]}:${t.split(":")[1]}`)}function fI(o,t){const r=Object.keys(t.namespaces).filter(a=>a.includes(o));if(!r.length)return[];const s=[];return r.forEach(a=>{const u=t.namespaces[a].accounts;s.push(...u)}),s}function gI(o={},t={}){const r=Rh(o),s=Rh(t);return Co.exports.merge(r,s)}function Rh(o){var t,r,s,a;const u={};if(!Dr(o))return u;for(const[l,f]of Object.entries(o)){const w=ko(l)?[l]:f.chains,_=f.methods||[],T=f.events||[],R=f.rpcMap||{},N=vi(l);u[N]=dI(bs(bs({},u[N]),f),{chains:ao(w,(t=u[N])==null?void 0:t.chains),methods:ao(_,(r=u[N])==null?void 0:r.methods),events:ao(T,(s=u[N])==null?void 0:s.events),rpcMap:bs(bs({},R),(a=u[N])==null?void 0:a.rpcMap)})}return u}function yI(o){return o.includes(":")?o.split(":")[2]:o}function mI(o){const t={};for(const[r,s]of Object.entries(o)){const a=s.methods||[],u=s.events||[],l=s.accounts||[],f=ko(r)?[r]:s.chains?s.chains:dl(s.accounts);t[r]={chains:f,methods:a,events:u,accounts:l}}return t}function go(o){return typeof o=="number"?o:o.includes("0x")?parseInt(o,16):o.includes(":")?Number(o.split(":")[1]):Number(o)}const fl={},ye=o=>fl[o],yo=(o,t)=>{fl[o]=t};class vI{constructor(t){this.name="polkadot",this.namespace=t.namespace,this.events=ye("events"),this.client=ye("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Mt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=fr(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Yt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Ut(new Zt(s,ye("disableProviderPing")))}}class wI{constructor(t){this.name="eip155",this.namespace=t.namespace,this.events=ye("events"),this.client=ye("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(t){switch(t.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(t);case"eth_chainId":return parseInt(this.getDefaultChain())}return this.namespace.methods.includes(t.request.method)?await this.client.request(t):this.getHttpProvider().request(t.request)}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(parseInt(t),r),this.chainId=parseInt(t),this.events.emit(Mt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}createHttpProvider(t,r){const s=r||Yt(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Ut(new Zt(s,ye("disableProviderPing")))}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=parseInt(fr(r));t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const t=this.chainId,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}async handleSwitchChain(t){var r,s;let a=t.request.params?(r=t.request.params[0])==null?void 0:r.chainId:"0x0";a=a.startsWith("0x")?a:`0x${a}`;const u=parseInt(a,16);if(this.isChainApproved(u))this.setDefaultChain(`${u}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:t.topic,request:{method:t.request.method,params:[{chainId:a}]},chainId:(s=this.namespace.chains)==null?void 0:s[0]}),this.setDefaultChain(`${u}`);else throw new Error(`Failed to switch to chain 'eip155:${u}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(t){return this.namespace.chains.includes(`${this.name}:${t}`)}}class bI{constructor(t){this.name="solana",this.namespace=t.namespace,this.events=ye("events"),this.client=ye("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Mt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=fr(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Yt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Ut(new Zt(s,ye("disableProviderPing")))}}class _I{constructor(t){this.name="cosmos",this.namespace=t.namespace,this.events=ye("events"),this.client=ye("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Mt.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=fr(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Yt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Ut(new Zt(s,ye("disableProviderPing")))}}class EI{constructor(t){this.name="cip34",this.namespace=t.namespace,this.events=ye("events"),this.client=ye("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Mt.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{const s=this.getCardanoRPCUrl(r),a=fr(r);t[a]=this.createHttpProvider(a,s)}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}getCardanoRPCUrl(t){const r=this.namespace.rpcMap;if(r)return r[t]}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||this.getCardanoRPCUrl(t);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Ut(new Zt(s,ye("disableProviderPing")))}}class II{constructor(t){this.name="elrond",this.namespace=t.namespace,this.events=ye("events"),this.client=ye("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Mt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=fr(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Yt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Ut(new Zt(s,ye("disableProviderPing")))}}class PI{constructor(t){this.name="multiversx",this.namespace=t.namespace,this.events=ye("events"),this.client=ye("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Mt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=fr(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Yt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Ut(new Zt(s,ye("disableProviderPing")))}}class SI{constructor(t){this.name="near",this.namespace=t.namespace,this.events=ye("events"),this.client=ye("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){if(this.chainId=t,!this.httpProviders[t]){const s=r||Yt(`${this.name}:${t}`,this.namespace);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,s)}this.events.emit(Mt.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;t[r]=this.createHttpProvider(r,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Yt(t,this.namespace);return typeof s>"u"?void 0:new Ut(new Zt(s,ye("disableProviderPing")))}}var OI=Object.defineProperty,RI=Object.defineProperties,AI=Object.getOwnPropertyDescriptors,Ah=Object.getOwnPropertySymbols,NI=Object.prototype.hasOwnProperty,TI=Object.prototype.propertyIsEnumerable,Nh=(o,t,r)=>t in o?OI(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,_s=(o,t)=>{for(var r in t||(t={}))NI.call(t,r)&&Nh(o,r,t[r]);if(Ah)for(var r of Ah(t))TI.call(t,r)&&Nh(o,r,t[r]);return o},mo=(o,t)=>RI(o,AI(t));class Ko{constructor(t){this.events=new H.Ct,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=t,this.logger=typeof(t==null?void 0:t.logger)<"u"&&typeof(t==null?void 0:t.logger)!="string"?t.logger:I.ot(I.k({level:(t==null?void 0:t.logger)||Ih})),this.disableProviderPing=(t==null?void 0:t.disableProviderPing)||!1}static async init(t){const r=new Ko(t);return await r.initialize(),r}async request(t,r){const[s,a]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(s).request({request:_s({},t),chainId:`${s}:${a}`,topic:this.session.topic})}sendAsync(t,r,s){const a=new Date().getTime();this.request(t,s).then(u=>r(null,I.formatJsonRpcResult(a,u))).catch(u=>r(u,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var t;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(t=this.session)==null?void 0:t.topic,reason:Pe("USER_DISCONNECTED")}),await this.cleanup()}async connect(t){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(t),await this.cleanupPendingPairings(),!t.skipPairing)return await this.pair(t.pairingTopic)}on(t,r){this.events.on(t,r)}once(t,r){this.events.once(t,r)}removeListener(t,r){this.events.removeListener(t,r)}off(t,r){this.events.off(t,r)}get isWalletConnect(){return!0}async pair(t){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:s,approval:a}=await this.client.connect({pairingTopic:t,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});s&&(this.uri=s,this.events.emit("display_uri",s)),await a().then(u=>{this.session=u,this.namespaces||(this.namespaces=mI(u.namespaces),this.persist("namespaces",this.namespaces))}).catch(u=>{if(u.message!==ll)throw u;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(t,r){try{if(!this.session)return;const[s,a]=this.validateChain(t);this.getProvider(s).setDefaultChain(a,r)}catch(s){if(!/Please call connect/.test(s.message))throw s}}async cleanupPendingPairings(t={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(hr(r)){for(const s of r)t.deletePairings?this.client.core.expirer.set(s.topic,0):await this.client.core.relayer.subscriber.unsubscribe(s.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const t=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[t]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await KE.init({logger:this.providerOpts.logger||Ih,relayUrl:this.providerOpts.relayUrl||sI,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const t=[...new Set(Object.keys(this.session.namespaces).map(r=>vi(r)))];yo("client",this.client),yo("events",this.events),yo("disableProviderPing",this.disableProviderPing),t.forEach(r=>{if(!this.session)return;const s=fI(r,this.session),a=dl(s),u=gI(this.namespaces,this.optionalNamespaces),l=mo(_s({},u[r]),{accounts:s,chains:a});switch(r){case"eip155":this.rpcProviders[r]=new wI({namespace:l});break;case"solana":this.rpcProviders[r]=new bI({namespace:l});break;case"cosmos":this.rpcProviders[r]=new _I({namespace:l});break;case"polkadot":this.rpcProviders[r]=new vI({namespace:l});break;case"cip34":this.rpcProviders[r]=new EI({namespace:l});break;case"elrond":this.rpcProviders[r]=new II({namespace:l});break;case"multiversx":this.rpcProviders[r]=new PI({namespace:l});break;case"near":this.rpcProviders[r]=new SI({namespace:l});break}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",t=>{this.events.emit("session_ping",t)}),this.client.on("session_event",t=>{const{params:r}=t,{event:s}=r;if(s.name==="accountsChanged"){const a=s.data;a&&hr(a)&&this.events.emit("accountsChanged",a.map(yI))}else if(s.name==="chainChanged"){const a=r.chainId,u=r.event.data,l=vi(a),f=go(a)!==go(u)?`${l}:${go(u)}`:a;this.onChainChanged(f)}else this.events.emit(s.name,s.data);this.events.emit("session_event",t)}),this.client.on("session_update",({topic:t,params:r})=>{var s;const{namespaces:a}=r,u=(s=this.client)==null?void 0:s.session.get(t);this.session=mo(_s({},u),{namespaces:a}),this.onSessionUpdate(),this.events.emit("session_update",{topic:t,params:r})}),this.client.on("session_delete",async t=>{await this.cleanup(),this.events.emit("session_delete",t),this.events.emit("disconnect",mo(_s({},Pe("USER_DISCONNECTED")),{data:t.topic}))}),this.on(Mt.DEFAULT_CHAIN_CHANGED,t=>{this.onChainChanged(t,!0)})}getProvider(t){if(!this.rpcProviders[t])throw new Error(`Provider not found: ${t}`);return this.rpcProviders[t]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(t=>{var r;this.getProvider(t).updateNamespace((r=this.session)==null?void 0:r.namespaces[t])})}setNamespaces(t){const{namespaces:r,optionalNamespaces:s,sessionProperties:a}=t;r&&Object.keys(r).length&&(this.namespaces=r),s&&Object.keys(s).length&&(this.optionalNamespaces=s),this.sessionProperties=a,this.persist("namespaces",r),this.persist("optionalNamespaces",s)}validateChain(t){const[r,s]=(t==null?void 0:t.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,s];if(r&&!Object.keys(this.namespaces||{}).map(l=>vi(l)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&s)return[r,s];const a=vi(Object.keys(this.namespaces)[0]),u=this.rpcProviders[a].getDefaultChain();return[a,u]}async requestAccounts(){const[t]=this.validateChain();return await this.getProvider(t).requestAccounts()}onChainChanged(t,r=!1){var s;if(!this.namespaces)return;const[a,u]=this.validateChain(t);r||this.getProvider(a).setDefaultChain(u),((s=this.namespaces[a])!=null?s:this.namespaces[`${a}:${u}`]).defaultChain=u,this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",u)}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(t,r){this.client.core.storage.setItem(`${Ph}/${t}`,r)}async getFromStore(t){return await this.client.core.storage.getItem(`${Ph}/${t}`)}}const CI=Ko,$I="wc",xI="ethereum_provider",DI=`${$I}@2:${xI}:`,FI="https://rpc.walletconnect.com/v1/",Rs=["eth_sendTransaction","personal_sign"],gl=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode"],As=["chainChanged","accountsChanged"],yl=["chainChanged","accountsChanged","message","disconnect","connect"];var jI=Object.defineProperty,qI=Object.defineProperties,UI=Object.getOwnPropertyDescriptors,Th=Object.getOwnPropertySymbols,MI=Object.prototype.hasOwnProperty,LI=Object.prototype.propertyIsEnumerable,Ch=(o,t,r)=>t in o?jI(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,bi=(o,t)=>{for(var r in t||(t={}))MI.call(t,r)&&Ch(o,r,t[r]);if(Th)for(var r of Th(t))LI.call(t,r)&&Ch(o,r,t[r]);return o},$h=(o,t)=>qI(o,UI(t));function Ns(o){return Number(o[0].split(":")[1])}function vo(o){return`0x${o.toString(16)}`}function kI(o){const{chains:t,optionalChains:r,methods:s,optionalMethods:a,events:u,optionalEvents:l,rpcMap:f}=o;if(!wo(t))throw new Error("Invalid chains");const w={chains:t,methods:s||Rs,events:u||As,rpcMap:bi({},t.length?{[Ns(t)]:f[Ns(t)]}:{})},_=u==null?void 0:u.filter(M=>!As.includes(M)),T=s==null?void 0:s.filter(M=>!Rs.includes(M));if(!r&&!l&&!a&&!(_!=null&&_.length)&&!(T!=null&&T.length))return{required:t.length?w:void 0};const R=(_==null?void 0:_.length)&&(T==null?void 0:T.length)||!r,N={chains:[...new Set(R?w.chains.concat(r||[]):r)],methods:[...new Set(w.methods.concat(a!=null&&a.length?a:gl))],events:[...new Set(w.events.concat(l!=null&&l.length?l:yl))],rpcMap:f};return{required:t.length?w:void 0,optional:r.length?N:void 0}}class xs{constructor(){this.events=new H.eventsExports.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=DI,this.on=(t,r)=>(this.events.on(t,r),this),this.once=(t,r)=>(this.events.once(t,r),this),this.removeListener=(t,r)=>(this.events.removeListener(t,r),this),this.off=(t,r)=>(this.events.off(t,r),this),this.parseAccount=t=>this.isCompatibleChainId(t)?this.parseAccountId(t).address:t,this.signer={},this.rpc={}}static async init(t){const r=new xs;return await r.initialize(t),r}async request(t){return await this.signer.request(t,this.formatChainId(this.chainId))}sendAsync(t,r){this.signer.sendAsync(t,r,this.formatChainId(this.chainId))}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(t);const{required:r,optional:s}=kI(this.rpc);try{const a=await new Promise(async(l,f)=>{var w;this.rpc.showQrModal&&((w=this.modal)==null||w.subscribeModal(_=>{!_.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),f(new Error("Connection request reset. Please try again.")))})),await this.signer.connect($h(bi({namespaces:bi({},r&&{[this.namespace]:r})},s&&{optionalNamespaces:{[this.namespace]:s}}),{pairingTopic:t==null?void 0:t.pairingTopic})).then(_=>{l(_)}).catch(_=>{f(new Error(_.message))})});if(!a)return;const u=yw(a.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:u),this.setAccounts(u),this.events.emit("connect",{chainId:vo(this.chainId)})}catch(a){throw this.signer.logger.error(a),a}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",t=>{const{params:r}=t,{event:s}=r;s.name==="accountsChanged"?(this.accounts=this.parseAccounts(s.data),this.events.emit("accountsChanged",this.accounts)):s.name==="chainChanged"?this.setChainId(this.formatChainId(s.data)):this.events.emit(s.name,s.data),this.events.emit("session_event",t)}),this.signer.on("chainChanged",t=>{const r=parseInt(t);this.chainId=r,this.events.emit("chainChanged",vo(this.chainId)),this.persist()}),this.signer.on("session_update",t=>{this.events.emit("session_update",t)}),this.signer.on("session_delete",t=>{this.reset(),this.events.emit("session_delete",t),this.events.emit("disconnect",$h(bi({},vw("USER_DISCONNECTED")),{data:t.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",t=>{var r,s;this.rpc.showQrModal&&((r=this.modal)==null||r.closeModal(),(s=this.modal)==null||s.openModal({uri:t})),this.events.emit("display_uri",t)})}switchEthereumChain(t){this.request({method:"wallet_switchEthereumChain",params:[{chainId:t.toString(16)}]})}isCompatibleChainId(t){return typeof t=="string"?t.startsWith(`${this.namespace}:`):!1}formatChainId(t){return`${this.namespace}:${t}`}parseChainId(t){return Number(t.split(":")[1])}setChainIds(t){const r=t.filter(s=>this.isCompatibleChainId(s)).map(s=>this.parseChainId(s));r.length&&(this.chainId=r[0],this.events.emit("chainChanged",vo(this.chainId)),this.persist())}setChainId(t){if(this.isCompatibleChainId(t)){const r=this.parseChainId(t);this.chainId=r,this.switchEthereumChain(r)}}parseAccountId(t){const[r,s,a]=t.split(":");return{chainId:`${r}:${s}`,address:a}}setAccounts(t){this.accounts=t.filter(r=>this.parseChainId(this.parseAccountId(r).chainId)===this.chainId).map(r=>this.parseAccountId(r).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(t){var r,s;const a=(r=t==null?void 0:t.chains)!=null?r:[],u=(s=t==null?void 0:t.optionalChains)!=null?s:[],l=a.concat(u);if(!l.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const f=a.length?(t==null?void 0:t.methods)||Rs:[],w=a.length?(t==null?void 0:t.events)||As:[],_=(t==null?void 0:t.optionalMethods)||[],T=(t==null?void 0:t.optionalEvents)||[],R=(t==null?void 0:t.rpcMap)||this.buildRpcMap(l,t.projectId),N=(t==null?void 0:t.qrModalOptions)||void 0;return{chains:a==null?void 0:a.map(M=>this.formatChainId(M)),optionalChains:u.map(M=>this.formatChainId(M)),methods:f,events:w,optionalMethods:_,optionalEvents:T,rpcMap:R,showQrModal:!!(t!=null&&t.showQrModal),qrModalOptions:N,projectId:t.projectId,metadata:t.metadata}}buildRpcMap(t,r){const s={};return t.forEach(a=>{s[a]=this.getRpcUrl(a,r)}),s}async initialize(t){if(this.rpc=this.getRpcConfig(t),this.chainId=this.rpc.chains.length?Ns(this.rpc.chains):Ns(this.rpc.optionalChains),this.signer=await CI.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:t.disableProviderPing,relayUrl:t.relayUrl,storageOptions:t.storageOptions}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let r;try{const{WalletConnectModal:s}=await Promise.resolve().then(()=>require("./index-DTJXuc64.js")).then(a=>a.index);r=s}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(r)try{this.modal=new r(bi({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(s){throw this.signer.logger.error(s),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(t){if(!t)return;const{chains:r,optionalChains:s,rpcMap:a}=t;r&&wo(r)&&(this.rpc.chains=r.map(u=>this.formatChainId(u)),r.forEach(u=>{this.rpc.rpcMap[u]=(a==null?void 0:a[u])||this.getRpcUrl(u)})),s&&wo(s)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=s==null?void 0:s.map(u=>this.formatChainId(u)),s.forEach(u=>{this.rpc.rpcMap[u]=(a==null?void 0:a[u])||this.getRpcUrl(u)}))}getRpcUrl(t,r){var s;return((s=this.rpc.rpcMap)==null?void 0:s[t])||`${FI}?chainId=eip155:${t}&projectId=${r||this.rpc.projectId}`}async loadPersistedSession(){if(!this.session)return;const t=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),r=this.session.namespaces[`${this.namespace}:${t}`]?this.session.namespaces[`${this.namespace}:${t}`]:this.session.namespaces[this.namespace];this.setChainIds(t?[this.formatChainId(t)]:r==null?void 0:r.accounts),this.setAccounts(r==null?void 0:r.accounts)}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(t){return typeof t=="string"||t instanceof String?[this.parseAccount(t)]:t.map(r=>this.parseAccount(r))}}const zI=xs;exports.EthereumProvider=zI;exports.OPTIONAL_EVENTS=yl;exports.OPTIONAL_METHODS=gl;exports.REQUIRED_EVENTS=As;exports.REQUIRED_METHODS=Rs;exports.default=xs;
|
|
46
|
+
}`;var G=_u(function(){return ie(d,U+"return "+A).apply(r,g)});if(G.source=A,Wn(G))throw G;return G}function pv(e){return se(e).toLowerCase()}function dv(e){return se(e).toUpperCase()}function fv(e,i,n){if(e=se(e),e&&(n||i===r))return Ta(e);if(!e||!(i=Ye(i)))return e;var c=ft(e),h=ft(i),d=Ca(c,h),g=$a(c,h)+1;return Wt(c,d,g).join("")}function gv(e,i,n){if(e=se(e),e&&(n||i===r))return e.slice(0,Da(e)+1);if(!e||!(i=Ye(i)))return e;var c=ft(e),h=$a(c,ft(i))+1;return Wt(c,0,h).join("")}function yv(e,i,n){if(e=se(e),e&&(n||i===r))return e.replace(Ks,"");if(!e||!(i=Ye(i)))return e;var c=ft(e),h=Ca(c,ft(i));return Wt(c,h).join("")}function mv(e,i){var n=Ds,c=rt;if(be(i)){var h="separator"in i?i.separator:h;n="length"in i?W(i.length):n,c="omission"in i?Ye(i.omission):c}e=se(e);var d=e.length;if(wr(e)){var g=ft(e);d=g.length}if(n>=d)return e;var y=n-br(c);if(y<1)return c;var v=g?Wt(g,0,y).join(""):e.slice(0,y);if(h===r)return v+c;if(g&&(y+=v.length-y),Jn(h)){if(e.slice(y).search(h)){var S,O=v;for(h.global||(h=hn(h.source,se(Zo.exec(h))+"g")),h.lastIndex=0;S=h.exec(O);)var A=S.index;v=v.slice(0,A===r?y:A)}}else if(e.indexOf(Ye(h),y)!=y){var D=v.lastIndexOf(h);D>-1&&(v=v.slice(0,D))}return v+c}function vv(e){return e=se(e),e&&Al.test(e)?e.replace(Go,Kp):e}var wv=Rr(function(e,i,n){return e+(n?" ":"")+i.toUpperCase()}),Yn=Ec("toUpperCase");function bu(e,i,n){return e=se(e),i=n?r:i,i===r?kp(e)?Gp(e):$p(e):e.match(i)||[]}var _u=Q(function(e,i){try{return Ge(e,r,i)}catch(n){return Wn(n)?n:new B(n)}}),bv=Ct(function(e,i){return st(i,function(n){n=It(n),Nt(e,n,Vn(e[n],e))}),e});function _v(e){var i=e==null?0:e.length,n=L();return e=i?ge(e,function(c){if(typeof c[1]!="function")throw new nt(l);return[n(c[0]),c[1]]}):[],Q(function(c){for(var h=-1;++h<i;){var d=e[h];if(Ge(d[0],this,c))return Ge(d[1],this,c)}})}function Ev(e){return Kd(at(e,R))}function Zn(e){return function(){return e}}function Iv(e,i){return e==null||e!==e?i:e}var Pv=Pc(),Sv=Pc(!0);function Ve(e){return e}function Xn(e){return ec(typeof e=="function"?e:at(e,R))}function Ov(e){return rc(at(e,R))}function Rv(e,i){return ic(e,at(i,R))}var Av=Q(function(e,i){return function(n){return si(n,e,i)}}),Nv=Q(function(e,i){return function(n){return si(e,n,i)}});function eo(e,i,n){var c=Ae(i),h=Zi(i,c);n==null&&!(be(i)&&(h.length||!c.length))&&(n=i,i=e,e=this,h=Zi(i,Ae(i)));var d=!(be(n)&&"chain"in n)||!!n.chain,g=xt(e);return st(h,function(y){var v=i[y];e[y]=v,g&&(e.prototype[y]=function(){var S=this.__chain__;if(d||S){var O=e(this.__wrapped__),A=O.__actions__=ze(this.__actions__);return A.push({func:v,args:arguments,thisArg:e}),O.__chain__=S,O}return v.apply(e,kt([this.value()],arguments))})}),e}function Tv(){return Ce._===this&&(Ce._=td),this}function to(){}function Cv(e){return e=W(e),Q(function(i){return sc(i,e)})}var $v=$n(ge),xv=$n(Sa),Dv=$n(rn);function Eu(e){return Mn(e)?sn(It(e)):hf(e)}function Fv(e){return function(i){return e==null?r:sr(e,i)}}var jv=Oc(),qv=Oc(!0);function ro(){return[]}function io(){return!1}function Uv(){return{}}function Mv(){return""}function Lv(){return!0}function kv(e,i){if(e=W(e),e<1||e>ue)return[];var n=De,c=Fe(e,De);i=L(i),e-=De;for(var h=an(c,i);++n<e;)i(n);return h}function zv(e){return K(e)?ge(e,It):Ze(e)?[e]:ze(zc(se(e)))}function Hv(e){var i=++Xp;return se(e)+i}var Bv=ss(function(e,i){return e+i},0),Vv=xn("ceil"),Kv=ss(function(e,i){return e/i},1),Wv=xn("floor");function Jv(e){return e&&e.length?Yi(e,Ve,vn):r}function Gv(e,i){return e&&e.length?Yi(e,L(i,2),vn):r}function Qv(e){return Aa(e,Ve)}function Yv(e,i){return Aa(e,L(i,2))}function Zv(e){return e&&e.length?Yi(e,Ve,En):r}function Xv(e,i){return e&&e.length?Yi(e,L(i,2),En):r}var ew=ss(function(e,i){return e*i},1),tw=xn("round"),rw=ss(function(e,i){return e-i},0);function iw(e){return e&&e.length?on(e,Ve):0}function sw(e,i){return e&&e.length?on(e,L(i,2)):0}return p.after=Oy,p.ary=Xc,p.assign=dm,p.assignIn=du,p.assignInWith=ms,p.assignWith=fm,p.at=gm,p.before=eu,p.bind=Vn,p.bindAll=bv,p.bindKey=tu,p.castArray=Uy,p.chain=Qc,p.chunk=Wf,p.compact=Jf,p.concat=Gf,p.cond=_v,p.conforms=Ev,p.constant=Zn,p.countBy=iy,p.create=ym,p.curry=ru,p.curryRight=iu,p.debounce=su,p.defaults=mm,p.defaultsDeep=vm,p.defer=Ry,p.delay=Ay,p.difference=Qf,p.differenceBy=Yf,p.differenceWith=Zf,p.drop=Xf,p.dropRight=eg,p.dropRightWhile=tg,p.dropWhile=rg,p.fill=ig,p.filter=ny,p.flatMap=cy,p.flatMapDeep=uy,p.flatMapDepth=hy,p.flatten=Kc,p.flattenDeep=sg,p.flattenDepth=ng,p.flip=Ny,p.flow=Pv,p.flowRight=Sv,p.fromPairs=og,p.functions=Sm,p.functionsIn=Om,p.groupBy=ly,p.initial=cg,p.intersection=ug,p.intersectionBy=hg,p.intersectionWith=lg,p.invert=Am,p.invertBy=Nm,p.invokeMap=dy,p.iteratee=Xn,p.keyBy=fy,p.keys=Ae,p.keysIn=Be,p.map=ls,p.mapKeys=Cm,p.mapValues=$m,p.matches=Ov,p.matchesProperty=Rv,p.memoize=ds,p.merge=xm,p.mergeWith=fu,p.method=Av,p.methodOf=Nv,p.mixin=eo,p.negate=fs,p.nthArg=Cv,p.omit=Dm,p.omitBy=Fm,p.once=Ty,p.orderBy=gy,p.over=$v,p.overArgs=Cy,p.overEvery=xv,p.overSome=Dv,p.partial=Kn,p.partialRight=nu,p.partition=yy,p.pick=jm,p.pickBy=gu,p.property=Eu,p.propertyOf=Fv,p.pull=gg,p.pullAll=Jc,p.pullAllBy=yg,p.pullAllWith=mg,p.pullAt=vg,p.range=jv,p.rangeRight=qv,p.rearg=$y,p.reject=wy,p.remove=wg,p.rest=xy,p.reverse=Hn,p.sampleSize=_y,p.set=Um,p.setWith=Mm,p.shuffle=Ey,p.slice=bg,p.sortBy=Sy,p.sortedUniq=Rg,p.sortedUniqBy=Ag,p.split=cv,p.spread=Dy,p.tail=Ng,p.take=Tg,p.takeRight=Cg,p.takeRightWhile=$g,p.takeWhile=xg,p.tap=Jg,p.throttle=Fy,p.thru=hs,p.toArray=hu,p.toPairs=yu,p.toPairsIn=mu,p.toPath=zv,p.toPlainObject=pu,p.transform=Lm,p.unary=jy,p.union=Dg,p.unionBy=Fg,p.unionWith=jg,p.uniq=qg,p.uniqBy=Ug,p.uniqWith=Mg,p.unset=km,p.unzip=Bn,p.unzipWith=Gc,p.update=zm,p.updateWith=Hm,p.values=Tr,p.valuesIn=Bm,p.without=Lg,p.words=bu,p.wrap=qy,p.xor=kg,p.xorBy=zg,p.xorWith=Hg,p.zip=Bg,p.zipObject=Vg,p.zipObjectDeep=Kg,p.zipWith=Wg,p.entries=yu,p.entriesIn=mu,p.extend=du,p.extendWith=ms,eo(p,p),p.add=Bv,p.attempt=_u,p.camelCase=Jm,p.capitalize=vu,p.ceil=Vv,p.clamp=Vm,p.clone=My,p.cloneDeep=ky,p.cloneDeepWith=zy,p.cloneWith=Ly,p.conformsTo=Hy,p.deburr=wu,p.defaultTo=Iv,p.divide=Kv,p.endsWith=Gm,p.eq=yt,p.escape=Qm,p.escapeRegExp=Ym,p.every=sy,p.find=oy,p.findIndex=Bc,p.findKey=wm,p.findLast=ay,p.findLastIndex=Vc,p.findLastKey=bm,p.floor=Wv,p.forEach=Yc,p.forEachRight=Zc,p.forIn=_m,p.forInRight=Em,p.forOwn=Im,p.forOwnRight=Pm,p.get=Gn,p.gt=By,p.gte=Vy,p.has=Rm,p.hasIn=Qn,p.head=Wc,p.identity=Ve,p.includes=py,p.indexOf=ag,p.inRange=Km,p.invoke=Tm,p.isArguments=ar,p.isArray=K,p.isArrayBuffer=Ky,p.isArrayLike=He,p.isArrayLikeObject=Ee,p.isBoolean=Wy,p.isBuffer=Jt,p.isDate=Jy,p.isElement=Gy,p.isEmpty=Qy,p.isEqual=Yy,p.isEqualWith=Zy,p.isError=Wn,p.isFinite=Xy,p.isFunction=xt,p.isInteger=ou,p.isLength=gs,p.isMap=au,p.isMatch=em,p.isMatchWith=tm,p.isNaN=rm,p.isNative=im,p.isNil=nm,p.isNull=sm,p.isNumber=cu,p.isObject=be,p.isObjectLike=_e,p.isPlainObject=hi,p.isRegExp=Jn,p.isSafeInteger=om,p.isSet=uu,p.isString=ys,p.isSymbol=Ze,p.isTypedArray=Nr,p.isUndefined=am,p.isWeakMap=cm,p.isWeakSet=um,p.join=pg,p.kebabCase=Zm,p.last=ut,p.lastIndexOf=dg,p.lowerCase=Xm,p.lowerFirst=ev,p.lt=hm,p.lte=lm,p.max=Jv,p.maxBy=Gv,p.mean=Qv,p.meanBy=Yv,p.min=Zv,p.minBy=Xv,p.stubArray=ro,p.stubFalse=io,p.stubObject=Uv,p.stubString=Mv,p.stubTrue=Lv,p.multiply=ew,p.nth=fg,p.noConflict=Tv,p.noop=to,p.now=ps,p.pad=tv,p.padEnd=rv,p.padStart=iv,p.parseInt=sv,p.random=Wm,p.reduce=my,p.reduceRight=vy,p.repeat=nv,p.replace=ov,p.result=qm,p.round=tw,p.runInContext=m,p.sample=by,p.size=Iy,p.snakeCase=av,p.some=Py,p.sortedIndex=_g,p.sortedIndexBy=Eg,p.sortedIndexOf=Ig,p.sortedLastIndex=Pg,p.sortedLastIndexBy=Sg,p.sortedLastIndexOf=Og,p.startCase=uv,p.startsWith=hv,p.subtract=rw,p.sum=iw,p.sumBy=sw,p.template=lv,p.times=kv,p.toFinite=Dt,p.toInteger=W,p.toLength=lu,p.toLower=pv,p.toNumber=ht,p.toSafeInteger=pm,p.toString=se,p.toUpper=dv,p.trim=fv,p.trimEnd=gv,p.trimStart=yv,p.truncate=mv,p.unescape=vv,p.uniqueId=Hv,p.upperCase=wv,p.upperFirst=Yn,p.each=Yc,p.eachRight=Zc,p.first=Wc,eo(p,function(){var e={};return _t(p,function(i,n){oe.call(p.prototype,n)||(e[n]=i)}),e}(),{chain:!1}),p.VERSION=s,st(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){p[e].placeholder=p}),st(["drop","take"],function(e,i){X.prototype[e]=function(n){n=n===r?1:Re(W(n),0);var c=this.__filtered__&&!i?new X(this):this.clone();return c.__filtered__?c.__takeCount__=Fe(n,c.__takeCount__):c.__views__.push({size:Fe(n,De),type:e+(c.__dir__<0?"Right":"")}),c},X.prototype[e+"Right"]=function(n){return this.reverse()[e](n).reverse()}}),st(["filter","map","takeWhile"],function(e,i){var n=i+1,c=n==E||n==J;X.prototype[e]=function(h){var d=this.clone();return d.__iteratees__.push({iteratee:L(h,3),type:n}),d.__filtered__=d.__filtered__||c,d}}),st(["head","last"],function(e,i){var n="take"+(i?"Right":"");X.prototype[e]=function(){return this[n](1).value()[0]}}),st(["initial","tail"],function(e,i){var n="drop"+(i?"":"Right");X.prototype[e]=function(){return this.__filtered__?new X(this):this[n](1)}}),X.prototype.compact=function(){return this.filter(Ve)},X.prototype.find=function(e){return this.filter(e).head()},X.prototype.findLast=function(e){return this.reverse().find(e)},X.prototype.invokeMap=Q(function(e,i){return typeof e=="function"?new X(this):this.map(function(n){return si(n,e,i)})}),X.prototype.reject=function(e){return this.filter(fs(L(e)))},X.prototype.slice=function(e,i){e=W(e);var n=this;return n.__filtered__&&(e>0||i<0)?new X(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),i!==r&&(i=W(i),n=i<0?n.dropRight(-i):n.take(i-e)),n)},X.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},X.prototype.toArray=function(){return this.take(De)},_t(X.prototype,function(e,i){var n=/^(?:filter|find|map|reject)|While$/.test(i),c=/^(?:head|last)$/.test(i),h=p[c?"take"+(i=="last"?"Right":""):i],d=c||/^find/.test(i);h&&(p.prototype[i]=function(){var g=this.__wrapped__,y=c?[1]:arguments,v=g instanceof X,S=y[0],O=v||K(g),A=function(Z){var ee=h.apply(p,kt([Z],y));return c&&D?ee[0]:ee};O&&n&&typeof S=="function"&&S.length!=1&&(v=O=!1);var D=this.__chain__,U=!!this.__actions__.length,k=d&&!D,G=v&&!U;if(!d&&O){g=G?g:new X(this);var z=e.apply(g,y);return z.__actions__.push({func:hs,args:[A],thisArg:r}),new ot(z,D)}return k&&G?e.apply(this,y):(z=this.thru(A),k?c?z.value()[0]:z.value():z)})}),st(["pop","push","shift","sort","splice","unshift"],function(e){var i=ji[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",c=/^(?:pop|shift)$/.test(e);p.prototype[e]=function(){var h=arguments;if(c&&!this.__chain__){var d=this.value();return i.apply(K(d)?d:[],h)}return this[n](function(g){return i.apply(K(g)?g:[],h)})}}),_t(X.prototype,function(e,i){var n=p[i];if(n){var c=n.name+"";oe.call(Pr,c)||(Pr[c]=[]),Pr[c].push({name:i,func:n})}}),Pr[is(r,Y).name]=[{name:"wrapper",func:r}],X.prototype.clone=md,X.prototype.reverse=vd,X.prototype.value=wd,p.prototype.at=Gg,p.prototype.chain=Qg,p.prototype.commit=Yg,p.prototype.next=Zg,p.prototype.plant=ey,p.prototype.reverse=ty,p.prototype.toJSON=p.prototype.valueOf=p.prototype.value=ry,p.prototype.first=p.prototype.head,Yr&&(p.prototype[Yr]=Xg),p},_r=Qp();Xt?((Xt.exports=_r)._=_r,Zs._=_r):Ce._=_r}).call(mi)})(Co,Co.exports);var cI=Object.defineProperty,uI=Object.defineProperties,hI=Object.getOwnPropertyDescriptors,Sh=Object.getOwnPropertySymbols,lI=Object.prototype.hasOwnProperty,pI=Object.prototype.propertyIsEnumerable,Oh=(o,t,r)=>t in o?cI(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,bs=(o,t)=>{for(var r in t||(t={}))lI.call(t,r)&&Oh(o,r,t[r]);if(Sh)for(var r of Sh(t))pI.call(t,r)&&Oh(o,r,t[r]);return o},dI=(o,t)=>uI(o,hI(t));function Yt(o,t,r){var s;const a=k0(o);return((s=t.rpcMap)==null?void 0:s[a.reference])||`${aI}?chainId=${a.namespace}:${a.reference}&projectId=${r}`}function fr(o){return o.includes(":")?o.split(":")[1]:o}function dl(o){return o.map(t=>`${t.split(":")[0]}:${t.split(":")[1]}`)}function fI(o,t){const r=Object.keys(t.namespaces).filter(a=>a.includes(o));if(!r.length)return[];const s=[];return r.forEach(a=>{const u=t.namespaces[a].accounts;s.push(...u)}),s}function gI(o={},t={}){const r=Rh(o),s=Rh(t);return Co.exports.merge(r,s)}function Rh(o){var t,r,s,a;const u={};if(!Dr(o))return u;for(const[l,f]of Object.entries(o)){const w=ko(l)?[l]:f.chains,_=f.methods||[],T=f.events||[],R=f.rpcMap||{},N=vi(l);u[N]=dI(bs(bs({},u[N]),f),{chains:ao(w,(t=u[N])==null?void 0:t.chains),methods:ao(_,(r=u[N])==null?void 0:r.methods),events:ao(T,(s=u[N])==null?void 0:s.events),rpcMap:bs(bs({},R),(a=u[N])==null?void 0:a.rpcMap)})}return u}function yI(o){return o.includes(":")?o.split(":")[2]:o}function mI(o){const t={};for(const[r,s]of Object.entries(o)){const a=s.methods||[],u=s.events||[],l=s.accounts||[],f=ko(r)?[r]:s.chains?s.chains:dl(s.accounts);t[r]={chains:f,methods:a,events:u,accounts:l}}return t}function go(o){return typeof o=="number"?o:o.includes("0x")?parseInt(o,16):o.includes(":")?Number(o.split(":")[1]):Number(o)}const fl={},ye=o=>fl[o],yo=(o,t)=>{fl[o]=t};class vI{constructor(t){this.name="polkadot",this.namespace=t.namespace,this.events=ye("events"),this.client=ye("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Mt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=fr(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Yt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Ut(new Zt(s,ye("disableProviderPing")))}}class wI{constructor(t){this.name="eip155",this.namespace=t.namespace,this.events=ye("events"),this.client=ye("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(t){switch(t.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(t);case"eth_chainId":return parseInt(this.getDefaultChain())}return this.namespace.methods.includes(t.request.method)?await this.client.request(t):this.getHttpProvider().request(t.request)}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(parseInt(t),r),this.chainId=parseInt(t),this.events.emit(Mt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}createHttpProvider(t,r){const s=r||Yt(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Ut(new Zt(s,ye("disableProviderPing")))}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=parseInt(fr(r));t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const t=this.chainId,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}async handleSwitchChain(t){var r,s;let a=t.request.params?(r=t.request.params[0])==null?void 0:r.chainId:"0x0";a=a.startsWith("0x")?a:`0x${a}`;const u=parseInt(a,16);if(this.isChainApproved(u))this.setDefaultChain(`${u}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:t.topic,request:{method:t.request.method,params:[{chainId:a}]},chainId:(s=this.namespace.chains)==null?void 0:s[0]}),this.setDefaultChain(`${u}`);else throw new Error(`Failed to switch to chain 'eip155:${u}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(t){return this.namespace.chains.includes(`${this.name}:${t}`)}}class bI{constructor(t){this.name="solana",this.namespace=t.namespace,this.events=ye("events"),this.client=ye("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Mt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=fr(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Yt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Ut(new Zt(s,ye("disableProviderPing")))}}class _I{constructor(t){this.name="cosmos",this.namespace=t.namespace,this.events=ye("events"),this.client=ye("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Mt.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=fr(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Yt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Ut(new Zt(s,ye("disableProviderPing")))}}class EI{constructor(t){this.name="cip34",this.namespace=t.namespace,this.events=ye("events"),this.client=ye("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Mt.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{const s=this.getCardanoRPCUrl(r),a=fr(r);t[a]=this.createHttpProvider(a,s)}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}getCardanoRPCUrl(t){const r=this.namespace.rpcMap;if(r)return r[t]}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||this.getCardanoRPCUrl(t);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Ut(new Zt(s,ye("disableProviderPing")))}}class II{constructor(t){this.name="elrond",this.namespace=t.namespace,this.events=ye("events"),this.client=ye("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Mt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=fr(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Yt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Ut(new Zt(s,ye("disableProviderPing")))}}class PI{constructor(t){this.name="multiversx",this.namespace=t.namespace,this.events=ye("events"),this.client=ye("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){this.httpProviders[t]||this.setHttpProvider(t,r),this.chainId=t,this.events.emit(Mt.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;const a=fr(r);t[a]=this.createHttpProvider(a,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Yt(t,this.namespace,this.client.core.projectId);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);return new Ut(new Zt(s,ye("disableProviderPing")))}}class SI{constructor(t){this.name="near",this.namespace=t.namespace,this.events=ye("events"),this.client=ye("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,r){if(this.chainId=t,!this.httpProviders[t]){const s=r||Yt(`${this.name}:${t}`,this.namespace);if(!s)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,s)}this.events.emit(Mt.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(r=>{var s;t[r]=this.createHttpProvider(r,(s=this.namespace.rpcMap)==null?void 0:s[r])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,r=this.httpProviders[t];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,r){const s=this.createHttpProvider(t,r);s&&(this.httpProviders[t]=s)}createHttpProvider(t,r){const s=r||Yt(t,this.namespace);return typeof s>"u"?void 0:new Ut(new Zt(s,ye("disableProviderPing")))}}var OI=Object.defineProperty,RI=Object.defineProperties,AI=Object.getOwnPropertyDescriptors,Ah=Object.getOwnPropertySymbols,NI=Object.prototype.hasOwnProperty,TI=Object.prototype.propertyIsEnumerable,Nh=(o,t,r)=>t in o?OI(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,_s=(o,t)=>{for(var r in t||(t={}))NI.call(t,r)&&Nh(o,r,t[r]);if(Ah)for(var r of Ah(t))TI.call(t,r)&&Nh(o,r,t[r]);return o},mo=(o,t)=>RI(o,AI(t));class Ko{constructor(t){this.events=new H.Ct,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=t,this.logger=typeof(t==null?void 0:t.logger)<"u"&&typeof(t==null?void 0:t.logger)!="string"?t.logger:I.ot(I.k({level:(t==null?void 0:t.logger)||Ih})),this.disableProviderPing=(t==null?void 0:t.disableProviderPing)||!1}static async init(t){const r=new Ko(t);return await r.initialize(),r}async request(t,r){const[s,a]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(s).request({request:_s({},t),chainId:`${s}:${a}`,topic:this.session.topic})}sendAsync(t,r,s){const a=new Date().getTime();this.request(t,s).then(u=>r(null,I.formatJsonRpcResult(a,u))).catch(u=>r(u,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var t;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(t=this.session)==null?void 0:t.topic,reason:Pe("USER_DISCONNECTED")}),await this.cleanup()}async connect(t){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(t),await this.cleanupPendingPairings(),!t.skipPairing)return await this.pair(t.pairingTopic)}on(t,r){this.events.on(t,r)}once(t,r){this.events.once(t,r)}removeListener(t,r){this.events.removeListener(t,r)}off(t,r){this.events.off(t,r)}get isWalletConnect(){return!0}async pair(t){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:s,approval:a}=await this.client.connect({pairingTopic:t,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});s&&(this.uri=s,this.events.emit("display_uri",s)),await a().then(u=>{this.session=u,this.namespaces||(this.namespaces=mI(u.namespaces),this.persist("namespaces",this.namespaces))}).catch(u=>{if(u.message!==ll)throw u;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(t,r){try{if(!this.session)return;const[s,a]=this.validateChain(t);this.getProvider(s).setDefaultChain(a,r)}catch(s){if(!/Please call connect/.test(s.message))throw s}}async cleanupPendingPairings(t={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(hr(r)){for(const s of r)t.deletePairings?this.client.core.expirer.set(s.topic,0):await this.client.core.relayer.subscriber.unsubscribe(s.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const t=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[t]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await KE.init({logger:this.providerOpts.logger||Ih,relayUrl:this.providerOpts.relayUrl||sI,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const t=[...new Set(Object.keys(this.session.namespaces).map(r=>vi(r)))];yo("client",this.client),yo("events",this.events),yo("disableProviderPing",this.disableProviderPing),t.forEach(r=>{if(!this.session)return;const s=fI(r,this.session),a=dl(s),u=gI(this.namespaces,this.optionalNamespaces),l=mo(_s({},u[r]),{accounts:s,chains:a});switch(r){case"eip155":this.rpcProviders[r]=new wI({namespace:l});break;case"solana":this.rpcProviders[r]=new bI({namespace:l});break;case"cosmos":this.rpcProviders[r]=new _I({namespace:l});break;case"polkadot":this.rpcProviders[r]=new vI({namespace:l});break;case"cip34":this.rpcProviders[r]=new EI({namespace:l});break;case"elrond":this.rpcProviders[r]=new II({namespace:l});break;case"multiversx":this.rpcProviders[r]=new PI({namespace:l});break;case"near":this.rpcProviders[r]=new SI({namespace:l});break}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",t=>{this.events.emit("session_ping",t)}),this.client.on("session_event",t=>{const{params:r}=t,{event:s}=r;if(s.name==="accountsChanged"){const a=s.data;a&&hr(a)&&this.events.emit("accountsChanged",a.map(yI))}else if(s.name==="chainChanged"){const a=r.chainId,u=r.event.data,l=vi(a),f=go(a)!==go(u)?`${l}:${go(u)}`:a;this.onChainChanged(f)}else this.events.emit(s.name,s.data);this.events.emit("session_event",t)}),this.client.on("session_update",({topic:t,params:r})=>{var s;const{namespaces:a}=r,u=(s=this.client)==null?void 0:s.session.get(t);this.session=mo(_s({},u),{namespaces:a}),this.onSessionUpdate(),this.events.emit("session_update",{topic:t,params:r})}),this.client.on("session_delete",async t=>{await this.cleanup(),this.events.emit("session_delete",t),this.events.emit("disconnect",mo(_s({},Pe("USER_DISCONNECTED")),{data:t.topic}))}),this.on(Mt.DEFAULT_CHAIN_CHANGED,t=>{this.onChainChanged(t,!0)})}getProvider(t){if(!this.rpcProviders[t])throw new Error(`Provider not found: ${t}`);return this.rpcProviders[t]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(t=>{var r;this.getProvider(t).updateNamespace((r=this.session)==null?void 0:r.namespaces[t])})}setNamespaces(t){const{namespaces:r,optionalNamespaces:s,sessionProperties:a}=t;r&&Object.keys(r).length&&(this.namespaces=r),s&&Object.keys(s).length&&(this.optionalNamespaces=s),this.sessionProperties=a,this.persist("namespaces",r),this.persist("optionalNamespaces",s)}validateChain(t){const[r,s]=(t==null?void 0:t.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,s];if(r&&!Object.keys(this.namespaces||{}).map(l=>vi(l)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&s)return[r,s];const a=vi(Object.keys(this.namespaces)[0]),u=this.rpcProviders[a].getDefaultChain();return[a,u]}async requestAccounts(){const[t]=this.validateChain();return await this.getProvider(t).requestAccounts()}onChainChanged(t,r=!1){var s;if(!this.namespaces)return;const[a,u]=this.validateChain(t);r||this.getProvider(a).setDefaultChain(u),((s=this.namespaces[a])!=null?s:this.namespaces[`${a}:${u}`]).defaultChain=u,this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",u)}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(t,r){this.client.core.storage.setItem(`${Ph}/${t}`,r)}async getFromStore(t){return await this.client.core.storage.getItem(`${Ph}/${t}`)}}const CI=Ko,$I="wc",xI="ethereum_provider",DI=`${$I}@2:${xI}:`,FI="https://rpc.walletconnect.com/v1/",Rs=["eth_sendTransaction","personal_sign"],gl=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode"],As=["chainChanged","accountsChanged"],yl=["chainChanged","accountsChanged","message","disconnect","connect"];var jI=Object.defineProperty,qI=Object.defineProperties,UI=Object.getOwnPropertyDescriptors,Th=Object.getOwnPropertySymbols,MI=Object.prototype.hasOwnProperty,LI=Object.prototype.propertyIsEnumerable,Ch=(o,t,r)=>t in o?jI(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,bi=(o,t)=>{for(var r in t||(t={}))MI.call(t,r)&&Ch(o,r,t[r]);if(Th)for(var r of Th(t))LI.call(t,r)&&Ch(o,r,t[r]);return o},$h=(o,t)=>qI(o,UI(t));function Ns(o){return Number(o[0].split(":")[1])}function vo(o){return`0x${o.toString(16)}`}function kI(o){const{chains:t,optionalChains:r,methods:s,optionalMethods:a,events:u,optionalEvents:l,rpcMap:f}=o;if(!wo(t))throw new Error("Invalid chains");const w={chains:t,methods:s||Rs,events:u||As,rpcMap:bi({},t.length?{[Ns(t)]:f[Ns(t)]}:{})},_=u==null?void 0:u.filter(M=>!As.includes(M)),T=s==null?void 0:s.filter(M=>!Rs.includes(M));if(!r&&!l&&!a&&!(_!=null&&_.length)&&!(T!=null&&T.length))return{required:t.length?w:void 0};const R=(_==null?void 0:_.length)&&(T==null?void 0:T.length)||!r,N={chains:[...new Set(R?w.chains.concat(r||[]):r)],methods:[...new Set(w.methods.concat(a!=null&&a.length?a:gl))],events:[...new Set(w.events.concat(l!=null&&l.length?l:yl))],rpcMap:f};return{required:t.length?w:void 0,optional:r.length?N:void 0}}class xs{constructor(){this.events=new H.eventsExports.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=DI,this.on=(t,r)=>(this.events.on(t,r),this),this.once=(t,r)=>(this.events.once(t,r),this),this.removeListener=(t,r)=>(this.events.removeListener(t,r),this),this.off=(t,r)=>(this.events.off(t,r),this),this.parseAccount=t=>this.isCompatibleChainId(t)?this.parseAccountId(t).address:t,this.signer={},this.rpc={}}static async init(t){const r=new xs;return await r.initialize(t),r}async request(t){return await this.signer.request(t,this.formatChainId(this.chainId))}sendAsync(t,r){this.signer.sendAsync(t,r,this.formatChainId(this.chainId))}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(t);const{required:r,optional:s}=kI(this.rpc);try{const a=await new Promise(async(l,f)=>{var w;this.rpc.showQrModal&&((w=this.modal)==null||w.subscribeModal(_=>{!_.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),f(new Error("Connection request reset. Please try again.")))})),await this.signer.connect($h(bi({namespaces:bi({},r&&{[this.namespace]:r})},s&&{optionalNamespaces:{[this.namespace]:s}}),{pairingTopic:t==null?void 0:t.pairingTopic})).then(_=>{l(_)}).catch(_=>{f(new Error(_.message))})});if(!a)return;const u=yw(a.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:u),this.setAccounts(u),this.events.emit("connect",{chainId:vo(this.chainId)})}catch(a){throw this.signer.logger.error(a),a}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",t=>{const{params:r}=t,{event:s}=r;s.name==="accountsChanged"?(this.accounts=this.parseAccounts(s.data),this.events.emit("accountsChanged",this.accounts)):s.name==="chainChanged"?this.setChainId(this.formatChainId(s.data)):this.events.emit(s.name,s.data),this.events.emit("session_event",t)}),this.signer.on("chainChanged",t=>{const r=parseInt(t);this.chainId=r,this.events.emit("chainChanged",vo(this.chainId)),this.persist()}),this.signer.on("session_update",t=>{this.events.emit("session_update",t)}),this.signer.on("session_delete",t=>{this.reset(),this.events.emit("session_delete",t),this.events.emit("disconnect",$h(bi({},vw("USER_DISCONNECTED")),{data:t.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",t=>{var r,s;this.rpc.showQrModal&&((r=this.modal)==null||r.closeModal(),(s=this.modal)==null||s.openModal({uri:t})),this.events.emit("display_uri",t)})}switchEthereumChain(t){this.request({method:"wallet_switchEthereumChain",params:[{chainId:t.toString(16)}]})}isCompatibleChainId(t){return typeof t=="string"?t.startsWith(`${this.namespace}:`):!1}formatChainId(t){return`${this.namespace}:${t}`}parseChainId(t){return Number(t.split(":")[1])}setChainIds(t){const r=t.filter(s=>this.isCompatibleChainId(s)).map(s=>this.parseChainId(s));r.length&&(this.chainId=r[0],this.events.emit("chainChanged",vo(this.chainId)),this.persist())}setChainId(t){if(this.isCompatibleChainId(t)){const r=this.parseChainId(t);this.chainId=r,this.switchEthereumChain(r)}}parseAccountId(t){const[r,s,a]=t.split(":");return{chainId:`${r}:${s}`,address:a}}setAccounts(t){this.accounts=t.filter(r=>this.parseChainId(this.parseAccountId(r).chainId)===this.chainId).map(r=>this.parseAccountId(r).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(t){var r,s;const a=(r=t==null?void 0:t.chains)!=null?r:[],u=(s=t==null?void 0:t.optionalChains)!=null?s:[],l=a.concat(u);if(!l.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const f=a.length?(t==null?void 0:t.methods)||Rs:[],w=a.length?(t==null?void 0:t.events)||As:[],_=(t==null?void 0:t.optionalMethods)||[],T=(t==null?void 0:t.optionalEvents)||[],R=(t==null?void 0:t.rpcMap)||this.buildRpcMap(l,t.projectId),N=(t==null?void 0:t.qrModalOptions)||void 0;return{chains:a==null?void 0:a.map(M=>this.formatChainId(M)),optionalChains:u.map(M=>this.formatChainId(M)),methods:f,events:w,optionalMethods:_,optionalEvents:T,rpcMap:R,showQrModal:!!(t!=null&&t.showQrModal),qrModalOptions:N,projectId:t.projectId,metadata:t.metadata}}buildRpcMap(t,r){const s={};return t.forEach(a=>{s[a]=this.getRpcUrl(a,r)}),s}async initialize(t){if(this.rpc=this.getRpcConfig(t),this.chainId=this.rpc.chains.length?Ns(this.rpc.chains):Ns(this.rpc.optionalChains),this.signer=await CI.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:t.disableProviderPing,relayUrl:t.relayUrl,storageOptions:t.storageOptions}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let r;try{const{WalletConnectModal:s}=await Promise.resolve().then(()=>require("./index-vhST1GVD.js")).then(a=>a.index);r=s}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(r)try{this.modal=new r(bi({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(s){throw this.signer.logger.error(s),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(t){if(!t)return;const{chains:r,optionalChains:s,rpcMap:a}=t;r&&wo(r)&&(this.rpc.chains=r.map(u=>this.formatChainId(u)),r.forEach(u=>{this.rpc.rpcMap[u]=(a==null?void 0:a[u])||this.getRpcUrl(u)})),s&&wo(s)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=s==null?void 0:s.map(u=>this.formatChainId(u)),s.forEach(u=>{this.rpc.rpcMap[u]=(a==null?void 0:a[u])||this.getRpcUrl(u)}))}getRpcUrl(t,r){var s;return((s=this.rpc.rpcMap)==null?void 0:s[t])||`${FI}?chainId=eip155:${t}&projectId=${r||this.rpc.projectId}`}async loadPersistedSession(){if(!this.session)return;const t=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),r=this.session.namespaces[`${this.namespace}:${t}`]?this.session.namespaces[`${this.namespace}:${t}`]:this.session.namespaces[this.namespace];this.setChainIds(t?[this.formatChainId(t)]:r==null?void 0:r.accounts),this.setAccounts(r==null?void 0:r.accounts)}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(t){return typeof t=="string"||t instanceof String?[this.parseAccount(t)]:t.map(r=>this.parseAccount(r))}}const zI=xs;exports.EthereumProvider=zI;exports.OPTIONAL_EVENTS=yl;exports.OPTIONAL_METHODS=gl;exports.REQUIRED_EVENTS=As;exports.REQUIRED_METHODS=Rs;exports.default=xs;
|
package/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./index-D2IEwdXM.js");exports.MAINNET=e.MAINNET;exports.TESTNET=e.TESTNET;exports.dark=e.dark;exports.default=e.WormholeConnect;exports.light=e.light;
|
package/lib/index.mjs
CHANGED